[cairo] How to export image_surface pixel data?

Vladimir Vukicevic vladimirv at gmail.com
Thu Jan 19 08:17:11 PST 2006

On 1/19/06, mental at rydia.net <mental at rydia.net> wrote:
> Quoting Vladimir Vukicevic <vladimirv at gmail.com>:
> > The internal backend methods acquire_dest_image and
> > release_dest_image already have this exact API; I'm not sure
> > whether it should really be exposed, though.
> {acquire,release}_dest_image avoids blitting if the original surface
> is an image?

Sort of; the API has a notion of an "interest rect" (the rectangle
that the caller is interested in) and the returned "image rect" (the
portion of the surface that's actually returned).  The image surface
backend always returns the full surface, i.e. itself, with an image
rect set to the full surface.  It doesn't extract out just a portion.

> > It's possible to get the exact same semantics by just creating a
> > temporary surface of your width/height, drawing your original
> > surface to it, doing whatever munging you want, and drawing
> > back...
> Yeah, that's the thing; I'd like to avoid those two blits when it's
> possible to do so.

True, but the only time it's possible to do that is with an image
surface, most likely.. at which point you've already lost the speed
race, and a few fast MMX blits aren't going to kill you, no?

- Vlad

More information about the cairo mailing list