Reference for the Mosaic class Graphics::RadialGradient
|
The class Graphics::RadialGradient provides functionality to define radial gradients. Such gradients can be used by Views::FillGradientPath or Views::StrokeGradientPath to fill a polygon or stroke its outline. At the runtime the radial gradient interpolates color values along a chord of a circle with center position and radius specified in the properties Center and Radius. The coordinates are expressed in pixel relative to the top-left corner of the view using that gradient.
A radial gradient is determined by a list of color stops. To add new and modify existing color stops use the methods AddColorStop() and SetColorStop(). Before adding color stops, the maximum capacity of the gradient has to be specified by using the method SetMaxNoOfColorStops().
In case of simple gradients consisting of two color stops only, the convenience properties StartColor and EndColor can be used. In such case it is not necessary to explicitly specify the capacity of the gradient and it is not necessary to add any color stops. Just specify the start and the end colors of the gradient in the both mentioned properties.
To query the capacity of the gradient the method GetMaxNoOfColorStops() is available. To query the number of already specified color stops, use the method GetNoOfColorStops().
property point Center = <0,0>;
The property 'Center' specifies the center position of the radial gradient. The position is expressed in pixel and it is relative to the top-left corner of the path view, which is using this gradient. To specify the radius of the radial gradient use the property Radius.
The color value at this center position corresponds to the first color stop specified in the gradient and configured with the offset 0.0.
property int32 Radius = 1;
The property 'Radius' specifies the radius of the radial gradient. The radius is expressed in pixel around the Center position. The color value at this radius corresponds to the last color stop specified in the gradient and configured with the offset 1.0. This color value is valid also for all pixel lying beyond the radius.
Please note, if the value specified in the property Radius is <= 0, the gradient is considered as invalid. Using this gradient will result in no screen contents being drawn.