[cairo] API Shakeup: cairo_current_matrix

Bill Spitzak spitzak at d2.com
Thu Apr 7 14:21:02 PDT 2005



Carl Worth wrote:
> On Thu, 07 Apr 2005 19:56:34 +0200, David Reveman wrote:
> 
>>>So I think we'll just want a different matrix datatype
>>>there. cairo_projective_matrix_t ? cairo_pattern_set_project_matrix ?
>>
>>That would mean that you wont be able to use any of the cairo_matrix_*
>>functions with projective matrices. Having another set of matrix
>>functions for projective matrices doesn't seem like a good idea to me,
>>and having no utility functions for projective matrices seems even
>>worse.
> 
> 
> Yes, I understand both of these downsides.
> 
> Do you have an alternate proposal?

Make cairo_matrix 3x3 by adding another row (it looks like a column in 
your structure):

typedef struct _cairo_matrix {
    double xx; double yx; double wx;
    double xy; double yy; double wy;
    double x0; double y0; double w0;
} cairo_matrix_t;

Affine transforms have undefined results if wx and wy are not zero (thus 
allowing perspective transforms to be enabled in the future). You can 
either say there is undefined results if w0 is not 1, or divide 
everything else by w0 before use (ie internally w0==1 at all times).

The functions that take 6 aruments to set the matrix set wx,wy,w0 to 0,0,1.



More information about the cairo mailing list