This function converts a Device Dependent Bitmap to a Device Independent Bitmap.
Parameters
Name | Explanation |
---|---|
hBm | The bitmap handle |
hPal | The bitmap palette (0 if there is no palette) |
Return Value
Returns the raster image handle if successful, otherwise returns 0 or NULL
Explanation
The IKBitmapFromDib function converts a Device Dependent Bitmap to a Device Independent Bitmap. If successful, the raster image handle will be returned. This function can be used to retrieve an image from C++Builder/Delhi TBitmap or VisualBasic PictureBox. Note: The hBm parameter is not freed after executing this function.
Delphi:
{Retrieve a raster image from TBitmap}
var
Bitmap1: TBitmap;
ImageHandle: THandle;
begin
Bitmap1 := TBitmap.Create;
try
Bitmap1.LoadFromFile('C:\Bmp\001.bmp');
{Image Processing 1}
ImageHandle := IKDibFromBitmap(Bitmap1.Handle, Bitmap1.Palette);
{Image Processing 2}
finally
Bitmap1.Free;
end;
end;
Visual Basic:
' Retrieve a raster image from a PictureBox
Dim ImageHandle As Long
Set Picture1.Picture = LoadPicture("C:\Bmp\001.bmp")
' Image Processing 1
ImageHandle = IKDibFromBitmap(Picture1.Picture.Handle, Picture1.Picture.hPal)
' Image Processing 2