BitmapExtensionsDither Method
Quantizes a bitmap with dithering (reduces the number of colors while trying to preserve details)
using the specified quantizer and ditherer.
Namespace: KGySoft.DrawingAssembly: KGySoft.Drawing (in KGySoft.Drawing.dll) Version: 8.1.0
public static void Dither(
this Bitmap bitmap,
IQuantizer quantizer,
IDitherer ditherer
)
<ExtensionAttribute>
Public Shared Sub Dither (
bitmap As Bitmap,
quantizer As IQuantizer,
ditherer As IDitherer
)
public:
[ExtensionAttribute]
static void Dither(
Bitmap^ bitmap,
IQuantizer^ quantizer,
IDitherer^ ditherer
)
[<ExtensionAttribute>]
static member Dither :
bitmap : Bitmap *
quantizer : IQuantizer *
ditherer : IDitherer -> unit
- bitmap Bitmap
- A Bitmap instance to be quantized.
- quantizer IQuantizer
- An IQuantizer implementation to be used for quantizing the specified bitmap.
- ditherer IDitherer
- An IDitherer implementation to be used for dithering during the quantization of the specified bitmap.
In Visual Basic and C#, you can call this method as an instance method on any object of type
Bitmap. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
This method adjusts the degree of parallelization automatically, blocks the caller, and does not support cancellation or reporting progress. Use the
BitmapDataExtensions.BeginDither
or
BitmapDataExtensions.DitherAsync (in .NET Framework 4.0 and above) methods for asynchronous call and to adjust parallelization, set up cancellation and for reporting progress.
This method quantizes bitmap with dithering in place (its original content will be overwritten). To return a new instance
use the ConvertPixelFormat extension method instead.
If the PixelFormat or the palette of bitmap is not compatible with the colors of the specified quantizer, then
the result may not be correct.
If bitmap has already the same set of colors that the specified quantizer, then it can happen
that calling this method does not change bitmap at all.