Table of Contents

Method DrawImage

Namespace
PaintDotNet.Direct2D1
Assembly
PaintDotNet.Windows.dll

DrawImage(IDeviceImage, Point2Float?, in RectFloat?, InterpolationMode, CompositeMode)

Draws an image to the device context. The image can be any type of IDeviceImage, including an IDeviceEffect, IDeviceBitmap, or ICommandList.

void DrawImage(IDeviceImage image, Point2Float? targetOffset = null, in RectFloat? imageRect = null, InterpolationMode interpolationMode = InterpolationMode.Linear, CompositeMode compositeMode = CompositeMode.SourceOver)

Parameters

image IDeviceImage

The image to be drawn to the device context.

targetOffset Point2Float?

The offset in the destination space that the image will be rendered to. The entire logical extent of the image will be rendered to the corresponding destination. If not specified, the destination origin will be (0, 0). The top-left corner of the image will be mapped to the target offset. This will not necessarily be the origin. This default value is null.

imageRect RectFloat?

The corresponding rectangle in the image space will be mapped to the given origins when processing the image. This default value is null.

interpolationMode InterpolationMode

The interpolation mode that will be used to scale the image if necessary.

compositeMode CompositeMode

The composite mode that will be applied to the limits of the currently selected clip. The default value is SourceOver.

Remarks

If interpolationMode is HighQualityCubic, different scalers will be used depending on the scale factor implied by the world transform.
Any invalid rectangles accumulated on any effect that is drawn by this call will be discarded regardless of which portion of the image rectangle is drawn.
If compositeMode is SourceOver, DrawImage will use the currently selected primitive blend specified by PrimitiveBlend.
If compositeMode is not SourceOver, the image will be extended to transparent up to the current axis-aligned clip.
If there is an image rectangle and a world transform, this is equivalent to inserting a clip effect to represent the image rectangle and a 2D affine transform to take into account the world transform.