コード例 #1
0
ファイル: TextElement.php プロジェクト: nimetu/ryzom_bmaker
 /**
  * Render text
  *
  * {@inheritdoc}
  */
 function drawAt($canvas)
 {
     // text needs bottom-left corner
     $x = $this->x;
     $y = $this->y + $this->height;
     if ($this->shadowColor) {
         $color = imagecolorallocatealpha($canvas, $this->shadowColor->getRed(), $this->shadowColor->getGreen(), $this->shadowColor->getBlue(), $this->shadowColor->getAlpha());
         imagefttext($canvas, $this->size, $this->angle, $x + $this->shadowOffsetX, $y + $this->shadowOffsetY, $color, $this->font, $this->value);
     }
     $color = imagecolorallocatealpha($canvas, $this->txtColor->getRed(), $this->txtColor->getGreen(), $this->txtColor->getBlue(), $this->txtColor->getAlpha());
     imagefttext($canvas, $this->size, $this->angle, $x, $y, $color, $this->font, $this->value);
 }
コード例 #2
0
 /**
  * Draw polygon to it's original X,Y position
  *
  * {@inheritdoc}
  */
 function drawAt($canvas)
 {
     if (count($this->points) < 6) {
         return;
     }
     // fill first
     if ($this->fillColor) {
         $fillColor = imagecolorallocatealpha($canvas, $this->fillColor->getRed(), $this->fillColor->getGreen(), $this->fillColor->getBlue(), $this->fillColor->getAlpha());
         imagefilledpolygon($canvas, $this->points, count($this->points) / 2, $fillColor);
     }
     $color = imagecolorallocatealpha($canvas, $this->color->getRed(), $this->color->getGreen(), $this->color->getBlue(), $this->color->getAlpha());
     imagesetthickness($canvas, $this->thickness);
     imagepolygon($canvas, $this->points, count($this->points) / 2, $color);
     // reset thickness if we modified it
     if ($this->thickness > 1) {
         imagesetthickness($canvas, 1);
     }
 }