我正在尝试将库中的 png 文件加载到位图数据中,但尝试这样做时会出现 EOF 错误。
遇到文件结尾。在 flash.display::BitmapData/setPixels()
我在下面的代码中使用了值添加了注释。
var bitmapData_texture:BitmapData = new BitmapData(image.width, image.height, true, 0x0);
bitmapData_texture.draw(image);
var pixels:ByteArray = bitmapData_texture.getPixels(rect_bmp);
var bitmapData:BitmapData = new BitmapData(rect_bmp.width,rect_bmp.height,true,0x0);
trace("image width : "+image.width.toString()); //image width : 161
trace("image height: "+image.height.toString()); //image height: 171
trace("rect x : "+rect_bmp.x.toString()); //rect x : 0
trace("rect y : "+rect_bmp.y.toString()); //rect y : 0
trace("rect width : "+rect_bmp.width.toString()); //rect width : 161
trace("rect height : "+rect_bmp.height.toString()); //rect height : 2
trace("bmpd width : "+bitmapData.width.toString()); //bmpd width : 161
trace("bmpd height : "+bitmapData.height.toString()); //bmpd height : 2
bitmapData.setPixels(rect_bmp,pixels);