[cairo] Pretty-please, help with cropping
Marty.Sherrill at celera.com
Tue Mar 6 13:56:59 PST 2007
Perfect! An instant ~2x performance boost, and my dignity restored! :-)
Thank you so much Carl for this information,
Carl Worth <cworth at cworth.org> wrote on 03/06/2007 04:07:02 PM:
> So, copying the sub-piece of big_surface of interest would be as
> simple as this:
> cairo_t *cr = cairo_create (small_surface);
> cairo_set_source_surface (cr, big_surface, -x, -y);
> cairo_rectangle (cr, 0, 0, width, height);
> cairo_fill (cr);
> The interesting thing to note here, (and what will hopefully be an
> "Ah-ha!" moment for some readers), is that cairo does not have any
> drawing operation that is "paint an image". Instead, cairo has a much
> more general notion where you can use an image, (or other more general
> patterns, such as gradients), as the source pattern. And with that,
> you can draw any shape you want, and the appropriate pieces of the
> source surface will appear within that shape.
> Does that make sense? Give the above sequence a try and let us know
> how it goes.
> > Congratulations on Cairo version 1.4.0. It's really a super package.
> Thanks! I hope you have lots of fun with it.
> > p.s. I'm using rcairo on Red Hat, if that matters.
> I'm not up on ruby syntax, but hopefully it is extremely
> straightforward for you to translate the above from C to ruby.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cairo