Beispiel #1
0
 /**
  * Draw a rounded rectangle on the image.
  *
  * @param  int $x
  * @param  int $y
  * @param  int $w
  * @param  int $h
  * @param  int $rx
  * @param  int $ry
  * @return Gmagick
  */
 public function roundedRectangle($x, $y, $w, $h = null, $rx = 10, $ry = null)
 {
     $x2 = $x + $w;
     $y2 = $y + (null === $h ? $w : $h);
     if (null === $ry) {
         $ry = $rx;
     }
     $draw = new \GmagickDraw();
     if (null !== $this->fillColor) {
         $draw->setFillColor($this->image->getColor($this->fillColor, $this->opacity));
     }
     if ($this->strokeWidth > 0) {
         $draw->setStrokeColor($this->image->getColor($this->strokeColor, $this->opacity));
         $draw->setStrokeWidth($this->strokeWidth);
     }
     $draw->roundRectangle($x, $y, $x2, $y2, $rx, $ry);
     $this->image->resource()->drawImage($draw);
     return $this;
 }