ChartDirector 5.1 (.NET Edition)

DrawArea.setTransparentColor


Usage

[VB] Public Sub setTransparentColor(c As Integer)
[C#] public void setTransparentColor(int c);

Description

Specifies a certain color to mean transparent when creating a raster image output, or to include alpha transparency channel in the output.

There are two types of transparency:

For internal drawing, ChartDirector always use alpha transparency. However, when outputting the image as an image file, ChartDirector by default will remove the alpha channel to reduce image size. It is because many image displaying software do not support alpha transparency. For example, the IE browser only supports single color transparency but not alpha transparency.

If you want to use single color transparency in the output, you may specify the transparent color as the argument to the setTransparentColor method. Note that only GIF and PNG can support single color transparency. JPEG, BMP and WBMP cannot support transparency at all.

If you do want to keep the alpha channel in final output, you may pass -1 as the argument to setTransparentColor. Note that the only image format that can support alpha transparency is PNG.

One important thing to note is that the IE browser (and possibly many image displaying software) only supports single color transparency for palette based images with up to 256 colors, but not for true color images. For this reason, if single color transparency is used, ChartDirector will automatically reduce the image to 256 colors if it has more than 256 colors. This may result in lost of image quality, especially if the image contains gradient colors.

Therefore, due to the limitations of the current generations of image displaying software, for highest image quality, sometimes it may be beneficial to not using transparency in image output, but to set the image background color to the same color as the container background.

Arguments

ArgumentDefaultDescription
c(Mandatory)The color that is designated as the transparent color. If -1 is used, the full alpha transparency channel will be included in the final output.

Return Value

None