update : 2015.11.03
php.shukuma.com

검색:
 
 
Applies a function on the image

Imagick::functionImage

(No version information available, might only be in Git)

Imagick::functionImageApplies a function on the image

설명

public bool Imagick::functionImage ( int $function , array $arguments [, int $channel = Imagick::CHANNEL_DEFAULT ] )

Applies an arithmetic, relational, or logical expression to a pseudo image.

See also » ImageMagick v6 Examples - Image Transformations — Function, Multi-Argument Evaluate

이 메쏘드는 Imagick을 ImageMagick 6.4.9 이상으로 컴파일 했을 때만 사용할 수 있습니다.

인수

function

Refer to this list of function constants

arguments

Array of arguments to pass to this function.

반환값

성공시에 TRUE를 반환합니다.

오류/예외

오류시에 ImagickException이 발생합니다.

예제

Example #1 Create a sinusoidal gradient

<?php
$imagick 
= new Imagick();
$imagick->newPseudoImage(200200'gradient:black-white');
$arguments = array(3, -90);
$imagick->functionImage(Imagick::FUNCTION_SINUSOID$arguments);

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

위 예제의 출력 예시:

Output of create a sinusoidal gradient

Example #2 Create a gradient from the polynomial (4x^2 - 4x + 1)

<?php
$imagick 
= new Imagick();
$imagick->newPseudoImage(200200'gradient:black-white');
$arguments = array(4, -41);
$imagick->functionImage(Imagick::FUNCTION_POLYNOMIAL$arguments);

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

위 예제의 출력 예시:

Output of create a polynomial gradient

Example #3 Create a complex gradient from the polynomial (4x^2 - 4x^2 + 1) modulated by a sinusoidal gradient

<?php
$imagick1 
= new Imagick();
$imagick1->newPseudoImage(200200'gradient:black-white');
$arguments = array(9, -90);
$imagick1->functionImage(Imagick::FUNCTION_SINUSOID$arguments);

$imagick2 = new Imagick();
$imagick2->newPseudoImage(200200'gradient:black-white');
$arguments = array(0.50);
$imagick2->functionImage(Imagick::FUNCTION_SINUSOID$arguments);
$imagick1->compositeimage($imagick2Imagick::COMPOSITE_MULTIPLY00);

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

위 예제의 출력 예시:

Output of create complex gradient