16位位图有没有调色板?

youngwolf 2007-05-09 09:59:32
我写了个位图文件,在BITMAPFILEHEADER + BITMAPINFOHEADER后面,有sizeof(RGBQUAD) * 65535个字节
用于写调色板(即位图数据是从调色板数据后面开始的),这个位图用看图软件打开很正常,但奇怪的是,
无论我如何更改(包括随机更改)那sizeof(RGBQUAD) * 65535字节的调色板数据,位图的样子都不发生任何变化,好像16位位图不使用调色板。
...全文
743 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
dnaiel_zeng 2008-03-11
  • 打赏
  • 举报
回复
如果位图是8位或更小的,那么它的位图数据位则标示了它在颜色板上的索引号,
所以一般是需要调色板的
但如果高于8位的话,如24位,则一个像素占三个字节,
那么该像素点则可以用其三个字节分别表示RGB的颜色了,
所以就没必要用调色板了!




小弟是新来的,不知道有没讲错,嘿嘿~~~。
还望各位多让小弟长点知识!!!
rageliu 2007-05-09
  • 打赏
  • 举报
回复
使用调色板是为了减少文件的存储大小,如果其索引需要的位数和直接存储一样没有什么减少,也就没有使用调色板的必要了
crumpy 2007-05-09
  • 打赏
  • 举报
回复
如果假设用StretchDIBits绘图时, 它的iUsage为DIB_PAL_COLORS, 而不是DIB_RGB_COLORS, 是否会使用你提供的调色板呢
会思考的草 2007-05-09
  • 打赏
  • 举报
回复
没有。256色以上的位图使用调色板没有意义。
菜牛 2007-05-09
  • 打赏
  • 举报
回复
没有调色板
tufaqing 2007-05-09
  • 打赏
  • 举报
回复
BITMAPINFOHEADER

biClrUsed
Specifies the number of color indexes in the color table that are actually used by the bitmap. If this value is zero, the bitmap uses the maximum number of colors corresponding to the value of the biBitCount member for the compression mode specified by biCompression.
If biClrUsed is nonzero and the biBitCount member is less than 16, the biClrUsed member specifies the actual number of colors the graphics engine or device driver accesses. If biBitCount is 16 or greater, the biClrUsed member specifies the size of the color table used to optimize performance of the system color palettes. If biBitCount equals 16 or 32, the optimal color palette starts immediately following the three DWORD masks.

If the bitmap is a packed bitmap (a bitmap in which the bitmap array immediately follows the BITMAPINFO header and is referenced by a single pointer), the biClrUsed member must be either zero or the actual size of the color table.
wltg2001 2007-05-09
  • 打赏
  • 举报
回复
256色以上的位图应该没有调色板
livedeal 2007-05-09
  • 打赏
  • 举报
回复
如果是16位的话555格式和565格式
555 bits :0rrrrrgggggbbbbb
565 bits : rrrrrggggggbbbbb

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧