DithererExtensionsInitializeAsync Method

Gets an IDitheringSession instance potentially asynchronously that can be used to dither the result of the specified IQuantizingSession applied to the specified source. If ditherer is a known ditherer that can be evaluated quickly, then this method might be executed synchronously.
This method is available in.NET Framework 4.0 and above.

Definition

Namespace: KGySoft.Drawing.Imaging
Assembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 8.2.0
C#
public static Task<IDitheringSession?> InitializeAsync(
	this IDitherer ditherer,
	IReadableBitmapData source,
	IQuantizingSession quantizingSession,
	TaskConfig? asyncConfig = null
)

Parameters

ditherer  IDitherer
An IDitherer instance to get an IDitheringSession for.
source  IReadableBitmapData
The dithering session to be initialized will be performed on the specified IReadableBitmapData instance.
quantizingSession  IQuantizingSession
The IQuantizingSession to which the dithering should be applied.
asyncConfig  TaskConfig  (Optional)
The configuration of the asynchronous operation such as parallelization, cancellation, reporting progress, etc. This parameter is optional.
Default value: .

Return Value

TaskIDitheringSession
A task that represents the asynchronous operation. Its result is an IDitheringSession instance that can be used to dither the result of the specified IQuantizingSession applied to the specified source, or , if the operation was canceled and the ThrowIfCanceled property of the asyncConfig parameter was .

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IDitherer. 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).

Exceptions

InvalidOperationExceptionThe non-canceled IDitherer.Initialize method returned .

See Also