ID2D1RadialGradientBrush interface (d2d1.h)
Paints an area with a radial gradient.
The ID2D1RadialGradientBrush interface inherits from ID2D1Brush. ID2D1RadialGradientBrush also has these types of members:
The ID2D1RadialGradientBrush interface has these methods.
Retrieves the center of the gradient ellipse.
Retrieves the offset of the gradient origin relative to the gradient ellipse's center.
Retrieves the ID2D1GradientStopCollection associated with this radial gradient brush object.
Retrieves the x-radius of the gradient ellipse.
Retrieves the y-radius of the gradient ellipse.
Specifies the center of the gradient ellipse in the brush's coordinate space.
Specifies the offset of the gradient origin relative to the gradient ellipse's center.
Specifies the x-radius of the gradient ellipse, in the brush's coordinate space.
Specifies the y-radius of the gradient ellipse, in the brush's coordinate space.
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 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 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.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.)
For an example on how to create a radial gradient brush, see the How to Create a Radial Gradient Brush topic.
|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]|