[cairo] painting a source to coordinates on a surface

Carl Worth cworth at cworth.org
Tue Mar 7 11:19:33 PST 2006


On Tue, 07 Mar 2006 20:10:06 +0100, Norbert Fabritius wrote:
> I loaded an image as a source for a cairo-context, and now I wonder how I
> can paint that source to some coordinates on the surface of the context.

	context.set_source_surface (image, x, y)
	context.paint ()

> context.paint() does the job, but doesn't accept coordinates. I find it
> very hard to find good documentation on all the cairo principles, like
> transforming and translating, which may solve my problem.

Yes, this kind of introductory documentation is still missing. Though
I hope to dedicate myself to writing something as soon as the 1.2
release is out.

Briefly, the source used in all cairo drawing is a pattern, which has
an associated transformation matrix. The set_source_surface function
is a convenience function that performs the common tasks of creating a
pattern from the given surface, and setting its transformation matrix
such that the origin of the surface will be translated to appear at
location (x,y) on the destination surface when painted.

I hope this helps, (and please feel free to continue to ask questions
here until we improve the documentation).

-Carl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060307/65890bd4/attachment.pgp


More information about the cairo mailing list