phpday 2025 - Call For Papers

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();
}

?>

add a note

User Contributed Notes

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