* @package cleversvg * @subpackage elements */ class csRect extends csBaseShape { protected $xml_node_name = 'rect'; /** * Class constructor * * @param mixed $x * @param mixed $y * @param mixed $width * @param mixed $height * @param array $attrs */ public function __construct($x=null, $y=null, $width=null, $height=null, $attrs=array()) { $this->setX($x); $this->setY($y); $this->setWidth($width); $this->setHeight($height); $this->attributes = array_merge($attrs, $this->attributes); } /** * The x-axis coordinate of one corner of the rectangular region into which an * embedded 'svg' element is placed. * */ public function setX($x) { $this->setAttribute('x', $x); } /** * The y-axis coordinate of one corner of the rectangular region into which an * embedded 'svg' element is placed. * */ public function setY($y) { $this->setAttribute('y', $y); } /** * For outermost 'svg' elements, the intrinsic width of the SVG document * fragment. For embedded 'svg' elements, the width of the rectangular * region into which the 'svg' element is placed. * */ public function setWidth($width) { $this->setAttribute('width', $width); } /** * For outermost 'svg' elements, the intrinsic height of the SVG document * fragment. For embedded 'svg' elements, the height of the rectangular * region into which the 'svg' element is placed. * */ public function setHeight($height) { $this->setAttribute('height', $height); } /** * Sets the radius of the corners * * @param int $radius */ public function setRadius($radius) { $this->setAttribute('rx', $radius); $this->setAttribute('ry', $radius); } /** * Sets the x-radius * * @param int $rx */ public function setRx($rx) { $this->setAttribute('rx', $rx); } /** * Sets the y-radius * * @param int $ry */ public function setRy($ry) { $this->setAttribute('ry', $ry); } }