Hi Folks,
I am testing the:
Lazarus-0.9.27-19324-fpc-2.2.5-20090411-win32.exe
snapshot. I have had a bug that has been around for many months, and finally had time to investigate it in this snapshot.
The TImageList.AddMasked does not work correctly with TBitmap.PixelFormat := pf32bit; . It works with pf24bit but not with pf32bit.Here is a demo code that shows the bug:
procedure TForm1.PaintBox2Paint(Sender: TObject);
var
ABitmap : TBitmap;
AImgeList : TImageList;
begin
AImgeList := TImageList.Create( NIL );
AImgeList.Width := 16;
AImgeList.Height := 16;
ABitmap := TBitmap.Create();
ABitmap.Width := 16;
ABitmap.Height := 16;
ABitmap.PixelFormat := pf32bit;
// ABitmap.PixelFormat := pf24bit;
ABitmap.Canvas.Brush.Color:= clRed;
ABitmap.Canvas.FillRect( 0, 0, 16, 16 );
ABitmap.Canvas.Brush.Color:= clBlue;
ABitmap.Canvas.Ellipse( 0, 0, 16, 16 );
AImgeList.AddMasked( ABitmap, clRed );
AImgeList.Draw( PaintBox2.Canvas, 10, 10, 0, True );
ABitmap.Free();
AImgeList.Free();
end;
Even worse, after ABitmap is drawn, I can't set the ABitmap.PixelFormat := pf24bit; . If I do that the image gets erased. It is not converted. The only workaround I have found is using a temporary bitmap to draw on and then use that one to populate the ImageList.With best regards,
Boian Mitov
------------------------------------------------------- Mitov Software
www.mitov.com
------------------------------------------------------- -------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20090412/9f09a41b/attachment.html
