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.
  • Some overloads have an IAsyncContext parameter. These methods are special ones and designed to be used from your custom asynchronous methods where cloning is just one step of potentially multiple operations. 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 or to be able to cancel the operation and to report progress you can use the CloneAsync overloads (on .NET Framework 4.0 and above) or the old-fasioned 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, 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, IAsyncContext, NullableRectangle) Gets the clone of the specified portion of source inside of an already created, possibly asynchronous context.
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, 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, 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 inside of an already created, possibly asynchronous context.
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, IAsyncContext, KnownPixelFormat, Color32, Byte, NullableRectangle) Gets the clone of the specified portion of source with the specified pixelFormat and color settings inside of an already created, possibly asynchronous context.
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 inside of an already created, possibly asynchronous context.
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 inside of an already created, possibly asynchronous context.

See Also