BitmapDataExtensionsBeginClone(IReadableBitmapData, KnownPixelFormat, IQuantizer, IDitherer, NullableRectangle, AsyncConfig) Method

Begins to clone the specified portion of source with the specified pixelFormat, using an optional quantizer and ditherer asynchronously.

Definition

Namespace: KGySoft.Drawing.Imaging
Assembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 7.0.0
C#
public static IAsyncResult BeginClone(
	this IReadableBitmapData source,
	KnownPixelFormat pixelFormat,
	IQuantizer? quantizer,
	IDitherer? ditherer = null,
	Rectangle? sourceRectangle = null,
	AsyncConfig? asyncConfig = null
)

Parameters

source  IReadableBitmapData
An IReadableBitmapData instance to be cloned.
pixelFormat  KnownPixelFormat
The desired pixel format of the result.
quantizer  IQuantizer
An optional IQuantizer instance to determine the colors of the result. If and pixelFormat is an indexed format, then a default palette and quantization logic will be used.
ditherer  IDitherer  (Optional)
The ditherer to be used. Might be ignored if quantizer is not specified and pixelFormat represents an at least 24 bits-per-pixel size. This parameter is optional.
Default value: .
sourceRectangle  NullableRectangle  (Optional)
A Rectangle that specifies the portion of the source to be cloned, or to clone the entire source. This parameter is optional.
Default value: .
asyncConfig  AsyncConfig  (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

IAsyncResult
An IReadWriteBitmapData instance that represents the clone of the specified source.

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

In .NET Framework 4.0 and above you can use also the CloneAsync(IReadableBitmapData, KnownPixelFormat, Palette, NullableRectangle, TaskConfig) method.

To get the result or the exception that occurred during the operation you have to call the EndClone method.

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

Exceptions

ArgumentNullExceptionsource is .
ArgumentOutOfRangeExceptionpixelFormat does not specify a valid format.
-or-
sourceRectangle has no overlapping region with source bounds.
ArgumentExceptionquantizer uses a palette with too many colors for the specified pixelFormat.

See Also