[cairo] how to copy a rect area from one surface to another

Kelvin Cheng KCheng at extracomm.com
Tue Dec 16 23:27:31 PST 2008


Below is the correct prototype of cairo_set_source_surface.  It does not 
takes 3 arguments as indicated in
the faq: cairo_set_source_surface (cr, dest_x - source_x, dest_y - 
source_y)


cairo_set_source_surface ()
void                cairo_set_source_surface            (cairo_t *cr,
                                                         cairo_surface_t 
*surface,
                                                         double x,
                                                         double y);
This is a convenience function for creating a pattern from surface and 
setting it as the source in cr with cairo_set_source(). 
The x and y parameters give the user-space coordinate at which the surface 
origin should appear. (The surface origin is its upper-left corner before 
any transformation has been applied.) The x and y patterns are negated and 
then set as translation values in the pattern matrix. 
Other than the initial translation pattern matrix, as described above, all 
other pattern attributes, (such as its extend mode), are set to the 
default values as in cairo_pattern_create_for_surface(). The resulting 
pattern can be queried with cairo_get_source() so that these attributes 
can be modified if desired, (eg. to create a repeating pattern with 
cairo_pattern_set_extend()).

cr :
a cairo context 
surface :
a surface to be used to set the source pattern 
x :
User-space X coordinate for surface origin 
y :
User-space Y coordinate for surface origin 

See
http://www.cairographics.org/manual/cairo-context.html#cairo-set-source-surface

Regards,
Kelvin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cairographics.org/archives/cairo/attachments/20081217/d1fa84a1/attachment.htm 


More information about the cairo mailing list