QuantizerExtensionsInitializeAsync Method

Gets an IQuantizingSession instance potentially asynchronously that can be used to quantize the colors of the specified IReadableBitmapData instance. If quantizer is a known quantizer 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: 9.0.0
C#
public static Task<IQuantizingSession?> InitializeAsync(
	this IQuantizer quantizer,
	IReadableBitmapData source,
	TaskConfig? asyncConfig = null
)

Parameters

quantizer  IQuantizer
An IQuantizer instance to get an IQuantizingSession for.
source  IReadableBitmapData
The quantizing session to be initialized will be performed on the specified IReadableBitmapData instance.
asyncConfig  TaskConfig  (Optional)
The configuration of the asynchronous operation such as parallelization, cancellation, reporting progress, etc. This parameter is optional.
Default value: .

Return Value

TaskIQuantizingSession
A task that represents the asynchronous operation. Its result is an IQuantizingSession instance that can be used to quantize the colors of the specified IReadableBitmapData instance 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 IQuantizer. 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 IQuantizer.Initialize method returned .

See Also