ID2D1LinearGradientBrush interface (d2d1.h)

Paints an area with a linear gradient.

Inheritance

The ID2D1LinearGradientBrush interface inherits from ID2D1Brush. ID2D1LinearGradientBrush also has these types of members:

Methods

The ID2D1LinearGradientBrush interface has these methods.

 
ID2D1LinearGradientBrush::GetEndPoint

Retrieves the ending coordinates of the linear gradient.
ID2D1LinearGradientBrush::GetGradientStopCollection

Retrieves the ID2D1GradientStopCollection associated with this linear gradient brush.
ID2D1LinearGradientBrush::GetStartPoint

Retrieves the starting coordinates of the linear gradient.
ID2D1LinearGradientBrush::SetEndPoint

Sets the ending coordinates of the linear gradient in the brush's coordinate space.
ID2D1LinearGradientBrush::SetStartPoint

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

Remarks

An ID2D1LinearGradientBrush paints an area with a linear gradient along a line between the brush start point and end point. The gradient, defined by the brush ID2D1GradientStopCollection, is extruded perpendicular to this line, and then transformed by a brush transform (if specified).

The start point and end point are described in the brush space and are mapped to the render target when the brush is used. Note the starting and ending coordinates are absolute, not relative to the render target size. A value of (0, 0) maps to the upper-left corner of the render target, while a value of (1, 1) maps one pixel diagonally away from (0, 0). If there is a nonidentity brush transform or render target transform, the brush start point and end point are also transformed.

It is possible to specify a gradient axis that does not completely fill the area that is being painted. When this occurs, the D2D1_EXTEND_MODE, specified by the ID2D1GradientStopCollection, determines how the remaining area is painted.

Creating ID2D1LinearGradientBrush Objects

To create a linear gradient brush, use the ID2D1RenderTarget::CreateLinearGradientBrush method of the render target on which the brush will be used. The brush can only be used with the render target that created it or with the compatible targets for that render target.

A linear gradient brush is a device-dependent resource: your application should create linear gradient brushes after it initializes the render target with which the brushes will be used, and recreate the brushes whenever the render target needs recreated. (For more information about resources, see Resources Overview.)

Requirements

Requirement Value
Minimum supported client Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header d2d1.h

See also

ID2D1Brush