libShiva

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.

Constructing a path

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:

p->moveTo(10,10);

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:

p->lineTo(100,10);

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:

p->conicCurveTo(150,100, 100,200);

A cubic segment requires two inner control-points and and end-point:

p->cubicCurveTo(50,250, 100,300, 50,350);

To be continued...