[cairo] RFC: an cairo image operator - cairo_image()
otte at redhat.com
Tue Apr 20 23:17:24 PDT 2010
On Tue, 2010-04-20 at 13:40 +0200, Arjen Nienhuis wrote:
> It's possible to draw an image (the contents of an Image Surface) onto
> a cairo surface with the following code:
If I'm not completely mistaken, what people usually want is not to scale
the image, but just paint it at an x, y coordinate. And in this case
cairo_set_source_surface(cr, image, -x, -y);
is enough. So the API buys them one line.
> 2: For SVG and PDF (PS?) backends implement it with the native image
> operators: <svg:image ...> and PDFs /Image. Now images are always
> pattern fills.
Cairo has always gone the way of deconstructing operations upon
rendering. So in this example it would mean that you'd write code for
the svg and pdf backends that checks that the current operation is a
rectangular fill exactly the size of the image and then emitting an
<svg:image> instead of what it currently does.
So in closing I'm very unconvinced that such a shortcut buys Cairo a
lot. And I'm completely unconvinced that it should be another backend
vfunc. I'm very interested in an implementation of <svg:image> though.
More information about the cairo