[cairo] line width questions

Behdad Esfahbod behdad at behdad.org
Mon Aug 18 16:00:05 PDT 2008

Bill Spitzak wrote:

> Also OpenGL, Windows GDI, GDI+, PDF, AGG, SVG, DirectX, SilverLight, and 
> a whole lot of others use "zero line width" to mean a special line 
> drawing algorithim. In fact it has been in *every single graphics api* I 
> have ever seen that has an ability to set the line width, except for Cairo.
> I have said this quite a few times on this mailing list but there seems 
> to be no interest in replicating it in Cairo, and have pretty much given 
> up as I don't want to make myself too much of an a**hole about it.

There's just not been a decent API for this proposed (abusing 0 is a
non-starter).  After it's proposed and discussed, a patch is welcome.

> The best definition of zero line width is that you get the smallest 
> integer number of device pixels that is larger than a fixed distance, 
> such as 1/300 of an inch (this would match what PostScript did on the 
> first printers that used it).

So what does it get you for on-screen?  1px wide?  What about when we get
350dpi displays?  We already see 280dpi ones.

> In addition the line ends are adjusted so that horizontal and vertical 
> lines are aligned with pixel boundaries so that the line thickness looks 
> the same no matter where it is drawn.

This is where it becomes impossible to implement.  No matter which side you
round, it's going to make someone unhappy.


More information about the cairo mailing list