[cairo] Blurriness when drawing from a temporary surface as the source

Gerdus van Zyl gerdusvanzyl at gmail.com
Mon Jun 29 07:39:29 PDT 2009


The surface is probably getting scaled and thus the blurriness (if
working with raster surface). If you want it sharp you will have to
issue the drawing commands again or make your temp surface of the same
resolution as the target so no scaling is needed.

>> whether perhaps I'm doing something suboptimal in setting up my
>> temporary surface to pass to cairo_set_source.
cairo_surface_create_similar will do the right thing.

~Gerdus

On Mon, Jun 29, 2009 at 2:59 PM, Hakki Dogusan<dogusanh at tr.net> wrote:
> Hi,
>
> Adam Richard wrote:
>> Hi,
>>
>> When I draw a shape normally, it works fine.  However, when I create a
>> temporary surface, draw that same shape on it, then draw using the
>> temporary surface with cairo_set_source, the image is sometimes more
>> blurry (of lower quality) than the one drawn directly.  It is especially
>> noticeable when drawing small shapes; not as much when drawing larger
>> shapes.
>>
>> I've only noticed this blurriness in a png file resulting from
>> write_to_png; when I write to a postscript instead it is not
>> noticeable.  I also only notice it when I have matrix transformations
>> set up so that the units of the shape I'm drawing are much different
>> than device units.
>>
>
> I may be wrong but, it may be related to:
> FAQ: How do I draw a sharp, single-pixel-wide line?
>
> (I ended up adjusting all coordinates for zooming, instead of using
> cairo_scale.)
>
>
>> I've tried disabling antialiasing with cairo_set_antialias, and it does
>> get disabled, but the 2 images are still different.
>>
>> Does anyone have any ideas as to what could cause an effect like this?
>> I'm new to Cairo so I'm not sure whether it's using some approximation
>> algorithm that could result in unavoidable blurriness in some cases, or
>> whether perhaps I'm doing something suboptimal in setting up my
>> temporary surface to pass to cairo_set_source.
>>
>>
>
> --
> Regards,
> Hakki Dogusan
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
>


More information about the cairo mailing list