User Guide
Ruby Component
This is all best illustrated with an example. The picture below shows a gradient with three blend points in between the end points which
themselves are set to zero (ie. color1):
You can also introduce a whole range of colours into the gradient using the setInterpolationColors method. This is very similar to the
setBlend method except that instead of a blend factor you have a Color object paired with the position along the gradient.
setInterpolationColors colourArray
The example below shows 4 colours merging together at various points:
Wrapping
The LinearGradientBrush has a defined bounding rectangle. This makes the brush into a tile. The tile is then used repeatedly to pave any
area that is painted with the brush.
Depending on how you define your gradient you may want to flip the tiles as they are placed so that you don't get hard edges between them.
You can do this by setting the wrap mode to 'flip' using the setWrapMode method.
setWrapMode mode
The default mode is to tile without flipping but by passing the string “Flip” or the number 1 you can set this to flipped. Here's an example of
how the wrap mode affects the overall result.You can see that in the bottom rectangle each tile is flipped so that the gradient runs smoothly
from one tile into another.
131 of 212