TBitmapInfo 回显图像数据(100)

W

wealsh

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure GetImgData(pBuf:pByte); pBuf 为位图返回的数据,大小为:宽度*高度*颜色位数 div 8 当 dwColor 为 16 时返回的是 555位图 ,设置为 16 或 24 以下方式显示正常。 如果设置为 4 或 8 显示就不正常了。 当取位4色时缓冲长度为64字节,当取8位色时缓冲长度为1024字节。 请问 BtimapInfo 还需要设置哪些参数?或是用其它方法? 谢谢。 var BitmapInfo:TBitmapInfo; dwColor:=24; with BitmapInfo.bmiHeader do begin biSize := SizeOf(TBitmapInfoHeader); biWidth := xxxxWidth; biHeight := xxxHeight; biPlanes := 1; biBitCount := dwColor; biCompression := BI_RGB; end; SetDIBitsToDevice(Form1.Canvas.Handle, xxxRect.Left, xxxRect.Top, xxxWidth, xxxHeight, 0, 0, 0, xxxHeight, pBuf, BitmapInfo, DIB_RGB_COLORS);
 
4 或 8 位时所取数据为颜色索引表值你还要取出色彩索引表
 
另还有一个函数:function GetColorTable(pTable:pointer):Dword;返回的这个 pTable 应该是色彩索引表?该怎么设置 BitmapInfo
 
文件说明提示 先使用 GetColorTable (只需调用一次)再使用 GetImgData
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
959
SUNSTONE的Delphi笔记
S
S
回复
0
查看
779
SUNSTONE的Delphi笔记
S
I
回复
0
查看
569
import
I
顶部