User Guide
Ruby Component
getInterpolationMode mode
Redraw
If values changes in another method which affects what should be displayed by the draw method then you need to be able to request a
redraw. This is very easy to do. All you do is call the redraw method.
If you have more than one View connected to your Ruby component then you should also provide the input connector reference of the View
you want to redraw as an input parameter to the redraw method.
If only part of the display needs to be redrawn you can pass a rectangle after the connector reference So that's:
redraw connectorReference, redrawArea { both optional }
Where redrawArea is a Ruby array of the form [x,y,w,h].
Clipping
Sometimes you need to be able to draw only within a portion of a View. This is where clipping comes into play. The View class has two
methods for setting the clipping:
setClip region
combineClip region, combineMode
Both methods take a region as input. This can be a four element array defining a rectangle, the same format as the rectangles we used for
drawing shapes. It can also be a collection of points defining a polygon. This is represented by an array of two element arrays, each of which
defines an (x,y) position. You can also use a graphics path object to define the region.
The setClip method sets the clipping region to the input region. This means that drawing will only occur within that region – anything outside
is 'clipped' out.
The combineClip method combines the region with the current clipping region. The combineMode input is a string that specifies how the
regions are to be combined. The options are:
“replace” - use the new region
“intersect” - use the intersection of both regions
“union” - use both regions combined
“xor” - use the union minus the intersection
“exclude” - use the old region minus the new one
“complement” - use the new region one minus the old one
Here's an example of how to use clipping:
There are another two methods relating to clipping:
resetClip
getClip
126 of 212