Is it possible to resize SpriteAsset without adding it to the display list?

I have an inline object (with a scale9 grid) and I'm trying to get bitmaps when resizing, but I cannot do this without adding it to the display list.

I try this:

spriteAsset.setActualSize(w,h);
spriteAsset.width = w;
bmd.draw(spriteAsset);

But when I then cross out the bitmaps using graphics.beginBitmapFill (), I just get the original unstretched image.

Any pointers? Or do I need to take 9 separate BitmapData images and make 9 separate bitmap fills?

Cheers, -Josh

+3
source share
2 answers

, BitmapData.draw() scale9, , 9 , . , , , .

scale9, , BitmapData.draw . null, ( , ..). , ...

bmd.draw(spriteAsset, spriteAsset.transform.matrix)

( , , ymmv.)

+2

Danjp , , , :

var scaledBitmapData:BitmapData = new BitmapData(newWidth, newHeight);
var scaleMatrix:Matrix = new Matrix();
scaleMatrix.scale(scaleFactor, scaleFactor);

scaledBitmapData.draw(bitmap, scaleMatrix);
0

Source: https://habr.com/ru/post/1739262/


All Articles