ReadableBitmapDataExtensionsToSKBitmapAsync(IReadableBitmapData, SKColorType, SKAlphaType, IQuantizer, IDitherer, TaskConfig) Method

Converts the specified source to an SKBitmap asynchronously.

Definition

Namespace: KGySoft.Drawing.SkiaSharp
Assembly: KGySoft.Drawing.SkiaSharp (in KGySoft.Drawing.SkiaSharp.dll) Version: 9.1.0
C#
public static Task<SKBitmap?> ToSKBitmapAsync(
	this IReadableBitmapData source,
	SKColorType colorType,
	SKAlphaType alphaType,
	IQuantizer quantizer,
	IDitherer ditherer = null,
	TaskConfig asyncConfig = null
)

Parameters

source  IReadableBitmapData
The source IReadableBitmapData instance to convert.
colorType  SKColorType
Determines the ColorType property of the result SKBitmap. Can be Unknown to auto select a color type that matches the source pixel format.
alphaType  SKAlphaType
Determines the AlphaType property of the result SKBitmap. It might be ignored if the colorType cannot have the specified alpha type. Can be Unknown to auto select an alpha type that matches the source pixel format.
quantizer  IQuantizer
An optional IQuantizer instance to determine the colors of the result.
ditherer  IDitherer  (Optional)
The ditherer to be used. Might be ignored if quantizer is not specified and colorType represents a higher bits-per-pixel per color channel format. This parameter is optional.
Default value: .
asyncConfig  TaskConfig  (Optional)
The configuration of the asynchronous operation such as parallelization, cancellation, reporting progress, etc. When Progress is set in this parameter, then this library always passes a DrawingOperation instance to the generic methods of the IAsyncProgress interface. This parameter is optional.
Default value: .

Return Value

TaskSKBitmap
A task that represents the asynchronous operation. Its result is an SKBitmap instance converted from 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 IReadableBitmapData. 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).

Remarks

This method is not a blocking call even if the MaxDegreeOfParallelism property of the asyncConfig parameter is 1.

Exceptions

ArgumentNullExceptionsource is .
ArgumentOutOfRangeExceptioncolorType or alphaType does not specify a defined value.

See Also