TLazIntfImage.CreateBitmaps doesn't work if it isn't first loaded from a dummy bitmap
Original Reporter info from Mantis: sekelsenmat
-
Reporter name: Felipe Monteiro de Carvalho
Original Reporter info from Mantis: sekelsenmat
- Reporter name: Felipe Monteiro de Carvalho
Description:
Consider the following code:
procedure TForm1.Button1Click(Sender: TObject);
var
IntfImg: TLazIntfImage;
ImgHandle, ImgMaskHandle: HBITMAP;
DummyBmp: TBitmap;
begin
IntfImg := TLazIntfImage.Create(10,10);
DummyBmp := TBitmap.Create;
try
// Works if we add something like:
{$ifdef use_dummy_bmp}
DummyBmp.Width := 10;
DummyBmp.Height := 10;
IntfImg.LoadFromBitmap(DummyBmp.Handle, DummyBmp.MaskHandle);
{$endif}
// do some color operation
IntfImg.Colors[5,5] := colGreen;
// Converts the TLazIntfImage to a TBitmap
IntfImg.CreateBitmaps(ImgHandle,ImgMaskHandle, false);
finally
IntfImg.Free;
DummyBmp.Free;
end;
end;
An exception is raised if we don't first load the TLazIntfImage from a dummy bitmap:
procedure TLazIntfImage.CreateBitmaps(out ABitmap, AMask: HBitmap; ASkipMask: boolean);
begin
if not RawImage_CreateBitmaps(FRawImage, ABitmap, AMask, ASkipMask)
then raise FPImageException.Create('Failed to create handles'); <<<-- this exception
end;
Mantis conversion info:
- Mantis ID: 17305
- OS: Microsoft Windows
- OS Build: XP
- Platform: Intel Pentium 4