Editare

Partajați prin


CD2DBrush Class

A wrapper for ID2D1Brush.

Syntax

class CD2DBrush : public CD2DResource;

Members

Protected Constructors

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

Public Methods

Name Description
CD2DBrush::Attach Attaches existing resource interface to the object
CD2DBrush::Destroy Destroys a CD2DBrush object. (Overrides CD2DResource::Destroy.)
CD2DBrush::Detach Detaches resource interface from the object
CD2DBrush::Get Returns ID2D1Brush interface
CD2DBrush::GetOpacity Gets the degree of opacity of this brush
CD2DBrush::GetTransform Gets the current transform of the brush
CD2DBrush::IsValid Checks resource validity (Overrides CD2DResource::IsValid.)
CD2DBrush::SetOpacity Sets the degree of opacity of this brush
CD2DBrush::SetTransform Applies the specified transform to the brush, replacing the existing transformation. All subsequent drawing operations occur in the transformed space

Public Operators

Name Description
CD2DBrush::operator ID2D1Brush* Returns ID2D1Brush interface

Protected Data Members

Name Description
CD2DBrush::m_pBrush Stores a pointer to an ID2D1Brush object.
CD2DBrush::m_pBrushProperties Brush properties.

Inheritance Hierarchy

CObject

CD2DResource

CD2DBrush

Requirements

Header: afxrendertarget.h

CD2DBrush::~CD2DBrush

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

virtual ~CD2DBrush();

CD2DBrush::Attach

Attaches existing resource interface to the object.

void Attach(ID2D1Brush* pResource);

Parameters

pResource
Existing resource interface. Can't be NULL.

CD2DBrush::CD2DBrush

Constructs a CD2DBrush object.

CD2DBrush(
    CRenderTarget* pParentTarget,
    CD2DBrushProperties* pBrushProperties = NULL,
    BOOL bAutoDestroy = TRUE);

Parameters

pParentTarget
A pointer to the render target.

pBrushProperties
A pointer to the opacity and transformation of a brush.

bAutoDestroy
Indicates that the owner (pParentTarget) destroys the object.

CD2DBrush::Destroy

Destroys a CD2DBrush object.

virtual void Destroy();

CD2DBrush::Detach

Detaches resource interface from the object.

ID2D1Brush* Detach();

Return Value

Pointer to detached resource interface.

CD2DBrush::Get

Returns ID2D1Brush interface

ID2D1Brush* Get();

Return Value

Pointer to an ID2D1Brush interface or NULL if object isn't initialized yet.

CD2DBrush::GetOpacity

Gets the degree of opacity of this brush

FLOAT GetOpacity() const;

Return Value

A value between zero and 1 that indicates the opacity of the brush. This value is a constant multiplier that linearly scales the alpha value of all pixels filled by the brush. The opacity values are clamped in the range 0 to 1 before they're multiplied together.

CD2DBrush::GetTransform

Gets the current transform of the brush

void GetTransform(D2D1_MATRIX_3X2_F* transform) const;

Parameters

transform
When this returns, contains the current transform of the brush. This parameter is passed uninitialized.

CD2DBrush::IsValid

Checks resource validity

virtual BOOL IsValid() const;

Return Value

TRUE if resource is valid; otherwise FALSE.

CD2DBrush::m_pBrush

Stores a pointer to an ID2D1Brush object.

ID2D1Brush* m_pBrush;

CD2DBrush::m_pBrushProperties

Brush properties.

CD2DBrushProperties* m_pBrushProperties;

CD2DBrush::operator ID2D1Brush*

Returns ID2D1Brush interface

operator ID2D1Brush*();

Return Value

Pointer to an ID2D1Brush interface or NULL if object isn't initialized yet.

CD2DBrush::SetOpacity

Sets the degree of opacity of this brush

void SetOpacity(FLOAT opacity);

Parameters

opacity
A value between zero and 1 that indicates the opacity of the brush. This value is a constant multiplier that linearly scales the alpha value of all pixels filled by the brush. The opacity values are clamped in the range 0 to 1 before they're multiplied together.

CD2DBrush::SetTransform

Applies the specified transform to the brush, replacing the existing transformation. All subsequent drawing operations occur in the transformed space.

void SetTransform(const D2D1_MATRIX_3X2_F* transform);

Parameters

transform
The transform to apply to the brush

See also

Classes