ID2D1RadialGradientBrush interface

Paints an area with a radial gradient.

When to implement

Custom implementations are not supported.

Members

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

Methods

The ID2D1RadialGradientBrush interface has these methods.

MethodDescription
GetCenter

Retrieves the center of the gradient ellipse.

GetGradientOriginOffset

Retrieves the offset of the gradient origin relative to the gradient ellipse's center.

GetGradientStopCollection

Retrieves the ID2D1GradientStopCollection associated with this radial gradient brush object.

GetRadiusX

Retrieves the x-radius of the gradient ellipse.

GetRadiusY

Retrieves the y-radius of the gradient ellipse.

SetCenter

Specifies the center of the gradient ellipse in the brush's coordinate space.

SetGradientOriginOffset

Specifies the offset of the gradient origin relative to the gradient ellipse's center.

SetRadiusX

Specifies the x-radius of the gradient ellipse, in the brush's coordinate space.

SetRadiusY

Specifies the y-radius of the gradient ellipse, in the brush's coordinate space.

 

Remarks

The ID2D1RadialGradientBrush is similar to the ID2D1LinearGradientBrush in that they both map a collection of gradient stops to a gradient. However, the linear gradient has a start and an end point to define the gradient vector, while the radial gradient uses an ellipse and a gradient origin to define its gradient behavior. To define the position and size of the ellipse, use the SetCenter, SetRadiusX, and SetRadiusY methods to specify the center, x-radius, and y-radius of the ellipse. The gradient origin is the center of the ellipse, unless a gradient offset is specified by using the SetGradientOriginOffset method.

The brush maps the gradient stop position 0.0f of the gradient origin, and the position 1.0f is mapped to the ellipse boundary. When the gradient origin is within the ellipse, the contents of the ellipse enclose the entire [0, 1] range of the brush gradient stops. If the gradient origin is outside the bounds of the ellipse, the brush still works, but its gradient is not well-defined.

The start point and end point are described in the brush space and are mappped 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 just one pixel diagonally away from (0, 0). If there is a nonidentity brush transform or render target transform, the brush ellipse and gradient origin are also transformed.

It is possible to specify an ellipse that does not completely fill area being painted. When this occurs, the D2D1_EXTEND_MODE and setting (specified by the brush ID2D1GradientStopCollection) determines how the remaining area is painted.

Creating ID2D1RadialGradientBrush Objects

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

A radial gradient brush is a device-dependent resource: your application should create radial 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.)

Examples

For an example on how to create a radial gradient brush, see the How to Create a Radial Gradient Brush topic.

Requirements

Minimum supported client

Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | Windows Store apps]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Header

D2d1.h

Library

D2d1.lib

DLL

D2d1.dll

See also

Brushes Overview
How to Create a Radial Gradient Brush
Brush Types Example

 

 

Community Additions

ADD
Show:
© 2014 Microsoft