Grafika\DrawingObject\Polygon::__construct PHP Method

__construct() public method

Creates a polygon.
public __construct ( array $points = [[0, 0], [0, 0], [0, 0]], integer $borderSize = 1, Color | string | boolean $borderColor = '#000000', Color | string | boolean $fillColor = '#FFFFFF' )
$points array Array of all X and Y positions. Must have at least three positions.
$borderSize integer Size of the border in pixels. Defaults to 1 pixel. Set to 0 for no border.
$borderColor Grafika\Color | string | boolean Border color. Defaults to black. Set to null for no color.
$fillColor Grafika\Color | string | boolean Fill color. Defaults to white. Set to null for no color.
    public function __construct($points = array(array(0, 0), array(0, 0), array(0, 0)), $borderSize = 1, $borderColor = '#000000', $fillColor = '#FFFFFF')
    {
        if (is_string($borderColor)) {
            $borderColor = new Color($borderColor);
        }
        if (is_string($fillColor)) {
            $fillColor = new Color($fillColor);
        }
        $this->points = $points;
        $this->borderSize = $borderSize;
        $this->borderColor = $borderColor;
        $this->fillColor = $fillColor;
    }