OrderedDithererDottedHalftone Property

Gets an OrderedDitherer using a 8x8 matrix of a dotted halftone pattern.

Definition

Namespace: KGySoft.Drawing.Imaging
Assembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 7.0.0
C#
public static OrderedDitherer DottedHalftone { get; }

Property Value

OrderedDitherer

Example

The following example demonstrates how to use the ditherer returned by this property:
C#
public static IReadWriteBitmapData ToDitheredDottedHalftone(IReadWriteBitmapData source, IQuantizer quantizer)
{
    IDitherer ditherer = OrderedDitherer.DottedHalftone;

    // a.) this solution returns a new bitmap data and does not change the original one:
    return source.Clone(quantizer.PixelFormatHint, quantizer, ditherer);

    // b.) alternatively, you can perform the dithering directly on the source bitmap data:
    source.Dither(quantizer, ditherer);
    return source;
}

The example above may produce the following results:

Original imageQuantized and dithered image

Color hues with alpha gradient
Color hues with alpha gradient

Grayscale color shades with different bit depths
Grayscale color shades

Grayscale color shades with black and white palette using dotted halftone dithering
Quantizing with black and white palette

  Tip

See the Remarks section of the OrderedDitherer class for more details and examples.

See Also