PredefinedColorsQuantizer Class

Represents a quantizer with predefined set of colors. Use the static members to retrieve an instance. For using optimized colors for a specific source image see the OptimizedPaletteQuantizer class.
See the Remarks section of the static methods of this class for details and image examples.

Definition

Namespace: KGySoft.Drawing.Imaging
Assembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 9.0.0
C#
public sealed class PredefinedColorsQuantizer : IQuantizer
Inheritance
Object    PredefinedColorsQuantizer
Implements
IQuantizer

Properties

AlphaThreshold Gets the alpha threshold value used by this PredefinedColorsQuantizer. This value will be returned also by the AlphaThreshold property once an IQuantizingSession is created from this instance.
See the Remarks section of the IQuantizingSession.AlphaThreshold property for details.
BackColor Gets the back color used by this PredefinedColorsQuantizer. This value will be returned also by the BackColor property once an IQuantizingSession is created from this instance. The A field of the returned color is always 255.
See the Remarks section of the IQuantizingSession.AlphaThreshold property for details.
Palette If this PredefinedColorsQuantizer is associated with a specific palette, then returns the same Palette that will be returned also by the Palette property once an IQuantizingSession is created from this instance; otherwise, returns .
PixelFormatHint Gets a KnownPixelFormat that is compatible with this PredefinedColorsQuantizer instance. If this PredefinedColorsQuantizer was not initialized with custom color mapping logic, then this is the possible lowest bits-per-pixel value format.
WorkingColorSpace Gets the preferred color space of this PredefinedColorsQuantizer instance for quantizing. This value will be returned also by the WorkingColorSpace property once an IQuantizingSession is created from this instance. You can use the ConfigureColorSpace method to create a clone of this PredefinedColorsQuantizer using a different working color space.

Methods

Argb1555 Gets a PredefinedColorsQuantizer instance that can quantize colors to 16-bit ones where alpha, red, green and blue components are encoded in 1, 5, 5 and 5 bits, respectively.

See the online help for an example with images.
Argb8888 Gets a PredefinedColorsQuantizer instance that can quantize colors to the 32-bit ARGB color space.

See the online help for an example with images.
BlackAndWhite Gets a PredefinedColorsQuantizer instance that quantizes every color to black or white.

See the online help for an example with images.
ConfigureColorSpace Configures the preferred working color space for this PredefinedColorsQuantizer. The configuration might be ignored if this instance was created from a custom function. The configuration may affect alpha blending, nearest color lookup if this quantizer has a Palette, and also the behavior of ditherers that use this quantizer.
See the Remarks section of the WorkingColorSpace enumeration for details and image examples about using the different color spaces in various operations.
FromBitmapData Gets a PredefinedColorsQuantizer instance that is compatible with the PixelFormat of the specified bitmapData and uses its Palette if bitmapData represents an indexed bitmap.
FromCustomFunction(FuncColor32, Color32, KnownPixelFormat) Gets a PredefinedColorsQuantizer instance that can quantize colors using the custom quantizer function specified in the quantizingFunction parameter.

See the online help for an example with images.
FromCustomFunction(FuncColor32, Color32, Color32, KnownPixelFormat, Byte) Gets a PredefinedColorsQuantizer instance that can quantize colors using the custom quantizer function specified in the quantizingFunction parameter.

See the online help for an example with images.
FromCustomFunction(FuncColor32, Color32, Color32, Byte, Boolean, KnownPixelFormat) Gets a PredefinedColorsQuantizer instance that can quantize colors using the custom quantizer function specified in the quantizingFunction parameter.
FromCustomPalette(Palette) Gets a PredefinedColorsQuantizer instance that can quantize colors using the specified palette.

See the online help for an example with images.
FromCustomPalette(Color, Color, Byte) Gets a PredefinedColorsQuantizer instance that can quantize colors using the colors in the specified palette.
FromCustomPalette(IEnumerableColor32, Color32, Byte) Gets a PredefinedColorsQuantizer instance that can quantize colors using the colors in the specified palette.
FromPixelFormat Gets a PredefinedColorsQuantizer instance that is compatible with the specified pixelFormat.
See the Remarks section for details.
Grayscale Gets a PredefinedColorsQuantizer instance that can quantize colors to 8-bit grayscale ones of 256 shades.

See the online help for an example with images.
Grayscale16 Gets a PredefinedColorsQuantizer instance that can quantize colors to 4-bit grayscale ones of 16 shades.

See the online help for an example with images.
Grayscale4 Gets a PredefinedColorsQuantizer instance that can quantize colors to 2-bit grayscale ones of 4 shades.

See the online help for an example with images.
Rgb332 Gets a PredefinedColorsQuantizer instance that can quantize colors to 8-bit ones where red, green and blue components are encoded in 3, 3 and 2 bits, respectively.

See the online help for an example with images.
Rgb555 Gets a PredefinedColorsQuantizer instance that can quantize colors to 16-bit ones where each color component is encoded in 5 bits.

See the online help for an example with images.
Rgb565 Gets a PredefinedColorsQuantizer instance that can quantize colors to 16-bit ones where red, green and blue components are encoded in 5, 6 and 5 bits, respectively.

See the online help for an example with images.
Rgb888 Gets a PredefinedColorsQuantizer instance that can quantize colors to 24-bit ones where each color component is encoded in 8 bits.

See the online help for an example with images.
SystemDefault1BppPalette Gets a PredefinedColorsQuantizer instance that can quantize colors using the system default 1-bit palette. This palette consists of the black and white colors.
SystemDefault4BppPalette Gets a PredefinedColorsQuantizer instance that can quantize colors using the system default 4-bit palette. This palette consists of the 16 standard basic sRGB colors.

See the online help for an example with images.
SystemDefault8BppPalette Gets a PredefinedColorsQuantizer instance that can quantize colors using the system default 8-bit palette. This palette contains the 16 standard basic sRGB colors, the "web-safe" palette of 216 colors as well as 24 transparent entries.

See the online help for an example with images.

Extension Methods

InitializeAsync Gets an IQuantizingSession instance potentially asynchronously that can be used to quantize the colors of the specified IReadableBitmapData instance. If quantizer is a known quantizer that can be evaluated quickly, then this method might be executed synchronously.
This method is available in.NET Framework 4.0 and above.
(Defined by QuantizerExtensions)

See Also