[cairo] help with cairo_scale
mkbosmans at gmail.com
Thu Dec 16 18:11:49 PST 2010
2010/12/17 Andrea Cimitan <andrea.cimitan at gmail.com>:
> Just for the records, the problem is that the line_width is scaled as
> well, and of course you can't use set_source and stroke after the
> restore, because after the restore the previous set_source is restored
> as well (so it ignores the call inside save/restore).
> To play only with a similar scale like this, you can get the matrix
> and set_matrix after the scale (it preserves the line width), or, if
> you know your previous code was running the identify matrix, just use
> cairo_identity_matrix without the need to get the matrix as well!
Yes, replacing the cairo_save and cairo_restore calls with saving and
restoring only the matrix yourself would do the trick.
You could also manipulate the matrix of the pattern itself.
cairo_matrix_init_scale (&matrix, 0.5, 0.5);
cairo_pattern_set_matrix (pattern, &matrix);
More information about the cairo