Grafika\DrawingObject\Rectangle::__construct PHP Method

__construct() public method

Creates a rectangle.
public __construct ( integer $width, integer $height, array $pos = [0, 0], integer $borderSize = 1, Color | string | null $borderColor = '#000000', Color | string | null $fillColor = '#FFFFFF' )
$width integer Width of rectangle in pixels.
$height integer Height in pixels.
$pos array Array of X and Y position. X is the distance in pixels from the left of the canvass to the left of the rectangle. Y is the distance from the top of the canvass to the top of the rectangle. Defaults to array(0,0).
$borderSize integer Size of the border in pixels. Defaults to 1 pixel. Set to 0 for no border.
$borderColor Grafika\Color | string | null Border color. Defaults to black. Set to null for no color.
$fillColor Grafika\Color | string | null Fill color. Defaults to white. Set to null for no color.
    public function __construct($width, $height, $pos = 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->width = $width;
        $this->height = $height;
        $this->pos = $pos;
        $this->borderSize = $borderSize;
        $this->borderColor = $borderColor;
        $this->fillColor = $fillColor;
    }