[cairo] How to resize the cairo surface ?

Kalle Vahlman kalle.vahlman at gmail.com
Tue Jan 29 04:13:07 PST 2008


2008/1/29, anurag swarnkar <anu_swar10 at yahoo.co.in>:
>
> Hi All,
>
> I have seen that there is an APi in cairo for scaling an image.
> But if I the want to resize the cairo surface without actually scaling the
> image how is this possible in cairo. That means if i am resizing the cairo
> surface to bigger size then all the pixels outside the range of the old
> surface-size should be set to zero.
>
> Is this possible in cairo ?

Only through creating a bigger surface and transferring the data with
'cairo_set_source_surface() ; cairo_paint()'.

The only surface type that seems to have any notion of resize (in
cairo API) is xlib, and that is for reacting to outside changes to the
native drawable.

And just to clarify, cairo's scaling works in the same fashion. It
scales the source (which may be an  image or something else) and
paints it to the target. It never changes the source image.

-- 
Kalle Vahlman, zuh at iki.fi
Powered by http://movial.fi
Interesting stuff at http://syslog.movial.fi


More information about the cairo mailing list