首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

ImagickDraw::setFillRule

(PECL imagick 2.0.0)

ImagickDraw::setFillRule — Sets the fill rule to use while drawing polygons

Description

代码语言:javascript
复制
bool ImagickDraw::setFillRule ( int $fill_rule )

Warning

This function is currently not documented; only its argument list is available.

Sets the fill rule to use while drawing polygons.

Parameters

fill_rule

FILLRULE_ constant

Return Values

No value is returned.

Examples

Example #1 ImagickDraw::setFillRule()

代码语言:javascript
复制
<?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(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();
}

?>

← ImagickDraw::setFillPatternURL

ImagickDraw::setFont →

代码语言:txt
复制
 ? 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com