TImageList.AddMasked not working with TBitmap.PixelFormat := pf32bit
Original Reporter info from Mantis: mitov
-
Reporter name: Boian Mitov
Original Reporter info from Mantis: mitov
- Reporter name: Boian Mitov
Description:
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.
Mantis conversion info:
- Mantis ID: 13505
- Version: 0.9.27 (SVN)
- Monitored by: » etrusco (Flávio Etrusco)