Writting on transparent Bitmap
Original Reporter info from Mantis: krzynio
-
Reporter name: Krzysztof Stępień
Original Reporter info from Mantis: krzynio
- Reporter name: Krzysztof Stępień
Description:
Hello!
What I wanted to do is to copy an image from image list to bitmap b2, write text on this b2 bitmap, then paste it to bitmap of the image.
Image must be transparent.
When I copy bitmap from TImageList to bitmap b2 and copy it to bitmap b the result is correct.
But when I copy image from the ImageList to bitmap b2 then write some text on it and next copy b2 to b1 then in place of written text a transparent rectangle is displayed. I save the image of b2 into the file and I see that text on b2 is correct. The bug seems to be in Draw function which copies the image from b2 into b.
Steps to reproduce:
Image.Transparent := True;
b := Image.Picture.Bitmap;
b.PixelFormat := pf32bit;
b.Transparent := True;
b.TransparentColor := clFuchsia;
b.TransparentMode := tmFixed;
b.Canvas.CopyMode := cmSrcCopy;
b.Canvas.Brush.Style := bsSolid;
b.Canvas.Brush.Color := b.TransparentColor;
b.Canvas.FillRect(0,0,w,h);
b2 := TBitmap.Create;
b2.PixelFormat := pf32bit;
dm.il64x50.GetBitmap(1, b2);
b2.Canvas.Font.Size := 8;
b2.Canvas.Brush.Color := clYellow;
b2.Canvas.Brush.Style := bsSolid;
b2.Canvas.Font.Style := [];
b2.Canvas.Font.Color := clBlack;
b2.Canvas.TextOut(10,40, 'XXXXXXX');
b2.SaveToFile('d:\xx.bmp');
b.Canvas.Draw(0,(w-64) div 2, b2);
//b.Canvas.StretchDraw(rect(2,2,62,52), b2);
b2.Free;
Mantis conversion info:
- Mantis ID: 35585
- OS: Windows 10
- OS Build: 1809
- Platform: Intel x64
- Version: 2.1 (SVN)