Fix getColorBoundsRect
This commit is contained in:
@@ -436,29 +436,31 @@ class ImageDataUtil {
|
|||||||
var top = image.height + 1;
|
var top = image.height + 1;
|
||||||
var bottom = 0;
|
var bottom = 0;
|
||||||
|
|
||||||
var color:RGBA = color;
|
var _color:RGBA, _mask:RGBA;
|
||||||
var mask:RGBA = mask;
|
|
||||||
|
|
||||||
switch (format) {
|
switch (format) {
|
||||||
|
|
||||||
case ARGB32:
|
case ARGB32:
|
||||||
|
|
||||||
color = (color:ARGB);
|
_color = (color:ARGB);
|
||||||
mask = (mask:ARGB);
|
_mask = (mask:ARGB);
|
||||||
|
|
||||||
case BGRA32:
|
case BGRA32:
|
||||||
|
|
||||||
color = (color:BGRA);
|
_color = (color:BGRA);
|
||||||
mask = (mask:BGRA);
|
_mask = (mask:BGRA);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
|
_color = color;
|
||||||
|
_mask = mask;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!image.transparent) {
|
if (!image.transparent) {
|
||||||
|
|
||||||
color.a = 0xFF;
|
_color.a = 0xFF;
|
||||||
mask.a = 0xFF;
|
_mask.a = 0xFF;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -471,7 +473,7 @@ class ImageDataUtil {
|
|||||||
for (y in 0...image.height) {
|
for (y in 0...image.height) {
|
||||||
|
|
||||||
pixel = image.getPixel32 (x, y, RGBA32);
|
pixel = image.getPixel32 (x, y, RGBA32);
|
||||||
hit = findColor ? (pixel & mask) == color : (pixel & mask) != color;
|
hit = findColor ? (pixel & _mask) == _color : (pixel & _mask) != _color;
|
||||||
|
|
||||||
if (hit) {
|
if (hit) {
|
||||||
|
|
||||||
@@ -500,7 +502,7 @@ class ImageDataUtil {
|
|||||||
for (y in 0...image.height) {
|
for (y in 0...image.height) {
|
||||||
|
|
||||||
pixel = image.getPixel32 (ix, y, RGBA32);
|
pixel = image.getPixel32 (ix, y, RGBA32);
|
||||||
hit = findColor ? (pixel & mask) == color : (pixel & mask) != color;
|
hit = findColor ? (pixel & _mask) == _color : (pixel & _mask) != _color;
|
||||||
|
|
||||||
if (hit) {
|
if (hit) {
|
||||||
|
|
||||||
@@ -526,7 +528,7 @@ class ImageDataUtil {
|
|||||||
for (x in 0...image.width) {
|
for (x in 0...image.width) {
|
||||||
|
|
||||||
pixel = image.getPixel32 (x, y, RGBA32);
|
pixel = image.getPixel32 (x, y, RGBA32);
|
||||||
hit = findColor ? (pixel & mask) == color : (pixel & mask) != color;
|
hit = findColor ? (pixel & _mask) == _color : (pixel & _mask) != _color;
|
||||||
|
|
||||||
if (hit) {
|
if (hit) {
|
||||||
|
|
||||||
@@ -555,7 +557,7 @@ class ImageDataUtil {
|
|||||||
for (x in 0...image.width) {
|
for (x in 0...image.width) {
|
||||||
|
|
||||||
pixel = image.getPixel32 (x, iy, RGBA32);
|
pixel = image.getPixel32 (x, iy, RGBA32);
|
||||||
hit = findColor ? (pixel & mask) == color : (pixel & mask) != color;
|
hit = findColor ? (pixel & _mask) == _color : (pixel & _mask) != _color;
|
||||||
|
|
||||||
if (hit) {
|
if (hit) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user