当前位置: 首页>>代码示例>>PHP>>正文


PHP ImagickDraw::ellipse方法代码示例

本文整理汇总了PHP中ImagickDraw::ellipse方法的典型用法代码示例。如果您正苦于以下问题:PHP ImagickDraw::ellipse方法的具体用法?PHP ImagickDraw::ellipse怎么用?PHP ImagickDraw::ellipse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ImagickDraw的用法示例。


在下文中一共展示了ImagickDraw::ellipse方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: perform

 /**
  * Draws an ellipse on the handle
  *
  * @param ImageMagick-object $handle The handle on which the ellipse is drawn
  * @param Zend_Image_Action_DrawEllipse $ellipseObject The object that with all info
  */
 public function perform(Zend_Image_Adapter_ImageMagick $adapter, Zend_Image_Action_DrawEllipse $ellipseObject)
 {
     $draw = new ImagickDraw();
     $strokeColor = (string) $ellipseObject->getStrokeColor();
     $strokeAlpha = $ellipseObject->getStrokeAlpha() * 0.01;
     $draw->setStrokeColor($strokeColor);
     $draw->setStrokeOpacity($strokeAlpha);
     $draw->setStrokeWidth($ellipseObject->getStrokeWidth());
     $strokeDashArray = $ellipseObject->getStrokeDashPattern();
     if (count($strokeDashArray) > 0) {
         $draw->setStrokeDashArray($strokeDashArray);
     }
     $draw->setStrokeDashOffset($ellipseObject->getStrokeDashOffset());
     if ($ellipseObject->filled()) {
         $fillColor = (string) $ellipseObject->getFillColor();
         $draw->setFillColor($fillColor);
         $draw->setFillOpacity($ellipseObject->getFillAlpha() * 0.01);
     } else {
         $draw->setFillOpacity(0);
     }
     $width = $ellipseObject->getWidth();
     $height = $ellipseObject->getHeight();
     $x = $ellipseObject->getLocation()->getX();
     $y = $ellipseObject->getLocation()->getY();
     $draw->ellipse($x, $y, $width / 2, $height / 2, 0, 360);
     $adapter->getHandle()->drawImage($draw);
 }
开发者ID:BGCX262,项目名称:zym-svn-to-git,代码行数:33,代码来源:DrawEllipse.php

示例2: draw

 /**
  * @param ImageInterface $image
  * @return ImageInterface
  */
 public function draw($image)
 {
     $strokeColor = new \ImagickPixel($this->getBorderColor()->getHexString());
     $fillColor = new \ImagickPixel($this->getFillColor()->getHexString());
     $draw = new \ImagickDraw();
     $draw->setStrokeColor($strokeColor);
     $draw->setFillColor($fillColor);
     $draw->setStrokeWidth($this->borderSize);
     list($x, $y) = $this->pos;
     $left = $x + $this->width / 2;
     $top = $y + $this->height / 2;
     $draw->ellipse($left, $top, $this->width / 2, $this->height / 2, 0, 360);
     $image->getCore()->drawImage($draw);
     return $image;
 }
开发者ID:kosinix,项目名称:grafika,代码行数:19,代码来源:Ellipse.php

示例3: test_shape

function test_shape(&$canvas)
{
    $draw = new ImagickDraw();
    $draw->setFillColor('transparent');
    $draw->setStrokeColor('#F02B88');
    $draw->setStrokeWidth(9);
    $draw->translate(200, 100);
    $draw->rectangle(-50, -50, 50, 50);
    $draw->translate(200, 100);
    $draw->ellipse(0, 0, 100, 80, 0, 360);
    $draw->skewX(-30);
    $draw->translate(200, 100);
    $draw->circle(0, 0, 50, 50);
    $canvas->drawImage($draw);
}
开发者ID:badlamer,项目名称:hhvm,代码行数:15,代码来源:draw_example.php

示例4: applyToImage

 /**
  * Draw ellipse instance on given image
  *
  * @param  Image   $image
  * @param  integer $x
  * @param  integer $y
  * @return boolean
  */
 public function applyToImage(Image $image, $x = 0, $y = 0)
 {
     $circle = new \ImagickDraw();
     // set background
     $bgcolor = new Color($this->background);
     $circle->setFillColor($bgcolor->getPixel());
     // set border
     if ($this->hasBorder()) {
         $border_color = new Color($this->border_color);
         $circle->setStrokeWidth($this->border_width);
         $circle->setStrokeColor($border_color->getPixel());
     }
     $circle->ellipse($x, $y, $this->width / 2, $this->height / 2, 0, 360);
     $image->getCore()->drawImage($circle);
     return true;
 }
开发者ID:alvarobfdev,项目名称:applog,代码行数:24,代码来源:EllipseShape.php

示例5: createDefaultLogo

 public static function createDefaultLogo($path)
 {
     try {
         $image = new \Imagick();
         $image->newImage(90, 90, new \ImagickPixel("white"));
         $draw = new \ImagickDraw();
         $draw->setFillColor(new \ImagickPixel("#" . mt_rand(100000, 999999)));
         $draw->ellipse(45, 45, 45, 45, 0, 360);
         $image->drawImage($draw);
         //$draw->setFillColor( new ImagickPixel( "#".mt_rand(100000, 999999) ) );#01C3EB
         $draw->setFillColor(new \ImagickPixel("#418bc9"));
         $draw->ellipse(45, 45, 20, 20, 0, 360);
         $image->drawImage($draw);
         $image->setImageFormat("png");
         $image_name = 'image_' . time() . '.png';
         $image->writeImage($path . $image_name);
         return $image_name;
     } catch (Exception $e) {
         //echo $e->getMessage();
         return false;
     }
 }
开发者ID:sujata-patne,项目名称:icon_api,代码行数:22,代码来源:ImageLib.php

示例6: ellipse

 /**
  * {@inheritdoc}
  */
 public function ellipse(PointInterface $center, BoxInterface $size, ColorInterface $color, $fill = false, $thickness = 1)
 {
     $width = $size->getWidth();
     $height = $size->getHeight();
     try {
         $pixel = $this->getColor($color);
         $ellipse = new \ImagickDraw();
         $ellipse->setStrokeColor($pixel);
         $ellipse->setStrokeWidth(max(1, (int) $thickness));
         if ($fill) {
             $ellipse->setFillColor($pixel);
         } else {
             $ellipse->setFillColor('transparent');
         }
         $ellipse->ellipse($center->getX(), $center->getY(), $width / 2, $height / 2, 0, 360);
         if (false === $this->imagick->drawImage($ellipse)) {
             throw new RuntimeException('Ellipse operation failed');
         }
         $pixel->clear();
         $pixel->destroy();
         $ellipse->clear();
         $ellipse->destroy();
     } catch (\ImagickException $e) {
         throw new RuntimeException('Draw ellipse operation failed', $e->getCode(), $e);
     }
     return $this;
 }
开发者ID:jmstan,项目名称:craft-website,代码行数:30,代码来源:Drawer.php

示例7: pie

 /**
  * Draw a pie slice on the image.
  *
  * @param  int $x
  * @param  int $y
  * @param  int $start
  * @param  int $end
  * @param  int $w
  * @param  int $h
  * @return Imagick
  */
 public function pie($x, $y, $start, $end, $w, $h = null)
 {
     $wid = $w;
     $hgt = null === $h ? $w : $h;
     $draw = new \ImagickDraw();
     $draw->setFillColor($this->image->getColor($this->fillColor));
     $x1 = $w * cos($start / 180 * pi());
     $y1 = $h * sin($start / 180 * pi());
     $x2 = $w * cos($end / 180 * pi());
     $y2 = $h * sin($end / 180 * pi());
     $points = [['x' => $x, 'y' => $y], ['x' => $x + $x1, 'y' => $y + $y1], ['x' => $x + $x2, 'y' => $y + $y2]];
     $draw->polygon($points);
     $draw->ellipse($x, $y, $wid, $hgt, $start, $end);
     $this->image->resource()->drawImage($draw);
     if ($this->strokeWidth > 0) {
         $draw = new \ImagickDraw();
         $draw->setFillColor($this->image->getColor($this->fillColor));
         $draw->setStrokeColor($this->image->getColor($this->strokeColor));
         $draw->setStrokeWidth($this->strokeWidth);
         $draw->ellipse($x, $y, $wid, $hgt, $start, $end);
         $draw->line($x, $y, $x + $x1, $y + $y1);
         $draw->line($x, $y, $x + $x2, $y + $y2);
         $this->image->resource()->drawImage($draw);
     }
     return $this;
 }
开发者ID:popphp,项目名称:pop-image,代码行数:37,代码来源:Imagick.php

示例8: fillCircle

 /**
  * Draw filled circle on current image
  *
  * @param string $color
  * @param int    $center_x
  * @param int    $center_y
  * @param int    $radius
  * @param float  $opacity
  *
  * @return image
  */
 public function fillCircle($color, $center_x, $center_y, $radius, $opacity = 1)
 {
     $fill = new \ImagickDraw();
     $fill->setfillcolor(new \ImagickPixel($color));
     $fill->setfillopacity($opacity);
     $fill->ellipse($center_x, $center_y, $radius, $radius, 0, 360);
     $this->imagick->drawimage($fill);
     return $this;
 }
开发者ID:s4urp8n,项目名称:kohana-admin,代码行数:20,代码来源:Image.php

示例9: ellipse

function ellipse($strokeColor, $fillColor, $backgroundColor)
{
    $draw = new \ImagickDraw();
    $draw->setStrokeColor($strokeColor);
    $draw->setFillColor($fillColor);
    $draw->setStrokeWidth(2);
    $draw->setFontSize(72);
    $draw->ellipse(125, 70, 100, 50, 0, 360);
    $draw->ellipse(350, 70, 100, 50, 0, 315);
    $draw->push();
    $draw->translate(125, 250);
    $draw->rotate(30);
    $draw->ellipse(0, 0, 100, 50, 0, 360);
    $draw->pop();
    $draw->push();
    $draw->translate(350, 250);
    $draw->rotate(30);
    $draw->ellipse(0, 0, 100, 50, 0, 315);
    $draw->pop();
    $imagick = new \Imagick();
    $imagick->newImage(500, 500, $backgroundColor);
    $imagick->setImageFormat("png");
    $imagick->drawImage($draw);
    header("Content-Type: image/png");
    echo $imagick->getImageBlob();
}
开发者ID:sdmmember,项目名称:Imagick-demos,代码行数:26,代码来源:functions.php

示例10: drawArc

 /**
  * Method to add an arc to the image.
  *
  * @param  int $x
  * @param  int $y
  * @param  int $start
  * @param  int $end
  * @param  int $w
  * @param  int $h
  * @return \Pop\Image\Imagick
  */
 public function drawArc($x, $y, $start, $end, $w, $h = null)
 {
     $wid = $w;
     $hgt = null === $h ? $w : $h;
     $draw = new \ImagickDraw();
     $draw->setFillColor($this->setColor($this->fillColor));
     $x1 = $w * cos($start / 180 * pi());
     $y1 = $h * sin($start / 180 * pi());
     $x2 = $w * cos($end / 180 * pi());
     $y2 = $h * sin($end / 180 * pi());
     $points = array(array('x' => $x, 'y' => $y), array('x' => $x + $x1, 'y' => $y + $y1), array('x' => $x + $x2, 'y' => $y + $y2));
     $draw->polygon($points);
     $draw->ellipse($x, $y, $wid, $hgt, $start, $end);
     $this->resource->drawImage($draw);
     if (null !== $this->strokeWidth) {
         $draw = new \ImagickDraw();
         $draw->setFillColor($this->setColor($this->fillColor));
         $draw->setStrokeColor($this->setColor($this->strokeColor));
         $draw->setStrokeWidth(null === $this->strokeWidth ? 1 : $this->strokeWidth);
         $draw->ellipse($x, $y, $wid, $hgt, $start, $end);
         $draw->line($x, $y, $x + $x1, $y + $y1);
         $draw->line($x, $y, $x + $x2, $y + $y2);
         $this->resource->drawImage($draw);
     }
     return $this;
 }
开发者ID:nicksagona,项目名称:PopPHP,代码行数:37,代码来源:Imagick.php


注:本文中的ImagickDraw::ellipse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。