The TPNGImage latest
release provides a method to generate transparency data for the current
image when its not avaliable, this method is
CreateAlpha. It generates alpha
information:
-
When the image color type is COLOR_RGB or COLOR_GRAYSCALE it converts to
COLOR_RGBALPHA and COLOR_GRAYSCALEALPHA and makes the
AlphaScanline property
avaliable.
-
For COLOR_PALETTE color type, it generates a tRNS
chunk which may be acessed using
Chunks.ItemFromClass.
If the
image already contains alpha information, the method don't do nothing, so
its always safe to call it. Also, it initialize the transparency image so
the image is fully opaque for booth COLOR_PALETTE and
COLOR_RGB/COLOR_GRAYSCALE modes.
To
access the transparency information when the image is
COLOR_RGB/COLOR_GRAYSCALE use the first
way, and for COLOR_PALETTE use the
second way.