[Cairo] New functions for cairo_matrix

Duncan Mak duncan at ximian.com
Fri Nov 14 12:46:06 PST 2003


Hi,

I needed an 'equals' function and an accessor to the elements in a
cairo_matrix_t, so I wrote these two functions:

int
cairo_matrix_equals (const cairo_matrix_t *x, const cairo_matrix_t *y)
{
        int i, j;
        for (i = 0; i < 3; i++)
                for (j = 0; j < 2; j++)
                        if (x->m[i][j] != y->m[i][j])
                                return 0;
        return 1;
}

cairo_status_t
cairo_matrix_get_element (const cairo_matrix_t *matrix, int i, int j, 
double *element)
{
        if (i < 3 && j < 2) {
                *element = matrix->m[i][j];
                return CAIRO_STATUS_SUCCESS;

        } else
		/* maybe CAIRO_STATUS_INVALID_ARG? */
                return CAIRO_STATUS_INVALID_MATRIX;
}

I can't keep them inside Mono's GDI+ implementation because 'struct
cairo_t' is inside cairoint.h. 

Can these be included?

Duncan.





More information about the cairo mailing list