public function add(\Jdenticon\Canvas\Rasterization\Edge $edge) 
    {
        $minY = 0;
        $maxY = 0;

        if ($edge->y0 == $edge->y1) {
            // Skip horizontal lines
            return;
        } elseif ($edge->y0 < $edge->y1) {
            $minY = (int)($edge->y0);
            $maxY = (int)($edge->y1 + 0.996 /* 1/255 */);
        } else {
            $minY = (int)($edge->y1);
            $maxY = (int)($edge->y0 + 0.996 /* 1/255 */);
        }

        if ($maxY < 0 || $minY >= $this->height) {
            return;
        }

        if ($minY < 0) {
            $minY = 0;
        }
        if ($maxY > $this->height) {
            $maxY = $this->height;
        }
        
        if ($minY < $maxY) {
            $y = $minY;
            $x1 = $edge->intersection($y);

            while ($y < $maxY) {
                $x2 = $edge->intersection($y + 1);

                $fromX;
                $width;
                if ($x1 < $x2) {
                    $fromX = (int)($x1);
                    $width = (int)($x2 + 0.9999) - $fromX;
                } else {
                    $fromX = (int)($x2);
                    $width = (int)($x1 + 0.9999) - $fromX;
                }

                if ($fromX < 0) {
                    $width += $fromX;
                    $fromX = 0;

                    if ($width < 0) {
                        $width = 0;
                    }
                }

                if ($fromX < $this->width) {
                    if (!isset($this->scanlines[$y])) {
                        $this->scanlines[$y] = array();
                    }
                    
                    $this->scanlines[$y][] = new EdgeIntersection(
                        $fromX, $width, $edge);
                }

                $x1 = $x2;
                $y++;
            }
        }
    }