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

NameDescription
CD2DResource::CD2DResourceConstructs a CD2DResource object.
CD2DResource::~CD2DResourceThe destructor. Called when a D2D resource object is being destroyed.

Public Methods

NameDescription
CD2DResource::CreateCreates a CD2DResource.
CD2DResource::DestroyDestroys a CD2DResource object.
CD2DResource::IsValidChecks resource validity

Protected Methods

NameDescription
CD2DResource::IsAutoDestroyCheck auto destroy flag.
CD2DResource::ReCreateRe-creates a CD2DResource.

Protected Data Members

NameDescription
CD2DResource::m_bIsAutoDestroyResource will be destoyed by owner (CRenderTarget)
CD2DResource::m_pParentTargetPointer to the parent CRenderTarget)

CObject

CD2DResource

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.

Classes

Show: