现在已经将一幅图载入内存,而且已经得到它的CBitmap和BITMAP,请问用什么方法可以取得这幅图里边任意点的RGB值(假定是24位的真彩位图)?
还有,在程序中如何确定一幅位图是24位的,还是8位的?
问多一个问题,我想知道一般这些位图在内存中以怎样的形态摆放的?以下是我的猜想,错了请指正:
BMPINFOHEADER
R(pixel(0,0)) G(pixel(0,0)) B(pixel(0,0)) R(pixel(0,1)) G(pixel(0,1)) B(pixel(0,1)) R(pixel(0,2)) G(pixel(0,2)) B(pixel(0,2)) R(pixel(0,3)) G(pixel(0,3)) B(pixel(0,3))
......
还有,在程序中如何确定一幅位图是24位的,还是8位的?
问多一个问题,我想知道一般这些位图在内存中以怎样的形态摆放的?以下是我的猜想,错了请指正:
BMPINFOHEADER
R(pixel(0,0)) G(pixel(0,0)) B(pixel(0,0)) R(pixel(0,1)) G(pixel(0,1)) B(pixel(0,1)) R(pixel(0,2)) G(pixel(0,2)) B(pixel(0,2)) R(pixel(0,3)) G(pixel(0,3)) B(pixel(0,3))
......
比如CBitmap里我要取得(5,5)位置像素点的RGB, 该怎么写?
另外,BITMAP结构里有个LPVOID bmBits, msdn上说是"bmBits: Points to the location of the bit values for the bitmap. The bmBits member must be a long pointer to an array of 1-byte values. ". 这个指针有什么用么?我想用它指向位图图像数据的第一个数据,不过发现它的值为0(地址为0)一加上*程序就立刻挂掉了
从下到上:DIB指针为0的时候当然不能动,可以用一些GDI函数获取位图数据。
DIB与设备无关,它的灰度值是颜色值(0~1)或是
颜色查找表中的索引值
DDB与设备相关,根据设备来定义灰度值标准