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


PHP Component::draw方法代码示例

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


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

示例1: draw

 public function draw(OsuSignature $signature)
 {
     parent::draw($signature);
     if ($this->width != -1 || $this->height != -1) {
         $this->image->resizeImage($this->width == -1 ? $this->image->getImageWidth() : $this->width, $this->height == -1 ? $this->image->getImageHeight() : $this->height, 1, $this->filter);
     }
     $signature->getCanvas()->compositeImage($this->image, $this->composite, $this->x, $this->y);
 }
开发者ID:BTCTaras,项目名称:osusig,代码行数:8,代码来源:ComponentImage.php

示例2: 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

示例3: 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


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