Table of Contents

Class Bitmap1

Namespace
SharpDX.Direct2D1
Assembly
SharpDX.Direct2D1.dll
[Guid("a898a84c-3873-4588-b08b-ebbf978df041")]
public class Bitmap1 : Bitmap
Inheritance
Bitmap1
Inherited Members

Constructors

Bitmap1(DeviceContext, Surface)

Creates an Bitmap whose data is shared with another resource.

public Bitmap1(DeviceContext deviceContext, Surface surface)

Parameters

deviceContext DeviceContext

an instance of RenderTarget

surface Surface

An SharpDX.DXGI.Surface that contains the data to share with the new ID2D1Bitmap. For more information, see the Remarks section.

Bitmap1(DeviceContext, Surface, BitmapProperties1)

Creates an Bitmap whose data is shared with another resource.

public Bitmap1(DeviceContext deviceContext, Surface surface, BitmapProperties1 bitmapProperties)

Parameters

deviceContext DeviceContext

an instance of RenderTarget

surface Surface

An SharpDX.DXGI.Surface that contains the data to share with the new ID2D1Bitmap. For more information, see the Remarks section.

bitmapProperties BitmapProperties1

The pixel format and DPI of the bitmap to create . The SharpDX.DXGI.Format portion of the pixel format must match the SharpDX.DXGI.Format of data or the method will fail, but the alpha modes don't have to match. To prevent a mismatch, you can pass NULL or the value obtained from the {{D2D1::PixelFormat}} helper function. The DPI settings do not have to match those of data. If both dpiX and dpiY are 0.0f, the default DPI, 96, is used.

Bitmap1(DeviceContext, Size2)

Creates a Direct2D bitmap from a pointer to in-memory source data.

public Bitmap1(DeviceContext deviceContext, Size2 size)

Parameters

deviceContext DeviceContext

an instance of RenderTarget

size Size2

The dimension of the bitmap to create in pixels.

Bitmap1(DeviceContext, Size2, DataStream, int)

Creates a Direct2D bitmap from a pointer to in-memory source data.

public Bitmap1(DeviceContext deviceContext, Size2 size, DataStream dataStream, int pitch)

Parameters

deviceContext DeviceContext

an instance of RenderTarget

size Size2

The dimension of the bitmap to create in pixels.

dataStream DataStream

A pointer to the memory location of the image data, or NULL to create an uninitialized bitmap.

pitch int

The byte count of each scanline, which is equal to (the image width in pixels * the number of bytes per pixel) + memory padding. If srcData is NULL, this value is ignored. (Note that pitch is also sometimes called stride.)

Bitmap1(DeviceContext, Size2, DataStream, int, BitmapProperties1)

Creates a Direct2D bitmap from a pointer to in-memory source data.

public Bitmap1(DeviceContext deviceContext, Size2 size, DataStream dataStream, int pitch, BitmapProperties1 bitmapProperties)

Parameters

deviceContext DeviceContext

an instance of RenderTarget

size Size2

The dimension of the bitmap to create in pixels.

dataStream DataStream

A pointer to the memory location of the image data, or NULL to create an uninitialized bitmap.

pitch int

The byte count of each scanline, which is equal to (the image width in pixels * the number of bytes per pixel) + memory padding. If srcData is NULL, this value is ignored. (Note that pitch is also sometimes called stride.)

bitmapProperties BitmapProperties1

The pixel format and dots per inch (DPI) of the bitmap to create.

Bitmap1(DeviceContext, Size2, BitmapProperties1)

Creates a Direct2D bitmap from a pointer to in-memory source data.

public Bitmap1(DeviceContext deviceContext, Size2 size, BitmapProperties1 bitmapProperties)

Parameters

deviceContext DeviceContext

an instance of RenderTarget

size Size2

The dimension of the bitmap to create in pixels.

bitmapProperties BitmapProperties1

The pixel format and dots per inch (DPI) of the bitmap to create.

Bitmap1(nint)

public Bitmap1(nint nativePtr)

Parameters

nativePtr nint

Properties

ColorContext

Gets the color context information associated with the bitmap.

public ColorContext ColorContext { get; }

Property Value

ColorContext

Remarks

If the bitmap was created without specifying a color context, the returned context is null.

Options

Gets the options used in creating the bitmap.

public BitmapOptions Options { get; }

Property Value

BitmapOptions

Surface

Gets either the surface that was specified when the bitmap was created, or the default surface created when the bitmap was created.

public Surface Surface { get; }

Property Value

Surface

Remarks

The bitmap used must have been created from a DXGI surface render target, a derived render target, or a device context created from an Device.

The returned surface can be used with Microsoft Direct3D or any other API that interoperates with shared surfaces. The application must transitively ensure that the surface is usable on the Direct3D device that is used in this context. For example, if using the surface with Direct2D then the Direct2D render target must have been created through ID2D1Factory::CreateDxgiSurfaceRenderTarget or on a device context created on the same device.

Methods

FromWicBitmap(DeviceContext, BitmapSource)

Creates a Bitmap from a WIC bitmap.

public static Bitmap1 FromWicBitmap(DeviceContext deviceContext, BitmapSource wicBitmapSource)

Parameters

deviceContext DeviceContext

The render target.

wicBitmapSource BitmapSource

A reference to a BitmapSource WIC bitmap.

Returns

Bitmap1

FromWicBitmap(DeviceContext, BitmapSource, BitmapProperties1)

Creates a Bitmap from a WIC bitmap.

public static Bitmap1 FromWicBitmap(DeviceContext deviceContext, BitmapSource wicBitmap, BitmapProperties1 bitmapProperties)

Parameters

deviceContext DeviceContext

The render target.

wicBitmap BitmapSource

The WIC bitmap.

bitmapProperties BitmapProperties1

The bitmap properties.

Returns

Bitmap1

Map(MapOptions)

Maps the given bitmap into memory.

public DataRectangle Map(MapOptions options)

Parameters

options MapOptions

The options used in mapping the bitmap into memory.

Returns

DataRectangle

a reference to the rectangle that is mapped into memory

Remarks

The bitmap must have been created with the Read flag specified.The caller should try to unmap the memory as quickly as is feasible to release occupied DMA aperture memory.

Unmap()

Unmaps the bitmap from memory.

public void Unmap()

Remarks

Any memory returned from the Map call is now invalid and may be reclaimed by the operating system or used for other purposes.

The bitmap must have been previously mapped.

Operators

explicit operator Bitmap1(nint)

public static explicit operator Bitmap1(nint nativePtr)

Parameters

nativePtr nint

Returns

Bitmap1