[cairo] Extents of degenerate paths

Bill Spitzak spitzak at thefoundry.co.uk
Thu May 10 03:38:56 PDT 2007


Yes returning a bounding box of zero is correct for the definition of 
how Cairo works. The problem is that the original poster wants the same 
thing I have requested quite a few times:

Setting the line width to zero should produce a "special" stroke mode 
which draws very thin but nice-looking lines that hide the antialiasing 
on the same shape when filled and never have antialiasing if they are 
horizontal or vertical. It also, I guess, changes the rules for the 
bounding box so that it does not really surround the pixels that will be 
drawn, but instead is the bounding box of an infinitesimally thin line.

Believe me, this is EXTREMELY common, so common that T Rowley just 
assumed that he should set the line width to zero to get this effect, as 
though it was second nature. Notice that he purposely set the line 
width, rather than leaving it at the default value, which reveals this 
implicit assumption. Every other graphics api I have ever seen that 
allows the line width to be set has exactly this behavior: zero is a 
special mode that produces visible lines, often quite different than 
what you get with 1 or with .000001.

Behdad Esfahbod wrote:
> On Wed, 2007-05-09 at 15:20 +0200, David Turner wrote:
>> On Mon, 07 May 2007 20:07:15 -0400, "Behdad Esfahbod" <behdad at behdad.org> said:
>>> On Mon, 2007-05-07 at 14:46 -0400, T Rowley wrote:
>>>> In Mozilla SVG, I've run across the case where the code needs to check 
>>>> the extents of a single diagonal line.  With stroke_width set to zero I 
>>>> get back 0,0,0,0 rather than the a tight bounding box for the line.


More information about the cairo mailing list