CakeFest 2024: The Official CakePHP Conference

ImagickDraw::composite

(PECL imagick 2, PECL imagick 3)

ImagickDraw::composite現在の画像上に別の画像を合成する

説明

public ImagickDraw::composite(
    int $compose,
    float $x,
    float $y,
    float $width,
    float $height,
    Imagick $compositeWand
): bool
警告

この関数は、 現在のところ詳細な情報はありません。引数のリストのみが 記述されています。

現在の画像上に別の画像を合成します。 合成演算子、位置、サイズを指定します。

パラメータ

compose

合成演算子 (imagick::COMPOSITE_*) のいずれか

x

左上角の x 座標。

y

左上角の y 座標。

width

合成する画像の幅。

height

合成する画像の高さ。

compositeWand

合成する画像を取得する Imagick オブジェクト。

戻り値

成功した場合に true を返します。

例1 ImagickDraw::composite() の例

<?php
function composite($strokeColor, $fillColor, $backgroundColor) {

$draw = new \ImagickDraw();

$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setFillOpacity(1);
$draw->setStrokeWidth(2);
$draw->setFontSize(72);
$draw->setStrokeOpacity(1);
$draw->setStrokeColor($strokeColor);
$draw->setStrokeWidth(2);
$draw->setFont("../fonts/CANDY.TTF");
$draw->setFontSize(140);
$draw->rectangle(0, 0, 1000, 300);
$draw->setFillColor('white');
$draw->setfillopacity(1);
$draw->annotation(50, 180, "Lorem Ipsum!");

//Create an image object which the draw commands can be rendered into
$imagick = new \Imagick();
$imagick->newImage(1000, 302, $backgroundColor);
$imagick->setImageFormat("png");

//Render the draw commands in the ImagickDraw object
//into the image.
$imagick->drawImage($draw);

//Send the image to the browser
header("Content-Type: image/png");
echo
$imagick->getImageBlob();
}

?>

add a note

User Contributed Notes 1 note

up
0
christian dot reinecke at web dot de
14 years ago
To see some examples how the COMPOSITE_* constants work, see this page:
http://www.imagemagick.org/Usage/compose/#duff-porter
To Top