GraphicsBuilder - Paints - LinearGradient Add comment to Wiki View in Wiki Edit Wiki page Printable Version

Creates a linear gradient of many colors.

Requires graphicsbuilder-ext-jdk6 and Java6+.

Properties

Property

Default

Notes

x1

0

 

y1

0

 

x2

100

 

y2

0

 

cycle

'nocycle'

value must be any of ['nocycle','reflect','repeat] or any MultipleGradientPaint.CycleMethod

stretch

false

Scales the gradient to fit the Shape's bounds

fit

true

Scales the gradient retaining the aspect ratio

stops

[]

must define at least two stops

linkTo

 

a reference to a linearGradient or a radialGradient

If linkTo is used, then this gradient will reuse the referenced one's stops, new stops may be added to this gradient though.

Stops

Property

Default

Notes

offset

 

a float value in the range [0..1]

color

 

a Color or a color string

opacity

 

must be in the range [0..1]

Example

4 rectangles, each one with a diagonal gradient

Different settings for fit, stretch and cycle

 

 

Search

Results of your search request can come from various sources: the Groovy website itself, the JIRA issues, the API documentation, as well as a few other interesting Groovy-related blogs.

  By  -  pages  -  views  - last modified