I have TImage
with a preloaded Bitmap (by PNGImage
unit) with an Alpha Channel:
The subject is the Great Green Dino. I wanted to be able to change its Alpha Level in runtime, to any value in the range. Like 127 and he would look like this:
Following the answer to another similar question I almost felt in the skin it would work. But that was the result to Alpha Level 0 for example:
So, my question. Could someone know how to improve the answer's routine? Or know another way to achieve the second picture result? Note that I want to be able change this Alpha Level property in runtime be with a Method or any other way you know
Thank you in advance...
Using
AlphaBlend
,Commented a little, the above code produces the below image here (below image is the 'Image1'):
The other question involved using
TBitmap
to apply alpha blending to GIF images.TPNGImage
has its own native alpha support, so you don't need to involveTBitmap
. Look at theTPNGImage.CreateAlpha()
method and theTPNGImage.AlphaScanline
property.Try something like this: