[view] fix ImageView color

This commit is contained in:
2019-03-28 17:38:09 +03:00
parent 22e7894c03
commit d55201ecc0

View File

@@ -15,6 +15,7 @@ class ImageView extends SpriteView {
public var fillType(default, set):FillType;
private var bitmapSkin:BitmapSkin = new BitmapSkin();
private var coloredImage:BitmapData;
public function new(image:BitmapData = null) {
super();
@@ -34,9 +35,9 @@ class ImageView extends SpriteView {
if (image != value) {
image = value;
if (color > -1) {
image = BitmapUtil.colorize(image, color);
coloredImage = BitmapUtil.colorize(image, color);
}
bitmapSkin.image = image;
bitmapSkin.image = coloredImage == null ? image : coloredImage;
toRedraw();
}
return image;
@@ -64,9 +65,10 @@ class ImageView extends SpriteView {
if (color != value) {
color = value;
if (image != null) {
image = BitmapUtil.colorize(image, color);
toRedraw();
coloredImage = BitmapUtil.colorize(image, color);
bitmapSkin.image = coloredImage;
}
toRedraw();
}
return color;
}