Synopsis

                    GOBezierSpline;
void                go_bezier_spline_destroy            (GOBezierSpline *sp);
GOBezierSpline *    go_bezier_spline_init               (double const *x,
                                                         double const *y,
                                                         int n,
                                                         gboolean closed);
void                go_bezier_spline_to_cairo           (GOBezierSpline *sp,
                                                         cairo_t *cr,
                                                         gboolean horiz_flip);
GOPath *            go_bezier_spline_to_path            (GOBezierSpline *sp);

Object Hierarchy

  GBoxed
   +----GOBezierSpline

Description

Details

GOBezierSpline

typedef struct {
	double *x, *y;
	int n;
	gboolean closed;
	/* private */
	unsigned ref_count;
} GOBezierSpline;

double *x;

control points abscissa.

double *y;

control points ordinates.

int n;

spline segments number.

gboolean closed;

whether the curve is closed.

go_bezier_spline_destroy ()

void                go_bezier_spline_destroy            (GOBezierSpline *sp);

Destroys the given structures after cleaning all allocated fields.

sp :

a struct GOBezierSpline instance

go_bezier_spline_init ()

GOBezierSpline *    go_bezier_spline_init               (double const *x,
                                                         double const *y,
                                                         int n,
                                                         gboolean closed);

x and y values must be valid and finite. The returned structure contains the x and y coordinates of all control points, including the incoming data. the n and closed fields are just copies of the corresponding arguments.

x :

the x values

y :

the y values

n :

the number of x and y values

closed :

whether to return a closed curve or not

Returns :

a newly created struct GOBezierSpline instance which should be destroyed by a call to go_bezier_spline_destroy.

go_bezier_spline_to_cairo ()

void                go_bezier_spline_to_cairo           (GOBezierSpline *sp,
                                                         cairo_t *cr,
                                                         gboolean horiz_flip);

Renders the spline in \a cr

sp :

a struct GOBezierSpline instance returned by go_bezier_spline_init

cr :

a cairo context

horiz_flip :

whether to flip horizontally (for a RTL canvas).

go_bezier_spline_to_path ()

GOPath *            go_bezier_spline_to_path            (GOBezierSpline *sp);

Builds a GOPath using the control points evaluated in go_bezier_spline_init.

sp :

a struct GOBezierSpline instance returned by go_bezier_spline_init

Returns :

a newly created GOPath which should be destroyed by a call to go_path_free.