[cairo] Correctly copying surfaces

Andrea Canciani ranma42 at gmail.com
Sat Mar 26 08:07:27 PDT 2011

On Sat, Mar 26, 2011 at 3:28 PM, Felix Lelchuk <felixlelchuk at web.de> wrote:
> 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.

It depends on the surface you're using.
Image surfaces are immediately rasterized.

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

Recording, SVG, PS, PDF surfaces should preserve the vector content, but
currently there are some issues with them, too:


> 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
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo

More information about the cairo mailing list