public function fill($windingRule = "nonzero") 
    {
        $polygonId = $this->edges->getNextPolygonId();
        $fillColor = ColorUtils::parse($this->fillStyle);
        
        foreach ($this->paths as $points) {
            $pointsCount = count($points);
            if ($pointsCount <= 2) {
                // Nothing to fill
                continue;
            }

            for ($i = 2; $i < $pointsCount; $i += 2) {
                $this->edges->add(new Edge(
                    $polygonId,
                    $points[$i - 2],
                    $points[$i - 1],
                    $points[$i],
                    $points[$i + 1],
                    $fillColor,
                    $windingRule));
            }
            
            // Close path
            if ($points[0] != $points[$pointsCount - 2] ||
                $points[1] != $points[$pointsCount - 1]
            ) {
                $this->edges->add(new Edge(
                    $polygonId,
                    $points[$pointsCount - 2],
                    $points[$pointsCount - 1],
                    $points[0],
                    $points[1],
                    $fillColor,
                    $windingRule));
            }
        }
    }
public function fill($windingRule = "nonzero") 
    {
        $polygonId = $this->edges->getNextPolygonId();
        $fillColor = ColorUtils::parse($this->fillStyle);
        
        foreach ($this->paths as $points) {
            $pointsCount = count($points);
            if ($pointsCount <= 2) {
                // Nothing to fill
                continue;
            }

            for ($i = 2; $i < $pointsCount; $i += 2) {
                $this->edges->add(new Edge(
                    $polygonId,
                    $points[$i - 2],
                    $points[$i - 1],
                    $points[$i],
                    $points[$i + 1],
                    $fillColor,
                    $windingRule));
            }
            
            // Close path
            if ($points[0] != $points[$pointsCount - 2] ||
                $points[1] != $points[$pointsCount - 1]
            ) {
                $this->edges->add(new Edge(
                    $polygonId,
                    $points[$pointsCount - 2],
                    $points[$pointsCount - 1],
                    $points[0],
                    $points[1],
                    $fillColor,
                    $windingRule));
            }
        }
    }
public function fill ( $ windingRule = "nonzero" ) { $ polygonId = $ this -> edges -> getNextPolygonId ( ) ; $ fillColor = ColorUtils :: parse ( $ this -> fillStyle ) ; foreach ( $ this -> paths as $ points ) { $ pointsCount = count ( $ points ) ; if ( $ pointsCount <= 2 ) { // Nothing to fill continue ; } for ( $ i = 2 ; $ i < $ pointsCount ; $ i += 2 ) { $ this -> edges -> add ( new Edge ( $ polygonId , $ points [ $ i - 2 ] , $ points [ $ i - 1 ] , $ points [ $ i ] , $ points [ $ i + 1 ] , $ fillColor , $ windingRule ) ) ; } // Close path if ( $ points [ 0 ] != $ points [ $ pointsCount - 2 ] || $ points [ 1 ] != $ points [ $ pointsCount - 1 ] ) { $ this -> edges -> add ( new Edge ( $ polygonId , $ points [ $ pointsCount - 2 ] , $ points [ $ pointsCount - 1 ] , $ points [ 0 ] , $ points [ 1 ] , $ fillColor , $ windingRule ) ) ; } } }
Fills the defined paths.

@param string $windingRule  The winding rule to be used for determining
which areas are covered by the current path. Valid values are
"evenodd" and "nonzero". Default is "nonzero".
Fills the defined paths .