Specifies a certain color to mean transparent when creating a raster image output.
There are two types of transparency:
- Alpha transparency: In addition to red, green and blue levels, there is a transparency level associated with each pixel, which can range from completely transparent to completely opaque. The data associated with the transparency information is called the alpha channel.
- Single color transparency: The image itself has no alpha channel, but a certain color is used to mean completely transparent.
When outputting the image, to reduce image size, ChartDirector will include the alpha channel only if the chart background is a transparent or semi-transparent. You may pass -1 to setTransparentColor to force ChartDirector to include the alpha channel in the output.
Note that including alpha channel is possible only if the image format supports alpha channel. The PNG, SVG and PDF formats support alpha transparency, while the JPG, GIF and BMP formats does not support it.
Although the GIF format does not support alpha transparency, it does support single color transparency. The setTransparentColor method can be used to specify which color should be used to mean completely transparent.
© 2021 Advanced Software Engineering Limited. All rights reserved.