[cairo] How to get 1px line width SVGSurface>ImageSurface ?

Behdad Esfahbod behdad at behdad.org
Tue May 11 13:22:49 PDT 2010


On 05/11/2010 04:19 PM, Stuart Axon wrote:
> Is there any way to setup an SVGSurface so that when I have a line width of 1, this will be 1 pixel when I draw it do an ImageSurface?

Cairo uses different units for different surfaces.  The raster surfaces are in
pixels while the vector surfaces are in points.  And they are mapped 1-to-1,
so in that sense when copying from one surface to another cairo assumes a
72dpi.  That is what you want.

> At the moment, the value 1 seems to make a really massive border.

Probably has more to do with the line not falling onto whole pixels.  Try
adding a .5 pixel offset to each direction.

behdad

> Dividing by arbitrary numbers helps, but I'm not sure the numbers are right :)
> 
>  S++


More information about the cairo mailing list