[cairo] Correctly copying surfaces

Felix Lelchuk felixlelchuk at web.de
Sat Mar 26 07:28:34 PDT 2011


Hello Alex,

Thank you for your reply.

I tried setting the pattern filter to any of the CAIRO_FILTER_* values, 
but results looked quite blurry.
Setting the value to CAIRO_FILTER_NEAREST or CAIRO_FILTER_FAST produced 
better results but not quite what one would expect.

When I draw on one image surface and copy it over to another one at 
double size (scaling the pattern matrix), can I expect the output to
be the same as if I drew at double size on the destination directly? It 
should be the same because we're dealing with vectors, right?
But does the cairo image surface even keep track of vectors, or do 
things get rasterized immediately? If not, that might just explain why
the output looks like a stretched bitmap.

Maybe the recording surface that was mentioned in other posts suits 
better here but seems like it is not yet implemented in cairomm. :-(

Felix Lelchuk

Am 25.03.2011 19:08, schrieb Alexander Shulgin:
> On Fri, Mar 25, 2011 at 17:38, Felix Lelchuk<FelixLelchuk at web.de>  wrote:
>> Hello!
>>
>> I'm new to Cairo and I've got a question about copying surfaces.
>>
>> I'm trying to draw on one image surface and then copy it over to another by creating a pattern and then drawing it using cairo_rectangle and cairo_fill. None of the surfaces has anti-aliasing turned on but I get a blurred (anti-aliased?) image if I scale the pattern by 1.5. It looks like the copied area is rasterized and the copying is actually a "bitmap stretching".
>>
>> What am I doing wrong? How do I get the expected un-blurred behaviour?
> Tried this: http://cairographics.org/manual/cairo-cairo-pattern-t.html#cairo-pattern-set-filter
> ?
>
> --
> Alex
>



More information about the cairo mailing list