Method CreateFormatConvertedBitmap
- Namespace
- PaintDotNet.Imaging
- Assembly
- PaintDotNet.Windows.Core.dll
CreateFormatConvertedBitmap<TPixelDst>(IImagingFactory, 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> CreateFormatConvertedBitmap<TPixelDst>(this IImagingFactory factory, IBitmapSource source, BitmapDitherType dither, IPalette? palette, double alphaThresholdPercent, BitmapPaletteType paletteTranslate) where TPixelDst : unmanaged, INaturalPixelInfo
Parameters
factoryIImagingFactoryThe imaging factory to use.
sourceIBitmapSource- The input bitmap to convert.
ditherBitmapDitherType- The dithering type used for conversion. Applicable only for indexed destination formats such as Indexed8.
paletteIPalette- The palette to use for conversion. Should be
nullif not using an indexed destination format such as Indexed8. alphaThresholdPercentdouble- 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.
paletteTranslateBitmapPaletteType- The palette translation type to use for conversion. Applicable only for indexed destination formats such as Indexed8.
Returns
- IBitmapSource<TPixelDst>
Type Parameters
TPixelDst
CreateFormatConvertedBitmap(IImagingFactory, 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 CreateFormatConvertedBitmap(this IImagingFactory factory, IBitmapSource source, in PixelFormat dstFormat)
Parameters
factoryIImagingFactorysourceIBitmapSourcedstFormatPixelFormat
Returns
CreateFormatConvertedBitmap<TPixelDst>(IImagingFactory, 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> CreateFormatConvertedBitmap<TPixelDst>(this IImagingFactory factory, IBitmapSource source) where TPixelDst : unmanaged, INaturalPixelInfo
Parameters
factoryIImagingFactorysourceIBitmapSource
Returns
- IBitmapSource<TPixelDst>
Type Parameters
TPixelDst
CreateFormatConvertedBitmap(IImagingFactory, 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 CreateFormatConvertedBitmap(this IImagingFactory factory, IBitmapSource source, in PixelFormat dstFormat, BitmapDitherType dither, int ditherLevel, IPalette? palette, double alphaThresholdPercent, BitmapPaletteType paletteTranslate)
Parameters
factoryIImagingFactoryThe imaging factory to use.
sourceIBitmapSource- The input bitmap to convert.
dstFormatPixelFormat- The destination pixel format.
ditherBitmapDitherType- The dithering type used for conversion. Applicable only for indexed destination formats such as Indexed8.
ditherLevelintSpecifies the dithering level when
ditheris set to ErrorDiffusion. The range of this value is 0 to 8. A good default value is 7.paletteIPalette- The palette to use for conversion. Should be
nullif not using an indexed destination format such as Indexed8. alphaThresholdPercentdouble- 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.
paletteTranslateBitmapPaletteType- The palette translation type to use for conversion. Applicable only for indexed destination formats such as Indexed8.
Returns
CreateFormatConvertedBitmap<TDstPixel>(IImagingFactory, 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> CreateFormatConvertedBitmap<TDstPixel>(this IImagingFactory factory, IBitmapSource source, BitmapDitherType dither, int ditherLevel, IPalette? palette, double alphaThresholdPercent, BitmapPaletteType paletteTranslate) where TDstPixel : unmanaged, INaturalPixelInfo
Parameters
factoryIImagingFactory- The imaging factory to use.
sourceIBitmapSource- The input bitmap to convert.
ditherBitmapDitherType- The dithering type used for conversion. Applicable only for indexed destination formats such as Indexed8.
ditherLevelint- Specifies the dithering level when
ditheris set to ErrorDiffusion. The range of this value is 0 to 8. A good default value is 7. paletteIPalette- The palette to use for conversion. Should be
nullif not using an indexed destination format such as Indexed8. alphaThresholdPercentdouble- 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.
paletteTranslateBitmapPaletteType- The palette translation type to use for conversion. Applicable only for indexed destination formats such as Indexed8.
Returns
- IBitmapSource<TDstPixel>
Type Parameters
TDstPixel