cairo_matrix_t

cairo_matrix_t — Generic matrix operations

Synopsis




            cairo_matrix_t;
void        cairo_matrix_init               (cairo_matrix_t *matrix,
                                             double xx,
                                             double yx,
                                             double xy,
                                             double yy,
                                             double x0,
                                             double y0);
void        cairo_matrix_init_identity      (cairo_matrix_t *matrix);
void        cairo_matrix_init_translate     (cairo_matrix_t *matrix,
                                             double tx,
                                             double ty);
void        cairo_matrix_init_scale         (cairo_matrix_t *matrix,
                                             double sx,
                                             double sy);
void        cairo_matrix_init_rotate        (cairo_matrix_t *matrix,
                                             double radians);
void        cairo_matrix_translate          (cairo_matrix_t *matrix,
                                             double tx,
                                             double ty);
void        cairo_matrix_scale              (cairo_matrix_t *matrix,
                                             double sx,
                                             double sy);
void        cairo_matrix_rotate             (cairo_matrix_t *matrix,
                                             double radians);
cairo_status_t cairo_matrix_invert          (cairo_matrix_t *matrix);
void        cairo_matrix_multiply           (cairo_matrix_t *result,
                                             const cairo_matrix_t *a,
                                             const cairo_matrix_t *b);
void        cairo_matrix_transform_distance (const cairo_matrix_t *matrix,
                                             double *dx,
                                             double *dy);
void        cairo_matrix_transform_point    (const cairo_matrix_t *matrix,
                                             double *x,
                                             double *y);

Description

cairo_matrix_t is used throughout cairo to convert between different coordinate spaces. A cairo_matrix_t holds an affine transformation, such as a scale, rotation, shear, or a combination of these. The transformation of a point (x,y) is given by:

    x_new = xx * x + xy * y + x0;
    y_new = yx * x + yy * y + y0;
  

The current transformation matrix of a cairo_t, represented as a cairo_matrix_t, defines the transformation from user-space coordinates to device-space coordinates. See cairo_get_matrix() and cairo_set_matrix().

Details

cairo_matrix_t

typedef struct {
    double xx; double yx;
    double xy; double yy;
    double x0; double y0;
} cairo_matrix_t;

A cairo_matrix_t holds an affine transformation, such as a scale, rotation, shear, or a combination of those. The transformation of a point (x, y) is given by:

    x_new = xx * x + xy * y + x0;
    y_new = yx * x + yy * y + y0;

double xx; xx component of the affine transformation
double yx; yx component of the affine transformation
double xy; xy component of the affine transformation
double yy; yy component of the affine transformation
double x0; X translation component of the affine transformation
double y0; Y translation component of the affine transformation

cairo_matrix_init ()

void        cairo_matrix_init               (cairo_matrix_t *matrix,
                                             double xx,
                                             double yx,
                                             double xy,
                                             double yy,
                                             double x0,
                                             double y0);

cairo_matrix_init_identity ()

void        cairo_matrix_init_identity      (cairo_matrix_t *matrix);

cairo_matrix_init_translate ()

void        cairo_matrix_init_translate     (cairo_matrix_t *matrix,
                                             double tx,
                                             double ty);

cairo_matrix_init_scale ()

void        cairo_matrix_init_scale         (cairo_matrix_t *matrix,
                                             double sx,
                                             double sy);

cairo_matrix_init_rotate ()

void        cairo_matrix_init_rotate        (cairo_matrix_t *matrix,
                                             double radians);

cairo_matrix_translate ()

void        cairo_matrix_translate          (cairo_matrix_t *matrix,
                                             double tx,
                                             double ty);

cairo_matrix_scale ()

void        cairo_matrix_scale              (cairo_matrix_t *matrix,
                                             double sx,
                                             double sy);

cairo_matrix_rotate ()

void        cairo_matrix_rotate             (cairo_matrix_t *matrix,
                                             double radians);

cairo_matrix_invert ()

cairo_status_t cairo_matrix_invert          (cairo_matrix_t *matrix);

cairo_matrix_multiply ()

void        cairo_matrix_multiply           (cairo_matrix_t *result,
                                             const cairo_matrix_t *a,
                                             const cairo_matrix_t *b);

cairo_matrix_transform_distance ()

void        cairo_matrix_transform_distance (const cairo_matrix_t *matrix,
                                             double *dx,
                                             double *dy);

cairo_matrix_transform_point ()

void        cairo_matrix_transform_point    (const cairo_matrix_t *matrix,
                                             double *x,
                                             double *y);