BitmapDataExtensionsDrawIntoAsync(IReadableBitmapData, IReadWriteBitmapData, Rectangle, Rectangle, IQuantizer, IDitherer, ScalingMode, TaskConfig) Method

Draws the source IReadableBitmapData into the target IReadWriteBitmapData asynchronously, using scaling and blending. This method works between any pair of source and target KnownPixelFormats and supports quantizing and dithering. To copy a bitmap data into another one without blending use the CopyToAsync method instead.

Definition

Namespace: KGySoft.Drawing.Imaging
Assembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 8.0.0-preview.1
C#
public static Task DrawIntoAsync(
	this IReadableBitmapData source,
	IReadWriteBitmapData target,
	Rectangle sourceRectangle,
	Rectangle targetRectangle,
	IQuantizer? quantizer = null,
	IDitherer? ditherer = null,
	ScalingMode scalingMode = ScalingMode.Auto,
	TaskConfig? asyncConfig = null
)

Parameters

source  IReadableBitmapData
The source IReadableBitmapData to be drawn into the target.
target  IReadWriteBitmapData
The target IReadWriteBitmapData into which source should be drawn.
sourceRectangle  Rectangle
A Rectangle that specifies the portion of the source to be drawn into the target.
targetRectangle  Rectangle
A Rectangle that specifies the location and size of the drawn source.
quantizer  IQuantizer  (Optional)
An IQuantizer instance to be used for the drawing. If not specified, then the drawing operation might automatically pick a quantizer based on target PixelFormat. This parameter is optional.
Default value: .
ditherer  IDitherer  (Optional)
The ditherer to be used for the drawing. Might be ignored if quantizer is not specified and target PixelFormat format has at least 24 bits-per-pixel size. This parameter is optional.
Default value: .
scalingMode  ScalingMode  (Optional)
Specifies the scaling mode if the bitmap data to be drawn needs to be resized. This parameter is optional.
Default value: Auto.
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

Task
A Task that represents the asynchronous operation, which could still be pending.

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 or target is .
ArgumentOutOfRangeExceptionscalingMode has an unsupported value.

See Also