User Guide
Ruby Component
The drawCurve method can take two additional forms:
drawCurve instrument, points, tension
drawCurve instrument, points, offset, segments, tension
The tension input determines the curvature. A value of zero will produce straight lines, a value of 0.5 will produce curves at the standard
curvature and increasing tensions will produce more curvy lines.
The offset value determines the point at which drawing will begin and the segments input determines how many segments of the curve are
drawn.
The image below shows how the curvature changes for tensions above and below 0.5:
Graphics Paths
A graphics path is a combination of shapes and lines which are grouped together, in sequence to form one single object. Paths are
represented by the GraphicsPath class.
To create an instance of a GraphicsPath is easy:
path = GraphicsPath.new
After that you call methods on the GraphicsPath object to add elements to the path. There is one method for each of the line and shape
methods in the View class. They take the same parameters except for the drawing instrument input.
There are 5 shape methods and 5 line methods as follows:
addRectangle rect
addEllipse rect
addPie rect, startAngle, sweepAngle
addPolygon points
addClosedCurve points
addLine point1, point2
120 of 212