Exemplo n.º 1
0
 /**
  * Credit to Leif Åstrand <*****@*****.**> for the base of the round corners.
  *
  * Note there is a defect with this, as non-transparent corners get opaque circles of color. Maybe mask it with auto-generated corners?
  *
  * @link  http://www.imagemagick.org/Usage/thumbnails/#rounded
  */
 protected function _rounded($radius, $sides, $antialias = 0)
 {
     extract(parent::_rounded($radius, $sides, null));
     $image = '"' . $this->image_temp . '"';
     $r = $radius;
     $command = $image . " ( +clone -alpha extract " . (!$tr ? '' : "-draw \"fill black polygon 0,0 0,{$r} {$r},0 fill white circle {$r},{$r} {$r},0\" ") . "-flip " . (!$br ? '' : "-draw \"fill black polygon 0,0 0,{$r} {$r},0 fill white circle {$r},{$r} {$r},0\" ") . "-flop " . (!$bl ? '' : "-draw \"fill black polygon 0,0 0,{$r} {$r},0 fill white circle {$r},{$r} {$r},0\" ") . "-flip " . (!$tl ? '' : "-draw \"fill black polygon 0,0 0,{$r} {$r},0 fill white circle {$r},{$r} {$r},0\" ") . ') -alpha off -compose CopyOpacity -composite ' . $image;
     $this->exec('convert', $command);
 }
Exemplo n.º 2
0
 protected function _rounded($radius, $sides, $antialias = 0)
 {
     extract(parent::_rounded($radius, $sides, null));
     $sizes = $this->sizes();
     $sizes->width_half = $sizes->width / 2;
     $sizes->height_half = $sizes->height / 2;
     if (!$tl) {
         $tlimage = $this->imagick->clone();
         $tlimage->cropImage($sizes->width_half, $sizes->height_half, 0, 0);
     }
     if (!$tr) {
         $trimage = $this->imagick->clone();
         $trimage->cropImage($sizes->width_half, $sizes->height_half, $sizes->width_half, 0);
     }
     if (!$bl) {
         $blimage = $this->imagick->clone();
         $blimage->cropImage($sizes->width_half, $sizes->height_half, 0, $sizes->height_half);
     }
     if (!$br) {
         $brimage = $this->imagick->clone();
         $brimage->cropImage($sizes->width_half, $sizes->height_half, $sizes->width_half, $sizes->height_half);
     }
     $this->imagick->roundCorners($radius, $radius);
     if (!$tl) {
         $this->imagick->compositeImage($tlimage, \Imagick::COMPOSITE_DEFAULT, 0, 0);
     }
     if (!$tr) {
         $this->imagick->compositeImage($trimage, \Imagick::COMPOSITE_DEFAULT, $sizes->width_half, 0);
     }
     if (!$bl) {
         $this->imagick->compositeImage($blimage, \Imagick::COMPOSITE_DEFAULT, 0, $sizes->height_half);
     }
     if (!$br) {
         $this->imagick->compositeImage($brimage, \Imagick::COMPOSITE_DEFAULT, $sizes->width_half, $sizes->height_half);
     }
 }
Exemplo n.º 3
0
 protected function _rounded($radius, $sides, $antialias)
 {
     extract(parent::_rounded($radius, $sides, $antialias));
     $tl and $this->round_corner($this->image_data, $radius, $antialias, true, true);
     $tr and $this->round_corner($this->image_data, $radius, $antialias, true, false);
     $bl and $this->round_corner($this->image_data, $radius, $antialias, false, true);
     $br and $this->round_corner($this->image_data, $radius, $antialias, false, false);
 }