【发布时间】:2012-12-03 17:11:27
【问题描述】:
情况如下:在我的舞台上,我有一个引用 BitmapData 对象的 Bitmap 对象。我的位图对象是全屏的,所以是 1366x768。
另一方面,我有一个函数(来自一个库,所以我无法编辑它),它返回一个带有新图片的 BitmapData。那张图片是 640x480,每秒调用一次函数。
问题是:我找不到将返回的图片缩放到全屏的方法。我尝试使用 Matrix 和 .draw 方法,但什么也没做。
这里有一些代码:
var mat:Matrix = new Matrix();
mat.scale(0.52, 0.52); // I tried with other values such as 2 but the picture stays the same
// scr_bmp is the BitmapData attached to the displayed Bitmap
// capt.bmp is the BitmapData returned by the function
// I tried without the new Rectangle but that doesn't change anything
scr_bmp.draw(capt.bmp, mat, null, null,new Rectangle(0, 0, 640, 480), true);
使用此代码,新图片可以正确显示,但仍为原始尺寸:640x480,屏幕其余部分为空白。
提前感谢您的帮助!
【问题讨论】:
标签: actionscript matrix resize bitmapdata