コード例 #1
0
ファイル: Fuel_Imagemagick.php プロジェクト: hiproz/mincms
 /**
  * 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);
 }
コード例 #2
0
ファイル: Fuel_Imagick.php プロジェクト: hiproz/mincms
 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, Fuel_Imagick::COMPOSITE_DEFAULT, 0, 0);
     }
     if (!$tr) {
         $this->imagick->compositeImage($trimage, Fuel_Imagick::COMPOSITE_DEFAULT, $sizes->width_half, 0);
     }
     if (!$bl) {
         $this->imagick->compositeImage($blimage, Fuel_Imagick::COMPOSITE_DEFAULT, 0, $sizes->height_half);
     }
     if (!$br) {
         $this->imagick->compositeImage($brimage, Fuel_Imagick::COMPOSITE_DEFAULT, $sizes->width_half, $sizes->height_half);
     }
 }