BitmapDataExtensionsDrawInto(IReadableBitmapData, IReadWriteBitmapData, Point, IDitherer) Method

Draws the source IReadableBitmapData into the target IReadWriteBitmapData without scaling, using blending. This method always preserves the source size in pixels, works between any pair of source and target KnownPixelFormats and supports quantizing and dithering. For scaling use the overloads with targetRectangle and ScalingMode parameters. To copy a bitmap data into another one without blending use the CopyTo methods instead.


Namespace: KGySoft.Drawing.Imaging
Assembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 8.0.0-preview.1
public static void DrawInto(
	this IReadableBitmapData source,
	IReadWriteBitmapData target,
	Point targetLocation,
	IDitherer? ditherer


source  IReadableBitmapData
The source IReadableBitmapData to be drawn into the target.
target  IReadWriteBitmapData
The target IReadWriteBitmapData into which source should be drawn.
targetLocation  Point
The target location. Target size will be always the same as the source size.
ditherer  IDitherer
The ditherer to be used for the drawing. 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).



This method adjusts the degree of parallelization automatically, blocks the caller, and does not support cancellation or reporting progress. Use the BeginDrawInto(IReadableBitmapData, IReadWriteBitmapData, NullableRectangle, NullablePoint, IQuantizer, IDitherer, AsyncConfig) or DrawIntoAsync(IReadableBitmapData, IReadWriteBitmapData, NullableRectangle, NullablePoint, IQuantizer, IDitherer, TaskConfig) (in .NET Framework 4.0 and above) methods for asynchronous call and to adjust parallelization, set up cancellation and for reporting progress.

The image to be drawn is automatically clipped if its size or targetLocation makes it impossible to completely fit in the target.

target must be an IReadWriteBitmapData because it must be readable if blending is necessary. For write-only IWritableBitmapData instances you can use the CopyTo methods.

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.


ArgumentNullExceptionsource or target is .

See Also