Details
struct ArtPoint
struct ArtPoint {
/*< public >*/
double x, y;
}; |
This structure is used here and there in the API: there is no general rule
about its use. It simply represents a point with its x and y coordinates
in the libart 2D space.
The libart 2D space is not a direct cartesian 2D space: it is an indirect cartesian
space (that is, its direction is the invert of the standard trigonometric direction).
The 2D space used by libart is inspired by the X coordinate space:
enum ArtPathcode
typedef enum {
ART_MOVETO,
ART_MOVETO_OPEN,
ART_CURVETO,
ART_LINETO,
ART_END
} ArtPathcode; |
This enum contains the list of the possible drawing commands understood
by ArtVpath and ArtBpath.
These commands are described there.
They can be summarized by the folowing figure:
struct ArtVpath
struct ArtVpath {
ArtPathcode code;
double x;
double y;
}; |
A vector path is an array of ArtVpath (short for vector path) data structures.
Each of those describes a
given vector along the vector path. ArtVpaths can contain ART_MOVETO,
ART_MOVETO_OPEN, ART_LINETO and ART_END
commands. Of course, the x and y members of this data structure have no meaning when code is
ART_END.
struct ArtBpath
struct ArtBpath {
/*< public >*/
ArtPathcode code;
double x1;
double y1;
double x2;
double y2;
double x3;
double y3;
}; |
A vector path can also be an array of ArtBpath (short for bézier path) data structures.
Bézier paths can hold all the possible drawing commands present in an ArtPathCode. XXX: is this true ?
art_vpath_add_point ()
void art_vpath_add_point (ArtVpath **p_vpath,
int *pn_points,
int *pn_points_max,
ArtPathcode code,
double x,
double y); |
Adds a new point to *p_vpath, reallocating and updating *p_vpath
and *pn_points_max as necessary. *pn_points is incremented.
This routine always adds the point after all points already in the
vpath. Thus, it should be called in the order the points are
desired.
art_bez_path_to_vec ()
Creates a vector path closely approximating the bezier path defined by
bez. The flatness argument controls the amount of subdivision. In
general, the resulting vpath deviates by at most flatness pixels
from the "ideal" path described by bez.