replaceRGB(r1, g1, b1, a1, r2, g2, b2, a2, region) → {Phaser.BitmapData}
Replaces all pixels matching one color with another. The color values are given as two sets of RGBA values.
An optional region parameter controls if the replacement happens in just a specific area of the BitmapData or the entire thing.
Parameters
| Name | Type | Argument | Description | 
|---|---|---|---|
r1 |  number | The red color value to be replaced. Between 0 and 255.  |  |
g1 |  number | The green color value to be replaced. Between 0 and 255.  |  |
b1 |  number | The blue color value to be replaced. Between 0 and 255.  |  |
a1 |  number | The alpha color value to be replaced. Between 0 and 255.  |  |
r2 |  number | The red color value that is the replacement color. Between 0 and 255.  |  |
g2 |  number | The green color value that is the replacement color. Between 0 and 255.  |  |
b2 |  number | The blue color value that is the replacement color. Between 0 and 255.  |  |
a2 |  number | The alpha color value that is the replacement color. Between 0 and 255.  |  |
region |  Phaser.Rectangle |  <optional> |  The area to perform the search over. If not given it will replace over the whole BitmapData.  |  
Returns
This BitmapData object for method chaining.
- Source code: gameobjects/BitmapData.js (Line 754)
 
Please login to continue.