Table of Contents

Enum BitmapOptions

Namespace
PaintDotNet.Direct2D1
Assembly
PaintDotNet.Windows.dll

Specifies how a bitmap can be used.
D2D1_BITMAP_OPTIONS

[Flags]
public enum BitmapOptions

Fields

None = 0

The bitmap is created with default properties.

Target = 1

The bitmap can be used as a device context target.

CannotDraw = 2

The bitmap cannot be used as an input.

CpuRead = 4

The bitmap can be read from the CPU by using Map(MapOptions). This flag requires CannotDraw and cannot be combined with any other flags.

GdiCompatible = 8

The bitmap works with ID2D1GdiInteropRenderTarget::GetDC(). (unsupported)

Remarks

BitmapOptions.None implies that none of the flags are set. This means that the bitmap can be used for drawing from, cannot be set as a target and cannot be read from by the CPU.
BitmapOptions.Target means that the bitmap can be specified as a target in SetTarget(IDeviceImage?). If you also specify the BitmapOptions.CannotDraw flag the bitmap can be used a target but, it cannot be drawn from. Attempting to draw with a bitmap that has both flags set will result in the device context being put into an error state with D2DERR_BITMAP_CANNOT_DRAW.
BitmapOptions.CpuRead means that the bitmap can be mapped by using Map(MapOptions). This flag requires BitmapOptions.CannotDraw and cannot be combined with any other flags. The bitmap must be updated with the CopyFromBitmap or CopyFromRenderTarget methods.
NOTE: You should only use BitmapOptions.CannotDraw when the purpose of the bitmap is to be a target only or when the bitmap will be mapped.
BitmapOptions.GdiCompatible means that it is possible to get a DC associated with this bitmap. This must be used in conjunction with BitmapOptions.Target. The DxgiFormat must be either B8G8R8A8_UNormor B8G8R8A8_UNorm_Srgb.