# 如何将Hi-Color转换为Ture-Color??

Posted by Ivan on November 02, 1999 at 19:26:21:

各位先进大家好

小弟有一问题想请教~~

小弟利用以下程式取得picture1之各Byte之值.欲存成全彩packbits compression压缩之tiff档, 但以下函式于16bits(Hi-Color)下仅能读取到
每个点2byte(rrrrrggg|gggbbbbb)之资料,是否有方法可以读取到全彩3byte的资料,或可快速将每个点(2 byte)转换为3byte的方法呢??

请各位先进, 指教谢谢!!

Public Declare Function GetObject Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As Long
Public Declare Function GetBitmapBits Lib "gdi32" (ByVal hBitmap As Long, ByVal dwCount As Long, lpBits As Any) As Long
Type Bitmap_DataType
bmType As Long
bmWidth As Long
bmHeight As Long
bmWidthBytes As Long
bmPlanes As Integer
bmBitsPixel As Integer
bmBits As Long
End Type
Dim hBitmap As Long
Dim Ret As Long
Dim Bitmap As Bitmap_DataType
Dim bBuffer() As Byte
Dim TotalByte As Long
hBitmap = picture1.image.handle

Ret = GetObject(hBitmap, Len(Bitmap), Bitmap)
TotalByte = Bitmap.bmWidthBytes * Bitmap.bmHeight

ReDim bBuffer(TotalByte - 1)
Ret = GetBitmapBits(hBitmap, TotalByte, bBuffer(0))

Follow Ups: