[cairo] How cairo_pattern_set_matrix() works?

Owen Taylor otaylor at redhat.com
Fri Mar 18 10:15:14 PST 2005


Silenio Quarti wrote:
> What cairo_pattern_set_matrix() should do? Should it affect every
> individual cell or the whole pattern coordinate system? It seems also
> that the matrix have the inverse effect. If the matrix scaling portion
> is 0.5, it actually enlarges the image, instead of reducing it.
> 
> For example, in the code below I was expecting 4 surfaces/pixmaps
> of reduced size (30x30) to be drawn completely (one in which corner of the
> rectangle (50,50, 60,60)), but instead the output is partial enlarged
> images.
> 
> Is this the expected behavior?

The matrix for a pattern defines a mapping from user space to pattern
space. So, if we set a scale on the pattern matrix of 0.5, that means
that for every unit we move in user space, we move 0.5 units in pattern
space ... that is, enlargement.

I'm not sure what you mean by individual cell vs. whole pattern 
coordinate system. If you set a pattern to repeat, the repeat is in
pattern space.

Regards,

						Owen




More information about the cairo mailing list