array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'imagickpixel.setcolorvaluequantum.php', 1 => 'ImagickPixel::setColorValueQuantum', 2 => 'Sets the quantum value of a color element of the ImagickPixel', ), 'up' => array ( 0 => 'class.imagickpixel.php', 1 => 'ImagickPixel', ), 'prev' => array ( 0 => 'imagickpixel.setcolorvalue.php', 1 => 'ImagickPixel::setColorValue', ), 'next' => array ( 0 => 'imagickpixel.sethsl.php', 1 => 'ImagickPixel::setHSL', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/imagick/imagickpixel/setcolorvaluequantum.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

ImagickPixel::setColorValueQuantum

(PECL imagick 2 >=2.3.0, PECL imagick 3)

ImagickPixel::setColorValueQuantumSets the quantum value of a color element of the ImagickPixel

说明

public ImagickPixel::setColorValueQuantum(int $color, int|float $value): bool

Sets the quantum value of a color element of the ImagickPixel.

警告

本函数还未编写文档,仅有参数列表。

参数

color

Which color element to set e.g. \Imagick::COLOR_GREEN.

value

The quantum value to set the color element to. This should be a float if ImageMagick was compiled with HDRI otherwise an int in the range 0 to Imagick::getQuantum().

返回值

成功时返回 true

示例

示例 #1 ImagickPixel::setColorValueQuantum()

<?php
function setColorValueQuantum() {
$image = new \Imagick();

$quantumRange = $image->getQuantumRange();

$draw = new \ImagickDraw();
$color = new \ImagickPixel('blue');
$color->setcolorValueQuantum(\Imagick::COLOR_RED, 128 * $quantumRange['quantumRangeLong'] / 256);

$draw->setstrokewidth(1.0);
$draw->setStrokeColor($color);
$draw->setFillColor($color);
$draw->rectangle(200, 200, 300, 300);

$image->newImage(500, 500, "SteelBlue2");
$image->setImageFormat("png");

$image->drawImage($draw);

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

?>