This method 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 True if successful, otherwise returns False.
Explanation
The DibFromBitmap method converts a Device Dependent Bitmap to a Device Independent Bitmap. If successful, the image handle is set in the LayerNo property (ImageHandle property or Layer(LayerNo).ImageHandle property).
This method can be used to retrieve an image from TBitmap.
Note: The argument hBm is not freed after executing this method.
In C++Builder:
//Set a raster image in TBitmap
Graphics::TBitmap *bm = new
Graphics::TBitmap();
try
{
bm->LoadFromFile("C:\\Bmp\\001.bmp");
// Some
image processing code
VImageKit1->LayerNo = -1;
VImageKit1->DibFromBitmap(bm->Handle, bm->Palette);
// Some
image processing code
}
__finally
{
delete
bm;
}
In Delphi:
{Set a raster image in TBitmap}
var
Bitmap1:
TBitmap;
begin
Bitmap1 :=
TBitmap.Create;
try
Bitmap1.LoadFromFile('C:\Bmp\001.bmp');
{Some image processing code}
VImageKit1.LayerNo := -1;
VImageKit1.DibFromBitmap(Bitmap1.Handle, Bitmap1.Palette);
{Some image processing code}
finally
Bitmap1.Free;
end;
end;