BitmapDataExtensionsClone Method

The overloads of the Clone method can be grouped into the following categories:
  • The ones without KnownPixelFormat and Rectangle parameters attempt to create an exact copy of the original bitmap data. The original pixel format is attempted to be preserved even for custom formats, which may succeed if the BackBufferIndependentPixelAccess property was set to when the bitmap data was created.
  • The overloads that have a KnownPixelFormat parameter create a copy with the specified pixel format. The original color depth is attempted to be preserved as much as possible, even between different pixel formats with wide colors.
  • The overloads with a Rectangle parameter allow to create a copy only of a portion of the source bitmap.
  • If an overload has an IQuantizer parameter, then it allows limiting the set of colors of the result even if the format would allow more colors.
  • If the result pixel format has a low bit-per-pixel value or you use a quantizer and you want to preserve the details as much as possible, then look for the overloads that have an IDitherer parameter.
  • To be able to configure the degree of parallelism, cancellation or progress reporting, look for the overloads whose last parameter is a ParallelConfig instance.
  • Some overloads have an IAsyncContext parameter. These methods are special ones and are designed to be used from your custom asynchronous methods where cloning is just one step of potentially multiple operations. But you can also use these overloads to force synchronous execution on a single thread. See the Examples section of the AsyncHelper class for details about how to create a context for possibly async top level methods.
  • All of these methods block the caller on the current thread. For asynchronous call you can use the CloneAsync overloads (on .NET Framework 4.0 and above), or the old-fashioned BeginClone methods that work on every platform target.

Overload List

Clone(IReadableBitmapData) Gets the clone of the specified source with identical size.
Clone(IReadableBitmapData, WorkingColorSpace) Gets the clone of the specified source with identical size.
Clone(IReadableBitmapData, ParallelConfig) Gets the clone of the specified source with identical size.
Clone(IReadableBitmapData, Rectangle) Gets the clone of the specified portion of source.
Clone(IReadableBitmapData, KnownPixelFormat, IDitherer) Gets the clone of the specified source with identical size and the specified pixelFormat, using an optional ditherer.
Clone(IReadableBitmapData, KnownPixelFormat, Palette) Gets the clone of the specified source with identical size and the specified pixelFormat and palette.
Clone(IReadableBitmapData, WorkingColorSpace, ParallelConfig) Gets the clone of the specified source with identical size.
Clone(IReadableBitmapData, IAsyncContext, NullableRectangle) Gets the clone of the specified portion of source, using a context that may belong to a higher level, possibly asynchronous operation.
Clone(IReadableBitmapData, Rectangle, ParallelConfig) Gets the clone of the specified portion of source.
Clone(IReadableBitmapData, KnownPixelFormat, Color32, Byte) Gets the clone of the specified source with identical size and the specified pixelFormat and color settings.
Clone(IReadableBitmapData, KnownPixelFormat, IQuantizer, IDitherer) Gets the clone of the specified source with identical size and the specified pixelFormat, using an optional quantizer and ditherer.
Clone(IReadableBitmapData, KnownPixelFormat, Palette, ParallelConfig) Gets the clone of the specified source with identical size and the specified pixelFormat and palette.
Clone(IReadableBitmapData, Rectangle, KnownPixelFormat, IDitherer) Gets the clone of the specified portion of source with the specified pixelFormat, using an optional ditherer.
Clone(IReadableBitmapData, Rectangle, KnownPixelFormat, Palette) Gets the clone of the specified portion of source with the specified pixelFormat and palette.
Clone(IReadableBitmapData, KnownPixelFormat, Color32, Byte, ParallelConfig) Gets the clone of the specified source with identical size and the specified pixelFormat and color settings.
Clone(IReadableBitmapData, KnownPixelFormat, IQuantizer, IDitherer, ParallelConfig) Gets the clone of the specified source with identical size and the specified pixelFormat, using an optional quantizer and ditherer.
Clone(IReadableBitmapData, KnownPixelFormat, WorkingColorSpace, Color32, Byte) Gets the clone of the specified source with identical size and the specified pixelFormat and color settings.
Clone(IReadableBitmapData, IAsyncContext, KnownPixelFormat, Palette, NullableRectangle) Gets the clone of the specified portion of source with the specified pixelFormat and palette, using a context that may belong to a higher level, possibly asynchronous operation.
Clone(IReadableBitmapData, Rectangle, KnownPixelFormat, Color32, Byte) Gets the clone of the specified portion of source with the specified pixelFormat and color settings.
Clone(IReadableBitmapData, Rectangle, KnownPixelFormat, IQuantizer, IDitherer) Gets the clone of the specified portion of source with the specified pixelFormat, using an optional quantizer and ditherer.
Clone(IReadableBitmapData, Rectangle, KnownPixelFormat, Palette, ParallelConfig) Gets the clone of the specified portion of source with the specified pixelFormat and palette.
Clone(IReadableBitmapData, KnownPixelFormat, WorkingColorSpace, Color32, Byte, ParallelConfig) Gets the clone of the specified source with identical size and the specified pixelFormat and color settings.
Clone(IReadableBitmapData, IAsyncContext, KnownPixelFormat, Color32, Byte, NullableRectangle) Gets the clone of the specified portion of source with the specified pixelFormat and color settings, using a context that may belong to a higher level, possibly asynchronous operation.
Clone(IReadableBitmapData, IAsyncContext, KnownPixelFormat, IQuantizer, IDitherer, NullableRectangle) Gets the clone of the specified portion of source with the specified pixelFormat, using an optional quantizer and ditherer, along with a context that may belong to a higher level, possibly asynchronous operation.
Clone(IReadableBitmapData, Rectangle, KnownPixelFormat, Color32, Byte, ParallelConfig) Gets the clone of the specified portion of source with the specified pixelFormat and color settings.
Clone(IReadableBitmapData, Rectangle, KnownPixelFormat, IQuantizer, IDitherer, ParallelConfig) Gets the clone of the specified portion of source with the specified pixelFormat, using an optional quantizer and ditherer.
Clone(IReadableBitmapData, Rectangle, KnownPixelFormat, WorkingColorSpace, Color32, Byte) Gets the clone of the specified portion of source with the specified pixelFormat and color settings.
Clone(IReadableBitmapData, IAsyncContext, KnownPixelFormat, WorkingColorSpace, Color32, Byte, NullableRectangle) Gets the clone of the specified portion of source with the specified pixelFormat and color settings, using a context that may belong to a higher level, possibly asynchronous operation.
Clone(IReadableBitmapData, Rectangle, KnownPixelFormat, WorkingColorSpace, Color32, Byte, ParallelConfig) Gets the clone of the specified portion of source with the specified pixelFormat and color settings.

See Also