Table of Contents

Method DrawRegion

Namespace
LMKit.Media.Image
Assembly
LM-Kit.NET.dll

DrawRegion(ImageBuffer, int, int, int, int, int, int)

Copies a rectangular region of the source image onto this image at the specified destination coordinates. Both images must share the same pixel format.

public void DrawRegion(ImageBuffer source, int srcX, int srcY, int srcWidth, int srcHeight, int dstX, int dstY)

Parameters

source ImageBuffer

The source image to copy pixels from.

srcX int

Left edge of the source rectangle (inclusive).

srcY int

Top edge of the source rectangle (inclusive).

srcWidth int

Width of the source rectangle in pixels.

srcHeight int

Height of the source rectangle in pixels.

dstX int

X coordinate in this image where the top-left corner of the source rectangle will be placed. Negative values and out-of-bounds regions are clipped automatically.

dstY int

Y coordinate in this image where the top-left corner of the source rectangle will be placed. Negative values and out-of-bounds regions are clipped automatically.

Remarks

All coordinates are automatically clipped to both the source and destination image boundaries. If the clipped region is empty, the method returns without error.

// Draw the entire source onto destination at (100, 50)
destination.Draw(source, dstX: 100, dstY: 50);

// Draw only a 200x100 sub-region starting at (10, 20) in the source destination.DrawRegion(source, srcX: 10, srcY: 20, srcWidth: 200, srcHeight: 100, dstX: 0, dstY: 0);

Exceptions

ArgumentNullException

Thrown if source is null.

ArgumentException

Thrown if source has a different pixel format than this image.

Share