I have found that bitmaps added to a Block do not support transparency in the way that 'ordinary' bitmaps do. Though the block has the Bitmap.Transparent, TransparentMode and TransparentColor properties, the mode & color have no effect. Instead the Block always uses the tmAuto mode (which uses the colour for the bottom left pixel as the Transparent colour). The implementation of the mode also gives results different to a basic StretchDraw, I get different pixels showing transparent.
Note the transparent area top right on the middle Block. These pixels are not the same color as the transparent pixels in the StretchDraw, tmAuto version. The source image for the right Block has the bottom left pixel set to black (it's too small to see once rendered inside the block)
Hello David,
atDiagram1.GraphicLib := dglGdi;
Another top tip to add to the new manual ;-)
.... OK, PNGs might be the more modern way, but it's certainly not simple....
This is a very simple example:
atDiagram1.Blocks[0].Picture.LoadFromFile('C:\temp\myimage.png');
Yes, but I am generating the TPNGImage myself within the program so it seems very inefficient and poor practice to save the image I generate to a temp file then read it straight back in!
If you have a TPNGImage, then just assign it to the picture:
atDiagram1.Blocks[0].Picture.Assign(MyPNGImage);
Duhh. I actually had exactly that commented out in my code! I tried it but must have had something else wrong at the time.