单色位图

位图中的颜色在文件中按位存储,我们平时所见位图多试24位或32位。24位位图的含义是图片上每个像素点由24bit存储,24位位图由RGB三种颜色组成,每种颜色占一字节也就是8位,32位位图比24位位图多了透明通道(alpha通道)。这里所说的单色位图就是每个像素点仅用1bit存储,其值只能是0或1,即黑色和白色。

常用位图数据复制函数BitBlt是将一块位图数据复制到另一块地址中,但是32位位图和单色位图之间复制会怎么样呢?

When the BitBlt function converts a monochrome bitmap to color, it sets white bits (1) to the background color and black bits (0) to the foreground color. The foreground and background colors of the destination device context are used. To convert color to monochrome, BitBlt sets pixels that match the background color to white and sets all other pixels to black. BitBlt uses the foreground and background colors of the color device context to convert from color to monochrome.

http://msdn.microsoft.com/en-us/library/fcbk8779.aspx

从单色位图到彩色位图,单色位图中是1的地方需要先转换为彩色位图的背景色,全0的地方需要转换为前景色,然后在进行块间操作;从彩色位图到单色位图,彩色位图中所有和背景色一致的地方设置为全1,即白色,其余部分为0,黑色

http://blog.csdn.net/ThomasLiu83/article/details/443385

转载于:https://www.cnblogs.com/aishangxue/p/3669595.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值