ImagickDraw::setFillRule

(PECL imagick 2.0.0)

ImagickDraw::setFillRuleSets the fill rule to use while drawing polygons

설명

bool ImagickDraw::setFillRule ( int $fill_rule )
Warning

이 함수는 현재 문서화 되어있지 않습니다; 인수 목록만을 제공합니다.

Sets the fill rule to use while drawing polygons.

인수

fill_rule

FILLRULE_ constant

반환값

값을 반환하지 않습니다.

예제

Example #1 ImagickDraw::setFillRule()

<?php
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(175160);

    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 $points360) * pi() / 180;
            }
            else {
                
$angle fmod($n 360 $points360) * 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(3250);
    }

    
$image = new \Imagick();
    
$image->newImage(700320$backgroundColor);
    
$image->setImageFormat("png");
    
$image->drawImage($draw);

    
header("Content-Type: image/png");
    echo 
$image->getImageBlob();
}

?>

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top