otaylor at redhat.com
Thu Jun 23 13:40:56 PDT 2005
On Thu, 2005-06-23 at 22:25 +0200, Tim Teulings wrote:
> > Is there any reason that you can't just use XCopyArea()?
> Of course I could but in priciple I would avoid mixing X11 and Cairo for
> drawing operations (In fact I recently droped the X11 GC from the
> relevant code).
> >>Nevertheless, can someone still explain me the to coords params to the
> >>cairo_set_source_surface method?
> > It's really simple - it's just the coordinates of the upper left corner
> > of the surface in user space coordinates.
> I rewrite the relevant code snipped:
> Hmmm, where exactly is the origin of the "user space"? If it is the top
> left corner of window I would have called
> But in the code above it is relative to the top left of the rectangle!?
cairo_set_source_surface (cr, surface,
destX - srcX, destY - srcSY)
should make perfect sense ... the source is shifted from the source
by the amount you are moving the rectangle. Then you draw the
destination rectangle on the destination surface.
It's a little hard to draw with ascii art, so I'm not going to try,
but I think the situation is very direct and very visual. Just
imagine shifting two sheets of paper over each other so that the
source and destination rectangles overlap.
> So while the documentation is true ("the x and y patterns are negated
> and then set as translation values in the pattern matrix") I would add
> (or exchange that part) by a more "visual" and less mathematical
> description of what is happing. For example: "The parameters x and y
> that are passed to this method are substraced from the coordinates of
> every drawing operation to calculate their matching source coordinates
> in the source surface relative to their origin." Is this better?
The sentence before in the docs is much more descriptive to me:
* The @x and @y parameters give the user-space coordinate at which
* the surface origin should appear.
I think Carl was just being thorough in describing what happens to
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050623/2953c162/attachment.pgp
More information about the cairo