CD2DLinearGradientBrush 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 CD2DLinearGradientBrush Class.

A wrapper for ID2D1LinearGradientBrush.

class CD2DLinearGradientBrush : public CD2DGradientBrush;  

Public Constructors

NameDescription
CD2DLinearGradientBrush::CD2DLinearGradientBrushConstructs a CD2DLinearGradientBrush object.
CD2DLinearGradientBrush::~CD2DLinearGradientBrushThe destructor. Called when a D2D linear gradient brush object is being destroyed.

Public Methods

NameDescription
CD2DLinearGradientBrush::AttachAttaches existing resource interface to the object
CD2DLinearGradientBrush::CreateCreates a CD2DLinearGradientBrush. (Overrides CD2DResource::Create.)
CD2DLinearGradientBrush::DestroyDestroys a CD2DLinearGradientBrush object. (Overrides CD2DGradientBrush::Destroy.)
CD2DLinearGradientBrush::DetachDetaches resource interface from the object
CD2DLinearGradientBrush::GetReturns ID2D1LinearGradientBrush interface
CD2DLinearGradientBrush::GetEndPointRetrieves the ending coordinates of the linear gradient
CD2DLinearGradientBrush::GetStartPointRetrieves the starting coordinates of the linear gradient
CD2DLinearGradientBrush::SetEndPointSets the ending coordinates of the linear gradient in the brush's coordinate space
CD2DLinearGradientBrush::SetStartPointSets the starting coordinates of the linear gradient in the brush's coordinate space

Public Operators

NameDescription
CD2DLinearGradientBrush::operator ID2D1LinearGradientBrush*Returns ID2D1LinearGradientBrush interface

Protected Data Members

NameDescription
CD2DLinearGradientBrush::m_LinearGradientBrushPropertiesThe start and end points of the gradient.
CD2DLinearGradientBrush::m_pLinearGradientBrushA pointer to an ID2D1LinearGradientBrush.

CObject

CD2DResource

CD2DBrush

CD2DGradientBrush

CD2DLinearGradientBrush

Header: afxrendertarget.h

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

virtual ~CD2DLinearGradientBrush();

Attaches existing resource interface to the object

void Attach(ID2D1LinearGradientBrush* pResource);

Parameters

pResource
Existing resource interface. Cannot be NULL

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).

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.

Destroys a CD2DLinearGradientBrush object.

virtual void Destroy();

Detaches resource interface from the object

ID2D1LinearGradientBrush* Detach();

Return Value

Pointer to detached resource interface.

Returns ID2D1LinearGradientBrush interface

ID2D1LinearGradientBrush* Get();

Return Value

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

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

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

The start and end points of the gradient.

D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES m_LinearGradientBrushProperties;  

A pointer to an ID2D1LinearGradientBrush.

ID2D1LinearGradientBrush* m_pLinearGradientBrush;  

Returns ID2D1LinearGradientBrush interface

operator ID2D1LinearGradientBrush*();

Return Value

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

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

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

Classes

Show: