Re: fill-rule problem ..

i simplified the path to a square with a "V" in it.

<svg width="300" height="200">
  <path id="A" transform="translate(20,20)" stroke-width="2" stroke="blue"
fill="lightgray" fill-rule="nonzero"
        d="M0,0 H100 V100 H0 Z M10,50 50,90 90,50" />  <!-- clockwise /
counterclockwise -->
  <path id="B" transform="translate(140,20)" stroke-width="2" stroke="blue"
fill="lightgray" fill-rule="nonzero"
        d="M0,0 H100 V100 H0 Z M90,50 50,90 10,50" />  <!-- clockwise /
clockwise -->
</svg>

1) if a (sub)path is not closed, an invisible closepath from the (sub)path's
current point to its initial point is used for filling.
2) if one path contains the other completely the fill-rule determines if the
subpath has to be filled or not.
3) fill-rule="nonzero" (the default) will
   a) fill the inner subpath, if it has the same (angular) direction as the
outer subpath.
   b) not fill the the inner subpath, if its angular direction is different
to the outer subpath's.
4) fill-rule="evenodd" will never fill the inner subpath


it is conform to the SVG 1.1 spec, that there is *no way* to fill the square
in path (id="A") completely.
the path can be modified (id="B")to match point 3a) above. But in case of an
"N"-shaped subpath instead of a "V" that wouldn't help either.
--
stefan


----- Original Message -----
From: "Doug Schepers" <doug@schepers.cc>
To: "Goessner / MecXpert" <goessner@mecxpert.de>
Sent: Wednesday, May 01, 2002 2:24 PM
Subject: Re: fill-rule problem ..


> Could this be a bug in ASV3?  I got it to render as solid once, after
> refreshing a couple of times, and once got a blue artifact line straight
> from (50,50) to (90,50). [WinMe/IE6/ASV3]
>
> What is the logic behind it not filling the square with gray? No lines are
> being crossed. Do I misunderstand the fill rule?
>
> -Doug
>
> ----- Original Message -----
> From: "Goessner / MecXpert" <goessner@mecxpert.de>
> To: <www-svg@w3.org>
> Sent: Wednesday, May 01, 2002 5:48 AM
> Subject: fill-rule problem ..
>
>
> > i have a simple square with two quadratic bezier segments in it. it is
> easy
> > to define this by a single path element.
> >
> > <svg>
> >   <path transform="translate(20,20)" stroke-width="2" stroke="blue"
> > fill="lightgray"
> >         d="M0,0 H100 V100 H0 Z M10,50 Q30,30 50,50 T90,50" />
> > </svg>
> >
> > but i cannot find a fill-rule to completely fill the square. even the
new
> > winding-count rule wouldn't work.
> >
> > --
> > stefan goessner
> >
> >
>

Received on Wednesday, 1 May 2002 16:02:07 UTC