Problem in drawing a semi transparent PNG image on TBitmap object.
If the TBitmap's ,HandleType is set to bmDDB, then the canvas is drawn transparent.
But the problem is it doesn't work on all kinds of machines (for ex: Windows on apple computers).
When a TBitmap's HandleType property is set to bmDIB, canvas background is drawn white.
bmp.HandleType := bmDIB;
I tried setting Brush style to bsClear. But it draws the transparent pixels in black color.
How can I draw an image preserving its transparency and smooth curved edges.
Thanks
Pavan.
Best Answer
It is certainly possible to paint a
bmDIB
bitmap with transparent background to a canvas:Note that the whole bitmap is filled first with the colour set as
TransparentColor
.But for more control and speed you should look into a solution that is not as dependent on the GDI (which involves graphics card and driver capabilities), something like Graphics32.