On the Form I have two TImages. TImage which is on the top should be transparent, so we can see what is underneath. How to change the level of TImage transparency?
Example:
On the Form I have two TImages. TImage which is on the top should be transparent, so we can see what is underneath. How to change the level of TImage transparency?
Example:
TImage
itself (and any other UI control, for that matter) cannot be alpha blended on top of other controls. However, you can display an alpha blended GIF image inside of aTImage
using theTGIFImage
class.The usual way would be drawing all graphics to one destination canvas (which could be the bitmap of an TImage), but even with many overlapping TImages this can be done. Be aware that you can't overlap TWinControls.
Since a 32 bit Bitmap support transparency this can be reached by converting the contained graphic to an bitmap (if needed).
By setting Alphaformat := afDefined the bitmap will be drawn with the transparency informations from the alphachannel.
We need a copy of the bitmap since setting the AlphaFormat will let us loose the pixelinformations.
Using scanlines the pixelinformation from the copy can be transferred to the destination, the alpha channel is set to the desired value.
A "fire and forget" implementation could look like this: