I have created a composite Sprite “box”, containing a pair of bitmaps and a MovieClip, “mc”: “mc” is cachedAsBitmap and I am applying
for tinting. Then I want to render (
.draw) the resulting “box” to a BitmapData, rescaling it to 50% with a Matrix: the problem is that the resulting BitmapData shows the bitmaps correctly rescaled, but “mc” at the original size. I am pretty sure that the problem is cacheAsBitmap.
A simple workaround is to prerender “box” to a temporary BitmapData, and then render this to a new BitmapData applying the matrix, but it would be better if I could avoid it. I still can’t try the new Lime/Openfl version, so I don’t know if this problem has been fixed.
Is there any way you might be able to create a small sample of this? Something like this?
var box = new Sprite ();
var bitmap = new Bitmap (Assets.getBitmapData ("image1.png"));
var bitmap2 = new Bitmap (Assets.getBitmapData ("image2.png"));
var mc = new MovieClip ();
mc.graphics.drawRect (0, 0, 100, 100);
mc.cacheAsBitmap = true;
mc.transform.colorTransform = new ColorTransform (1, 0, 0, 1);
var bitmapData = new BitmapData (Math.ceil (box.width / 2), Math.ceil (box.height / 2), true, 0);
var matrix = new Matrix ();
matrix.scale (0.5, 0.5);
bitmapData.draw (box, matrix);
var bitmap3 = new Bitmap (bitmapData);