CD2DLayer Class

A wrapper for ID2D1Layer.

Syntax

class CD2DLayer : public CD2DResource;

Members

Public Constructors

Name Description
CD2DLayer::CD2DLayer Constructs a CD2DLayer object.
CD2DLayer::~CD2DLayer The destructor. Called when a D2D layer object is being destroyed.

Public Methods

Name Description
CD2DLayer::Attach Attaches existing resource interface to the object
CD2DLayer::Create Creates a CD2DLayer. (Overrides CD2DResource::Create.)
CD2DLayer::Destroy Destroys a CD2DLayer object. (Overrides CD2DResource::Destroy.)
CD2DLayer::Detach Detaches resource interface from the object
CD2DLayer::Get Returns ID2D1Layer interface
CD2DLayer::GetSize Returns the size of the render target in device-independent pixels
CD2DLayer::IsValid Checks resource validity (Overrides CD2DResource::IsValid.)

Public Operators

Name Description
CD2DLayer::operator ID2D1Layer* Returns ID2D1Layer interface

Protected Data Members

Name Description
CD2DLayer::m_pLayer Stores a pointer to an ID2D1Layer object.

Inheritance Hierarchy

CObject

CD2DResource

CD2DLayer

Requirements

Header: afxrendertarget.h

CD2DLayer::~CD2DLayer

The destructor. Called when a D2D layer object is being destroyed.

virtual ~CD2DLayer();

CD2DLayer::Attach

Attaches existing resource interface to the object

void Attach(ID2D1Layer* pResource);

Parameters

pResource
Existing resource interface. Cannot be NULL

CD2DLayer::CD2DLayer

Constructs a CD2DLayer object.

CD2DLayer(
    CRenderTarget* pParentTarget,
    BOOL bAutoDestroy = TRUE);

Parameters

pParentTarget
A pointer to the render target.

bAutoDestroy
Indicates that the object will be destroyed by owner (pParentTarget).

CD2DLayer::Create

Creates a CD2DLayer.

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.

CD2DLayer::Destroy

Destroys a CD2DLayer object.

virtual void Destroy();

CD2DLayer::Detach

Detaches resource interface from the object

ID2D1Layer* Detach();

Return Value

Pointer to detached resource interface.

CD2DLayer::Get

Returns ID2D1Layer interface

ID2D1Layer* Get();

Return Value

Pointer to an ID2D1Layer interface or NULL if object is not initialized yet.

CD2DLayer::GetSize

Returns the size of the render target in device-independent pixels

CD2DSizeF GetSize() const;

Return Value

The current size of the render target in device-independent pixels

CD2DLayer::IsValid

Checks resource validity

virtual BOOL IsValid() const;

Return Value

TRUE if resource is valid; otherwise FALSE.

CD2DLayer::m_pLayer

Stores a pointer to an ID2D1Layer object.

ID2D1Layer* m_pLayer;

CD2DLayer::operator ID2D1Layer*

Returns ID2D1Layer interface

operator ID2D1Layer* ();

Return Value

Pointer to an ID2D1Layer interface or NULL if object is not initialized yet.

See also

Classes