我有26,4KB的图像。它由Frame bellow类加载。为什么Flex的Profiling Tool显示此Frame实例的使用量为1388KB。
public class Frame extends Group
{
public function Frame(source:Object)// image with 26,4K
{
var image:BitmapImage;
image = new BitmapImage();
image.smooth = true;
image.source = source;
this.addElement(image);
}
}
答案 0 :(得分:1)
BitmapImages本质上是一个未压缩的矩形数组,包含确定像素颜色的字节。
我想您的输入文件是JPG/JPEG
,PNG
,GIF
? (基本上,它被压缩了。)
想象一下图像100px by 100px, 32bit RGBA colors
(红色/绿色/蓝色/ Alpha)。
此 BitmapImage 的内存要求将在100 * 100 * (32 / 8)
(X * Y * bytesPerPixel)= 40K字节附近。但是 SAME 图像作为JPG
可能会压缩到3K或者其他东西。 (或GIF
,或PNG
等)
必须将其存储为某个位图,以便可以将其复制(blitted)到视频内存中进行显示。或许flex
可以使用/尝试其他图像存储类型吗?