Table of Contents

Class BitmapRenderTarget

Namespace
SharpDX.Direct2D1
Assembly
SharpDX.Direct2D1.dll
[Guid("2cd90695-12e2-11dc-9fed-001143a055f9")]
public class BitmapRenderTarget : RenderTarget
Inheritance
BitmapRenderTarget
Inherited Members

Constructors

BitmapRenderTarget(RenderTarget, CompatibleRenderTargetOptions)

Creates a bitmap render target for use during intermediate offscreen drawing that is compatible with the current render target with same size, pixel size and pixel format.

public BitmapRenderTarget(RenderTarget renderTarget, CompatibleRenderTargetOptions options)

Parameters

renderTarget RenderTarget

an instance of RenderTarget

options CompatibleRenderTargetOptions

A value that specifies whether the new render target must be compatible with GDI.

BitmapRenderTarget(RenderTarget, CompatibleRenderTargetOptions, Size2F)

Creates a bitmap render target for use during intermediate offscreen drawing that is compatible with the current render target with same pixel size and pixel format.

public BitmapRenderTarget(RenderTarget renderTarget, CompatibleRenderTargetOptions options, Size2F desiredSize)

Parameters

renderTarget RenderTarget

an instance of RenderTarget

options CompatibleRenderTargetOptions

A value that specifies whether the new render target must be compatible with GDI.

desiredSize Size2F

The desired size of the new render target in device-independent pixels if it should be different from the original render target. For more information, see the Remarks section.

BitmapRenderTarget(RenderTarget, CompatibleRenderTargetOptions, PixelFormat?)

Creates a bitmap render target for use during intermediate offscreen drawing that is compatible with the current render target with same size and pixel size.

public BitmapRenderTarget(RenderTarget renderTarget, CompatibleRenderTargetOptions options, PixelFormat? desiredFormat)

Parameters

renderTarget RenderTarget

an instance of RenderTarget

options CompatibleRenderTargetOptions

A value that specifies whether the new render target must be compatible with GDI.

desiredFormat PixelFormat?

The desired pixel format and alpha mode of the new render target. If the pixel format is set to DXGI_FORMAT_UNKNOWN, the new render target uses the same pixel format as the original render target. If the alpha mode is Unknown, the alpha mode of the new render target defaults to D2D1_ALPHA_MODE_PREMULTIPLIED. For information about supported pixel formats, see {{Supported Pixel Formats and Alpha Modes}}.

BitmapRenderTarget(RenderTarget, CompatibleRenderTargetOptions, Size2F?, Size2?, PixelFormat?)

Creates a bitmap render target for use during intermediate offscreen drawing that is compatible with the current render target.

public BitmapRenderTarget(RenderTarget renderTarget, CompatibleRenderTargetOptions options, Size2F? desiredSize, Size2? desiredPixelSize, PixelFormat? desiredFormat)

Parameters

renderTarget RenderTarget

an instance of RenderTarget

options CompatibleRenderTargetOptions

A value that specifies whether the new render target must be compatible with GDI.

desiredSize Size2F?

The desired size of the new render target in device-independent pixels if it should be different from the original render target. For more information, see the Remarks section.

desiredPixelSize Size2?

The desired size of the new render target in pixels if it should be different from the original render target. For more information, see the Remarks section.

desiredFormat PixelFormat?

The desired pixel format and alpha mode of the new render target. If the pixel format is set to DXGI_FORMAT_UNKNOWN, the new render target uses the same pixel format as the original render target. If the alpha mode is Unknown, the alpha mode of the new render target defaults to D2D1_ALPHA_MODE_PREMULTIPLIED. For information about supported pixel formats, see {{Supported Pixel Formats and Alpha Modes}}.

Remarks

The pixel size and DPI of the new render target can be altered by specifying values for desiredSize or desiredPixelSize: If desiredSize is specified but desiredPixelSize is not, the pixel size is computed from the desired size using the parent target DPI. If the desiredSize maps to a integer-pixel size, the DPI of the compatible render target is the same as the DPI of the parent target. If desiredSize maps to a fractional-pixel size, the pixel size is rounded up to the nearest integer and the DPI for the compatible render target is slightly higher than the DPI of the parent render target. In all cases, the coordinate (desiredSize.width, desiredSize.height) maps to the lower-right corner of the compatible render target.If the desiredPixelSize is specified and desiredSize is not, the DPI of the new render target is the same as the original render target.If both desiredSize and desiredPixelSize are specified, the DPI of the new render target is computed to account for the difference in scale.If neither desiredSize nor desiredPixelSize is specified, the new render target size and DPI match the original render target.

BitmapRenderTarget(nint)

public BitmapRenderTarget(nint nativePtr)

Parameters

nativePtr nint

Properties

Bitmap

Retrieves the bitmap for this render target. The returned bitmap can be used for drawing operations.

public Bitmap Bitmap { get; }

Property Value

Bitmap

Remarks

The DPI for the Bitmap obtained from GetBitmap will be the DPI of the BitmapRenderTarget when the render target was created. Changing the DPI of the BitmapRenderTarget by calling SetDpi doesn't affect the DPI of the bitmap, even if SetDpi is called before GetBitmap. Using SetDpi to change the DPI of the BitmapRenderTarget does affect how contents are rendered into the bitmap: it just doesn't affect the DPI of the bitmap retrieved by GetBitmap.

Operators

explicit operator BitmapRenderTarget(nint)

public static explicit operator BitmapRenderTarget(nint nativePtr)

Parameters

nativePtr nint

Returns

BitmapRenderTarget