當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。