Underneath, every basic shape is derived from the Path class. This is a generic class to describe any vector shape, composed of linear, conic or cubic segments, either closed or open.
First we create a path object much like any other libShiva object:
PathRef p = new Path;
Each path construction must begin with a moveTo() call. This lays down the pen to a point where we will start drawing:
After that we can can any of the segment construction functions. Each new segment uses the last pen position as its first point. To draw a linear (straight line) segment we write:
When we draw a conic segment, we have to specify two points: first one is the inner control-point at the peak of the curve and second one is the end-point of the curve:
A cubic segment requires two inner control-points and and end-point:
p->cubicCurveTo(50,250, 100,300, 50,350);
To be continued...