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

Begins to clone the specified portion of source with the specified pixelFormat and palette 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,
	Palette? palette,
	Rectangle? sourceRectangle = null,
	AsyncConfig? asyncConfig = null
)

Parameters

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

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

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.
ArgumentExceptionpalette contains too many colors for the specified pixelFormat.

See Also