BitmapData#alphaMask()

alphaMask(source, mask, sourceRect, maskRect) → {Phaser.BitmapData}

Draws the image onto this BitmapData using an image as an alpha mask.

Parameters
Name Type Argument Description
source Phaser.Sprite | Phaser.Image | Phaser.Text | Phaser.BitmapData | Image | HTMLCanvasElement | string

The source to copy from. If you give a string it will try and find the Image in the Game.Cache first. This is quite expensive so try to provide the image itself.

mask Phaser.Sprite | Phaser.Image | Phaser.Text | Phaser.BitmapData | Image | HTMLCanvasElement | string <optional>

The object to be used as the mask. If you give a string it will try and find the Image in the Game.Cache first. This is quite expensive so try to provide the image itself. If you don't provide a mask it will use this BitmapData as the mask.

sourceRect Phaser.Rectangle <optional>

A Rectangle where x/y define the coordinates to draw the Source image to and width/height define the size.

maskRect Phaser.Rectangle <optional>

A Rectangle where x/y define the coordinates to draw the Mask image to and width/height define the size.

Returns

This BitmapData object for method chaining.

Source code: gameobjects/BitmapData.js (Line 1738)
doc_phaser
2017-02-14 10:36:31
Comments
Leave a Comment

Please login to continue.