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


PHP ImagickDraw::roundRectangle方法代码示例

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


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

示例1: draw

 public function draw(OsuSignature $signature)
 {
     parent::draw($signature);
     $flag = $this->getFlag($signature->getUser());
     if ($flag) {
         $flag->resizeImage($this->getWidth(), $this->getHeight(), Imagick::FILTER_CATROM, 1);
         if (isset($_GET['flagshadow'])) {
             $shadow = $flag->clone();
             $shadow->setImageBackgroundColor(new ImagickPixel('black'));
             $shadow->shadowImage(50, 3, 0, 0);
             $signature->getCanvas()->compositeImage($shadow, \Imagick::COMPOSITE_DEFAULT, $this->x - 6, $this->y - 6);
         }
         if (isset($_GET['flagstroke'])) {
             $flagStroke = new \ImagickDraw();
             $flagStroke->setFillColor("#FFFFFFEE");
             $flagStroke->roundRectangle($this->x - 1, $this->y - 1, $this->x - 1 + ($this->getWidth() + 1), $this->y - 1 + ($this->getHeight() + 1), 1, 1);
             $signature->getCanvas()->drawImage($flagStroke);
         }
         $signature->getCanvas()->compositeImage($flag, Imagick::COMPOSITE_DEFAULT, $this->x, $this->y);
     }
 }
开发者ID:BTCTaras,项目名称:osusig,代码行数:21,代码来源:ComponentFlag.php

示例2: draw

 public function draw(OsuSignature $signature)
 {
     parent::draw($signature);
     $avatar = $this->getAvatar($signature->getUser());
     if ($avatar) {
         $fitByWidth = $this->getWidth() / $avatar->getImageWidth() < $this->getHeight() / $avatar->getImageHeight() ? true : false;
         if ($fitByWidth) {
             $avatar->thumbnailImage($this->getWidth(), 0, false);
         } else {
             $avatar->thumbnailImage(0, $this->getHeight(), false);
         }
         $avatarXOffset = ($this->getWidth() - $avatar->getImageWidth()) / 2;
         $avatarYOffset = ($this->getHeight() - $avatar->getImageHeight()) / 2;
         /*$avatar->resizeImage(
         			$this->getWidth(),
         			$this->get Height(),
         			1
         			Imagick::FILTER_CATROM
         		);*/
         $avatarRounding = isset($_GET['avatarrounding']) ? max((int) $_GET['avatarrounding'], 0) : $this->rounding;
         $avatar->setImageAlphaChannel(Imagick::ALPHACHANNEL_SET);
         $roundImage = new Imagick();
         $roundImage->newPseudoImage($this->getWidth(), $this->getHeight(), 'canvas:transparent');
         $roundMask = new ImagickDraw();
         $roundMask->setFillColor(new ImagickPixel('black'));
         $roundMask->roundRectangle(0, 0, $avatar->getImageWidth() - 1, $avatar->getImageHeight() - 1, $avatarRounding, $avatarRounding);
         $roundImage->drawImage($roundMask);
         $roundImage->setImageFormat('png');
         $avatar->compositeImage($roundImage, Imagick::COMPOSITE_DSTIN, 0, 0, Imagick::CHANNEL_ALPHA);
         $signature->getCanvas()->compositeImage($avatar, Imagick::COMPOSITE_DEFAULT, $this->x + $avatarXOffset, $this->y + $avatarYOffset);
     }
 }
开发者ID:BTCTaras,项目名称:osusig,代码行数:32,代码来源:ComponentAvatar.php

示例3: roundedRectangle

 /**
  * 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 Imagick
  */
 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 \ImagickDraw();
     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;
 }
开发者ID:popphp,项目名称:pop-image,代码行数:30,代码来源:Imagick.php

示例4: roundedRectangle

 /**
  * Draw a rounded rectangle.
  *
  * @param integer $x       The left x-coordinate of the rectangle.
  * @param integer $y       The top y-coordinate of the rectangle.
  * @param integer $width   The width of the rectangle.
  * @param integer $height  The height of the rectangle.
  * @param integer $round   The width of the corner rounding.
  * @param string  $color   The line color of the rectangle.
  * @param string  $fill    The color to fill the rounded rectangle with.
  */
 public function roundedRectangle($x, $y, $width, $height, $round, $color, $fill)
 {
     $draw = new ImagickDraw();
     $draw->setStrokeColor(new ImagickPixel($color));
     $draw->setFillColor(new ImagickPixel($fill));
     $draw->roundRectangle($x, $y, $x + $width, $y + $height, $round, $round);
     try {
         $res = $this->_imagick->drawImage($draw);
     } catch (ImagickException $e) {
         throw new Horde_Image_Exception($e);
     }
     $draw->destroy();
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:24,代码来源:Imagick.php

示例5: roundRectangle

function roundRectangle($strokeColor, $fillColor, $backgroundColor, $startX, $startY, $endX, $endY, $roundX, $roundY)
{
    $draw = new \ImagickDraw();
    $draw->setStrokeColor($strokeColor);
    $draw->setFillColor($fillColor);
    $draw->setStrokeOpacity(1);
    $draw->setStrokeWidth(2);
    $draw->roundRectangle($startX, $startY, $endX, $endY, $roundX, $roundY);
    $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,代码行数:15,代码来源:functions.php

示例6: draw

 public function draw(OsuSignature $signature)
 {
     if (empty($this->hexColour)) {
         $this->hexColour = $signature->getHexColour();
     }
     $composite = new Imagick();
     $composite->newPseudoImage($this->getWidth(), $this->getHeight(), "canvas:transparent");
     // Background
     $draw = new ImagickDraw();
     $draw->setFillColor(new ImagickPixel("#555555"));
     $draw->rectangle(0, 0, $this->getWidth(), $this->getHeight());
     $composite->drawImage($draw);
     // Main bar
     $level = $signature->getUser()['level'];
     $xp = $level - floor($level);
     $draw = new ImagickDraw();
     $draw->setFillColor(new ImagickPixel($this->hexColour));
     $draw->rectangle(0, 0, $this->getWidth() * $xp, $this->getHeight());
     $composite->drawImage($draw);
     // Bar end glow
     $draw = new ImagickDraw();
     $draw->setFillColor(new ImagickPixel('#ffffff'));
     $draw->setFillOpacity(0.35);
     $draw->rectangle($this->getWidth() * $xp - $this->getHeight(), 0, $this->getWidth() * $xp, $this->getHeight());
     $composite->drawImage($draw);
     // Text draw & metrics
     $textDraw = new ImagickDraw();
     $textDraw->setFillColor(new ImagickPixel('#555555'));
     $textDraw->setFontSize(12);
     $textDraw->setFont(ComponentLabel::FONT_DIRECTORY . ComponentLabel::FONT_REGULAR);
     $textDraw->setGravity(Imagick::GRAVITY_NORTHWEST);
     $metrics = $composite->queryFontMetrics($textDraw, 'lv' . floor($level));
     // Text white bg
     $draw = new ImagickDraw();
     $draw->setFillColor(new ImagickPixel('#ffffff'));
     $draw->rectangle(($this->getWidth() - $metrics['textWidth']) / 2 - 2, 0, ($this->getWidth() + $metrics['textWidth']) / 2 + 1, $this->getHeight());
     $composite->drawImage($draw);
     // Rounding
     $roundMask = new Imagick();
     $roundMask->newPseudoImage($this->getWidth(), $this->getHeight(), "canvas:transparent");
     $draw = new ImagickDraw();
     $draw->setFillColor(new ImagickPixel("black"));
     $draw->roundRectangle(0, 0, $this->getWidth() - 1, $this->getHeight() - 1, $this->rounding, $this->rounding);
     $roundMask->drawImage($draw);
     $roundMask->setImageFormat('png');
     $composite->compositeImage($roundMask, Imagick::COMPOSITE_DSTIN, 0, 0, Imagick::CHANNEL_ALPHA);
     $signature->getCanvas()->compositeImage($composite, Imagick::COMPOSITE_DEFAULT, $this->x, $this->y);
     // Level text
     $signature->getCanvas()->annotateImage($textDraw, $this->x + ($this->getWidth() - $metrics['textWidth']) / 2, $this->y + ($this->getHeight() - $metrics['textHeight']) / 2 - 2, 0, 'lv' . floor($level));
 }
开发者ID:BTCTaras,项目名称:osusig,代码行数:50,代码来源:ComponentXPBar.php

示例7: drawFinalStroke

 /**
  * Draws the stroke over the whole card
  *
  * @param string $hexColour [Hexadecimal colour value for the card stroke]
  */
 public function drawFinalStroke($hexColour)
 {
     $cardStrokeImage = new Imagick();
     $cardStrokeImage->newPseudoImage($this->canvas->getImageWidth(), $this->canvas->getImageHeight(), 'canvas:transparent');
     $cardStroke = new ImagickDraw();
     $cardStroke->setFillColor(new ImagickPixel($hexColour));
     $cardStroke->roundRectangle(self::SIG_MARGIN + self::SIG_STROKE_WIDTH / 2, self::SIG_MARGIN + self::SIG_STROKE_WIDTH / 2, $this->baseWidth + self::SIG_MARGIN - 1 - self::SIG_STROKE_WIDTH / 2, $this->baseHeight + self::SIG_MARGIN - 1 - self::SIG_STROKE_WIDTH / 2, self::SIG_OUTER_ROUNDING * 2, self::SIG_OUTER_ROUNDING * 2);
     $cardStrokeImage->drawImage($cardStroke);
     $roundImage = new Imagick();
     $roundImage->newPseudoImage($this->canvas->getImageWidth(), $this->canvas->getImageHeight(), 'canvas:transparent');
     $roundMask = new ImagickDraw();
     $roundMask->setFillColor(new ImagickPixel('black'));
     $roundMask->roundRectangle(self::SIG_MARGIN + self::SIG_STROKE_WIDTH * 2, self::SIG_MARGIN + self::SIG_STROKE_WIDTH * 2, $this->baseWidth + self::SIG_MARGIN - self::SIG_STROKE_WIDTH * 2 - 1, $this->baseHeight + self::SIG_MARGIN - self::SIG_STROKE_WIDTH * 2 - 1, self::SIG_ROUNDING, self::SIG_ROUNDING);
     $roundImage->drawImage($roundMask);
     $cardStrokeImage->compositeImage($roundImage, Imagick::COMPOSITE_DSTOUT, 0, 0);
     $this->canvas->compositeImage($cardStrokeImage, \Imagick::COMPOSITE_DEFAULT, 0, 0);
 }
开发者ID:BTCTaras,项目名称:osusig,代码行数:22,代码来源:CardRegular.php

示例8: _buildImage

 /**
  * Build image
  * @access protected
  * @return Imagick
  */
 protected function _buildImage()
 {
     $canvas = new Imagick();
     $canvas->newImage($this->_width, $this->_height, 'none');
     $draw = new ImagickDraw();
     //drawing Background
     $draw->setFillColor(new ImagickPixel($this->_theme->bgColor));
     $draw->roundRectangle(0, 0, $this->_width - 1, $this->_height - 1, 5, 5);
     //drawing Title and Description
     $this->_addTextToDraw($draw, $this->_theme->titleColor, $this->_theme->titleFont, $this->_theme->titleFontSize, 84, $this->_theme->titleYPos, $this->_title);
     $this->_addTextToDraw($draw, $this->_theme->textColor, $this->_theme->textFont, $this->_theme->textFontSize, 84, $this->_theme->descYPos, $this->_description);
     //drawing Reward
     if (!empty($this->_reward)) {
         $this->_addTextToDraw($draw, $this->_theme->textColor, $this->_theme->textFont, $this->_theme->textFontSize, 84, $this->_theme->rewardYPos, $this->_reward);
     }
     $canvas->drawImage($draw);
     //drawing pix (if not unlocked, set black and white)
     $expired = new Imagick($this->_pix);
     if ($this->_state != 'unlocked') {
         $expired->modulateImage(100, 0, 100);
     }
     $canvas->compositeImage($expired, imagick::COMPOSITE_OVER, 4, 4);
     //if expired, draw the expired logo
     if ($this->_state == 'expired') {
         $expired = new Imagick(dirname(__FILE__) . '/extra/expired.png');
         $canvas->compositeImage($expired, imagick::COMPOSITE_OVER, 0, 0);
     }
     return $canvas;
 }
开发者ID:vincenta,项目名称:achievements,代码行数:34,代码来源:achievement.php


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