function polygon($points, $color, $width = null, $style = null, $fill = false) { $this->_set_fill_color($color); $this->_set_stroke_color($color); if (!$fill && isset($width)) { $this->_set_line_style($width, "square", "miter", $style); } $y = $this->y(array_pop($points)); $x = array_pop($points); $this->_pdf->moveto($x, $y); while (count($points) > 1) { $y = $this->y(array_pop($points)); $x = array_pop($points); $this->_pdf->lineto($x, $y); } if ($fill) { $this->_pdf->fill(); } else { $this->_pdf->closepath_stroke(); } }