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


PHP ImagickDraw::setFillRule方法代码示例

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


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

示例1: fmod

 function renderImage3()
 {
     //dupe of two ?
     $draw = new \ImagickDraw();
     $strokeColor = new \ImagickPixel($this->strokeColor);
     $fillColor = new \ImagickPixel($this->fillColor);
     $draw->setStrokeWidth(1);
     $draw->setStrokeColor($strokeColor);
     $draw->setFillColor($fillColor);
     $fillRules = [\Imagick::FILLRULE_NONZERO, \Imagick::FILLRULE_EVENODD];
     $points = 11;
     $size = 150;
     $draw->translate(175, 160);
     for ($x = 0; $x < 2; $x++) {
         //$pointsArray = array();
         $draw->setFillRule($fillRules[$x]);
         $draw->pathStart();
         for ($n = 0; $n < $points * 2; $n++) {
             if ($n >= $points) {
                 $angle = fmod($n * 360 * 4 / $points, 360) * pi() / 180;
             } else {
                 $angle = fmod($n * 360 * 3 / $points, 360) * pi() / 180;
             }
             $positionX = $size * sin($angle);
             $positionY = $size * cos($angle);
             if ($n == 0) {
                 $draw->pathMoveToAbsolute($positionX, $positionY);
             } else {
                 $draw->pathLineToAbsolute($positionX, $positionY);
             }
         }
         $draw->pathClose();
         $draw->pathFinish();
         $draw->translate(325, 0);
     }
     //Create an image object which the draw commands can be rendered into
     $image = new \Imagick();
     //$image->newImage(700, 320, $this->backgroundColor);
     $image->newImage(700, 320, "#eee");
     $image->setImageFormat("png");
     //Render the draw commands in the ImagickDraw object
     //into the image.
     $image->drawImage($draw);
     //Send the image to the browser
     header("Content-Type: image/png");
     echo $image->getImageBlob();
 }
开发者ID:sdmmember,项目名称:Imagick-demos,代码行数:47,代码来源:setFillRule.php

示例2: setFillRule

function setFillRule($fillColor, $strokeColor, $backgroundColor)
{
    $draw = new \ImagickDraw();
    $draw->setStrokeWidth(1);
    $draw->setStrokeColor($strokeColor);
    $draw->setFillColor($fillColor);
    $fillRules = [\Imagick::FILLRULE_NONZERO, \Imagick::FILLRULE_EVENODD];
    $points = 11;
    $size = 150;
    $draw->translate(175, 160);
    for ($x = 0; $x < 2; $x++) {
        $draw->setFillRule($fillRules[$x]);
        $draw->pathStart();
        for ($n = 0; $n < $points * 2; $n++) {
            if ($n >= $points) {
                $angle = fmod($n * 360 * 4 / $points, 360) * pi() / 180;
            } else {
                $angle = fmod($n * 360 * 3 / $points, 360) * pi() / 180;
            }
            $positionX = $size * sin($angle);
            $positionY = $size * cos($angle);
            if ($n == 0) {
                $draw->pathMoveToAbsolute($positionX, $positionY);
            } else {
                $draw->pathLineToAbsolute($positionX, $positionY);
            }
        }
        $draw->pathClose();
        $draw->pathFinish();
        $draw->translate(325, 0);
    }
    $image = new \Imagick();
    $image->newImage(700, 320, $backgroundColor);
    $image->setImageFormat("png");
    $image->drawImage($draw);
    header("Content-Type: image/png");
    echo $image->getImageBlob();
}
开发者ID:sdmmember,项目名称:Imagick-demos,代码行数:38,代码来源:functions.php

示例3: ImagickDraw

<?php

$draw = new ImagickDraw();
// clip
$draw->setClipRule(Imagick::FILLRULE_EVENODD);
var_dump($draw->getClipRule() === Imagick::FILLRULE_EVENODD);
$draw->setClipUnits(10);
var_dump($draw->getClipUnits());
// fill
$draw->setFillColor('yellow');
var_dump($draw->getFillColor()->getColor());
$draw->setFillOpacity(0.5);
printf("%.2f\n", $draw->getFillOpacity());
$draw->setFillRule(Imagick::FILLRULE_NONZERO);
var_dump($draw->getClipRule() === Imagick::FILLRULE_NONZERO);
// gravity
$draw->setGravity(Imagick::GRAVITY_SOUTHEAST);
var_dump($draw->getGravity() === Imagick::GRAVITY_SOUTHEAST);
// stroke
$draw->setStrokeAntialias(false);
var_dump($draw->getStrokeAntialias());
$draw->setStrokeColor(new ImagickPixel('#F02B88'));
var_dump($draw->getStrokeColor()->getColor());
$draw->setStrokeDashArray(array(1, 2, 3));
var_dump($draw->getStrokeDashArray());
$draw->setStrokeDashOffset(-1);
var_dump($draw->getStrokeDashOffset());
$draw->setStrokeLineCap(Imagick::LINECAP_SQUARE);
var_dump($draw->getStrokeLineCap() === Imagick::LINECAP_SQUARE);
$draw->setStrokeLineJoin(Imagick::LINEJOIN_BEVEL);
var_dump($draw->getStrokeLineJoin() === Imagick::LINEJOIN_BEVEL);
开发者ID:badlamer,项目名称:hhvm,代码行数:31,代码来源:draw_accessor.php


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