本文整理汇总了PHP中ImagickDraw::pathLineToAbsolute方法的典型用法代码示例。如果您正苦于以下问题:PHP ImagickDraw::pathLineToAbsolute方法的具体用法?PHP ImagickDraw::pathLineToAbsolute怎么用?PHP ImagickDraw::pathLineToAbsolute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImagickDraw
的用法示例。
在下文中一共展示了ImagickDraw::pathLineToAbsolute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例2: drawBlendedChart
public function drawBlendedChart($points, $curveLinearBlend)
{
$this->draw->setFillColor('#B42AAF9F');
$this->draw->translate($this->chartWidth / 2, $this->chartHeight / 2);
$this->draw->pathStart();
list($nextPositionX, $nextPositionY) = $this->getInterpolatedPosition(0, 0, $points);
$this->draw->pathMoveToAbsolute($nextPositionX, $nextPositionY);
for ($p = 0; $p < count($points); $p++) {
for ($i = 0; $i < $this->segments; $i++) {
$curvedPosition = $this->getInterpolatedPosition($p, $i, $points);
$linearPosition = $this->getLinearPosition($p, $i, $points);
list($nextPositionX, $nextPositionY) = interpolateArray($curveLinearBlend, $curvedPosition, $linearPosition);
$this->draw->pathLineToAbsolute($nextPositionX, $nextPositionY);
}
}
$this->draw->pathClose();
$this->draw->pathFinish();
}
示例3: test_path
function test_path(&$canvas)
{
$draw = new ImagickDraw();
$draw->setFillColor('transparent');
$draw->setStrokeColor('blue');
$draw->setStrokeWidth(4);
$draw->pathStart();
$draw->pathMoveToAbsolute(300, 10);
$draw->pathLineToHorizontalRelative(50);
$draw->pathLineToVerticalRelative(50);
$draw->pathEllipticArcRelative(40, 30, 30, false, true, 60, 10);
$draw->pathLineToAbsolute(444, 22);
$draw->pathFinish();
$draw->pathStart();
$draw->pathMoveToAbsolute(480, 30);
$draw->pathCurveToAbsolute(520, 40, 560, 10, 600, 20);
$draw->pathCurveToQuadraticBezierRelative(30, 10, -60, 80);
$draw->pathCurveToQuadraticBezierSmoothRelative(20, -50);
$draw->pathClose();
$draw->pathFinish();
$canvas->drawImage($draw);
}
示例4: 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();
}