BitmapDataExtensionsBeginClone(IReadableBitmapData, KnownPixelFormat, Palette, NullableRectangle, AsyncConfig) Method

Begins to clone the specified portion of source with the specified pixelFormat and palette asynchronously.


Namespace: KGySoft.Drawing.Imaging
Assembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 7.0.0
public static IAsyncResult BeginClone(
	this IReadableBitmapData source,
	KnownPixelFormat pixelFormat,
	Palette? palette,
	Rectangle? sourceRectangle = null,
	AsyncConfig? asyncConfig = null


source  IReadableBitmapData
An IReadableBitmapData instance to be cloned.
pixelFormat  KnownPixelFormat
The desired pixel format of the result.
palette  Palette
If pixelFormat is an indexed format, then specifies the desired Palette of the returned IReadWriteBitmapData instance. It determines also the BackColor and AlphaThreshold properties of the result. If , then the target palette is taken from source if it also has a palette of no more entries than the target indexed format can have; otherwise, a default palette will be used based on pixelFormat.
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

An IAsyncResult 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).


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.


ArgumentNullExceptionsource is .
ArgumentOutOfRangeExceptionpixelFormat does not specify a valid format.
sourceRectangle has no overlapping region with source bounds.
ArgumentExceptionpalette contains too many colors for the specified pixelFormat.

See Also