Libart: Vector Paths

typedef enum {
  ART_MOVETO,
  ART_MOVETO_OPEN,
  ART_CURVETO,
  ART_LINETO,
  ART_END
} ArtPathcode;

typedef struct _ArtVpath ArtVpath;

/* CURVETO is not allowed! */
struct _ArtVpath {
  ArtPathcode code;
  double x;
  double y;
};

ArtVpath is the basic libart data structure for representing vector paths. Related data structures include Bézier paths and Sorted Vector Paths.

A vector path is represented in memory as an array of ArtVpath elements. The last such element has a path code of ART_END.

A vector path is made of a number of segments, each of which is a connected sequence of points. The ordering of segments within a vector path is not significant. Each segment begins with an ART_MOVETO or ART_MOVETO_OPEN path code. Each successive point in the segment has an ART_LINETO path code.

Segments can be either open or closed, depending on the choice of initial path code. The last point of a closed segment should coincide with the first point. The converse is not necessarily true; an open path in which the last point coincides with the first is entirely legal.

libart
* www.levien.com