关于颜色表
时间:2011-10-20
来源:互联网
已获取 颜色表 的数据为 cBuf (cBuf:Tbyte),是8位色,长度为 1024 字节
var
BitmapInfo:TBitmapInfo;
BitmapInfo.bmiHeader.biSize :=sizeof(BITMAPINFOHEADER);
BitmapInfo.bmiHeader.biCompression := BI_RGB;
BitmapInfo.bmiHeader.biClrImportant := 0;
BitmapInfo.bmiHeader.biPlanes := 1;
// BitmapInfo.bmiHeader.biClrUsed := 0;
BitmapInfo.bmiHeader.biSizeImage := nWidth * nHeight * 8 div 8;
BitmapInfo.bmiHeader.biWidth := nWidth;
BitmapInfo.bmiHeader.biHeight := -nHeight;
BitmapInfo.bmiHeader.biBitCount := 8;
BitmapInfo.bmiColors //如何把上面的颜色表数据 cBuf 应用在这里?谢谢。
注:颜色表数据 cBuf 是由一个 dll 调用获取的,现在主要是把图像显示出来。
var
BitmapInfo:TBitmapInfo;
BitmapInfo.bmiHeader.biSize :=sizeof(BITMAPINFOHEADER);
BitmapInfo.bmiHeader.biCompression := BI_RGB;
BitmapInfo.bmiHeader.biClrImportant := 0;
BitmapInfo.bmiHeader.biPlanes := 1;
// BitmapInfo.bmiHeader.biClrUsed := 0;
BitmapInfo.bmiHeader.biSizeImage := nWidth * nHeight * 8 div 8;
BitmapInfo.bmiHeader.biWidth := nWidth;
BitmapInfo.bmiHeader.biHeight := -nHeight;
BitmapInfo.bmiHeader.biBitCount := 8;
BitmapInfo.bmiColors //如何把上面的颜色表数据 cBuf 应用在这里?谢谢。
注:颜色表数据 cBuf 是由一个 dll 调用获取的,现在主要是把图像显示出来。
作者: wealsh 发布时间: 2011-10-20
关键是颜色表后面的你那些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,你要获取到才能显示出来
类似于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,你要获取到才能显示出来
作者: ljmanage 发布时间: 2011-10-20
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;
已搞定。
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;
已搞定。
作者: wealsh 发布时间: 2011-10-20
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28