内存中的位图大小 [英] Bitmap size in memory

查看:102
本文介绍了内存中的位图大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

内存中位图的每个像素的大小是多少?

Whats the size of each pixel of a bitmap in memory?

推荐答案

我想它取决于颜色深度... [卷轴]
请参见BITMAP结构定义[ ^ ], bmBitsPixel成员看起来很有希望.
:)

I suppose it depends on color depth... [rolleyes]
See BITMAP struct definition [^], the bmBitsPixel member looks promising.
:)


在大多数情况下,如果您运行超过256种颜色,它将32位(一个处理器字,即使颜色本身由四个字节中的3个字节表示).
否则,对于256种颜色,为1个字节;
对于16种颜色,需要1位4个不同的字节(每个颜色平面一个,也称为RGBI)
In the most of the cases, if you''re running more than 256 colors, it will be 32 bits (one processor word, even if the color itself is represented by 3 bytes of the four).
Otherwise, for 256 colors, 1 byte;
and for 16 colors 1 bit of four different bytes (one per color plane, also named RGBI)


要记住的另一件事是24位图像是按字对齐的,因此可以有一些每行末尾填充.这意味着大小根本不是每个像素.也许如果您告诉我们您在做什么,我们的答复可能会更准确.
The other thing to remember is that 24 bit images are word aligned, so there can be some padding at the end of each row. This means that the size is not per pixel at all. Perhaps if you told us what you''re doing, we could be more precise in our replies.


这篇关于内存中的位图大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆