关键是颜色表后面的你那些rgb数据 类似于C的 //by lpData, and the destination image is pointed by m_pTransfered. LPBITMAPINFOHEADER lpBitmapInfoHeader = (LPBITMAPINFOHEADER)(m_pBitmap+14); LPBITMAPFILEHEADER lpBitmapFileHeader = (LPBITMAPFILEHEADER)m_pBitmap; unsigned char *lpData = m_pBitmap + lpBitmapFileHeader->bfOffBits; unsigned long biHeight = lpBitmapInfoHeader->biHeight; unsigned long biWidth = lpBitmapInfoHeader->biWidth; unsigned long biAlign = ( biWidth*3+3) /4 *4; unsigned long bmSize = biHeight * biAlign; if (m_pTransfered == NULL) m_pTransfered = (unsigned char*)malloc(bmSize); if (m_pTransfered == NULL) return ; //Add the processing code here, which reverses the color of each pixel. int x, y, cur; for (y = 0; y < (int)biHeight; y++) { for (x = 0; x < (int)biWidth; x++) { cur = y*biAlign+3*x; //current pixel m_pTransfered[cur] = 255-lpData[cur]; //on B m_pTransfered[cur+1] = 255-lpData[cur+1]; //on G m_pTransfered[cur+2] = 255-lpData[cur+2]; //on R } } 就是这里面lpData,你要获取到才能显示出来
case dwColor of 1:cNum=1; 4:cNum=15; 8:cNum=255; end; for i := 0 tO cNum dO begin with BitmapInfo.bmiColors[i] do begin rgbRed:= RGBQuad.rgbRed; rgbGreen:= RGBQuad.rgbGreen; rgbBlue:= RGBQuad.rgbBlue; rgbReserved:= 0; end; INC(RGBQuad); end;已搞定。
类似于C的
//by lpData, and the destination image is pointed by m_pTransfered.
LPBITMAPINFOHEADER lpBitmapInfoHeader = (LPBITMAPINFOHEADER)(m_pBitmap+14);
LPBITMAPFILEHEADER lpBitmapFileHeader = (LPBITMAPFILEHEADER)m_pBitmap;
unsigned char *lpData = m_pBitmap + lpBitmapFileHeader->bfOffBits;
unsigned long biHeight = lpBitmapInfoHeader->biHeight;
unsigned long biWidth = lpBitmapInfoHeader->biWidth;
unsigned long biAlign = ( biWidth*3+3) /4 *4;
unsigned long bmSize = biHeight * biAlign;
if (m_pTransfered == NULL)
m_pTransfered = (unsigned char*)malloc(bmSize);
if (m_pTransfered == NULL)
return ; //Add the processing code here, which reverses the color of each pixel.
int x, y, cur;
for (y = 0; y < (int)biHeight; y++)
{
for (x = 0; x < (int)biWidth; x++)
{
cur = y*biAlign+3*x; //current pixel
m_pTransfered[cur] = 255-lpData[cur]; //on B
m_pTransfered[cur+1] = 255-lpData[cur+1]; //on G
m_pTransfered[cur+2] = 255-lpData[cur+2]; //on R
}
}
就是这里面lpData,你要获取到才能显示出来
1:cNum=1;
4:cNum=15;
8:cNum=255;
end;
for i := 0 tO cNum dO
begin
with BitmapInfo.bmiColors[i] do
begin
rgbRed:= RGBQuad.rgbRed;
rgbGreen:= RGBQuad.rgbGreen;
rgbBlue:= RGBQuad.rgbBlue;
rgbReserved:= 0;
end;
INC(RGBQuad);
end;已搞定。