BitmapDataExtensionsCopyTo(IReadableBitmapData, IWritableBitmapData, Rectangle, Point, IDitherer) Method

Copies the source IReadableBitmapData into the target IWritableBitmapData without scaling and blending. This method works between any pair of source and target KnownPixelFormats and supports quantizing and dithering. To draw a bitmap data into another one with blending use the DrawInto methods instead.

Definition

Namespace: KGySoft.Drawing.Imaging
Assembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 7.0.0
C#
public static void CopyTo(
	this IReadableBitmapData source,
	IWritableBitmapData target,
	Rectangle sourceRectangle,
	Point targetLocation,
	IDitherer? ditherer
)

Parameters

source  IReadableBitmapData
The source IReadableBitmapData to be copied into the target.
target  IWritableBitmapData
The target IWritableBitmapData into which source should be copied.
sourceRectangle  Rectangle
A Rectangle that specifies the portion of the source to be copied into the target.
targetLocation  Point
The target location. Target size will be always the same as the source size.
ditherer  IDitherer
The ditherer to be used. Might be ignored if target PixelFormat format has at least 24 bits-per-pixel size.

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

  Note

This method adjusts the degree of parallelization automatically, blocks the caller, and does not support cancellation or reporting progress. Use the BeginCopyTo or CopyToAsync (in .NET Framework 4.0 and above) methods for asynchronous call and to adjust parallelization, set up cancellation and for reporting progress.

The copied area is automatically clipped if its size or targetLocation makes it impossible to completely fit in the target.

If target can represent a narrower set of colors, then the result will be automatically quantized to the colors of the target. To use dithering a ditherer must be explicitly specified.

Exceptions

ArgumentNullExceptionsource or target is .

See Also