Table of Contents

Method CreateFormatConverter

Namespace
PaintDotNet.Imaging
Assembly
PaintDotNet.Windows.Core.dll

CreateFormatConverter(IBitmapSource, in PixelFormat, BitmapDitherType, IPalette?, double, BitmapPaletteType)

Converts a bitmap from one pixel format to another, handling dithering and halftoning to indexed formats, palette translation, and alpha thresholding.

For more information, see IWICFormatConverter::Initialize.

public static IBitmapSource CreateFormatConverter(this IBitmapSource source, in PixelFormat dstFormat, BitmapDitherType dither, IPalette? palette, double alphaThresholdPercent, BitmapPaletteType paletteTranslate)

Parameters

source IBitmapSource
The input bitmap to convert.
dstFormat PixelFormat
The destination pixel format.
dither BitmapDitherType
The dithering type used for conversion. Applicable only for indexed destination formats such as Indexed8.
palette IPalette
The palette to use for conversion. Should be null if not using an indexed destination format such as Indexed8.
alphaThresholdPercent double
The alpha threshold to use for conversion. Specifies the percentage of transparency that should map to the transparent color of the palette. Applicable only for indexed destination formats such as Indexed8.
paletteTranslate BitmapPaletteType
The palette translation type to use for conversion. Applicable only for indexed destination formats such as Indexed8.

Returns

IBitmapSource

CreateFormatConverter<TPixelDst>(IBitmapSource, BitmapDitherType, IPalette?, double, BitmapPaletteType)

Converts a bitmap from one pixel format to another, handling dithering and halftoning to indexed formats, palette translation, and alpha thresholding.

For more information, see IWICFormatConverter::Initialize.

public static IBitmapSource<TPixelDst> CreateFormatConverter<TPixelDst>(this IBitmapSource source, BitmapDitherType dither, IPalette? palette, double alphaThresholdPercent, BitmapPaletteType paletteTranslate) where TPixelDst : unmanaged, INaturalPixelInfo

Parameters

source IBitmapSource
The input bitmap to convert.
dither BitmapDitherType
The dithering type used for conversion. Applicable only for indexed destination formats such as Indexed8.
palette IPalette
The palette to use for conversion. Should be null if not using an indexed destination format such as Indexed8.
alphaThresholdPercent double
The alpha threshold to use for conversion. Specifies the percentage of transparency that should map to the transparent color of the palette. Applicable only for indexed destination formats such as Indexed8.
paletteTranslate BitmapPaletteType
The palette translation type to use for conversion. Applicable only for indexed destination formats such as Indexed8.

Returns

IBitmapSource<TPixelDst>

Type Parameters

TPixelDst

CreateFormatConverter(IBitmapSource, in PixelFormat)

Converts a bitmap from one pixel format to another, handling dithering and halftoning to indexed formats, palette translation, and alpha thresholding.

For more information, see IWICFormatConverter::Initialize.

public static IBitmapSource CreateFormatConverter(this IBitmapSource source, in PixelFormat dstFormat)

Parameters

source IBitmapSource
dstFormat PixelFormat

Returns

IBitmapSource

CreateFormatConverter(IBitmapSource, in PixelFormat, BitmapDitherType, int, IPalette?, double, BitmapPaletteType)

Converts a bitmap from one pixel format to another, handling dithering and halftoning to indexed formats, palette translation, and alpha thresholding.

For more information, see IWICFormatConverter::Initialize.

public static IBitmapSource CreateFormatConverter(this IBitmapSource source, in PixelFormat dstFormat, BitmapDitherType dither, int ditherLevel, IPalette? palette, double alphaThresholdPercent, BitmapPaletteType paletteTranslate)

Parameters

source IBitmapSource
The input bitmap to convert.
dstFormat PixelFormat
The destination pixel format.
dither BitmapDitherType
The dithering type used for conversion. Applicable only for indexed destination formats such as Indexed8.
ditherLevel int
Specifies the dithering level when dither is set to ErrorDiffusion. The range of this value is 0 to 8. A good default value is 7.
palette IPalette
The palette to use for conversion. Should be null if not using an indexed destination format such as Indexed8.
alphaThresholdPercent double
The alpha threshold to use for conversion. Specifies the percentage of transparency that should map to the transparent color of the palette. Applicable only for indexed destination formats such as Indexed8.
paletteTranslate BitmapPaletteType
The palette translation type to use for conversion. Applicable only for indexed destination formats such as Indexed8.

Returns

IBitmapSource

CreateFormatConverter<TDstPixel>(IBitmapSource, BitmapDitherType, int, IPalette?, double, BitmapPaletteType)

Converts a bitmap from one pixel format to another, handling dithering and halftoning to indexed formats, palette translation, and alpha thresholding.

For more information, see IWICFormatConverter::Initialize.

public static IBitmapSource<TDstPixel> CreateFormatConverter<TDstPixel>(this IBitmapSource source, BitmapDitherType dither, int ditherLevel, IPalette? palette, double alphaThresholdPercent, BitmapPaletteType paletteTranslate) where TDstPixel : unmanaged, INaturalPixelInfo

Parameters

source IBitmapSource
The input bitmap to convert.
dither BitmapDitherType
The dithering type used for conversion. Applicable only for indexed destination formats such as Indexed8.
ditherLevel int
Specifies the dithering level when dither is set to ErrorDiffusion. The range of this value is 0 to 8. A good default value is 7.
palette IPalette
The palette to use for conversion. Should be null if not using an indexed destination format such as Indexed8.
alphaThresholdPercent double
The alpha threshold to use for conversion. Specifies the percentage of transparency that should map to the transparent color of the palette. Applicable only for indexed destination formats such as Indexed8.
paletteTranslate BitmapPaletteType
The palette translation type to use for conversion. Applicable only for indexed destination formats such as Indexed8.

Returns

IBitmapSource<TDstPixel>

Type Parameters

TDstPixel

CreateFormatConverter<TPixelDst>(IBitmapSource)

Converts a bitmap from one pixel format to another, handling dithering and halftoning to indexed formats, palette translation, and alpha thresholding.

For more information, see IWICFormatConverter::Initialize.

public static IBitmapSource<TPixelDst> CreateFormatConverter<TPixelDst>(this IBitmapSource source) where TPixelDst : unmanaged, INaturalPixelInfo

Parameters

source IBitmapSource

Returns

IBitmapSource<TPixelDst>

Type Parameters

TPixelDst