CD2DLinearGradientBrush Class

A wrapper for ID2D1LinearGradientBrush.

Syntax

class CD2DLinearGradientBrush : public CD2DGradientBrush;

Members

Public Constructors

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

Public Methods

Name Description
CD2DLinearGradientBrush::Attach Attaches existing resource interface to the object
CD2DLinearGradientBrush::Create Creates a CD2DLinearGradientBrush. (Overrides CD2DResource::Create.)
CD2DLinearGradientBrush::Destroy Destroys a CD2DLinearGradientBrush object. (Overrides CD2DGradientBrush::Destroy.)
CD2DLinearGradientBrush::Detach Detaches resource interface from the object
CD2DLinearGradientBrush::Get Returns ID2D1LinearGradientBrush interface
CD2DLinearGradientBrush::GetEndPoint Retrieves the ending coordinates of the linear gradient
CD2DLinearGradientBrush::GetStartPoint Retrieves the starting coordinates of the linear gradient
CD2DLinearGradientBrush::SetEndPoint Sets the ending coordinates of the linear gradient in the brush's coordinate space
CD2DLinearGradientBrush::SetStartPoint Sets the starting coordinates of the linear gradient in the brush's coordinate space

Public Operators

Name Description
CD2DLinearGradientBrush::operator ID2D1LinearGradientBrush* Returns ID2D1LinearGradientBrush interface

Protected Data Members

Name Description
CD2DLinearGradientBrush::m_LinearGradientBrushProperties The start and end points of the gradient.
CD2DLinearGradientBrush::m_pLinearGradientBrush A pointer to an ID2D1LinearGradientBrush.

Inheritance Hierarchy

CObject

CD2DResource

CD2DBrush

CD2DGradientBrush

CD2DLinearGradientBrush

Requirements

Header: afxrendertarget.h

CD2DLinearGradientBrush::~CD2DLinearGradientBrush

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

virtual ~CD2DLinearGradientBrush();

CD2DLinearGradientBrush::Attach

Attaches existing resource interface to the object

void Attach(ID2D1LinearGradientBrush* pResource);

Parameters

pResource
Existing resource interface. Cannot be NULL

CD2DLinearGradientBrush::CD2DLinearGradientBrush

Constructs a CD2DLinearGradientBrush object.

CD2DLinearGradientBrush(
    CRenderTarget* pParentTarget,
    const D2D1_GRADIENT_STOP* gradientStops,
    UINT gradientStopsCount,
    D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES LinearGradientBrushProperties,
    D2D1_GAMMA colorInterpolationGamma = D2D1_GAMMA_2_2,
    D2D1_EXTEND_MODE extendMode = D2D1_EXTEND_MODE_CLAMP,
    CD2DBrushProperties* pBrushProperties = NULL,
    BOOL bAutoDestroy = TRUE);

Parameters

pParentTarget
A pointer to the render target.

gradientStops
A pointer to an array of D2D1_GRADIENT_STOP structures.

gradientStopsCount
A value greater than or equal to 1 that specifies the number of gradient stops in the gradientStops array.

LinearGradientBrushProperties
The start and end points of the gradient.

colorInterpolationGamma
The space in which color interpolation between the gradient stops is performed.

extendMode
The behavior of the gradient outside the [0,1] normalized range.

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

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

CD2DLinearGradientBrush::Create

Creates a CD2DLinearGradientBrush.

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.

CD2DLinearGradientBrush::Destroy

Destroys a CD2DLinearGradientBrush object.

virtual void Destroy();

CD2DLinearGradientBrush::Detach

Detaches resource interface from the object

ID2D1LinearGradientBrush* Detach();

Return Value

Pointer to detached resource interface.

CD2DLinearGradientBrush::Get

Returns ID2D1LinearGradientBrush interface

ID2D1LinearGradientBrush* Get();

Return Value

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

CD2DLinearGradientBrush::GetEndPoint

Retrieves the ending coordinates of the linear gradient

CD2DPointF GetEndPoint() const;

Return Value

The ending two-dimensional coordinates of the linear gradient, in the brush's coordinate space

CD2DLinearGradientBrush::GetStartPoint

Retrieves the starting coordinates of the linear gradient

CD2DPointF GetStartPoint() const;

Return Value

The starting two-dimensional coordinates of the linear gradient, in the brush's coordinate space

CD2DLinearGradientBrush::m_LinearGradientBrushProperties

The start and end points of the gradient.

D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES m_LinearGradientBrushProperties;

CD2DLinearGradientBrush::m_pLinearGradientBrush

A pointer to an ID2D1LinearGradientBrush.

ID2D1LinearGradientBrush* m_pLinearGradientBrush;

CD2DLinearGradientBrush::operator ID2D1LinearGradientBrush*

Returns ID2D1LinearGradientBrush interface

operator ID2D1LinearGradientBrush*();

Return Value

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

CD2DLinearGradientBrush::SetEndPoint

Sets the ending coordinates of the linear gradient in the brush's coordinate space

void SetEndPoint(CD2DPointF point);

Parameters

point
The ending two-dimensional coordinates of the linear gradient, in the brush's coordinate space

CD2DLinearGradientBrush::SetStartPoint

Sets the starting coordinates of the linear gradient in the brush's coordinate space

void SetStartPoint(CD2DPointF point);

Parameters

point
The starting two-dimensional coordinates of the linear gradient, in the brush's coordinate space

See also

Classes