Actionscript 3 在as3中使用位图数据(带矩阵)绘制位图
我想将舞台绘制为新位图。Actionscript 3 在as3中使用位图数据(带矩阵)绘制位图,actionscript-3,Actionscript 3,我想将舞台绘制为新位图。 如何剪切舞台的顶部栏(顶部栏的高度为100像素)并将其绘制为新位图?您可以通过将位图中的所有内容添加到精灵中来完成此操作,然后执行以下操作: var stageSprite:Sprite = new Sprite(); addChild(stageSprite); //Creates the sprite you want to draw stageSprite.addChild(objectsYouWantToDraw); //Here you add the
如何剪切舞台的顶部栏(顶部栏的高度为100像素)并将其绘制为新位图?您可以通过将位图中的所有内容添加到精灵中来完成此操作,然后执行以下操作:
var stageSprite:Sprite = new Sprite();
addChild(stageSprite);
//Creates the sprite you want to draw
stageSprite.addChild(objectsYouWantToDraw);
//Here you add the objects you want to draw to the sprite
var bmd:BitmapData = new BitmapData(stage.stageWidth, 100, true, 0);
var bit:Bitmap = new Bitmap(bmd);
addChild(bit);
//Create a bitmap with your size
bmd.draw(stageSprite);
//Draw the objects to a bitmap
如果希望获得屏幕的另一部分,可以选择添加矩阵
var m:Matrix = new Matrix();
m.translate(-xOffset, -yOffset);
bmd.draw(stageSprite, m);
//Draw the objects to a bitmap with the offsets you want
啊,好吧,我用另一种方式建造了它。无论如何,谢谢你的回答。