[Cairo] Image functions

Alexandre Pigolkine pigolkine at gmx.de
Wed Oct 15 13:25:58 PDT 2003


The function works nicely.
Thanks a lot for the help.


On Wed, 2003-10-15 at 17:46, Carl Worth wrote:

> Ah, I see what you want. And yes, cairo_show_surface is a rather
> fixed-purpose convenience function. You can get more general behavior
> by instead using cairo_set_pattern followed by cairo_fill.
> For example, this function should do something like what you want:
> 	void
> 	show_partial_image (cairo_t *cr, cairo_surface_t *surface,
> 			    int x_source, int y_source,
> 			    int width, int height,
> 			    int x_dest, int y_dest)
> 	{
> 	    cairo_move_to (cr, x_dest-x_source, y_dest-y_source);
> 	    cairo_set_pattern (cr, surface);
> 	    cairo_rectangle (cr, x_dest, y_dest, width, height);
> 	    cairo_fill (cr);
> 	}
> Even more general effects can be obtained by using
> cairo_surface_set_matrix.
> -Carl
> PS. It may make sense to implement cairo_show_surface with code similar
> to the above. This would let us simplify the surface backend interface
> by dropping _cairo_surface_composite and instead force all drawing
> through _cairo_surface_composite_trapezoids.

More information about the cairo mailing list