DitherType enumeration (gdipluspixelformats.h)

The DitherType enumeration identifies the available algorithms for dithering when a bitmap is converted.

Calling the Bitmap::ConvertFormat method of a Bitmap object changes the pixel format of that Bitmap. If the conversion results in a reduced bit depth (fewer bits per pixel), then certain colors in the original bitmap will be simulated by a dither (checkerboard) pattern made up of colors that are available in the new pixel format. The members of the DitherType enumeration identify the algorithms available for performing this dithering.

Syntax

typedef enum DitherType {
  DitherTypeNone = 0,
  DitherTypeSolid = 1,
  DitherTypeOrdered4x4 = 2,
  DitherTypeOrdered8x8 = 3,
  DitherTypeOrdered16x16 = 4,
  DitherTypeSpiral4x4 = 5,
  DitherTypeSpiral8x8 = 6,
  DitherTypeDualSpiral4x4 = 7,
  DitherTypeDualSpiral8x8 = 8,
  DitherTypeErrorDiffusion = 9,
  DitherTypeMax = 10
} ;

Constants

 
DitherTypeNone
Value: 0
No dithering is performed. Pixels in the source bitmap are mapped to the nearest color in the palette specified by the palette parameter of the Bitmap::ConvertFormat method. This algorithm can be used with any palette. If the palette specified by the palette parameter does not have one of the standard fixed formats listed in the PaletteType enumeration, pass PaletteTypeCustom to the palettetype parameter.
DitherTypeSolid
Value: 1
No dithering is performed. Pixels in the source bitmap are mapped to the nearest color in the palette specified by the palette parameter of the Bitmap::ConvertFormat method. This algorithm can be used with any palette. If the palette specified by the palette parameter does not have one of the standard fixed formats listed in the PaletteType enumeration, pass PaletteTypeCustom to the palettetype parameter.
DitherTypeOrdered4x4
Value: 2
You can use this algorithm to perform dithering based on the colors in one of the standard fixed palettes. You can also use this algorithm to convert a bitmap to a 16-bits-per-pixel format that has no palette.
DitherTypeOrdered8x8
Value: 3
Dithering is performed using the colors in one of the standard fixed palettes.
DitherTypeOrdered16x16
Value: 4
Dithering is performed using the colors in one of the standard fixed palettes.
DitherTypeSpiral4x4
Value: 5
Dithering is performed using the colors in one of the standard fixed palettes.
DitherTypeSpiral8x8
Value: 6
Dithering is performed using the colors in one of the standard fixed palettes.
DitherTypeDualSpiral4x4
Value: 7
Dithering is performed using the colors in one of the standard fixed palettes.
DitherTypeDualSpiral8x8
Value: 8
Dithering is performed using the colors in one of the standard fixed palettes.
DitherTypeErrorDiffusion
Value: 9
Dithering is performed based on the palette specified by the palette parameter of the Bitmap::ConvertFormat method. This algorithm can be used with any palette. If the palette specified by the palette parameter does not have one of the standard fixed formats listed in the PaletteType enumeration, pass PaletteTypeCustom to the palettetype parameter.
DitherTypeMax
Value: 10
TBD

Remarks

If you pass any of the ordered or spiral dither types (except DitherTypeOrdered4x4) to the dithertype parameter of the Bitmap::ConvertFormat method, you must pass one of the following fixed palette types to the palettetype parameter.

  • PaletteTypeFixedBW
  • PaletteTypeFixedHalftone8
  • PaletteTypeFixedHalftone27
  • PaletteTypeFixedHalftone64
  • PaletteTypeFixedHalftone125
  • PaletteTypeFixedHalftone216
  • PaletteTypeFixedHalftone252
  • PaletteTypeFixedHalftone256
The DitherTypeOrdered4x4 algorithm is a special case. You can use it with the fixed palette types shown in the preceding list or you can use it to convert a bitmap to a 16-bits-per-pixel format.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Header gdipluspixelformats.h (include Gdiplus.h)