[cairo] How to resize the cairo surface ?

anurag swarnkar anu_swar10 at yahoo.co.in
Tue Jan 29 04:32:59 PST 2008


First of all thanks for replying

>Only through creating a bigger surface and transferring the data with
>'cairo_set_source_surface() ; cairo_paint()'.
What i am concerned here is what are the APIs for getting the data and then setting it as a source.I tried with these APIs but i dont know whether this is correct or not.

    cairo_pattern_t* cairoPattern = cairo_pattern_create_for_surface(mData->mSurface);
    cairo_set_source(ctx, cairoPattern);
    cairo_paint();

Note: ctx is attached to another cairo surface. To which i want to draw the original contents
Is this correct or not?


>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.
Thats true. But here what i want to paint the image in the target without scaling it. That is with the original size.

thanks

----- Original Message ----
From: Kalle Vahlman <kalle.vahlman at gmail.com>
To: anurag swarnkar <anu_swar10 at yahoo.co.in>
Cc: cairo at cairographics.org
Sent: Tuesday, 29 January, 2008 2:13:07 PM
Subject: Re: [cairo] How to resize the cairo surface ?

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






      Meet people who discuss and share your passions. Go to http://in.promos.yahoo.com/groups
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cairographics.org/archives/cairo/attachments/20080129/e8e30ee5/attachment.html 


More information about the cairo mailing list