ChartDirector Ver 5.0 (PHP Edition)

DrawArea.setDitherMethod

Usage

setDitherMethod(m)

Description

Sets the dithering method in case dithering is necessary.
Dithering is a process of reducing the colors of an image. It is required if an image has more colors than can be supported by the image format. For example, a GIF image can only have 256 colors. If the actual image contains more than 256 colors, dithering is needed to reduce the colors to less than 256.
The dithering method must be one of the following predefined constants.

Constant | Value | Description
--- | --- | ---
Quantize | 0 | ChartDirector will first compute an optimal 256-color palette based on colors on the actual image. It then replaces the color of each pixel with the nearest color in the palette. This is the default method and produces the best result in most cases.

OrderedDither

1

Use the ordered dithering algorithm with a 4 x 4 matrix, and with the standard web-safe palette. The web-safe palette is a palette compatible with very old browsers (e.g. Netscape 1.x and 2.x browsers) on 256-color displays.
Web-safe palette is not an optimal palette. In most cases, this method is not as good as the Quantize method. Use this method only if you have to use the web-safe palette.

ErrorDiffusion | 2 | Similar to OrderedDither but use the Floyd and Steinberg error diffusion algorithm.

Arguments

Argument | Default | Description
--- | --- | ---
m | (Mandatory) | The dithering method to use in case dithering is necessary.

Return Value

None

© 2009 Advanced Software Engineering Limited. All rights reserved.