extract(destination, r, g, b, a, resize, r2, g2, b2) → {Phaser.BitmapData}
Scans this BitmapData for all pixels matching the given r,g,b values and then draws them into the given destination BitmapData.
The original BitmapData remains unchanged.
The destination BitmapData must be large enough to receive all of the pixels that are scanned unless the 'resize' parameter is true.
Although the destination BitmapData is returned from this method, it's actually modified directly in place, meaning this call is perfectly valid:picture.extract(mask, r, g, b)
You can specify optional r2, g2, b2 color values. If given the pixel written to the destination bitmap will be of the r2, g2, b2 color.
If not given it will be written as the same color it was extracted. You can provide one or more alternative colors, allowing you to tint
the color during extraction.
Parameters
Name | Type | Argument | Default | Description |
---|---|---|---|---|
destination | Phaser.BitmapData | The BitmapData that the extracted pixels will be drawn to. | ||
r | number | The red color component, in the range 0 - 255. | ||
g | number | The green color component, in the range 0 - 255. | ||
b | number | The blue color component, in the range 0 - 255. | ||
a | number | <optional> | 255 | The alpha color component, in the range 0 - 255 that the new pixel will be drawn at. |
resize | boolean | <optional> | false | Should the destination BitmapData be resized to match this one before the pixels are copied? |
r2 | number | <optional> | An alternative red color component to be written to the destination, in the range 0 - 255. | |
g2 | number | <optional> | An alternative green color component to be written to the destination, in the range 0 - 255. | |
b2 | number | <optional> | An alternative blue color component to be written to the destination, in the range 0 - 255. |
Returns
The BitmapData that the extract pixels were drawn on.
- Source code: gameobjects/BitmapData.js (Line 1772)
Please login to continue.