CD2DResource Class
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at CD2DResource Class.
An abstract class that provides a interface for creating and managing D2D resources such as brushes, layers, and texts.
class CD2DResource : public CObject;
Protected Constructors
| Name | Description |
|---|---|
| CD2DResource::CD2DResource | Constructs a CD2DResource object. |
| CD2DResource::~CD2DResource | The destructor. Called when a D2D resource object is being destroyed. |
Public Methods
| Name | Description |
|---|---|
| CD2DResource::Create | Creates a CD2DResource. |
| CD2DResource::Destroy | Destroys a CD2DResource object. |
| CD2DResource::IsValid | Checks resource validity |
Protected Methods
| Name | Description |
|---|---|
| CD2DResource::IsAutoDestroy | Check auto destroy flag. |
| CD2DResource::ReCreate | Re-creates a CD2DResource. |
Protected Data Members
| Name | Description |
|---|---|
| CD2DResource::m_bIsAutoDestroy | Resource will be destoyed by owner (CRenderTarget) |
| CD2DResource::m_pParentTarget | Pointer to the parent CRenderTarget) |
Header: afxrendertarget.h
The destructor. Called when a D2D resource object is being destroyed.
virtual ~CD2DResource();
Constructs a CD2DResource object.
CD2DResource(
CRenderTarget* pParentTarget,
BOOL bAutoDestroy);
Parameters
pParentTarget
A pointer to the render target.
bAutoDestroy
Indicates that the object will be destroyed by owner (pParentTarget).
Creates a CD2DResource.
virtual HRESULT Create(CRenderTarget* pRenderTarget) = 0;
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.
Destroys a CD2DResource object.
virtual void Destroy() = 0;
Check auto destroy flag.
BOOL IsAutoDestroy() const;
Return Value
TRUE if the object will be destroyed by its owner; otherwise FALSE.
Checks resource validity
virtual BOOL IsValid() const = 0;
Return Value
TRUE if resource is valid; otherwise FALSE.
Resource will be destoyed by owner (CRenderTarget)
BOOL m_bIsAutoDestroy;
Pointer to the parent CRenderTarget)
CRenderTarget* m_pParentTarget;
Re-creates a CD2DResource.
virtual HRESULT ReCreate(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.