[]
ID2D1Bitmap
[Guid("a2296057-ea42-4099-983b-539fb6505426")]
public class Bitmap : Image, IDisposable, IUnknown
Initializes a new instance of the Bitmap class.
public Bitmap(IntPtr nativePtr)
nativePtr
System.IntPtrThe native pointer.
Return the dots per inch (DPI) of the bitmap.
public Size2F DotsPerInch { get; }
HRESULT ID2D1Bitmap::CopyFromBitmap([In, Optional] const D2D_POINT_2U* destPoint,[In] ID2D1Bitmap* bitmap,[In, Optional] const D2D_RECT_U* srcRect)
public void CopyFromBitmap(Bitmap bitmap, RectL srcRect)
HRESULT ID2D1Bitmap::CopyFromBitmap([In, Optional] const D2D_POINT_2U* destPoint,[In] ID2D1Bitmap* bitmap,[In, Optional] const D2D_RECT_U* srcRect)
public void CopyFromBitmap(Bitmap bitmap)
bitmap
BitmapHRESULT ID2D1Bitmap::CopyFromBitmap([In, Optional] const D2D_POINT_2U* destPoint,[In] ID2D1Bitmap* bitmap,[In, Optional] const D2D_RECT_U* srcRect)
public void CopyFromBitmap(Point2L destPoint, Bitmap bitmap, RectL srcRect)
HRESULT ID2D1Bitmap::CopyFromBitmap([In, Optional] const D2D_POINT_2U* destPoint,[In] ID2D1Bitmap* bitmap,[In, Optional] const D2D_RECT_U* srcRect)
public void CopyFromBitmap(Point2L destPoint, Bitmap bitmap)
Copies the specified region from memory into the current bitmap.
public void CopyFromMemory(byte[] memory, int pitch, RectL destinationArea)
memory
byte[]The data to copy.
pitch
intThe stride, or pitch, of the source bitmap stored in srcData. The stride is the byte count of a scanline (one row of pixels in memory). The stride can be computed from the following formula: pixel width * bytes per pixel + memory padding.
destinationArea
RectLIn the current bitmap, the upper-left corner of the area to which the region specified by srcRect is copied.
This method does not update the size of the current bitmap. If the contents of the source bitmap do not fit in the current bitmap, this method fails. Also, note that this method does not perform format conversion; the two bitmap formats should match. Passing this method invalid input, such as an invalid destination rectangle, can produce unpredictable results, such as a distorted image or device failure. Calling this method may cause the current batch to flush if the bitmap is active in the batch. If the batch that was flushed does not complete successfully, this method fails. However, this method does not clear the error state of the render target on which the batch was flushed. The failing int and tag state will be returned at the next call to {{EndDraw}} or {{Flush}}.
Copies the specified region from memory into the current bitmap.
public void CopyFromMemory(byte[] memory, int pitch)
memory
byte[]The data to copy.
pitch
intThe stride, or pitch, of the source bitmap stored in srcData. The stride is the byte count of a scanline (one row of pixels in memory). The stride can be computed from the following formula: pixel width * bytes per pixel + memory padding.
This method does not update the size of the current bitmap. If the contents of the source bitmap do not fit in the current bitmap, this method fails. Also, note that this method does not perform format conversion; the two bitmap formats should match. Passing this method invalid input, such as an invalid destination rectangle, can produce unpredictable results, such as a distorted image or device failure. Calling this method may cause the current batch to flush if the bitmap is active in the batch. If the batch that was flushed does not complete successfully, this method fails. However, this method does not clear the error state of the render target on which the batch was flushed. The failing int and tag state will be returned at the next call to {{EndDraw}} or {{Flush}}.
Copies the specified region from memory into the current bitmap.
public void CopyFromMemory(IntPtr pointer, int pitch, RectL destinationArea)
pointer
System.IntPtrThe data to copy.
pitch
intThe stride, or pitch, of the source bitmap stored in srcData. The stride is the byte count of a scanline (one row of pixels in memory). The stride can be computed from the following formula: pixel width * bytes per pixel + memory padding.
destinationArea
RectLIn the current bitmap, the upper-left corner of the area to which the region specified by srcRect is copied.
This method does not update the size of the current bitmap. If the contents of the source bitmap do not fit in the current bitmap, this method fails. Also, note that this method does not perform format conversion; the two bitmap formats should match. Passing this method invalid input, such as an invalid destination rectangle, can produce unpredictable results, such as a distorted image or device failure. Calling this method may cause the current batch to flush if the bitmap is active in the batch. If the batch that was flushed does not complete successfully, this method fails. However, this method does not clear the error state of the render target on which the batch was flushed. The failing int and tag state will be returned at the next call to {{EndDraw}} or {{Flush}}.
Copies the specified region from memory into the current bitmap.
public void CopyFromMemory(IntPtr pointer, int pitch)
pointer
System.IntPtrThe data to copy.
pitch
intThe stride, or pitch, of the source bitmap stored in srcData. The stride is the byte count of a scanline (one row of pixels in memory). The stride can be computed from the following formula: pixel width * bytes per pixel + memory padding.
This method does not update the size of the current bitmap. If the contents of the source bitmap do not fit in the current bitmap, this method fails. Also, note that this method does not perform format conversion; the two bitmap formats should match. Passing this method invalid input, such as an invalid destination rectangle, can produce unpredictable results, such as a distorted image or device failure. Calling this method may cause the current batch to flush if the bitmap is active in the batch. If the batch that was flushed does not complete successfully, this method fails. However, this method does not clear the error state of the render target on which the batch was flushed. The failing int and tag state will be returned at the next call to {{EndDraw}} or {{Flush}}.
HRESULT ID2D1Bitmap::CopyFromMemory([In, Optional] const D2D_RECT_U* dstRect,[In] const void* srcData,[In] unsigned int pitch)
public void CopyFromMemory(RectL? dstRect, IntPtr srcData, int pitch)
dstRect
RectL?srcData
System.IntPtrpitch
intCopies the specified region from memory into the current bitmap.
public void CopyFromMemory<T>(T[] memory, int pitch, RectL destinationArea) where T : struct
memory
T[]The data to copy.
pitch
intThe stride, or pitch, of the source bitmap stored in srcData. The stride is the byte count of a scanline (one row of pixels in memory). The stride can be computed from the following formula: pixel width * bytes per pixel + memory padding.
destinationArea
RectLIn the current bitmap, the upper-left corner of the area to which the region specified by srcRect is copied.
T
This method does not update the size of the current bitmap. If the contents of the source bitmap do not fit in the current bitmap, this method fails. Also, note that this method does not perform format conversion; the two bitmap formats should match. Passing this method invalid input, such as an invalid destination rectangle, can produce unpredictable results, such as a distorted image or device failure. Calling this method may cause the current batch to flush if the bitmap is active in the batch. If the batch that was flushed does not complete successfully, this method fails. However, this method does not clear the error state of the render target on which the batch was flushed. The failing int and tag state will be returned at the next call to {{EndDraw}} or {{Flush}}.
Copies the specified region from memory into the current bitmap.
public void CopyFromMemory<T>(T[] memory, int pitch = 0) where T : struct
memory
T[]The data to copy.
pitch
intThe stride, or pitch, of the source bitmap stored in srcData. The stride is the byte count of a scanline (one row of pixels in memory). The stride can be computed from the following formula: pixel width * bytes per pixel + memory padding.
T
This method does not update the size of the current bitmap. If the contents of the source bitmap do not fit in the current bitmap, this method fails. Also, note that this method does not perform format conversion; the two bitmap formats should match. Passing this method invalid input, such as an invalid destination rectangle, can produce unpredictable results, such as a distorted image or device failure. Calling this method may cause the current batch to flush if the bitmap is active in the batch. If the batch that was flushed does not complete successfully, this method fails. However, this method does not clear the error state of the render target on which the batch was flushed. The failing int and tag state will be returned at the next call to {{EndDraw}} or {{Flush}}.
Copies the specified region from the specified render target into the current bitmap.
public void CopyFromRenderTarget(RenderTarget renderTarget, Point2L destinationPoint, RectL sourceArea)
renderTarget
RenderTargetThe render target that contains the region to copy.
destinationPoint
Point2LIn the current bitmap, the upper-left corner of the area to which the region specified by srcRect is copied.
sourceArea
RectLThe area of renderTarget to copy.
This method does not update the size of the current bitmap. If the contents of the source bitmap do not fit in the current bitmap, this method fails. Also, note that this method does not perform format conversion, and will fail if the bitmap formats do not match. Calling this method may cause the current batch to flush if the bitmap is active in the batch. If the batch that was flushed does not complete successfully, this method fails. However, this method does not clear the error state of the render target on which the batch was flushed. The failing int and tag state will be returned at the next call to {{EndDraw}} or {{Flush}}. All clips and layers must be popped off of the render target before calling this method. The method returns {{D2DERR_RENDER_TARGET_HAS_LAYER_OR_CLIPRECT}} if any clips or layers are currently applied to the render target.
Copies the specified region from the specified render target into the current bitmap.
public void CopyFromRenderTarget(RenderTarget renderTarget, Point2L destinationPoint)
renderTarget
RenderTargetThe render target that contains the region to copy.
destinationPoint
Point2LIn the current bitmap, the upper-left corner of the area to which the region specified by srcRect is copied.
This method does not update the size of the current bitmap. If the contents of the source bitmap do not fit in the current bitmap, this method fails. Also, note that this method does not perform format conversion, and will fail if the bitmap formats do not match. Calling this method may cause the current batch to flush if the bitmap is active in the batch. If the batch that was flushed does not complete successfully, this method fails. However, this method does not clear the error state of the render target on which the batch was flushed. The failing int and tag state will be returned at the next call to {{EndDraw}} or {{Flush}}. All clips and layers must be popped off of the render target before calling this method. The method returns {{D2DERR_RENDER_TARGET_HAS_LAYER_OR_CLIPRECT}} if any clips or layers are currently applied to the render target.
Copies the specified region from the specified render target into the current bitmap.
public void CopyFromRenderTarget(RenderTarget renderTarget)
renderTarget
RenderTargetThe render target that contains the region to copy.
This method does not update the size of the current bitmap. If the contents of the source bitmap do not fit in the current bitmap, this method fails. Also, note that this method does not perform format conversion, and will fail if the bitmap formats do not match. Calling this method may cause the current batch to flush if the bitmap is active in the batch. If the batch that was flushed does not complete successfully, this method fails. However, this method does not clear the error state of the render target on which the batch was flushed. The failing int and tag state will be returned at the next call to {{EndDraw}} or {{Flush}}. All clips and layers must be popped off of the render target before calling this method. The method returns {{D2DERR_RENDER_TARGET_HAS_LAYER_OR_CLIPRECT}} if any clips or layers are currently applied to the render target.
HRESULT ID2D1Bitmap::CopyFromRenderTarget([In, Optional] const D2D_POINT_2U* destPoint,[In] ID2D1RenderTarget* renderTarget,[In, Optional] const D2D_RECT_U* srcRect)
public void CopyFromRenderTarget(Point2L? destPoint, RenderTarget renderTarget, RectL? srcRect)
destPoint
Point2L?renderTarget
RenderTargetsrcRect
RectL?Copies the specified region from a stream into the current bitmap.
public void CopyFromStream(Stream stream, int pitch, int length, RectL destinationArea)
stream
System.IO.StreamThe stream to copy the data from.
pitch
intThe stride, or pitch, of the source bitmap stored in srcData. The stride is the byte count of a scanline (one row of pixels in memory). The stride can be computed from the following formula: pixel width * bytes per pixel + memory padding.
length
intLength in bytes of the data to copy from the stream.
destinationArea
RectLIn the current bitmap, the upper-left corner of the area to which the region specified by srcRect is copied.
This method does not update the size of the current bitmap. If the contents of the source bitmap do not fit in the current bitmap, this method fails. Also, note that this method does not perform format conversion; the two bitmap formats should match. Passing this method invalid input, such as an invalid destination rectangle, can produce unpredictable results, such as a distorted image or device failure. Calling this method may cause the current batch to flush if the bitmap is active in the batch. If the batch that was flushed does not complete successfully, this method fails. However, this method does not clear the error state of the render target on which the batch was flushed. The failing int and tag state will be returned at the next call to {{EndDraw}} or {{Flush}}.
Copies the specified region from a stream into the current bitmap.
public void CopyFromStream(Stream stream, int pitch, int length)
stream
System.IO.StreamThe stream to copy the data from.
pitch
intThe stride, or pitch, of the source bitmap stored in srcData. The stride is the byte count of a scanline (one row of pixels in memory). The stride can be computed from the following formula: pixel width * bytes per pixel + memory padding.
length
intLength in bytes of the data to copy from the stream.
This method does not update the size of the current bitmap. If the contents of the source bitmap do not fit in the current bitmap, this method fails. Also, note that this method does not perform format conversion; the two bitmap formats should match. Passing this method invalid input, such as an invalid destination rectangle, can produce unpredictable results, such as a distorted image or device failure. Calling this method may cause the current batch to flush if the bitmap is active in the batch. If the batch that was flushed does not complete successfully, this method fails. However, this method does not clear the error state of the render target on which the batch was flushed. The failing int and tag state will be returned at the next call to {{EndDraw}} or {{Flush}}.
Creates an Bitmap whose data is shared with another resource.
public static Bitmap Create(RenderTarget renderTarget, Bitmap bitmap, BitmapProperties? bitmapProperties)
renderTarget
RenderTargetan instance of RenderTarget
bitmap
BitmapAn Bitmap that contains the data to share with the new ID2D1Bitmap. For more information, see the Remarks section.
bitmapProperties
BitmapProperties?The pixel format and DPI of the bitmap to create . The Format portion of the pixel format must match the 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.
Creates an Bitmap whose data is shared with another resource.
public static Bitmap Create(RenderTarget renderTarget, Bitmap bitmap)
renderTarget
RenderTargetan instance of RenderTarget
bitmap
BitmapAn Bitmap that contains the data to share with the new ID2D1Bitmap. For more information, see the Remarks section.
Creates an Bitmap whose data is shared with another resource.
public static Bitmap Create(RenderTarget renderTarget, Surface surface, BitmapProperties? bitmapProperties)
renderTarget
RenderTargetan instance of RenderTarget
surface
SurfaceAn Surface that contains the data to share with the new ID2D1Bitmap. For more information, see the Remarks section.
bitmapProperties
BitmapProperties?The pixel format and DPI of the bitmap to create . The Format portion of the pixel format must match the 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.
Creates an Bitmap whose data is shared with another resource.
public static Bitmap Create(RenderTarget renderTarget, Surface surface)
renderTarget
RenderTargetan instance of RenderTarget
surface
SurfaceAn Surface that contains the data to share with the new ID2D1Bitmap. For more information, see the Remarks section.
Creates a Direct2D bitmap from a pointer to in-memory source data.
public static Bitmap Create(RenderTarget renderTarget, Size2L size, DataPointer dataPointer, int pitch, BitmapProperties bitmapProperties)
renderTarget
RenderTargetan instance of RenderTarget
size
Size2LThe dimension of the bitmap to create in pixels.
dataPointer
DataPointerA 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
BitmapPropertiesThe pixel format and dots per inch (DPI) of the bitmap to create.
Creates a Direct2D bitmap from a pointer to in-memory source data.
public static Bitmap Create(RenderTarget renderTarget, Size2L size, DataPointer dataPointer, int pitch)
renderTarget
RenderTargetan instance of RenderTarget
size
Size2LThe dimension of the bitmap to create in pixels.
dataPointer
DataPointerA 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.)
Creates a Direct2D bitmap from a pointer to in-memory source data.
public static Bitmap Create(RenderTarget renderTarget, Size2L size, BitmapProperties bitmapProperties)
renderTarget
RenderTargetan instance of RenderTarget
size
Size2LThe dimension of the bitmap to create in pixels.
bitmapProperties
BitmapPropertiesThe pixel format and dots per inch (DPI) of the bitmap to create.
Creates a Direct2D bitmap from a pointer to in-memory source data.
public static Bitmap Create(RenderTarget renderTarget, Size2L size)
renderTarget
RenderTargetan instance of RenderTarget
size
Size2LThe dimension of the bitmap to create in pixels.
Creates an Bitmap that points to the bitmap data already stored in the BitmapLock.
public static Bitmap Create(RenderTarget renderTarget, BitmapLock bitmapLock, BitmapProperties? bitmapProperties)
renderTarget
RenderTargetAn instance of RenderTarget.
bitmapLock
BitmapLockAn RenderTarget that contains the data to share with the new Bitmap.
bitmapProperties
BitmapProperties?The pixel format and DPI of the bitmap to create . The Format portion of the pixel format must match the 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.
Creates a Bitmap from a wic bitmap.
public static Bitmap Create(RenderTarget renderTarget, BitmapSource wicBitmap, BitmapProperties bitmapProperties)
renderTarget
RenderTargetThe render target.
wicBitmap
BitmapSourceThe wic bitmap.
bitmapProperties
BitmapPropertiesThe bitmap properties.
Creates a Bitmap from a wic bitmap.
public static Bitmap Create(RenderTarget renderTarget, BitmapSource wicBitmapSource)
renderTarget
RenderTargetThe render target.
wicBitmapSource
BitmapSourceA reference to a BitmapSource wic bitmap.
void ID2D1Bitmap::GetDpi([Out] float* dpiX,[Out] float* dpiY)
public void GetDpi(out float dpiX, out float dpiY)
dpiX
floatdpiY
floatD2D1_PIXEL_FORMAT ID2D1Bitmap::GetPixelFormat()
public PixelFormat GetPixelFormat()
D2D_SIZE_U ID2D1Bitmap::GetPixelSize()
public Size2L GetPixelSize()
D2D_SIZE_F ID2D1Bitmap::GetSize()
public Size2F GetSize()
Creates a Direct2D bitmap from a pointer to in-memory source data.
public static Bitmap New<T>(RenderTarget renderTarget, Size2L size, T[] pixelDatas, BitmapProperties bitmapProperties) where T : struct
renderTarget
RenderTargetan instance of RenderTarget
size
Size2LThe dimension of the bitmap to create in pixels.
pixelDatas
T[]A pointer to an array of pixel data. The size of the array must be equal to sizeof(pixel) * Size.Width * Height.
bitmapProperties
BitmapPropertiesThe pixel format and dots per inch (DPI) of the bitmap to create.
T
Performs an explicit conversion from System.IntPtr to Bitmap.
public static explicit operator Bitmap(IntPtr nativePointer)
nativePointer
System.IntPtr