Reference for the Mosaic class Graphics::LinearGradient

Graphics::LinearGradient
End
Start
Graphics::Gradient
EndColor
StartColor
AddColorStop()
GetMaxNoOfColorStops()
GetNoOfColorStops()
SetColorStop()
SetMaxNoOfColorStops()

SEE ALSO

Using the Linear Gradient object to define linear gradients composed of multiple colors.

The class Graphics::LinearGradient provides functionality to define linear gradients. Such gradients can be used by Views::FillGradientPath or Views::StrokeGradientPath to fill a polygon or stroke its outline. At the runtime the linear gradient interpolates color values along a straight line segment whose coordinates are specified in the properties Start and End. The coordinates are expressed in pixel relative to the top-left corner of the view using that gradient.

A linear 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 End = <0,0>;

The property 'End' specifies the end position of a straight line segment representing the linear 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 start position of the gradient use the property Start.

The color value at this end position 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 after the end position.

Please note, if the value specified in the property End is equal to the value in the property Start, the gradient is considered as invalid. Using this gradient will result in no screen contents being drawn.

property point Start = <0,0>;

The property 'Start' specifies the start position of a straight line segment representing the linear 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 end position of the gradient use the property End.

The color value at this start position corresponds to the first color stop specified in the gradient and configured with the offset 0.0. This color value is valid also for all pixel lying before the start position.

Please note, if the value specified in the property Start is equal to the value in the property End, the gradient is considered as invalid. Using this gradient will result in no screen contents being drawn.