CHwndRenderTarget Class

A wrapper for ID2D1HwndRenderTarget.

Syntax

class CHwndRenderTarget : public CRenderTarget;

Members

Public Constructors

Name Description
CHwndRenderTarget::CHwndRenderTarget Constructs a CHwndRenderTarget object from HWND.

Public Methods

Name Description
CHwndRenderTarget::Attach Attaches existing render target interface to the object
CHwndRenderTarget::CheckWindowState Indicates whether the HWND associated with this render target is occluded.
CHwndRenderTarget::Create Creates a render target associated with the window
CHwndRenderTarget::Detach Detaches render target interface from the object
CHwndRenderTarget::GetHwnd Returns the HWND associated with this render target.
CHwndRenderTarget::GetHwndRenderTarget Returns ID2D1HwndRenderTarget interface.
CHwndRenderTarget::ReCreate Re-creates a render target associated with the window
CHwndRenderTarget::Resize Changes the size of the render target to the specified pixel size

Public Operators

Name Description
CHwndRenderTarget::operator ID2D1HwndRenderTarget* Returns ID2D1HwndRenderTarget interface.

Protected Data Members

Name Description
CHwndRenderTarget::m_pHwndRenderTarget A pointer to an ID2D1HwndRenderTarget object.

Inheritance Hierarchy

CObject

CRenderTarget

CHwndRenderTarget

Requirements

Header: afxrendertarget.h

CHwndRenderTarget::Attach

Attaches existing render target interface to the object

void Attach(ID2D1HwndRenderTarget* pTarget);

Parameters

pTarget
Existing render target interface. Cannot be NULL

CHwndRenderTarget::CheckWindowState

Indicates whether the HWND associated with this render target is occluded.

D2D1_WINDOW_STATE CheckWindowState() const;

Return Value

A value that indicates whether the HWND associated with this render target is occluded.

CHwndRenderTarget::CHwndRenderTarget

Constructs a CHwndRenderTarget object from HWND.

CHwndRenderTarget(HWND hwnd = NULL);

Parameters

hwnd
The HWND associated with this render target

CHwndRenderTarget::Create

Creates a render target associated with the window

BOOL Create(HWND hWnd);

Parameters

hWnd
The HWND associated with this render target

Return Value

If the method succeeds, it returns TRUE. Otherwise, it returns FALSE

CHwndRenderTarget::Detach

Detaches render target interface from the object

ID2D1HwndRenderTarget* Detach();

Return Value

Pointer to detached render target interface.

CHwndRenderTarget::GetHwnd

Returns the HWND associated with this render target.

HWND GetHwnd() const;

Return Value

The HWND associated with this render target.

CHwndRenderTarget::GetHwndRenderTarget

Returns ID2D1HwndRenderTarget interface.

ID2D1HwndRenderTarget* GetHwndRenderTarget();

Return Value

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

CHwndRenderTarget::m_pHwndRenderTarget

A pointer to an ID2D1HwndRenderTarget object.

ID2D1HwndRenderTarget* m_pHwndRenderTarget;

CHwndRenderTarget::operator ID2D1HwndRenderTarget*

Returns ID2D1HwndRenderTarget interface.

operator ID2D1HwndRenderTarget*();

Return Value

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

CHwndRenderTarget::ReCreate

Re-creates a render target associated with the window

BOOL ReCreate(HWND hWnd);

Parameters

hWnd
The HWND associated with this render target

Return Value

If the method succeeds, it returns TRUE. Otherwise, it returns FALSE.

CHwndRenderTarget::Resize

Changes the size of the render target to the specified pixel size

BOOL Resize(const CD2DSizeU& size);

Parameters

size
The new size of the render target in device pixels

Return Value

If the method succeeds, it returns TRUE. Otherwise, it returns FALSE.

See also

Classes