Class Bitmap1
[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
DeviceContextan instance of RenderTarget
surface
SurfaceAn 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
DeviceContextan instance of RenderTarget
surface
SurfaceAn SharpDX.DXGI.Surface that contains the data to share with the new ID2D1Bitmap. For more information, see the Remarks section.
bitmapProperties
BitmapProperties1The 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
DeviceContextan instance of RenderTarget
size
Size2The 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
DeviceContextan instance of RenderTarget
size
Size2The dimension of the bitmap to create in pixels.
dataStream
DataStreamA pointer to the memory location of the image data, or NULL to create an uninitialized bitmap.
pitch
intThe 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
DeviceContextan instance of RenderTarget
size
Size2The dimension of the bitmap to create in pixels.
dataStream
DataStreamA pointer to the memory location of the image data, or NULL to create an uninitialized bitmap.
pitch
intThe 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
BitmapProperties1The 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
DeviceContextan instance of RenderTarget
size
Size2The dimension of the bitmap to create in pixels.
bitmapProperties
BitmapProperties1The 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
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
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
DeviceContextThe render target.
wicBitmapSource
BitmapSourceA reference to a BitmapSource WIC bitmap.
Returns
FromWicBitmap(DeviceContext, BitmapSource, BitmapProperties1)
Creates a Bitmap from a WIC bitmap.
public static Bitmap1 FromWicBitmap(DeviceContext deviceContext, BitmapSource wicBitmap, BitmapProperties1 bitmapProperties)
Parameters
deviceContext
DeviceContextThe render target.
wicBitmap
BitmapSourceThe WIC bitmap.
bitmapProperties
BitmapProperties1The bitmap properties.
Returns
Map(MapOptions)
Maps the given bitmap into memory.
public DataRectangle Map(MapOptions options)
Parameters
options
MapOptionsThe 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