PredefinedColorsQuantizerFromBitmapData Method

Gets a PredefinedColorsQuantizer instance that is compatible with the PixelFormat of the specified bitmapData and uses its Palette if bitmapData represents an indexed bitmap.

Definition

Namespace: KGySoft.Drawing.Imaging
Assembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 10.0.0-rc.1
C#
public static PredefinedColorsQuantizer FromBitmapData(
	IBitmapData bitmapData
)

Parameters

bitmapData  IBitmapData
The IBitmapData to get a compatible quantizer for.

Return Value

PredefinedColorsQuantizer
A PredefinedColorsQuantizer instance that is compatible with the specified bitmapData.

Remarks

If the PixelFormat of bitmapData is Format24bppRgb, Format32bppRgb, Format48bppRgb or Format96bppRgb, then this method returns the same quantizer as the Rgb888 method.

If the PixelFormat of bitmapData is Format16bppArgb1555, then this method returns the same quantizer as the Argb1555 method.

If the PixelFormat of bitmapData is Format16bppRgb565, then this method returns the same quantizer as the Rgb565 method.

If the PixelFormat of bitmapData is Format16bppRgb555, then this method returns the same quantizer as the Rgb555 method.

If the PixelFormat of bitmapData is Format8bppGrayScale, Format16bppGrayScale or Format32bppGrayScale, then this method returns the same quantizer as the Grayscale method.

If the PixelFormat of bitmapData is an indexed format, then this method returns the same quantizer as the FromCustomPalette(Palette) method using the Palette of the specified bitmapData.

If none of above and the bitmapData has been created by one of the BitmapDataFactory.CreateBitmapData methods that have a CustomBitmapDataConfig or CustomIndexedBitmapDataConfig parameter where the BackBufferIndependentPixelAccess property is , then a special quantizer is returned that produces exactly the same colors as the specified bitmapData.

Otherwise, this method returns either the same quantizer as the Argb8888 method (if the PixelFormat of bitmapData supports alpha), a grayscale quantizer for grayscale formats (with or without alpha support), or the same quantizer as returned by the Rgb888 method.

  Note

For examples see the Examples section of the mentioned methods above.

See Also