[cairo] Patterns, coordinate systems, and the current point

Carl Worth cworth at east.isi.edu
Thu Apr 29 05:42:35 PDT 2004

I'm tracking down some of the SVG gradient regression problems since the
recent pattern API additions/improvements.

I think we want the patch below, which fixes things so that the
coordinates for creating linear and radial gradients are in user
space. Currently, they are in a bizarre relative-to-the-current-point

At the same time, we do need a way to position surface-based
patterns. The pattern matrix should work fine for that. One thing that
is perhaps unpleasant is the inconsitency with the mechanism for
positioning cairo_show_surface which does use the current point. Do we
care? Do we want to change the semantics of cairo_show_surface?

Meanwhile, I've been skimming the PostScript pattern support. It has a
required pattern operator (makepattern) that locks the relationship
between pattern space and user space. We may want a way to do that, (to
allow the pattern to use a previous CTM rather than the current matrix
at the time of cairo_set_pattern).

So, perhaps:

	cairo_lock_pattern (cairo_t *cr, cairo_pattern_t *pattern);


diff -u -p -r1.47 cairo_gstate.c
--- a/src/cairo_gstate.c        23 Apr 2004 17:08:53 -0000      1.47
+++ b/src/cairo_gstate.c        29 Apr 2004 11:29:49 -0000
@@ -364,10 +364,6 @@ _cairo_gstate_set_pattern (cairo_gstate_
     gstate->pattern = pattern;
     cairo_pattern_reference (pattern);
-    _cairo_gstate_current_point (gstate,
-                                 &gstate->pattern_offset.x,
-                                 &gstate->pattern_offset.y);

More information about the cairo mailing list