Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DitherType enumeration

Applies to: desktop apps only

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  {
  DitherTypeNone             = 0,
  DitherTypeSolid            = 1,
  DitherTypeOrdered4x4       = 2,
  DitherTypeOrdered8x8       = 3,
  DitherTypeOrdered16x16     = 4,
  DitherTypeOrdered91x91     = 5,
  DitherTypeSpiral4x4        = 6,
  DitherTypeSpiral8x8        = 7,
  DitherTypeDualSpiral4x4    = 8,
  DitherTypeDualSpiral8x8    = 9,
  DitherTypeErrorDiffusion   = 10 
} DitherType;

Constants

DitherTypeNone

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

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

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

Dithering is performed using the colors in one of the standard fixed palettes.

DitherTypeOrdered16x16

Dithering is performed using the colors in one of the standard fixed palettes.

DitherTypeOrdered91x91

Dithering is performed using the colors in one of the standard fixed palettes.

DitherTypeSpiral4x4

Dithering is performed using the colors in one of the standard fixed palettes.

DitherTypeSpiral8x8

Dithering is performed using the colors in one of the standard fixed palettes.

DitherTypeDualSpiral4x4

Dithering is performed using the colors in one of the standard fixed palettes.

DitherTypeDualSpiral8x8

Dithering is performed using the colors in one of the standard fixed palettes.

DitherTypeErrorDiffusion

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.

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

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008

Product

GDI+ 1.1

Header

Gdiplusenums.h (include Gdiplus.h)

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Additions

Show:
© 2014 Microsoft