本文整理匯總了PHP中ImagickDraw::color方法的典型用法代碼示例。如果您正苦於以下問題:PHP ImagickDraw::color方法的具體用法?PHP ImagickDraw::color怎麽用?PHP ImagickDraw::color使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ImagickDraw
的用法示例。
在下文中一共展示了ImagickDraw::color方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getImage
protected function getImage()
{
$image = new \Imagick();
$image->newImage(2, 2, new \ImagickPixel('white'));
$draw = new \ImagickDraw();
$draw->setFillColor(new \ImagickPixel('black'));
$draw->color(0, 1, \Imagick::PAINT_POINT);
$draw2 = new \ImagickDraw();
$draw2->setFillColor(new \ImagickPixel('black'));
$draw2->color(1, 1, \Imagick::PAINT_POINT);
$image->drawImage($draw);
$image->drawimage($draw2);
$image->setformat('png');
return $image;
}
示例2: switch
$maxX = $matches[4];
$maxY = $matches[5];
for ($x = $minX; $x <= $maxX; $x++) {
for ($y = $minY; $y <= $maxY; $y++) {
switch ($action) {
case 'turn on':
$grid[$x][$y] = true;
break;
case 'turn off':
$grid[$x][$y] = false;
break;
case 'toggle':
$grid[$x][$y] = !$grid[$x][$y];
}
}
}
}
}
$draw = new ImagickDraw();
$draw->setfillcolor(new ImagickPixel('white'));
foreach ($grid as $x => $col) {
foreach ($col as $y => $px) {
if ($px) {
$draw->color($x, $y, Imagick::PAINT_POINT);
}
}
}
$image = new Imagick();
$image->newimage(count($grid), count($grid[0]), 'black', 'png');
$image->drawimage($draw);
$image->writeimage('output.png');