I am using openfl to develop a html interface. The interface has some white images that are colored in a specific color, by using flash approach:
var colorInfo = this.transform.colorTransform;
colorInfo.color = value;
this.transform.colorTransform = colorInfo;
This works ok when rendering in webgl, but when rendering in canvas or dom, the images aren’t colorized.
Is this an issue in openfl or do I need to use another approach?
Thank you, I just realized we had a regression, and this stopped working (at least in the development builds) for our software renderers, like canvas.
How it works now (in dev) is that
colorTransform means your object will be drawn to a temporary surface, then tinted, and we will preserve that copy so long as your object’s contents do not change. This is a bit expensive if your object constantly changes, but not bad otherwise.
Here’s another you can accomplish the same effect, if you need a workaround:
var bitmapData = new BitmapData (width, height, true, 0);
bitmapData.colorTransform (bitmapData.rect, colorInfo);
var bitmap = new Bitmap (bitmapData);
…then you can use that
Bitmap for display instead of the original object.
Thanks a lot for your response.
Since I made a lot of changes to Bitmaps (color + size since is a liquid layout) and also I’m using a sort of Movieclip (my custom implementation by changing the bitmapData of a Bitmap) I think I can’t use the approach since will be time consuming and also expensive.
But, for now, I can live with it as so; and my next question is if this fix will come to a new version of OpenFL? because I can wait for it.