ColorQuantizer

Ecng.Drawing

Chooses the colors of an indexed picture by median cut: the colors in use are split, box by box, along the channel they spread widest on, at the point that halves the pixels.

Методы

Quantize
public static byte[] Quantize(RasterImage image, int maxColors, byte[] indices, int firstIndex)
result = ColorQuantizer.Quantize(image, maxColors, indices, firstIndex)

Gives every opaque pixel of a picture one of at most colors. A picture with no more colors than that keeps them exactly.

image
The picture.
maxColors
The most colors to use.
indices
Receives, for every opaque pixel, the number of its color plus . Other pixels are left as they are.
firstIndex
The number of the first color.

Возвращает: The colors, three bytes each.

Поля

OpaqueAlpha
public const int OpaqueAlpha
value = ColorQuantizer.OpaqueAlpha

An alpha below this is transparent in a format that knows only on and off.