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


PHP ImagickDraw::rotate方法代码示例

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


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

示例1: drawImage

function drawImage()
{
    $strokeColor = 'black';
    $fillColor = 'plum1';
    $draw = new \ImagickDraw();
    $draw->setStrokeOpacity(1);
    $draw->setStrokeColor($strokeColor);
    $draw->setStrokeWidth(1.2);
    $draw->setFont("../fonts/Arial.ttf");
    $draw->setFontSize(64);
    $draw->setFillColor($fillColor);
    $draw->rotate(-12);
    $draw->annotation(140, 380, "c'est ne pas \nune Lorikeet!");
    $imagick = new \Imagick(realpath("../imagick/images/lories/IMG_1599_480.jpg"));
    $imagick->setImageFormat("png");
    $imagick->drawImage($draw);
    header("Content-Type: image/png");
    echo $imagick->getImageBlob();
}
开发者ID:atawsports2,项目名称:Imagick-demos,代码行数:19,代码来源:functions.php

示例2: rotate

function rotate($strokeColor, $fillColor, $backgroundColor, $fillModifiedColor)
{
    $draw = new \ImagickDraw();
    $draw->setStrokeColor($strokeColor);
    $draw->setStrokeOpacity(1);
    $draw->setFillColor($fillColor);
    $draw->rectangle(200, 200, 300, 300);
    $draw->setFillColor($fillModifiedColor);
    $draw->rotate(15);
    $draw->rectangle(200, 200, 300, 300);
    $image = new \Imagick();
    $image->newImage(500, 500, $backgroundColor);
    $image->setImageFormat("png");
    $image->drawImage($draw);
    header("Content-Type: image/png");
    echo $image->getImageBlob();
}
开发者ID:sdmmember,项目名称:Imagick-demos,代码行数:17,代码来源:functions.php

示例3: text

 /**
  * Set and apply the text on the image
  *
  * @param  string $string
  * @throws Exception
  * @return Imagick
  */
 public function text($string)
 {
     $draw = new \ImagickDraw();
     // Set the font if passed
     if (null !== $this->font) {
         if (!$draw->setFont($this->font)) {
             throw new Exception('Error: That font is not recognized by the Imagick extension.');
         }
         // Else, attempt to set a basic, default system font
     } else {
         $fonts = $this->image->resource()->queryFonts();
         if (in_array('Arial', $fonts)) {
             $this->font = 'Arial';
         } else {
             if (in_array('Helvetica', $fonts)) {
                 $this->font = 'Helvetica';
             } else {
                 if (in_array('Tahoma', $fonts)) {
                     $this->font = 'Tahoma';
                 } else {
                     if (in_array('Verdana', $fonts)) {
                         $this->font = 'Verdana';
                     } else {
                         if (in_array('System', $fonts)) {
                             $this->font = 'System';
                         } else {
                             if (in_array('Fixed', $fonts)) {
                                 $this->font = 'Fixed';
                             } else {
                                 if (in_array('system', $fonts)) {
                                     $this->font = 'system';
                                 } else {
                                     if (in_array('fixed', $fonts)) {
                                         $this->font = 'fixed';
                                     } else {
                                         if (isset($fonts[0])) {
                                             $this->font = $fonts[0];
                                         } else {
                                             throw new Exception('Error: No default font could be found by the Imagick extension.');
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $draw->setFont($this->font);
     $draw->setFontSize($this->size);
     $draw->setFillColor($this->image->getColor($this->fillColor, $this->opacity));
     if (null !== $this->rotation) {
         $draw->rotate($this->rotation);
     }
     if (null !== $this->strokeColor) {
         $draw->setStrokeColor($this->image->getColor($this->strokeColor, $this->opacity));
         $draw->setStrokeWidth((int) $this->strokeWidth);
     }
     $draw->annotation($this->x, $this->y, $string);
     $this->image->resource()->drawImage($draw);
     return $this;
 }
开发者ID:Nnadozieomeonu,项目名称:lacecart,代码行数:70,代码来源:Imagick.php

示例4: get

$strokeColor = "#ffffff";
$fillColor = "#0000ff";
$backgroundColor = "#000000";
$fillModifiedColor = "#00ffff";
$x1 = 100;
$x2 = 400;
$y1 = 230;
$y2 = 280;
$draw = new \ImagickDraw();
$draw->setStrokeColor($strokeColor);
$draw->setStrokeOpacity(1);
$draw->setFillColor($fillColor);
$draw->rectangle($x1, $y1, $x2, $y2);
$draw->setFillColor($fillModifiedColor);
$draw->rotate(25);
list($rx1, $ry1) = get($x1, $y1, 25);
list($rx2, $ry2) = get($x2, $y2, 25);
$draw->rectangle($rx1, $ry1, $rx2, $ry2);
$image = new \Imagick();
$image->newImage(500, 500, $backgroundColor);
$image->setImageFormat("png");
$image->drawImage($draw);
header("Content-Type: image/png");
echo $image->getImageBlob();
function get($x, $y, $r)
{
    $rx = $x - 250 + cos(deg2rad($r)) * 250 + sin(deg2rad($r)) * 250;
    $ry = $y - 250 + cos(deg2rad($r)) * 250 - sin(deg2rad($r)) * 250;
    return array($rx, $ry);
}
开发者ID:hajime3333out,项目名称:Shout,代码行数:30,代码来源:test.php


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