CD2DBitmap Class
A wrapper for ID2D1Bitmap.
Syntax
class CD2DBitmap : public CD2DResource;
Members
Public Constructors
Name | Description |
---|---|
CD2DBitmap::CD2DBitmap | Overloaded. Constructs a CD2DBitmap object from HBITMAP. |
CD2DBitmap::~CD2DBitmap | The destructor. Called when a D2D bitmap object is being destroyed. |
Protected Constructors
Name | Description |
---|---|
CD2DBitmap::CD2DBitmap | Overloaded. Constructs a CD2DBitmap object. |
Public Methods
Name | Description |
---|---|
CD2DBitmap::Attach | Attaches existing resource interface to the object |
CD2DBitmap::CopyFromBitmap | Copies the specified region from the specified bitmap into the current bitmap |
CD2DBitmap::CopyFromMemory | Copies the specified region from memory into the current bitmap |
CD2DBitmap::CopyFromRenderTarget | Copies the specified region from the specified render target into the current bitmap |
CD2DBitmap::Create | Creates a CD2DBitmap. (Overrides CD2DResource::Create.) |
CD2DBitmap::Destroy | Destroys a CD2DBitmap object. (Overrides CD2DResource::Destroy.) |
CD2DBitmap::Detach | Detaches resource interface from the object |
CD2DBitmap::Get | Returns ID2D1Bitmap interface |
CD2DBitmap::GetDPI | Return the dots per inch (DPI) of the bitmap |
CD2DBitmap::GetPixelFormat | Retrieves the pixel format and alpha mode of the bitmap |
CD2DBitmap::GetPixelSize | Returns the size, in device-dependent units (pixels), of the bitmap |
CD2DBitmap::GetSize | Returns the size, in device-independent pixels (DIPs), of the bitmap |
CD2DBitmap::IsValid | Checks resource validity (Overrides CD2DResource::IsValid.) |
Protected Methods
Name | Description |
---|---|
CD2DBitmap::CommonInit | Initializes the object |
Public Operators
Name | Description |
---|---|
CD2DBitmap::operator ID2D1Bitmap* | Returns ID2D1Bitmap interface |
Protected Data Members
Name | Description |
---|---|
CD2DBitmap::m_bAutoDestroyHBMP | TRUE if m_hBmpSrc should be destroyed; otherwise FALSE. |
CD2DBitmap::m_hBmpSrc | Source bitmap handle. |
CD2DBitmap::m_lpszType | Resource type. |
CD2DBitmap::m_pBitmap | Stores a pointer to an ID2D1Bitmap object. |
CD2DBitmap::m_sizeDest | Bitmap destination size. |
CD2DBitmap::m_strPath | Bitmap file path. |
CD2DBitmap::m_uiResID | Bitmap resource ID. |
Inheritance Hierarchy
CD2DBitmap
Requirements
Header: afxrendertarget.h
CD2DBitmap::~CD2DBitmap
The destructor. Called when a D2D bitmap object is being destroyed.
virtual ~CD2DBitmap();
CD2DBitmap::Attach
Attaches existing resource interface to the object.
void Attach(ID2D1Bitmap* pResource);
Parameters
pResource
Existing resource interface. Cannot be NULL.
CD2DBitmap::CD2DBitmap
Constructs a CD2DBitmap object from resource.
CD2DBitmap(
CRenderTarget* pParentTarget,
UINT uiResID,
LPCTSTR lpszType = NULL,
CD2DSizeU sizeDest = CD2DSizeU(0, 0),
BOOL bAutoDestroy = TRUE);
CD2DBitmap(
CRenderTarget* pParentTarget,
LPCTSTR lpszPath,
CD2DSizeU sizeDest = CD2DSizeU(0, 0),
BOOL bAutoDestroy = TRUE);
CD2DBitmap(
CRenderTarget* pParentTarget,
HBITMAP hbmpSrc,
CD2DSizeU sizeDest = CD2DSizeU(0, 0),
BOOL bAutoDestroy = TRUE);
CD2DBitmap(
CRenderTarget* pParentTarget,
BOOL bAutoDestroy = TRUE);
Parameters
pParentTarget
A pointer to the render target.
uiResID
The resource ID number of the resource.
lpszType
Pointer to a null-terminated string that contains the resource type.
sizeDest
Destination size of the bitmap.
bAutoDestroy
Indicates that the object will be destroyed by owner (pParentTarget).
lpszPath
Pointer to a null-terminated string that contains the name of file.
hbmpSrc
Handle to the bitmap.
CD2DBitmap::CommonInit
Initializes the object.
void CommonInit();
CD2DBitmap::CopyFromBitmap
Copies the specified region from the specified bitmap into the current bitmap.
HRESULT CopyFromBitmap(
const CD2DBitmap* pBitmap,
const CD2DPointU* destPoint = NULL,
const CD2DRectU* srcRect = NULL);
Parameters
pBitmap
The bitmap to copy from.
destPoint
In the current bitmap, the upper-left corner of the area to which the region specified by srcRect is copied.
srcRect
The area of bitmap to copy.
Return Value
If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
CD2DBitmap::CopyFromMemory
Copies the specified region from memory into the current bitmap.
HRESULT CopyFromMemory(
const void* srcData,
UINT32 pitch,
const CD2DRectU* destRect = NULL);
Parameters
srcData
The data to copy.
pitch
The 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.
destRect
In the current bitmap, the upper-left corner of the area to which the region specified by srcRect is copied.
Return Value
If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
CD2DBitmap::CopyFromRenderTarget
Copies the specified region from the specified render target into the current bitmap.
HRESULT CopyFromRenderTarget(
const CRenderTarget* pRenderTarget,
const CD2DPointU* destPoint = NULL,
const CD2DRectU* srcRect = NULL);
Parameters
pRenderTarget
The render target that contains the region to copy.
destPoint
In the current bitmap, the upper-left corner of the area to which the region specified by srcRect is copied.
srcRect
The area of renderTarget to copy.
Return Value
If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
CD2DBitmap::Create
Creates a CD2DBitmap.
virtual HRESULT Create(CRenderTarget* pRenderTarget);
Parameters
pRenderTarget
A pointer to the render target.
Return Value
If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
CD2DBitmap::Destroy
Destroys a CD2DBitmap object.
virtual void Destroy();
CD2DBitmap::Detach
Detaches resource interface from the object.
ID2D1Bitmap* Detach();
Return Value
Pointer to detached resource interface.
CD2DBitmap::Get
Returns ID2D1Bitmap interface.
ID2D1Bitmap* Get();
Return Value
Pointer to an ID2D1Bitmap interface or NULL if object is not initialized yet.
CD2DBitmap::GetDPI
Return the dots per inch (DPI) of the bitmap.
CD2DSizeF GetDPI() const;
Return Value
The horizontal and vertical DPI of the bitmap.
CD2DBitmap::GetPixelFormat
Retrieves the pixel format and alpha mode of the bitmap
D2D1_PIXEL_FORMAT GetPixelFormat() const;
Return Value
The pixel format and alpha mode of the bitmap.
CD2DBitmap::GetPixelSize
Returns the size, in device-dependent units (pixels), of the bitmap.
CD2DSizeU GetPixelSize() const;
Return Value
The size, in pixels, of the bitmap..
CD2DBitmap::GetSize
Returns the size, in device-independent pixels (DIPs), of the bitmap.
CD2DSizeF GetSize() const;
Return Value
The size, in DIPs, of the bitmap.
CD2DBitmap::IsValid
Checks resource validity.
virtual BOOL IsValid() const;
Return Value
TRUE if resource is valid; otherwise FALSE.
CD2DBitmap::m_bAutoDestroyHBMP
TRUE if m_hBmpSrc should be destroyed; otherwise FALSE.
BOOL m_bAutoDestroyHBMP;
CD2DBitmap::m_hBmpSrc
Source bitmap handle.
HBITMAP m_hBmpSrc;
CD2DBitmap::m_lpszType
Resource type.
LPCTSTR m_lpszType;
CD2DBitmap::m_pBitmap
Stores a pointer to an ID2D1Bitmap object.
ID2D1Bitmap* m_pBitmap;
CD2DBitmap::m_sizeDest
Bitmap destination size.
CD2DSizeU m_sizeDest;
CD2DBitmap::m_strPath
Botmap file path.
CString m_strPath;
CD2DBitmap::m_uiResID
Bitmap resource ID.
UINT m_uiResID;
CD2DBitmap::operator ID2D1Bitmap*
Returns ID2D1Bitmap interface
operator ID2D1Bitmap*();
Return Value
Pointer to an ID2D1Bitmap interface or NULL if object is not initialized yet.