diff -Nru php-imagick-3.4.4/debian/changelog php-imagick-3.4.4+php8.0+3.4.4/debian/changelog --- php-imagick-3.4.4/debian/changelog 2020-12-28 13:09:48.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/debian/changelog 2021-03-05 10:49:49.000000000 +0000 @@ -1,16 +1,72 @@ -php-imagick (3.4.4-4.2) unstable; urgency=medium +php-imagick (3.4.4+php8.0+3.4.4-2+deb11u2) unstable; urgency=medium - * Non-maintainer upload. - * Adapt to recent version of PHPUnit (9) (Closes: #977824) + * Fix the extra test from PHP 8.0 patches to apply only to + imagick-3.4.4+php8.0/ directory (Closes: #983607) - -- David Prévot Mon, 28 Dec 2020 09:09:48 -0400 + -- Ondřej Surý Fri, 05 Mar 2021 11:49:49 +0100 -php-imagick (3.4.4-4.1) unstable; urgency=low +php-imagick (3.4.4+php8.0+3.4.4-2+deb11u1) unstable; urgency=medium - * Non-maintainer upload. - * Skip tests that fail with PHP 7.4 on armel. (Closes: #959386) + * Use only the main version to run the autopkgtest (Closes: #983041) - -- Adrian Bunk Sun, 14 Jun 2020 12:26:18 +0300 + -- Ondřej Surý Sat, 20 Feb 2021 13:33:52 +0100 + +php-imagick (3.4.4+php8.0+3.4.4-2) unstable; urgency=medium + + * Update d/watch to use https://pecl.php.net + * Lower the dh-php dependency to Debian sid version + * Update d/gbp.conf for Debian bullseye + + -- Ondřej Surý Sun, 14 Feb 2021 16:40:03 +0100 + +php-imagick (3.4.4+php8.0+3.4.4-1) unstable; urgency=medium + + * New upstream version 3.4.4+php8.0+3.4.4 + + Add extra source for PHP 8.0 and keep the 3.4.4 unpatched + for PHP 5.x and PHP 7.x + * Duplicate the patches for PHP 8.0 version + + -- Ondřej Surý Wed, 23 Dec 2020 18:18:03 +0100 + +php-imagick (3.4.4-10) unstable; urgency=medium + + * Update for dh-php >= 2.0 support + + -- Ondřej Surý Sun, 11 Oct 2020 14:35:31 +0200 + +php-imagick (3.4.4-9) unstable; urgency=medium + + * Update d/gbp.conf for main branch + * Pull patches to support PHP 8 (Courtesy of Remi Collet) + + -- Ondřej Surý Sat, 10 Oct 2020 12:50:29 +0200 + +php-imagick (3.4.4-8) unstable; urgency=medium + + * Build-Depend on dh-php >= 1.1~ + + -- Ondřej Surý Mon, 28 Sep 2020 14:56:06 +0200 + +php-imagick (3.4.4-7) unstable; urgency=medium + + * Build-Depend on debhelper >= 10~ + * Build-Depend on dh_php >= 0.38~ to get independent binary packages + + -- Ondřej Surý Mon, 28 Sep 2020 13:35:20 +0200 + +php-imagick (3.4.4-6) unstable; urgency=medium + + * Finish conversion to debhelper compat level 10 + * Build-Depend on dh_php >= 0.37~ to get independent binary packages + + -- Ondřej Surý Mon, 28 Sep 2020 13:18:49 +0200 + +php-imagick (3.4.4-5) unstable; urgency=medium + + * Don't fail on failed tests - the tests are still too fragile to cause + hard fail + + -- Ondřej Surý Mon, 02 Mar 2020 11:32:31 +0100 php-imagick (3.4.4-4) unstable; urgency=medium diff -Nru php-imagick-3.4.4/debian/compat php-imagick-3.4.4+php8.0+3.4.4/debian/compat --- php-imagick-3.4.4/debian/compat 2020-03-02 09:04:48.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/debian/compat 2021-03-05 10:49:49.000000000 +0000 @@ -1 +1 @@ -9 +10 diff -Nru php-imagick-3.4.4/debian/control php-imagick-3.4.4+php8.0+3.4.4/debian/control --- php-imagick-3.4.4/debian/control 2020-03-02 09:04:48.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/debian/control 2021-03-05 10:49:49.000000000 +0000 @@ -3,9 +3,9 @@ Priority: optional Maintainer: Debian PHP PECL Maintainers Uploaders: Guillaume Delacour , - Lior Kaplan , -Build-Depends: debhelper (>= 9), - dh-php (>= 0.33~), + Lior Kaplan +Build-Depends: debhelper (>= 10~), + dh-php, libmagickwand-6.q16-dev | libmagickwand-dev, php-all-dev Standards-Version: 3.9.8 @@ -17,11 +17,16 @@ Architecture: any Pre-Depends: php-common (>= 2:69~) Depends: ${misc:Depends}, + ${pecl:Depends}, ${php:Depends}, ${shlibs:Depends} Recommends: ghostscript, ttf-dejavu-core -Provides: ${php:Provides} +Breaks: ${pecl:Breaks} +Replaces: ${pecl:Replaces} +Provides: ${pecl:Provides}, + ${php:Provides} +Suggests: ${pecl:Suggests} Description: Provides a wrapper to the ImageMagick library Imagick is a native php extension to create and modify images using the ImageMagick API. diff -Nru php-imagick-3.4.4/debian/gbp.conf php-imagick-3.4.4+php8.0+3.4.4/debian/gbp.conf --- php-imagick-3.4.4/debian/gbp.conf 2020-03-02 09:04:48.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/debian/gbp.conf 2021-03-05 10:49:49.000000000 +0000 @@ -1,5 +1,5 @@ [DEFAULT] -debian-branch = master +debian-branch = debian/bullseye debian-tag = debian/%(version)s upstream-branch = upstream upstream-tag = upstream/%(version)s diff -Nru php-imagick-3.4.4/debian/patches/0001-Hardcode-path-to-usrsharefontstruetypettf-dejavuDeja.patch php-imagick-3.4.4+php8.0+3.4.4/debian/patches/0001-Hardcode-path-to-usrsharefontstruetypettf-dejavuDeja.patch --- php-imagick-3.4.4/debian/patches/0001-Hardcode-path-to-usrsharefontstruetypettf-dejavuDeja.patch 2020-03-02 09:04:48.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/debian/patches/0001-Hardcode-path-to-usrsharefontstruetypettf-dejavuDeja.patch 2021-03-05 10:49:49.000000000 +0000 @@ -4,9 +4,23 @@ Hardcode-path-to-usrsharefontstruetypettf-dejavuDejaVuSans.ttf-in-captcha.php --- - imagick-3.4.4/examples/captcha.php | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + imagick-3.4.4+php8.0/examples/captcha.php | 2 +- + imagick-3.4.4/examples/captcha.php | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) +diff --git a/imagick-3.4.4+php8.0/examples/captcha.php b/imagick-3.4.4+php8.0/examples/captcha.php +index a9176a3..a76c1cb 100644 +--- a/imagick-3.4.4+php8.0/examples/captcha.php ++++ b/imagick-3.4.4+php8.0/examples/captcha.php +@@ -17,7 +17,7 @@ $bg->setColor( 'white' ); + $ImagickDraw = new ImagickDraw(); + + /* Set font and font size. You can also specify /path/to/font.ttf */ +-$ImagickDraw->setFont( 'Helvetica Regular' ); ++$ImagickDraw->setFont( '/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf' ); + $ImagickDraw->setFontSize( 20 ); + + /* Create the text */ diff --git a/imagick-3.4.4/examples/captcha.php b/imagick-3.4.4/examples/captcha.php index a9176a3..a76c1cb 100644 --- a/imagick-3.4.4/examples/captcha.php diff -Nru php-imagick-3.4.4/debian/patches/0002-Skip-version-check-by-default.patch php-imagick-3.4.4+php8.0+3.4.4/debian/patches/0002-Skip-version-check-by-default.patch --- php-imagick-3.4.4/debian/patches/0002-Skip-version-check-by-default.patch 2020-03-02 09:04:48.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/debian/patches/0002-Skip-version-check-by-default.patch 2021-03-05 10:49:49.000000000 +0000 @@ -3,9 +3,32 @@ Subject: Skip version check by default --- - imagick-3.4.4/imagick.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) + imagick-3.4.4+php8.0/imagick.c | 4 ++-- + imagick-3.4.4/imagick.c | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) +diff --git a/imagick-3.4.4+php8.0/imagick.c b/imagick-3.4.4+php8.0/imagick.c +index 8e58afe..eb65ba7 100644 +--- a/imagick-3.4.4+php8.0/imagick.c ++++ b/imagick-3.4.4+php8.0/imagick.c +@@ -3260,7 +3260,7 @@ static zend_object_value php_imagickkernel_object_new(zend_class_entry *class_ty + + PHP_INI_BEGIN() + STD_PHP_INI_ENTRY("imagick.locale_fix", "0", PHP_INI_ALL, OnUpdateBool, locale_fix, zend_imagick_globals, imagick_globals) +- STD_PHP_INI_ENTRY("imagick.skip_version_check", "0", PHP_INI_ALL, OnUpdateBool, skip_version_check, zend_imagick_globals, imagick_globals) ++ STD_PHP_INI_ENTRY("imagick.skip_version_check", "1", PHP_INI_ALL, OnUpdateBool, skip_version_check, zend_imagick_globals, imagick_globals) + STD_PHP_INI_ENTRY("imagick.progress_monitor", "0", PHP_INI_SYSTEM, OnUpdateBool, progress_monitor, zend_imagick_globals, imagick_globals) + PHP_INI_END() + +@@ -3268,7 +3268,7 @@ static void php_imagick_init_globals(zend_imagick_globals *imagick_globals) + { + imagick_globals->locale_fix = 0; + imagick_globals->progress_monitor = 0; +- imagick_globals->skip_version_check = 0; ++ imagick_globals->skip_version_check = 1; + } + + diff --git a/imagick-3.4.4/imagick.c b/imagick-3.4.4/imagick.c index 8e58afe..eb65ba7 100644 --- a/imagick-3.4.4/imagick.c diff -Nru php-imagick-3.4.4/debian/patches/0003-Disable-test-014-which-fails-due-to-system-resources.patch php-imagick-3.4.4+php8.0+3.4.4/debian/patches/0003-Disable-test-014-which-fails-due-to-system-resources.patch --- php-imagick-3.4.4/debian/patches/0003-Disable-test-014-which-fails-due-to-system-resources.patch 2020-03-02 09:04:48.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/debian/patches/0003-Disable-test-014-which-fails-due-to-system-resources.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -From ab12be87225d50ac2122f006269c312c4593512d Mon Sep 17 00:00:00 2001 -From: Bryce Harrington -Date: Thu, 27 Feb 2020 03:40:31 +0000 -Subject: [PATCH] Disable test 014 which fails due to system resource limit - policy - -Origin: vendor -Forwarded: no -X-Not-Forwarded-Reason: Only applicable to Ubuntu build environments -Author: Bryce Harrington -Bug-Ubuntu: https://bugs.launchpad.net/bugs/1864961 -Last-Update: 2020-02-27 - ---- - imagick-3.4.4/tests/014-setresourcelimit.phpt | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/imagick-3.4.4/tests/014-setresourcelimit.phpt b/imagick-3.4.4/tests/014-setresourcelimit.phpt -index 14ea263..9c35725 100644 ---- a/imagick-3.4.4/tests/014-setresourcelimit.phpt -+++ b/imagick-3.4.4/tests/014-setresourcelimit.phpt -@@ -2,6 +2,8 @@ - Imagick::setResourceLimit test - --SKIPIF-- - --- -2.25.1 - diff -Nru php-imagick-3.4.4/debian/patches/0003-no-openmp-threads.patch php-imagick-3.4.4+php8.0+3.4.4/debian/patches/0003-no-openmp-threads.patch --- php-imagick-3.4.4/debian/patches/0003-no-openmp-threads.patch 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/debian/patches/0003-no-openmp-threads.patch 2021-03-05 10:49:49.000000000 +0000 @@ -0,0 +1,43 @@ +From: Steve Langasek +Date: Sat, 10 Oct 2020 12:25:53 +0200 +Subject: limit the number of openmp threads used to 1 + +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1549942 + +The php-imagick 3.4.0 test suite fails with various segfaults when openmp +threads are in use. Force the openmp thread count to 1 to avoid this +problem. + +This patch is a workaround only; it is currently unknown if the root bug +lies in php-imagick or in imagemagick. +--- + imagick-3.4.4+php8.0/imagick.c | 2 ++ + imagick-3.4.4/imagick.c | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/imagick-3.4.4+php8.0/imagick.c b/imagick-3.4.4+php8.0/imagick.c +index eb65ba7..61c593c 100644 +--- a/imagick-3.4.4+php8.0/imagick.c ++++ b/imagick-3.4.4+php8.0/imagick.c +@@ -3748,6 +3748,8 @@ PHP_MINIT_FUNCTION(imagick) + checkImagickVersion(); + } + ++ SetMagickResourceLimit(ThreadResource, 1); ++ + return SUCCESS; + } + +diff --git a/imagick-3.4.4/imagick.c b/imagick-3.4.4/imagick.c +index eb65ba7..61c593c 100644 +--- a/imagick-3.4.4/imagick.c ++++ b/imagick-3.4.4/imagick.c +@@ -3748,6 +3748,8 @@ PHP_MINIT_FUNCTION(imagick) + checkImagickVersion(); + } + ++ SetMagickResourceLimit(ThreadResource, 1); ++ + return SUCCESS; + } + diff -Nru php-imagick-3.4.4/debian/patches/0004-Disable-remaining-tests-failing-with-7.4.patch php-imagick-3.4.4+php8.0+3.4.4/debian/patches/0004-Disable-remaining-tests-failing-with-7.4.patch --- php-imagick-3.4.4/debian/patches/0004-Disable-remaining-tests-failing-with-7.4.patch 2020-03-02 09:04:48.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/debian/patches/0004-Disable-remaining-tests-failing-with-7.4.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,292 +0,0 @@ -Description: skip some tests still failing on php 7.4 on Debian'ish systems - The Ubuntu build already is more stable than Debian, but a few are left - that need to be analyzed and fixed post feature freeze. - For now disable those few tests that are left, but re-enable that bad tests - actually would break the build which is better coverage than fail&ignore. -Forwarded: no -X-Not-Forwarded-Reason: depends on analysis of the root cause -Author: Christian Ehrhardt -Bug-Ubuntu: https://bugs.launchpad.net/bugs/1864961 -Last-Update: 2020-02-27 ---- a/imagick-3.4.4/tests/177_ImagickDraw_composite_basic.phpt -+++ b/imagick-3.4.4/tests/177_ImagickDraw_composite_basic.phpt -@@ -2,6 +2,7 @@ - Test ImagickDraw, composite - --SKIPIF-- - -@@ -54,4 +55,4 @@ composite($strokeColor, $fillColor, $bac - echo "Ok"; - ?> - --EXPECTF-- --Ok -\ No newline at end of file -+Ok ---- a/imagick-3.4.4/tests/206_ImagickDraw_setFontSize_basic.phpt -+++ b/imagick-3.4.4/tests/206_ImagickDraw_setFontSize_basic.phpt -@@ -2,6 +2,7 @@ - Test ImagickDraw, setFontSize - --SKIPIF-- - -@@ -41,4 +42,4 @@ setFontSize($fillColor, $strokeColor, $b - echo "Ok"; - ?> - --EXPECTF-- --Ok -\ No newline at end of file -+Ok ---- a/imagick-3.4.4/tests/207_ImagickDraw_setFontFamily_basic.phpt -+++ b/imagick-3.4.4/tests/207_ImagickDraw_setFontFamily_basic.phpt -@@ -2,6 +2,7 @@ - Test ImagickDraw, setFontFamily - --SKIPIF-- - -@@ -52,4 +53,4 @@ setFontFamily($fillColor, $strokeColor, - echo "Ok"; - ?> - --EXPECTF-- --Ok -\ No newline at end of file -+Ok ---- a/imagick-3.4.4/tests/208_ImagickDraw_setFontStretch_basic.phpt -+++ b/imagick-3.4.4/tests/208_ImagickDraw_setFontStretch_basic.phpt -@@ -2,6 +2,7 @@ - Test ImagickDraw, setFontStretch - --SKIPIF-- - -@@ -43,4 +44,4 @@ setFontStretch($fillColor, $strokeColor, - echo "Ok"; - ?> - --EXPECTF-- --Ok -\ No newline at end of file -+Ok ---- a/imagick-3.4.4/tests/209_ImagickDraw_setFontWeight_basic.phpt -+++ b/imagick-3.4.4/tests/209_ImagickDraw_setFontWeight_basic.phpt -@@ -2,6 +2,7 @@ - Test ImagickDraw, setFontWeight - --SKIPIF-- - -@@ -48,4 +49,4 @@ setFontWeight($fillColor, $strokeColor, - echo "Ok"; - ?> - --EXPECTF-- --Ok -\ No newline at end of file -+Ok ---- a/imagick-3.4.4/tests/210_ImagickDraw_setFontStyle_basic.phpt -+++ b/imagick-3.4.4/tests/210_ImagickDraw_setFontStyle_basic.phpt -@@ -2,6 +2,7 @@ - Test ImagickDraw, setFontStyle - --SKIPIF-- - -@@ -40,4 +41,4 @@ setFontStyle($fillColor, $strokeColor, $ - echo "Ok"; - ?> - --EXPECTF-- --Ok -\ No newline at end of file -+Ok ---- a/imagick-3.4.4/tests/212_ImagickDraw_setGravity_basic.phpt -+++ b/imagick-3.4.4/tests/212_ImagickDraw_setGravity_basic.phpt -@@ -2,6 +2,7 @@ - Test ImagickDraw, setGravity - --SKIPIF-- - -@@ -41,4 +42,4 @@ setGravity($fillColor, $strokeColor, $ba - echo "Ok"; - ?> - --EXPECTF-- --Ok -\ No newline at end of file -+Ok ---- a/imagick-3.4.4/tests/222_ImagickDraw_setTextAlignment_basic.phpt -+++ b/imagick-3.4.4/tests/222_ImagickDraw_setTextAlignment_basic.phpt -@@ -2,6 +2,7 @@ - Test ImagickDraw, setTextAlignment - --SKIPIF-- - -@@ -40,4 +41,4 @@ setTextAlignment($strokeColor, $fillColo - echo "Ok"; - ?> - --EXPECTF-- --Ok -\ No newline at end of file -+Ok ---- a/imagick-3.4.4/tests/223_ImagickDraw_setTextAntialias_basic.phpt -+++ b/imagick-3.4.4/tests/223_ImagickDraw_setTextAntialias_basic.phpt -@@ -2,6 +2,7 @@ - Test ImagickDraw, setTextAntialias - --SKIPIF-- - -@@ -41,4 +42,4 @@ setTextAntialias($fillColor, $background - echo "Ok"; - ?> - --EXPECTF-- --Ok -\ No newline at end of file -+Ok ---- a/imagick-3.4.4/tests/224_ImagickDraw_setTextUnderColor_basic.phpt -+++ b/imagick-3.4.4/tests/224_ImagickDraw_setTextUnderColor_basic.phpt -@@ -2,6 +2,7 @@ - Test ImagickDraw, setTextUnderColor - --SKIPIF-- - -@@ -38,4 +39,4 @@ setTextUnderColor($strokeColor, $fillCol - echo "Ok"; - ?> - --EXPECTF-- --Ok -\ No newline at end of file -+Ok ---- a/imagick-3.4.4/tests/225_ImagickDraw_setTextDecoration_basic.phpt -+++ b/imagick-3.4.4/tests/225_ImagickDraw_setTextDecoration_basic.phpt -@@ -2,6 +2,7 @@ - Test ImagickDraw, setTextDecoration - --SKIPIF-- - -@@ -37,4 +38,4 @@ setTextDecoration($strokeColor, $fillCol - echo "Ok"; - ?> - --EXPECTF-- --Ok -\ No newline at end of file -+Ok ---- a/imagick-3.4.4/tests/241_Tutorial_psychedelicFont_basic.phpt -+++ b/imagick-3.4.4/tests/241_Tutorial_psychedelicFont_basic.phpt -@@ -2,6 +2,7 @@ - Test Tutorial, psychedelicFont - --SKIPIF-- - -@@ -43,4 +44,4 @@ psychedelicFont() ; - echo "Ok"; - ?> - --EXPECTF-- --Ok -\ No newline at end of file -+Ok ---- a/imagick-3.4.4/tests/244_Tutorial_psychedelicFontGif_basic.phpt -+++ b/imagick-3.4.4/tests/244_Tutorial_psychedelicFontGif_basic.phpt -@@ -2,6 +2,7 @@ - Test Tutorial, psychedelicFontGif - --SKIPIF-- - -@@ -66,4 +67,4 @@ psychedelicFontGif($name = 'Danack') ; - echo "Ok"; - ?> - --EXPECTF-- --Ok -\ No newline at end of file -+Ok ---- a/imagick-3.4.4/tests/264_ImagickDraw_getTextDirection_basic.phpt -+++ b/imagick-3.4.4/tests/264_ImagickDraw_getTextDirection_basic.phpt -@@ -2,6 +2,7 @@ - Test ImagickDraw, getTextDirection - --SKIPIF-- - -@@ -60,4 +61,4 @@ $imagick->writeImage('./directionTest.pn - echo "Ok"; - ?> - --EXPECTF-- --Ok -\ No newline at end of file -+Ok ---- a/imagick-3.4.4/tests/266_ImagickDraw_getFontResolution_basic.phpt -+++ b/imagick-3.4.4/tests/266_ImagickDraw_getFontResolution_basic.phpt -@@ -2,6 +2,7 @@ - Test ImagickDraw, getFontResolution - --SKIPIF-- - -@@ -65,4 +66,4 @@ echo "Ok"; - ?> - - --EXPECTF-- --Ok -\ No newline at end of file -+Ok ---- a/imagick-3.4.4/tests/279_ImagickDraw_setTextInterlineSpacing.phpt -+++ b/imagick-3.4.4/tests/279_ImagickDraw_setTextInterlineSpacing.phpt -@@ -2,6 +2,7 @@ - Test ImagickDraw:: setTextInterlineSpacing - --SKIPIF-- - -@@ -34,4 +35,4 @@ annotateImage($strokeColor, $fillColor) - echo "Ok"; - ?> - --EXPECTF-- --Ok -\ No newline at end of file -+Ok diff -Nru php-imagick-3.4.4/debian/patches/0004-Disable-test-014-which-fails-due-to-system-resources.patch php-imagick-3.4.4+php8.0+3.4.4/debian/patches/0004-Disable-test-014-which-fails-due-to-system-resources.patch --- php-imagick-3.4.4/debian/patches/0004-Disable-test-014-which-fails-due-to-system-resources.patch 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/debian/patches/0004-Disable-test-014-which-fails-due-to-system-resources.patch 2021-03-05 10:49:49.000000000 +0000 @@ -0,0 +1,42 @@ +From: Bryce Harrington +Date: Thu, 27 Feb 2020 03:40:31 +0000 +Subject: [PATCH] Disable test 014 which fails due to system resource limit + policy + +Origin: vendor +Forwarded: no +X-Not-Forwarded-Reason: Only applicable to Ubuntu build environments +Author: Bryce Harrington +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1864961 +Last-Update: 2020-02-27 +--- + imagick-3.4.4+php8.0/tests/014-setresourcelimit.phpt | 2 ++ + imagick-3.4.4/tests/014-setresourcelimit.phpt | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/imagick-3.4.4+php8.0/tests/014-setresourcelimit.phpt b/imagick-3.4.4+php8.0/tests/014-setresourcelimit.phpt +index 14ea263..9c35725 100644 +--- a/imagick-3.4.4+php8.0/tests/014-setresourcelimit.phpt ++++ b/imagick-3.4.4+php8.0/tests/014-setresourcelimit.phpt +@@ -2,6 +2,8 @@ + Imagick::setResourceLimit test + --SKIPIF-- + +diff --git a/imagick-3.4.4/tests/014-setresourcelimit.phpt b/imagick-3.4.4/tests/014-setresourcelimit.phpt +index 14ea263..9c35725 100644 +--- a/imagick-3.4.4/tests/014-setresourcelimit.phpt ++++ b/imagick-3.4.4/tests/014-setresourcelimit.phpt +@@ -2,6 +2,8 @@ + Imagick::setResourceLimit test + --SKIPIF-- + diff -Nru php-imagick-3.4.4/debian/patches/0005-Disable-remaining-tests-failing-with-7.4.patch php-imagick-3.4.4+php8.0+3.4.4/debian/patches/0005-Disable-remaining-tests-failing-with-7.4.patch --- php-imagick-3.4.4/debian/patches/0005-Disable-remaining-tests-failing-with-7.4.patch 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/debian/patches/0005-Disable-remaining-tests-failing-with-7.4.patch 2021-03-05 10:49:49.000000000 +0000 @@ -0,0 +1,696 @@ +From: Christian Ehrhardt +Date: Sat, 10 Oct 2020 12:25:53 +0200 +Subject: skip some tests still failing on php 7.4 on Debian'ish systems + +Forwarded: no +X-Not-Forwarded-Reason: depends on analysis of the root cause +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1864961 +Last-Update: 2020-02-27 + +The Ubuntu build already is more stable than Debian, but a few are left +that need to be analyzed and fixed post feature freeze. +For now disable those few tests that are left, but re-enable that bad tests +actually would break the build which is better coverage than fail&ignore. +--- + imagick-3.4.4+php8.0/tests/034_Imagick_annotateImage_basic.phpt | 3 ++- + imagick-3.4.4+php8.0/tests/206_ImagickDraw_setFontSize_basic.phpt | 3 ++- + imagick-3.4.4+php8.0/tests/207_ImagickDraw_setFontFamily_basic.phpt | 3 ++- + imagick-3.4.4+php8.0/tests/208_ImagickDraw_setFontStretch_basic.phpt | 3 ++- + imagick-3.4.4+php8.0/tests/209_ImagickDraw_setFontWeight_basic.phpt | 3 ++- + imagick-3.4.4+php8.0/tests/210_ImagickDraw_setFontStyle_basic.phpt | 3 ++- + imagick-3.4.4+php8.0/tests/212_ImagickDraw_setGravity_basic.phpt | 3 ++- + .../tests/222_ImagickDraw_setTextAlignment_basic.phpt | 3 ++- + .../tests/223_ImagickDraw_setTextAntialias_basic.phpt | 3 ++- + .../tests/224_ImagickDraw_setTextUnderColor_basic.phpt | 3 ++- + .../tests/225_ImagickDraw_setTextDecoration_basic.phpt | 3 ++- + imagick-3.4.4+php8.0/tests/241_Tutorial_psychedelicFont_basic.phpt | 3 ++- + .../tests/244_Tutorial_psychedelicFontGif_basic.phpt | 3 ++- + .../tests/264_ImagickDraw_getTextDirection_basic.phpt | 3 ++- + .../tests/266_ImagickDraw_getFontResolution_basic.phpt | 3 ++- + .../tests/279_ImagickDraw_setTextInterlineSpacing.phpt | 1 + + imagick-3.4.4+php8.0/tests/bug_72226.phpt | 5 ++++- + imagick-3.4.4/tests/034_Imagick_annotateImage_basic.phpt | 3 ++- + imagick-3.4.4/tests/177_ImagickDraw_composite_basic.phpt | 3 ++- + imagick-3.4.4/tests/206_ImagickDraw_setFontSize_basic.phpt | 3 ++- + imagick-3.4.4/tests/207_ImagickDraw_setFontFamily_basic.phpt | 3 ++- + imagick-3.4.4/tests/208_ImagickDraw_setFontStretch_basic.phpt | 3 ++- + imagick-3.4.4/tests/209_ImagickDraw_setFontWeight_basic.phpt | 3 ++- + imagick-3.4.4/tests/210_ImagickDraw_setFontStyle_basic.phpt | 3 ++- + imagick-3.4.4/tests/212_ImagickDraw_setGravity_basic.phpt | 3 ++- + imagick-3.4.4/tests/222_ImagickDraw_setTextAlignment_basic.phpt | 3 ++- + imagick-3.4.4/tests/223_ImagickDraw_setTextAntialias_basic.phpt | 3 ++- + imagick-3.4.4/tests/224_ImagickDraw_setTextUnderColor_basic.phpt | 3 ++- + imagick-3.4.4/tests/225_ImagickDraw_setTextDecoration_basic.phpt | 3 ++- + imagick-3.4.4/tests/241_Tutorial_psychedelicFont_basic.phpt | 3 ++- + imagick-3.4.4/tests/244_Tutorial_psychedelicFontGif_basic.phpt | 3 ++- + imagick-3.4.4/tests/264_ImagickDraw_getTextDirection_basic.phpt | 3 ++- + imagick-3.4.4/tests/266_ImagickDraw_getFontResolution_basic.phpt | 3 ++- + imagick-3.4.4/tests/279_ImagickDraw_setTextInterlineSpacing.phpt | 1 + + imagick-3.4.4/tests/bug_72226.phpt | 5 ++++- + 35 files changed, 72 insertions(+), 33 deletions(-) + +diff --git a/imagick-3.4.4+php8.0/tests/034_Imagick_annotateImage_basic.phpt b/imagick-3.4.4+php8.0/tests/034_Imagick_annotateImage_basic.phpt +index 65d113f..a03878c 100644 +--- a/imagick-3.4.4+php8.0/tests/034_Imagick_annotateImage_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/034_Imagick_annotateImage_basic.phpt +@@ -2,6 +2,7 @@ + Test Imagick, annotateImage + --SKIPIF-- + +@@ -34,4 +35,4 @@ annotateImage($strokeColor, $fillColor) ; + echo "Ok"; + ?> + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4+php8.0/tests/206_ImagickDraw_setFontSize_basic.phpt b/imagick-3.4.4+php8.0/tests/206_ImagickDraw_setFontSize_basic.phpt +index 9ac6d26..b964b30 100644 +--- a/imagick-3.4.4+php8.0/tests/206_ImagickDraw_setFontSize_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/206_ImagickDraw_setFontSize_basic.phpt +@@ -2,6 +2,7 @@ + Test ImagickDraw, setFontSize + --SKIPIF-- + +@@ -41,4 +42,4 @@ setFontSize($fillColor, $strokeColor, $backgroundColor) ; + echo "Ok"; + ?> + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4+php8.0/tests/207_ImagickDraw_setFontFamily_basic.phpt b/imagick-3.4.4+php8.0/tests/207_ImagickDraw_setFontFamily_basic.phpt +index 230e77c..0e2c147 100644 +--- a/imagick-3.4.4+php8.0/tests/207_ImagickDraw_setFontFamily_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/207_ImagickDraw_setFontFamily_basic.phpt +@@ -2,6 +2,7 @@ + Test ImagickDraw, setFontFamily + --SKIPIF-- + +@@ -52,4 +53,4 @@ setFontFamily($fillColor, $strokeColor, $backgroundColor) ; + echo "Ok"; + ?> + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4+php8.0/tests/208_ImagickDraw_setFontStretch_basic.phpt b/imagick-3.4.4+php8.0/tests/208_ImagickDraw_setFontStretch_basic.phpt +index af3cb92..918c3c1 100644 +--- a/imagick-3.4.4+php8.0/tests/208_ImagickDraw_setFontStretch_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/208_ImagickDraw_setFontStretch_basic.phpt +@@ -2,6 +2,7 @@ + Test ImagickDraw, setFontStretch + --SKIPIF-- + +@@ -43,4 +44,4 @@ setFontStretch($fillColor, $strokeColor, $backgroundColor) ; + echo "Ok"; + ?> + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4+php8.0/tests/209_ImagickDraw_setFontWeight_basic.phpt b/imagick-3.4.4+php8.0/tests/209_ImagickDraw_setFontWeight_basic.phpt +index e98dc27..cd63dbe 100644 +--- a/imagick-3.4.4+php8.0/tests/209_ImagickDraw_setFontWeight_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/209_ImagickDraw_setFontWeight_basic.phpt +@@ -2,6 +2,7 @@ + Test ImagickDraw, setFontWeight + --SKIPIF-- + +@@ -48,4 +49,4 @@ setFontWeight($fillColor, $strokeColor, $backgroundColor) ; + echo "Ok"; + ?> + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4+php8.0/tests/210_ImagickDraw_setFontStyle_basic.phpt b/imagick-3.4.4+php8.0/tests/210_ImagickDraw_setFontStyle_basic.phpt +index 920cce2..f5f5373 100644 +--- a/imagick-3.4.4+php8.0/tests/210_ImagickDraw_setFontStyle_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/210_ImagickDraw_setFontStyle_basic.phpt +@@ -2,6 +2,7 @@ + Test ImagickDraw, setFontStyle + --SKIPIF-- + +@@ -40,4 +41,4 @@ setFontStyle($fillColor, $strokeColor, $backgroundColor) ; + echo "Ok"; + ?> + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4+php8.0/tests/212_ImagickDraw_setGravity_basic.phpt b/imagick-3.4.4+php8.0/tests/212_ImagickDraw_setGravity_basic.phpt +index b6ad07d..ea2cc0c 100644 +--- a/imagick-3.4.4+php8.0/tests/212_ImagickDraw_setGravity_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/212_ImagickDraw_setGravity_basic.phpt +@@ -2,6 +2,7 @@ + Test ImagickDraw, setGravity + --SKIPIF-- + +@@ -41,4 +42,4 @@ setGravity($fillColor, $strokeColor, $backgroundColor) ; + echo "Ok"; + ?> + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4+php8.0/tests/222_ImagickDraw_setTextAlignment_basic.phpt b/imagick-3.4.4+php8.0/tests/222_ImagickDraw_setTextAlignment_basic.phpt +index bda8249..1f6978f 100644 +--- a/imagick-3.4.4+php8.0/tests/222_ImagickDraw_setTextAlignment_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/222_ImagickDraw_setTextAlignment_basic.phpt +@@ -2,6 +2,7 @@ + Test ImagickDraw, setTextAlignment + --SKIPIF-- + +@@ -40,4 +41,4 @@ setTextAlignment($strokeColor, $fillColor, $backgroundColor) ; + echo "Ok"; + ?> + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4+php8.0/tests/223_ImagickDraw_setTextAntialias_basic.phpt b/imagick-3.4.4+php8.0/tests/223_ImagickDraw_setTextAntialias_basic.phpt +index 0c9bcaf..0273cb0 100644 +--- a/imagick-3.4.4+php8.0/tests/223_ImagickDraw_setTextAntialias_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/223_ImagickDraw_setTextAntialias_basic.phpt +@@ -2,6 +2,7 @@ + Test ImagickDraw, setTextAntialias + --SKIPIF-- + +@@ -41,4 +42,4 @@ setTextAntialias($fillColor, $backgroundColor) ; + echo "Ok"; + ?> + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4+php8.0/tests/224_ImagickDraw_setTextUnderColor_basic.phpt b/imagick-3.4.4+php8.0/tests/224_ImagickDraw_setTextUnderColor_basic.phpt +index 69a788e..11ddbe6 100644 +--- a/imagick-3.4.4+php8.0/tests/224_ImagickDraw_setTextUnderColor_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/224_ImagickDraw_setTextUnderColor_basic.phpt +@@ -2,6 +2,7 @@ + Test ImagickDraw, setTextUnderColor + --SKIPIF-- + +@@ -38,4 +39,4 @@ setTextUnderColor($strokeColor, $fillColor, $backgroundColor, $textUnderColor) ; + echo "Ok"; + ?> + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4+php8.0/tests/225_ImagickDraw_setTextDecoration_basic.phpt b/imagick-3.4.4+php8.0/tests/225_ImagickDraw_setTextDecoration_basic.phpt +index 5479971..9cf35c2 100644 +--- a/imagick-3.4.4+php8.0/tests/225_ImagickDraw_setTextDecoration_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/225_ImagickDraw_setTextDecoration_basic.phpt +@@ -2,6 +2,7 @@ + Test ImagickDraw, setTextDecoration + --SKIPIF-- + +@@ -37,4 +38,4 @@ setTextDecoration($strokeColor, $fillColor, $backgroundColor, $textDecoration) ; + echo "Ok"; + ?> + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4+php8.0/tests/241_Tutorial_psychedelicFont_basic.phpt b/imagick-3.4.4+php8.0/tests/241_Tutorial_psychedelicFont_basic.phpt +index b2e9873..1365c38 100644 +--- a/imagick-3.4.4+php8.0/tests/241_Tutorial_psychedelicFont_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/241_Tutorial_psychedelicFont_basic.phpt +@@ -2,6 +2,7 @@ + Test Tutorial, psychedelicFont + --SKIPIF-- + +@@ -43,4 +44,4 @@ psychedelicFont() ; + echo "Ok"; + ?> + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4+php8.0/tests/244_Tutorial_psychedelicFontGif_basic.phpt b/imagick-3.4.4+php8.0/tests/244_Tutorial_psychedelicFontGif_basic.phpt +index f03bdf7..26adf1d 100644 +--- a/imagick-3.4.4+php8.0/tests/244_Tutorial_psychedelicFontGif_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/244_Tutorial_psychedelicFontGif_basic.phpt +@@ -2,6 +2,7 @@ + Test Tutorial, psychedelicFontGif + --SKIPIF-- + +@@ -66,4 +67,4 @@ psychedelicFontGif($name = 'Danack') ; + echo "Ok"; + ?> + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4+php8.0/tests/264_ImagickDraw_getTextDirection_basic.phpt b/imagick-3.4.4+php8.0/tests/264_ImagickDraw_getTextDirection_basic.phpt +index 8dbcbcd..9bedacb 100644 +--- a/imagick-3.4.4+php8.0/tests/264_ImagickDraw_getTextDirection_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/264_ImagickDraw_getTextDirection_basic.phpt +@@ -2,6 +2,7 @@ + Test ImagickDraw, getTextDirection + --SKIPIF-- + +@@ -60,4 +61,4 @@ $imagick->writeImage('./directionTest.png'); + echo "Ok"; + ?> + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4+php8.0/tests/266_ImagickDraw_getFontResolution_basic.phpt b/imagick-3.4.4+php8.0/tests/266_ImagickDraw_getFontResolution_basic.phpt +index 43a2e46..8efe48b 100644 +--- a/imagick-3.4.4+php8.0/tests/266_ImagickDraw_getFontResolution_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/266_ImagickDraw_getFontResolution_basic.phpt +@@ -2,6 +2,7 @@ + Test ImagickDraw, getFontResolution + --SKIPIF-- + +@@ -65,4 +66,4 @@ echo "Ok"; + ?> + + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4+php8.0/tests/279_ImagickDraw_setTextInterlineSpacing.phpt b/imagick-3.4.4+php8.0/tests/279_ImagickDraw_setTextInterlineSpacing.phpt +index 27250e3..3015eb6 100644 +--- a/imagick-3.4.4+php8.0/tests/279_ImagickDraw_setTextInterlineSpacing.phpt ++++ b/imagick-3.4.4+php8.0/tests/279_ImagickDraw_setTextInterlineSpacing.phpt +@@ -2,6 +2,7 @@ + Test ImagickDraw:: setTextInterlineSpacing + --SKIPIF-- + ++ + --FILE-- + +@@ -34,4 +35,4 @@ annotateImage($strokeColor, $fillColor) ; + echo "Ok"; + ?> + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4/tests/177_ImagickDraw_composite_basic.phpt b/imagick-3.4.4/tests/177_ImagickDraw_composite_basic.phpt +index 3c87524..0807402 100644 +--- a/imagick-3.4.4/tests/177_ImagickDraw_composite_basic.phpt ++++ b/imagick-3.4.4/tests/177_ImagickDraw_composite_basic.phpt +@@ -2,6 +2,7 @@ + Test ImagickDraw, composite + --SKIPIF-- + +@@ -54,4 +55,4 @@ composite($strokeColor, $fillColor, $backgroundColor) ; + echo "Ok"; + ?> + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4/tests/206_ImagickDraw_setFontSize_basic.phpt b/imagick-3.4.4/tests/206_ImagickDraw_setFontSize_basic.phpt +index 9ac6d26..b964b30 100644 +--- a/imagick-3.4.4/tests/206_ImagickDraw_setFontSize_basic.phpt ++++ b/imagick-3.4.4/tests/206_ImagickDraw_setFontSize_basic.phpt +@@ -2,6 +2,7 @@ + Test ImagickDraw, setFontSize + --SKIPIF-- + +@@ -41,4 +42,4 @@ setFontSize($fillColor, $strokeColor, $backgroundColor) ; + echo "Ok"; + ?> + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4/tests/207_ImagickDraw_setFontFamily_basic.phpt b/imagick-3.4.4/tests/207_ImagickDraw_setFontFamily_basic.phpt +index 230e77c..0e2c147 100644 +--- a/imagick-3.4.4/tests/207_ImagickDraw_setFontFamily_basic.phpt ++++ b/imagick-3.4.4/tests/207_ImagickDraw_setFontFamily_basic.phpt +@@ -2,6 +2,7 @@ + Test ImagickDraw, setFontFamily + --SKIPIF-- + +@@ -52,4 +53,4 @@ setFontFamily($fillColor, $strokeColor, $backgroundColor) ; + echo "Ok"; + ?> + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4/tests/208_ImagickDraw_setFontStretch_basic.phpt b/imagick-3.4.4/tests/208_ImagickDraw_setFontStretch_basic.phpt +index af3cb92..918c3c1 100644 +--- a/imagick-3.4.4/tests/208_ImagickDraw_setFontStretch_basic.phpt ++++ b/imagick-3.4.4/tests/208_ImagickDraw_setFontStretch_basic.phpt +@@ -2,6 +2,7 @@ + Test ImagickDraw, setFontStretch + --SKIPIF-- + +@@ -43,4 +44,4 @@ setFontStretch($fillColor, $strokeColor, $backgroundColor) ; + echo "Ok"; + ?> + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4/tests/209_ImagickDraw_setFontWeight_basic.phpt b/imagick-3.4.4/tests/209_ImagickDraw_setFontWeight_basic.phpt +index e98dc27..cd63dbe 100644 +--- a/imagick-3.4.4/tests/209_ImagickDraw_setFontWeight_basic.phpt ++++ b/imagick-3.4.4/tests/209_ImagickDraw_setFontWeight_basic.phpt +@@ -2,6 +2,7 @@ + Test ImagickDraw, setFontWeight + --SKIPIF-- + +@@ -48,4 +49,4 @@ setFontWeight($fillColor, $strokeColor, $backgroundColor) ; + echo "Ok"; + ?> + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4/tests/210_ImagickDraw_setFontStyle_basic.phpt b/imagick-3.4.4/tests/210_ImagickDraw_setFontStyle_basic.phpt +index 920cce2..f5f5373 100644 +--- a/imagick-3.4.4/tests/210_ImagickDraw_setFontStyle_basic.phpt ++++ b/imagick-3.4.4/tests/210_ImagickDraw_setFontStyle_basic.phpt +@@ -2,6 +2,7 @@ + Test ImagickDraw, setFontStyle + --SKIPIF-- + +@@ -40,4 +41,4 @@ setFontStyle($fillColor, $strokeColor, $backgroundColor) ; + echo "Ok"; + ?> + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4/tests/212_ImagickDraw_setGravity_basic.phpt b/imagick-3.4.4/tests/212_ImagickDraw_setGravity_basic.phpt +index b6ad07d..ea2cc0c 100644 +--- a/imagick-3.4.4/tests/212_ImagickDraw_setGravity_basic.phpt ++++ b/imagick-3.4.4/tests/212_ImagickDraw_setGravity_basic.phpt +@@ -2,6 +2,7 @@ + Test ImagickDraw, setGravity + --SKIPIF-- + +@@ -41,4 +42,4 @@ setGravity($fillColor, $strokeColor, $backgroundColor) ; + echo "Ok"; + ?> + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4/tests/222_ImagickDraw_setTextAlignment_basic.phpt b/imagick-3.4.4/tests/222_ImagickDraw_setTextAlignment_basic.phpt +index bda8249..1f6978f 100644 +--- a/imagick-3.4.4/tests/222_ImagickDraw_setTextAlignment_basic.phpt ++++ b/imagick-3.4.4/tests/222_ImagickDraw_setTextAlignment_basic.phpt +@@ -2,6 +2,7 @@ + Test ImagickDraw, setTextAlignment + --SKIPIF-- + +@@ -40,4 +41,4 @@ setTextAlignment($strokeColor, $fillColor, $backgroundColor) ; + echo "Ok"; + ?> + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4/tests/223_ImagickDraw_setTextAntialias_basic.phpt b/imagick-3.4.4/tests/223_ImagickDraw_setTextAntialias_basic.phpt +index 0c9bcaf..0273cb0 100644 +--- a/imagick-3.4.4/tests/223_ImagickDraw_setTextAntialias_basic.phpt ++++ b/imagick-3.4.4/tests/223_ImagickDraw_setTextAntialias_basic.phpt +@@ -2,6 +2,7 @@ + Test ImagickDraw, setTextAntialias + --SKIPIF-- + +@@ -41,4 +42,4 @@ setTextAntialias($fillColor, $backgroundColor) ; + echo "Ok"; + ?> + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4/tests/224_ImagickDraw_setTextUnderColor_basic.phpt b/imagick-3.4.4/tests/224_ImagickDraw_setTextUnderColor_basic.phpt +index 69a788e..11ddbe6 100644 +--- a/imagick-3.4.4/tests/224_ImagickDraw_setTextUnderColor_basic.phpt ++++ b/imagick-3.4.4/tests/224_ImagickDraw_setTextUnderColor_basic.phpt +@@ -2,6 +2,7 @@ + Test ImagickDraw, setTextUnderColor + --SKIPIF-- + +@@ -38,4 +39,4 @@ setTextUnderColor($strokeColor, $fillColor, $backgroundColor, $textUnderColor) ; + echo "Ok"; + ?> + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4/tests/225_ImagickDraw_setTextDecoration_basic.phpt b/imagick-3.4.4/tests/225_ImagickDraw_setTextDecoration_basic.phpt +index 5479971..9cf35c2 100644 +--- a/imagick-3.4.4/tests/225_ImagickDraw_setTextDecoration_basic.phpt ++++ b/imagick-3.4.4/tests/225_ImagickDraw_setTextDecoration_basic.phpt +@@ -2,6 +2,7 @@ + Test ImagickDraw, setTextDecoration + --SKIPIF-- + +@@ -37,4 +38,4 @@ setTextDecoration($strokeColor, $fillColor, $backgroundColor, $textDecoration) ; + echo "Ok"; + ?> + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4/tests/241_Tutorial_psychedelicFont_basic.phpt b/imagick-3.4.4/tests/241_Tutorial_psychedelicFont_basic.phpt +index b2e9873..1365c38 100644 +--- a/imagick-3.4.4/tests/241_Tutorial_psychedelicFont_basic.phpt ++++ b/imagick-3.4.4/tests/241_Tutorial_psychedelicFont_basic.phpt +@@ -2,6 +2,7 @@ + Test Tutorial, psychedelicFont + --SKIPIF-- + +@@ -43,4 +44,4 @@ psychedelicFont() ; + echo "Ok"; + ?> + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4/tests/244_Tutorial_psychedelicFontGif_basic.phpt b/imagick-3.4.4/tests/244_Tutorial_psychedelicFontGif_basic.phpt +index f03bdf7..26adf1d 100644 +--- a/imagick-3.4.4/tests/244_Tutorial_psychedelicFontGif_basic.phpt ++++ b/imagick-3.4.4/tests/244_Tutorial_psychedelicFontGif_basic.phpt +@@ -2,6 +2,7 @@ + Test Tutorial, psychedelicFontGif + --SKIPIF-- + +@@ -66,4 +67,4 @@ psychedelicFontGif($name = 'Danack') ; + echo "Ok"; + ?> + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4/tests/264_ImagickDraw_getTextDirection_basic.phpt b/imagick-3.4.4/tests/264_ImagickDraw_getTextDirection_basic.phpt +index 8dbcbcd..9bedacb 100644 +--- a/imagick-3.4.4/tests/264_ImagickDraw_getTextDirection_basic.phpt ++++ b/imagick-3.4.4/tests/264_ImagickDraw_getTextDirection_basic.phpt +@@ -2,6 +2,7 @@ + Test ImagickDraw, getTextDirection + --SKIPIF-- + +@@ -60,4 +61,4 @@ $imagick->writeImage('./directionTest.png'); + echo "Ok"; + ?> + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4/tests/266_ImagickDraw_getFontResolution_basic.phpt b/imagick-3.4.4/tests/266_ImagickDraw_getFontResolution_basic.phpt +index 43a2e46..8efe48b 100644 +--- a/imagick-3.4.4/tests/266_ImagickDraw_getFontResolution_basic.phpt ++++ b/imagick-3.4.4/tests/266_ImagickDraw_getFontResolution_basic.phpt +@@ -2,6 +2,7 @@ + Test ImagickDraw, getFontResolution + --SKIPIF-- + +@@ -65,4 +66,4 @@ echo "Ok"; + ?> + + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4/tests/279_ImagickDraw_setTextInterlineSpacing.phpt b/imagick-3.4.4/tests/279_ImagickDraw_setTextInterlineSpacing.phpt +index 27250e3..3015eb6 100644 +--- a/imagick-3.4.4/tests/279_ImagickDraw_setTextInterlineSpacing.phpt ++++ b/imagick-3.4.4/tests/279_ImagickDraw_setTextInterlineSpacing.phpt +@@ -2,6 +2,7 @@ + Test ImagickDraw:: setTextInterlineSpacing + --SKIPIF-- + ++ + --FILE-- + +Date: Fri, 4 Sep 2020 08:36:10 +0200 +Subject: SPL is always there + +--- + imagick-3.4.4+php8.0/imagick.c | 8 -------- + imagick-3.4.4/imagick.c | 8 -------- + 2 files changed, 16 deletions(-) + +diff --git a/imagick-3.4.4+php8.0/imagick.c b/imagick-3.4.4+php8.0/imagick.c +index 61c593c..11ea7d4 100644 +--- a/imagick-3.4.4+php8.0/imagick.c ++++ b/imagick-3.4.4+php8.0/imagick.c +@@ -33,9 +33,7 @@ + + + /* For the countable interface */ +-#if defined(HAVE_SPL) + #include "ext/spl/spl_iterators.h" +-#endif + + ZEND_DECLARE_MODULE_GLOBALS(imagick) + +@@ -3675,11 +3673,7 @@ PHP_MINIT_FUNCTION(imagick) + #endif + + php_imagick_sc_entry = zend_register_internal_class(&ce TSRMLS_CC); +-#if defined(HAVE_SPL) + zend_class_implements(php_imagick_sc_entry TSRMLS_CC, 2, zend_ce_iterator, spl_ce_Countable); +-#else +- zend_class_implements(php_imagick_sc_entry TSRMLS_CC, 1, zend_ce_iterator); +-#endif + + /* + Initialize the class (ImagickDraw) +@@ -3876,9 +3870,7 @@ PHP_RSHUTDOWN_FUNCTION(imagick) + static const zend_module_dep imagick_deps[] = { + ZEND_MOD_CONFLICTS("gmagick") + ZEND_MOD_REQUIRED("standard") +-#ifdef HAVE_SPL + ZEND_MOD_REQUIRED("spl") +-#endif + ZEND_MOD_END + }; + #endif +diff --git a/imagick-3.4.4/imagick.c b/imagick-3.4.4/imagick.c +index 61c593c..11ea7d4 100644 +--- a/imagick-3.4.4/imagick.c ++++ b/imagick-3.4.4/imagick.c +@@ -33,9 +33,7 @@ + + + /* For the countable interface */ +-#if defined(HAVE_SPL) + #include "ext/spl/spl_iterators.h" +-#endif + + ZEND_DECLARE_MODULE_GLOBALS(imagick) + +@@ -3675,11 +3673,7 @@ PHP_MINIT_FUNCTION(imagick) + #endif + + php_imagick_sc_entry = zend_register_internal_class(&ce TSRMLS_CC); +-#if defined(HAVE_SPL) + zend_class_implements(php_imagick_sc_entry TSRMLS_CC, 2, zend_ce_iterator, spl_ce_Countable); +-#else +- zend_class_implements(php_imagick_sc_entry TSRMLS_CC, 1, zend_ce_iterator); +-#endif + + /* + Initialize the class (ImagickDraw) +@@ -3876,9 +3870,7 @@ PHP_RSHUTDOWN_FUNCTION(imagick) + static const zend_module_dep imagick_deps[] = { + ZEND_MOD_CONFLICTS("gmagick") + ZEND_MOD_REQUIRED("standard") +-#ifdef HAVE_SPL + ZEND_MOD_REQUIRED("spl") +-#endif + ZEND_MOD_END + }; + #endif diff -Nru php-imagick-3.4.4/debian/patches/0007-thread-limit-per-request.patch php-imagick-3.4.4+php8.0+3.4.4/debian/patches/0007-thread-limit-per-request.patch --- php-imagick-3.4.4/debian/patches/0007-thread-limit-per-request.patch 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/debian/patches/0007-thread-limit-per-request.patch 2021-03-05 10:49:49.000000000 +0000 @@ -0,0 +1,136 @@ +From: Remi Collet +Date: Fri, 4 Sep 2020 08:57:24 +0200 +Subject: thread limit per request + +--- + imagick-3.4.4+php8.0/imagick.c | 31 +++++++++++++++++-------------- + 1 file changed, 17 insertions(+), 14 deletions(-) + +diff --git a/imagick-3.4.4+php8.0/imagick.c b/imagick-3.4.4+php8.0/imagick.c +index 11ea7d4..d9dec77 100644 +--- a/imagick-3.4.4+php8.0/imagick.c ++++ b/imagick-3.4.4+php8.0/imagick.c +@@ -473,10 +473,10 @@ PHP_IMAGICK_API zend_class_entry *php_imagickpixel_get_class_entry() + ZEND_ARG_OBJ_INFO(0, Imagick, Imagick, 0) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() +- ++ + ZEND_BEGIN_ARG_INFO_EX(imagick_transformimagecolorspace_args, 0, 0, 1) + ZEND_ARG_INFO(0, COLORSPACE) +- ZEND_END_ARG_INFO() ++ ZEND_END_ARG_INFO() + #endif + + #if MagickLibVersion > 0x655 +@@ -502,7 +502,7 @@ PHP_IMAGICK_API zend_class_entry *php_imagickpixel_get_class_entry() + ZEND_BEGIN_ARG_INFO_EX(imagick_deleteimageartifact_args, 0, 0, 1) + ZEND_ARG_INFO(0, artifact) + ZEND_END_ARG_INFO() +- ++ + ZEND_BEGIN_ARG_INFO_EX(imagick_setcolorspace_args, 0, 0, 1) + ZEND_ARG_INFO(0, COLORSPACE) + ZEND_END_ARG_INFO() +@@ -524,7 +524,7 @@ PHP_IMAGICK_API zend_class_entry *php_imagickpixel_get_class_entry() + ZEND_BEGIN_ARG_INFO_EX(imagick_construct_args, 0, 0, 0) + ZEND_ARG_INFO(0, files) + ZEND_END_ARG_INFO() +- ++ + ZEND_BEGIN_ARG_INFO_EX(imagick_getpixelregioniterator_args, 0, 0, 5) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) +@@ -834,7 +834,7 @@ PHP_IMAGICK_API zend_class_entry *php_imagickpixel_get_class_entry() + ZEND_BEGIN_ARG_INFO_EX(imagick_setimageprogressmonitor_args, 0, 0, 1) + ZEND_ARG_INFO(0, filename) + ZEND_END_ARG_INFO() +- ++ + ZEND_BEGIN_ARG_INFO_EX(imagick_setprogressmonitor_args, 0, 0, 1) + ZEND_ARG_INFO(0, callback) + ZEND_END_ARG_INFO() +@@ -2200,7 +2200,7 @@ static zend_function_entry php_imagickdraw_class_methods[] = + PHP_ME(imagickdraw, gettextdirection, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, settextdirection, imagickdraw_settextdirection_args, ZEND_ACC_PUBLIC) + #endif //#if MagickLibVersion >= 0x692 +- ++ + { NULL, NULL, NULL, 0, 0 } + }; + +@@ -2867,7 +2867,7 @@ static void php_imagick_object_free_storage(IM_ZEND_OBJECT *object TSRMLS_DC) + } + + if (intern->progress_monitor_name) { +- //TODO - is this meant to be free by us? ++ //TODO - is this meant to be free by us? + efree(intern->progress_monitor_name); + } + +@@ -3172,7 +3172,7 @@ static zend_object_value php_imagickpixel_object_new_ex(zend_class_entry *class_ + intern->initialized_via_iterator = 0; + zend_object_std_init(&intern->zo, class_type TSRMLS_CC); + object_properties_init(&intern->zo, class_type); +- ++ + #ifdef ZEND_ENGINE_3 + intern->zo.handlers = &imagickpixel_object_handlers; + +@@ -3380,7 +3380,7 @@ static zval *php_imagick_read_property(zval *object, zval *member, int type, con + ret = std_hnd->has_property(object, member, 2 TSRMLS_CC); + #else + ret = std_hnd->has_property(object, member, 2, key TSRMLS_CC); +-#endif ++#endif + + if (ret) { + std_hnd = zend_get_std_object_handlers(); +@@ -3505,7 +3505,7 @@ static zend_object_value php_imagick_clone_imagickpixel_object(zval *this_ptr TS + php_imagickpixel_object *old_obj = Z_IMAGICKPIXEL_P(this_ptr); + new_zo = php_imagickpixel_object_new_ex(old_obj->zo.ce, &new_obj TSRMLS_CC); + zend_objects_clone_members(&new_obj->zo, &old_obj->zo TSRMLS_CC); +-#else ++#else + php_imagickpixel_object *old_obj = (php_imagickpixel_object *) zend_object_store_get_object(this_ptr TSRMLS_CC); + zend_object_value new_zo = php_imagickpixel_object_new_ex(old_obj->zo.ce, &new_obj TSRMLS_CC); + zend_objects_clone_members(&new_obj->zo, new_zo, &old_obj->zo, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC); +@@ -3742,8 +3742,6 @@ PHP_MINIT_FUNCTION(imagick) + checkImagickVersion(); + } + +- SetMagickResourceLimit(ThreadResource, 1); +- + return SUCCESS; + } + +@@ -3753,7 +3751,7 @@ PHP_MINFO_FUNCTION(imagick) + + #ifdef ZEND_ENGINE_3 + smart_string formats = {0}; +-#else ++#else + smart_str formats = {0}; + #endif + +@@ -3800,7 +3798,7 @@ PHP_MINFO_FUNCTION(imagick) + #endif + IMAGICK_FREE_MAGICK_MEMORY(supported_formats[i]); + } +- ++ + #ifdef ZEND_ENGINE_3 + smart_string_0(&formats); + php_info_print_table_row(2, "ImageMagick supported formats", formats.c); +@@ -3840,6 +3838,11 @@ PHP_RINIT_FUNCTION(imagick) + (void)module_number; + + IMAGICK_G(progress_callback) = NULL; ++ ++ if (IMAGICK_G(set_single_thread)) { ++ MagickSetResourceLimit(ThreadResource, 1); ++ } ++ + return SUCCESS; + } + diff -Nru php-imagick-3.4.4/debian/patches/0008-add-patches-for-PHP-8-from-upstream.patch php-imagick-3.4.4+php8.0+3.4.4/debian/patches/0008-add-patches-for-PHP-8-from-upstream.patch --- php-imagick-3.4.4/debian/patches/0008-add-patches-for-PHP-8-from-upstream.patch 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/debian/patches/0008-add-patches-for-PHP-8-from-upstream.patch 2021-03-05 10:49:49.000000000 +0000 @@ -0,0 +1,1347 @@ +From: Remi Collet +Date: Sat, 10 Oct 2020 12:47:15 +0200 +Subject: add patches for PHP 8 from upstream + +--- + imagick-3.4.4+php8.0/imagick.c | 161 +++++++++++++++++++-- + imagick-3.4.4+php8.0/imagick_class.c | 31 ++++ + imagick-3.4.4+php8.0/imagick_helpers.c | 11 +- + imagick-3.4.4+php8.0/imagickkernel_class.c | 8 + + imagick-3.4.4+php8.0/php_imagick_defs.h | 25 ++++ + .../tests/034_Imagick_annotateImage_basic.phpt | 4 + + .../tests/047_Imagick_convolveImage_6.phpt | 2 +- + .../tests/097_Imagick_newPseudoImage_basic.phpt | 4 +- + .../098_Imagick_orderedPosterizeImage_basic.phpt | 2 +- + .../tests/102_Imagick_radialBlurImage_basic.phpt | 6 +- + .../tests/112_Imagick_roundCorners_basic.phpt | 2 +- + .../tests/121_Imagick_setImageBias_basic.phpt | 2 +- + .../tests/123_Imagick_setImageClipMask_basic.phpt | 2 +- + .../tests/151_Imagick_subImageMatch_basic.phpt | 2 +- + .../tests/159_Imagick_transformImage_basic.phpt | 2 +- + .../tests/177_ImagickDraw_composite_basic.phpt | 4 + + .../tests/180_ImagickDraw_matte_basic.phpt | 2 +- + .../tests/206_ImagickDraw_setFontSize_basic.phpt | 4 + + .../tests/207_ImagickDraw_setFontFamily_basic.phpt | 3 + + .../208_ImagickDraw_setFontStretch_basic.phpt | 3 + + .../tests/209_ImagickDraw_setFontWeight_basic.phpt | 3 + + .../tests/210_ImagickDraw_setFontStyle_basic.phpt | 4 + + .../tests/212_ImagickDraw_setGravity_basic.phpt | 3 + + .../222_ImagickDraw_setTextAlignment_basic.phpt | 3 + + .../223_ImagickDraw_setTextAntialias_basic.phpt | 3 + + .../224_ImagickDraw_setTextUnderColor_basic.phpt | 3 + + .../225_ImagickDraw_setTextDecoration_basic.phpt | 3 + + .../tests/241_Tutorial_psychedelicFont_basic.phpt | 2 + + .../244_Tutorial_psychedelicFontGif_basic.phpt | 2 + + .../tests/256_Imagick_exportImagePixels_basic.phpt | 2 +- + .../264_ImagickDraw_getTextDirection_basic.phpt | 3 + + .../266_ImagickDraw_getFontResolution_basic.phpt | 4 +- + .../tests/274_imagick_setImageAlpha.phpt | 44 +++++- + .../279_ImagickDraw_setTextInterlineSpacing.phpt | 2 + + .../tests/281_ini_settings_default.phpt | 29 ++++ + .../tests/282_ini_settings_set_falsy_string.phpt | 41 ++++++ + .../tests/283_ini_settings_set_falsy_zero.phpt | 33 +++++ + .../tests/284_ini_settings_set_truthy_number.phpt | 33 +++++ + .../tests/285_ini_settings_set_truthy_string.phpt | 33 +++++ + imagick-3.4.4+php8.0/tests/bug20636.phpt | 2 +- + imagick-3.4.4+php8.0/tests/functions.inc | 47 ++++++ + 41 files changed, 543 insertions(+), 36 deletions(-) + create mode 100644 imagick-3.4.4+php8.0/tests/281_ini_settings_default.phpt + create mode 100644 imagick-3.4.4+php8.0/tests/282_ini_settings_set_falsy_string.phpt + create mode 100644 imagick-3.4.4+php8.0/tests/283_ini_settings_set_falsy_zero.phpt + create mode 100644 imagick-3.4.4+php8.0/tests/284_ini_settings_set_truthy_number.phpt + create mode 100644 imagick-3.4.4+php8.0/tests/285_ini_settings_set_truthy_string.phpt + +diff --git a/imagick-3.4.4+php8.0/imagick.c b/imagick-3.4.4+php8.0/imagick.c +index d9dec77..0c03cda 100644 +--- a/imagick-3.4.4+php8.0/imagick.c ++++ b/imagick-3.4.4+php8.0/imagick.c +@@ -38,7 +38,11 @@ + ZEND_DECLARE_MODULE_GLOBALS(imagick) + + #ifdef IMAGICK_WITH_KERNEL +-HashTable* php_imagickkernel_get_debug_info(zval *obj, int *is_temp TSRMLS_DC); /* {{{ */ ++ #if PHP_VERSION_ID >= 80000 ++ HashTable* php_imagickkernel_get_debug_info(zend_object *obj, int *is_temp TSRMLS_DC); /* {{{ */ ++ #else ++ HashTable* php_imagickkernel_get_debug_info(zval *obj, int *is_temp TSRMLS_DC); /* {{{ */ ++ #endif + #endif + + zend_class_entry *php_imagick_sc_entry; +@@ -427,6 +431,14 @@ PHP_IMAGICK_API zend_class_entry *php_imagickpixel_get_class_entry() + ZEND_ARG_INFO(0, threshold) + ZEND_END_ARG_INFO() + ++#if PHP_IMAGICK_HAVE_HOUGHLINE ++ ZEND_BEGIN_ARG_INFO_EX(imagick_houghlineimage_args, 0, 0, 3) ++ ZEND_ARG_INFO(0, width) ++ ZEND_ARG_INFO(0, height) ++ ZEND_ARG_INFO(0, threshold) ++ ZEND_END_ARG_INFO() ++#endif ++ + ZEND_BEGIN_ARG_INFO_EX(imagick_segmentimage_args, 0, 0, 3) + ZEND_ARG_INFO(0, COLORSPACE) + ZEND_ARG_INFO(0, cluster_threshold) +@@ -2410,6 +2422,9 @@ static zend_function_entry php_imagick_class_methods[] = + PHP_ME(imagick, sparsecolorimage, imagick_sparsecolorimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, remapimage, imagick_remapimage_args, ZEND_ACC_PUBLIC) + #endif ++#if PHP_IMAGICK_HAVE_HOUGHLINE ++ PHP_ME(imagick, houghlineimage, imagick_houghlineimage_args, ZEND_ACC_PUBLIC) ++#endif + #if MagickLibVersion > 0x646 + PHP_ME(imagick, exportimagepixels, imagick_exportimagepixels_args, ZEND_ACC_PUBLIC) + #endif +@@ -2439,7 +2454,7 @@ static zend_function_entry php_imagick_class_methods[] = + PHP_ME(imagick, smushimages, imagick_smushimages_args, ZEND_ACC_PUBLIC) + #endif + PHP_ME(imagick, __construct, imagick_construct_args, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) +- PHP_ME(imagick, __tostring, NULL, ZEND_ACC_PUBLIC) ++ PHP_ME(imagick, __tostring, imagick_zero_args, ZEND_ACC_PUBLIC) + #if PHP_VERSION_ID >= 50600 + PHP_ME(imagick, count, imagick_count_args, ZEND_ACC_PUBLIC) + #else +@@ -2655,7 +2670,7 @@ static zend_function_entry php_imagick_class_methods[] = + PHP_ME(imagick, getimagegamma, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagegreenprimary, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimageheight, imagick_zero_args, ZEND_ACC_PUBLIC) +- PHP_ME(imagick, getimagehistogram, NULL, ZEND_ACC_PUBLIC) ++ PHP_ME(imagick, getimagehistogram, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimageinterlacescheme, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimageiterations, imagick_zero_args, ZEND_ACC_PUBLIC) + #if MagickLibVersion < 0x700 +@@ -3260,6 +3275,10 @@ PHP_INI_BEGIN() + STD_PHP_INI_ENTRY("imagick.locale_fix", "0", PHP_INI_ALL, OnUpdateBool, locale_fix, zend_imagick_globals, imagick_globals) + STD_PHP_INI_ENTRY("imagick.skip_version_check", "1", PHP_INI_ALL, OnUpdateBool, skip_version_check, zend_imagick_globals, imagick_globals) + STD_PHP_INI_ENTRY("imagick.progress_monitor", "0", PHP_INI_SYSTEM, OnUpdateBool, progress_monitor, zend_imagick_globals, imagick_globals) ++ ++ STD_PHP_INI_ENTRY("imagick.set_single_thread", "0", PHP_INI_SYSTEM, OnUpdateBool, set_single_thread, zend_imagick_globals, imagick_globals) ++ STD_PHP_INI_ENTRY("imagick.shutdown_sleep_count", "10", PHP_INI_ALL, OnUpdateLong, shutdown_sleep_count, zend_imagick_globals, imagick_globals) ++ + PHP_INI_END() + + static void php_imagick_init_globals(zend_imagick_globals *imagick_globals) +@@ -3267,12 +3286,21 @@ static void php_imagick_init_globals(zend_imagick_globals *imagick_globals) + imagick_globals->locale_fix = 0; + imagick_globals->progress_monitor = 0; + imagick_globals->skip_version_check = 1; ++ imagick_globals->set_single_thread = 0; ++ // 10 is magick number, that seems to be enough. ++ imagick_globals->shutdown_sleep_count = 10; + } + + ++#if PHP_VERSION_ID >= 80000 ++static int php_imagick_count_elements(zend_object *object, im_long *count) /* {{{ */ ++{ ++ php_imagick_object *intern= php_imagick_fetch_object(object); ++#else + static int php_imagick_count_elements(zval *object, im_long *count TSRMLS_DC) /* {{{ */ + { + php_imagick_object *intern= Z_IMAGICK_P(object); ++#endif + + if (intern->magick_wand) { + *count = MagickGetNumberImages(intern->magick_wand); +@@ -3281,6 +3309,71 @@ static int php_imagick_count_elements(zval *object, im_long *count TSRMLS_DC) /* + return FAILURE; + } + ++ ++#if PHP_VERSION_ID >= 80000 ++static zval *php_imagick_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv) ++{ ++ int ret; ++ php_imagick_object *intern; ++ zval *retval = NULL; ++ const zend_object_handlers *std_hnd; ++ ++ ++ std_hnd = zend_get_std_object_handlers(); ++ ++ ret = std_hnd->has_property(object, member, type, cache_slot TSRMLS_CC); ++ ++ if (ret) { ++ //TODO - this would allow better immutability ++ //ZVAL_COPY_VALUE(retval, std_hnd->read_property(object, member, type, cache_slot, rv TSRMLS_CC)); ++ retval = std_hnd->read_property(object, member, type, cache_slot, rv TSRMLS_CC); ++ } ++ else { ++ ++ intern = php_imagick_fetch_object(object); ++ /* Do we have any images? */ ++ if (MagickGetNumberImages(intern->magick_wand)) { ++ ++ //TODO - this seems redundant ++ /* Is this overloaded? */ ++ if (!strcmp(ZSTR_VAL(member), "width") || ++ !strcmp(ZSTR_VAL(member), "height") || ++ !strcmp(ZSTR_VAL(member), "format")) { ++ ++ if (!strcmp(ZSTR_VAL(member), "width")) { ++ retval = rv; ++ ZVAL_LONG(retval, MagickGetImageWidth(intern->magick_wand)); ++ } else if (!strcmp(ZSTR_VAL(member), "height")) { ++ retval = rv; ++ ZVAL_LONG(retval, MagickGetImageHeight(intern->magick_wand)); ++ } else if (!strcmp(ZSTR_VAL(member), "format")) { ++ char *format = MagickGetImageFormat(intern->magick_wand); ++ ++ if (format) { ++ retval = rv; ++ ZVAL_STRING(retval, format); ++ IMAGICK_FREE_MAGICK_MEMORY(format); ++ } else { ++ retval = rv; ++ ZVAL_STRING(retval, ""); ++ } ++ } ++ } ++ } ++ } ++ ++ if (!retval) { ++ //TODO - why is the error silent - it would be a small BC break ++ //to enable the warning. I think it would be the correct thing to do though. ++ //zend_error(E_NOTICE,"Undefined property: \Imagick::$%s", Z_STRVAL_P(member)); ++ retval = &EG(uninitialized_zval); ++ } ++ ++ return retval; ++} ++ ++#else // PHP_VERSION_ID >= 80000 ++ + #ifdef ZEND_ENGINE_3 + static zval *php_imagick_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv TSRMLS_DC) + { +@@ -3432,7 +3525,11 @@ static zval *php_imagick_read_property(zval *object, zval *member, int type, con + } + #endif + +-#ifdef ZEND_ENGINE_3 ++#endif ++ ++#if PHP_VERSION_ID >= 80000 ++static zend_object * php_imagick_clone_imagick_object(zend_object *this_ptr) ++#elif PHP_VERSION_ID >= 70000 + static zend_object * php_imagick_clone_imagick_object(zval *this_ptr TSRMLS_DC) + #else + static zend_object_value php_imagick_clone_imagick_object(zval *this_ptr TSRMLS_DC) +@@ -3440,7 +3537,11 @@ static zend_object_value php_imagick_clone_imagick_object(zval *this_ptr TSRMLS_ + { + MagickWand *wand_copy = NULL; + php_imagick_object *new_obj = NULL; +-#ifdef ZEND_ENGINE_3 ++#if PHP_VERSION_ID >= 80000 ++ php_imagick_object *old_obj = php_imagick_fetch_object(this_ptr); ++ zend_object * new_zo = php_imagick_object_new_ex(old_obj->zo.ce, &new_obj, 0 TSRMLS_CC); ++ zend_objects_clone_members(&new_obj->zo, &old_obj->zo TSRMLS_CC); ++#elif PHP_VERSION_ID >= 70000 + php_imagick_object *old_obj = Z_IMAGICK_P(this_ptr); + zend_object * new_zo = php_imagick_object_new_ex(old_obj->zo.ce, &new_obj, 0 TSRMLS_CC); + zend_objects_clone_members(&new_obj->zo, &old_obj->zo TSRMLS_CC); +@@ -3464,7 +3565,9 @@ static zend_object_value php_imagick_clone_imagick_object(zval *this_ptr TSRMLS_ + return new_zo; + } + +-#ifdef ZEND_ENGINE_3 ++#if PHP_VERSION_ID >= 80000 ++static zend_object * php_imagick_clone_imagickdraw_object(zend_object *this_ptr) ++#elif PHP_VERSION_ID >= 70000 + static zend_object * php_imagick_clone_imagickdraw_object(zval *this_ptr TSRMLS_DC) + #else + static zend_object_value php_imagick_clone_imagickdraw_object(zval *this_ptr TSRMLS_DC) +@@ -3472,7 +3575,11 @@ static zend_object_value php_imagick_clone_imagickdraw_object(zval *this_ptr TSR + { + DrawingWand *wand_copy = NULL; + php_imagickdraw_object *new_obj = NULL; +-#ifdef ZEND_ENGINE_3 ++#if PHP_VERSION_ID >= 80000 ++ php_imagickdraw_object *old_obj = php_imagickdraw_fetch_object(this_ptr); ++ zend_object * new_zo = php_imagickdraw_object_new_ex(old_obj->zo.ce, &new_obj, 0 TSRMLS_CC); ++ zend_objects_clone_members(&new_obj->zo, &old_obj->zo TSRMLS_CC); ++#elif PHP_VERSION_ID >= 70000 + php_imagickdraw_object *old_obj = Z_IMAGICKDRAW_P(this_ptr); + zend_object * new_zo = php_imagickdraw_object_new_ex(old_obj->zo.ce, &new_obj, 0 TSRMLS_CC); + zend_objects_clone_members(&new_obj->zo, &old_obj->zo TSRMLS_CC); +@@ -3492,7 +3599,10 @@ static zend_object_value php_imagick_clone_imagickdraw_object(zval *this_ptr TSR + return new_zo; + } + +-#ifdef ZEND_ENGINE_3 ++ ++#if PHP_VERSION_ID >= 80000 ++static zend_object * php_imagick_clone_imagickpixel_object(zend_object *this_ptr) ++#elif PHP_VERSION_ID >= 70000 + static zend_object * php_imagick_clone_imagickpixel_object(zval *this_ptr TSRMLS_DC) + #else + static zend_object_value php_imagick_clone_imagickpixel_object(zval *this_ptr TSRMLS_DC) +@@ -3500,7 +3610,13 @@ static zend_object_value php_imagick_clone_imagickpixel_object(zval *this_ptr TS + { + PixelWand *wand_copy = NULL; + php_imagickpixel_object *new_obj = NULL; +-#ifdef ZEND_ENGINE_3 ++ ++#if PHP_VERSION_ID >= 80000 ++ zend_object *new_zo; ++ php_imagickpixel_object *old_obj = php_imagickpixel_fetch_object(this_ptr); ++ new_zo = php_imagickpixel_object_new_ex(old_obj->zo.ce, &new_obj TSRMLS_CC); ++ zend_objects_clone_members(&new_obj->zo, &old_obj->zo TSRMLS_CC); ++#elif PHP_VERSION_ID >= 70000 + zend_object *new_zo; + php_imagickpixel_object *old_obj = Z_IMAGICKPIXEL_P(this_ptr); + new_zo = php_imagickpixel_object_new_ex(old_obj->zo.ce, &new_obj TSRMLS_CC); +@@ -3522,7 +3638,10 @@ static zend_object_value php_imagick_clone_imagickpixel_object(zval *this_ptr TS + } + + #ifdef IMAGICK_WITH_KERNEL +-#ifdef ZEND_ENGINE_3 ++ ++#if PHP_VERSION_ID >= 80000 ++static zend_object * php_imagick_clone_imagickkernel_object(zend_object *this_ptr TSRMLS_DC) ++#elif PHP_VERSION_ID >= 70000 + static zend_object * php_imagick_clone_imagickkernel_object(zval *this_ptr TSRMLS_DC) + #else + static zend_object_value php_imagick_clone_imagickkernel_object(zval *this_ptr TSRMLS_DC) +@@ -3531,7 +3650,12 @@ static zend_object_value php_imagick_clone_imagickkernel_object(zval *this_ptr T + KernelInfo *kernel_info_copy = NULL; + php_imagickkernel_object *new_obj = NULL; + +-#ifdef ZEND_ENGINE_3 ++#if PHP_VERSION_ID >= 80000 ++ zend_object *new_zo; ++ php_imagickkernel_object *old_obj = php_imagickkernel_fetch_object(this_ptr); ++ new_zo = php_imagickkernel_object_new_ex(old_obj->zo.ce, &new_obj TSRMLS_CC); ++ zend_objects_clone_members(&new_obj->zo, &old_obj->zo TSRMLS_CC); ++#elif PHP_VERSION_ID >= 70000 + zend_object *new_zo; + php_imagickkernel_object *old_obj = Z_IMAGICKKERNEL_P(this_ptr); + new_zo = php_imagickkernel_object_new_ex(old_obj->zo.ce, &new_obj TSRMLS_CC); +@@ -3742,6 +3866,10 @@ PHP_MINIT_FUNCTION(imagick) + checkImagickVersion(); + } + ++ if (IMAGICK_G(set_single_thread)) { ++ MagickSetResourceLimit(ThreadResource, 1); ++ } ++ + return SUCCESS; + } + +@@ -3818,12 +3946,21 @@ PHP_MINFO_FUNCTION(imagick) + + PHP_MSHUTDOWN_FUNCTION(imagick) + { ++ int i; ++ + // This suppresses an 'unused parameter' warning. + (void)type; + +- + MagickWandTerminus(); + ++ // Sleep for a bit to hopefully allow OpenMP to ++ // shut down the threads it created, and avoid a segfault ++ // This hack won't be needed once everyone is compiling ImageMagick ++ // against a version of OpenMP that has omp_pause_resource_all() ++ for (i = 0; i < 100 && i < IMAGICK_G(shutdown_sleep_count); i += 1) { ++ usleep(1000); ++ } ++ + #if defined(ZTS) && defined(PHP_WIN32) + tsrm_mutex_free(imagick_mutex); + #endif +diff --git a/imagick-3.4.4+php8.0/imagick_class.c b/imagick-3.4.4+php8.0/imagick_class.c +index 164406a..3b041c5 100644 +--- a/imagick-3.4.4+php8.0/imagick_class.c ++++ b/imagick-3.4.4+php8.0/imagick_class.c +@@ -2488,6 +2488,37 @@ PHP_METHOD(imagick, deskewimage) + RETURN_TRUE; + } + ++ ++#if PHP_IMAGICK_HAVE_HOUGHLINE ++/* {{{ proto bool Imagick::houghLineImage(int width, int height, float threshold) ++ Draw hough lines for the image ++ ++*/ ++PHP_METHOD(imagick, houghlineimage) ++{ ++ php_imagick_object *intern; ++ MagickBooleanType status; ++ double threshold; ++ im_long width, height; ++ ++ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lld", &width, &height, &threshold) == FAILURE) { ++ return; ++ } ++ ++ intern = Z_IMAGICK_P(getThis()); ++ if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) ++ return; ++ ++ status = MagickHoughLineImage(intern->magick_wand, width, height, threshold); ++ if (status == MagickFalse) { ++ php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to Hough line image" TSRMLS_CC); ++ return; ++ } ++ RETURN_TRUE; ++} ++/* }}} */ ++#endif ++ + PHP_METHOD(imagick, segmentimage) + { + php_imagick_object *intern; +diff --git a/imagick-3.4.4+php8.0/imagick_helpers.c b/imagick-3.4.4+php8.0/imagick_helpers.c +index 3d90aac..a85f72e 100644 +--- a/imagick-3.4.4+php8.0/imagick_helpers.c ++++ b/imagick-3.4.4+php8.0/imagick_helpers.c +@@ -97,6 +97,11 @@ MagickBooleanType php_imagick_progress_monitor_callable(const char *text, const + fci_cache = empty_fcall_info_cache; + + fci.size = sizeof(fci); ++ ++#if PHP_VERSION_ID >= 80000 ++ fci.named_params = NULL; ++#endif ++ + #if PHP_VERSION_ID < 70100 + fci.function_table = EG(function_table); + #endif +@@ -113,7 +118,9 @@ MagickBooleanType php_imagick_progress_monitor_callable(const char *text, const + #endif + fci.param_count = 2; + fci.params = zargs; ++#if PHP_VERSION_ID < 80000 + fci.no_separation = 0; ++#endif + #if PHP_VERSION_ID < 70100 + fci.symbol_table = NULL; + #endif +@@ -804,7 +811,7 @@ PixelWand *php_imagick_zval_to_pixelwand (zval *param, php_imagick_class_type_t + break; + + case IS_OBJECT: +- if (instanceof_function_ex(Z_OBJCE_P(param), php_imagickpixel_sc_entry, 0 TSRMLS_CC)) { ++ if (instanceof_function(Z_OBJCE_P(param), php_imagickpixel_sc_entry TSRMLS_CC)) { + php_imagickpixel_object *intern = Z_IMAGICKPIXEL_P(param); + pixel_wand = intern->pixel_wand; + } else +@@ -854,7 +861,7 @@ PixelWand *php_imagick_zval_to_opacity (zval *param, php_imagick_class_type_t ca + break; + + case IS_OBJECT: +- if (instanceof_function_ex(Z_OBJCE_P(param), php_imagickpixel_sc_entry, 0 TSRMLS_CC)) { ++ if (instanceof_function(Z_OBJCE_P(param), php_imagickpixel_sc_entry TSRMLS_CC)) { + php_imagickpixel_object *intern = Z_IMAGICKPIXEL_P(param); + pixel_wand = intern->pixel_wand; + } else +diff --git a/imagick-3.4.4+php8.0/imagickkernel_class.c b/imagick-3.4.4+php8.0/imagickkernel_class.c +index 7504d29..9cfc581 100644 +--- a/imagick-3.4.4+php8.0/imagickkernel_class.c ++++ b/imagick-3.4.4+php8.0/imagickkernel_class.c +@@ -79,7 +79,11 @@ static void php_imagickkernelvalues_to_zval(zval *zv, KernelInfo *kernel_info) { + } + + ++#if PHP_VERSION_ID >= 80000 ++HashTable* php_imagickkernel_get_debug_info(zend_object *obj, int *is_temp TSRMLS_DC) /* {{{ */ ++#else + HashTable* php_imagickkernel_get_debug_info(zval *obj, int *is_temp TSRMLS_DC) /* {{{ */ ++#endif + { + php_imagickkernel_object *internp; + HashTable *debug_info; +@@ -92,7 +96,11 @@ HashTable* php_imagickkernel_get_debug_info(zval *obj, int *is_temp TSRMLS_DC) / + + *is_temp = 1; //var_dump will destroy the hashtable + ++#if PHP_VERSION_ID >= 80000 ++ internp = php_imagickkernel_fetch_object(obj); ++#else + internp = Z_IMAGICKKERNEL_P(obj); ++#endif + kernel_info = internp->kernel_info; + + ALLOC_HASHTABLE(debug_info); +diff --git a/imagick-3.4.4+php8.0/php_imagick_defs.h b/imagick-3.4.4+php8.0/php_imagick_defs.h +index 5eb57e5..dd16896 100644 +--- a/imagick-3.4.4+php8.0/php_imagick_defs.h ++++ b/imagick-3.4.4+php8.0/php_imagick_defs.h +@@ -42,6 +42,16 @@ + #include "php_ini.h" + #include "Zend/zend.h" + ++#if PHP_VERSION_ID >= 80000 ++ #define HAVE_LOCALE_H ++ #define TSRMLS_C ++ #define TSRMLS_CC ++ #define TSRMLS_D ++ #define TSRMLS_DC ++ #define TSRMLS_FETCH() ++ #define TSRMLS_SET_CTX(ctx) ++#endif ++ + /* Include locale header */ + #ifdef HAVE_LOCALE_H + # include +@@ -83,6 +93,10 @@ ZEND_BEGIN_MODULE_GLOBALS(imagick) + zend_bool locale_fix; + zend_bool progress_monitor; + zend_bool skip_version_check; ++ ++ zend_bool set_single_thread; ++ im_long shutdown_sleep_count; ++ + php_imagick_callback *progress_callback; + #ifdef PHP_IMAGICK_ZEND_MM + MagickWand *keep_alive; +@@ -388,6 +402,12 @@ extern zend_class_entry *php_imagickkernel_exception_class_entry; + + /* Forward declarations (Imagick) */ + ++#if (MagickLibVersion >= 0x700 && MagickLibVersion >= 0x709) ++ #define PHP_IMAGICK_HAVE_HOUGHLINE 1 ++#else ++ #define PHP_IMAGICK_HAVE_HOUGHLINE 0 ++#endif ++ + /* The conditional methods */ + #if MagickLibVersion > 0x628 + PHP_METHOD(imagick, pingimageblob); +@@ -510,6 +530,11 @@ PHP_METHOD(imagick, setimagegravity); + #if MagickLibVersion > 0x645 + PHP_METHOD(imagick, importimagepixels); + PHP_METHOD(imagick, deskewimage); ++ ++ ++#if PHP_IMAGICK_HAVE_HOUGHLINE ++PHP_METHOD(imagick, houghlineimage); ++#endif + PHP_METHOD(imagick, segmentimage); + PHP_METHOD(imagick, sparsecolorimage); + PHP_METHOD(imagick, remapimage); +diff --git a/imagick-3.4.4+php8.0/tests/034_Imagick_annotateImage_basic.phpt b/imagick-3.4.4+php8.0/tests/034_Imagick_annotateImage_basic.phpt +index a03878c..b7b0be9 100644 +--- a/imagick-3.4.4+php8.0/tests/034_Imagick_annotateImage_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/034_Imagick_annotateImage_basic.phpt +@@ -9,6 +9,8 @@ require_once(dirname(__FILE__) . '/skipif.inc'); + --FILE-- + annotateimage($draw, 40, 40, 0, $text); + + $bytes = $imagick->getImageBlob(); +diff --git a/imagick-3.4.4+php8.0/tests/047_Imagick_convolveImage_6.phpt b/imagick-3.4.4+php8.0/tests/047_Imagick_convolveImage_6.phpt +index 0bca35f..1a4cb41 100644 +--- a/imagick-3.4.4+php8.0/tests/047_Imagick_convolveImage_6.phpt ++++ b/imagick-3.4.4+php8.0/tests/047_Imagick_convolveImage_6.phpt +@@ -38,5 +38,5 @@ convolveImage($bias, $kernelMatrix) ; + echo "Ok"; + ?> + --EXPECTF-- +-Deprecated: Function Imagick::setimagebias() is deprecated in %s ++Deprecated: %s Imagick::setimagebias() is deprecated in %s + Ok +diff --git a/imagick-3.4.4+php8.0/tests/097_Imagick_newPseudoImage_basic.phpt b/imagick-3.4.4+php8.0/tests/097_Imagick_newPseudoImage_basic.phpt +index 5b22164..fbb87ef 100644 +--- a/imagick-3.4.4+php8.0/tests/097_Imagick_newPseudoImage_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/097_Imagick_newPseudoImage_basic.phpt +@@ -5,7 +5,7 @@ Test Imagick, newPseudoImage + --FILE-- + + --EXPECTF-- +-Ok +\ No newline at end of file ++Ok +diff --git a/imagick-3.4.4+php8.0/tests/098_Imagick_orderedPosterizeImage_basic.phpt b/imagick-3.4.4+php8.0/tests/098_Imagick_orderedPosterizeImage_basic.phpt +index e53ecb5..87192c5 100644 +--- a/imagick-3.4.4+php8.0/tests/098_Imagick_orderedPosterizeImage_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/098_Imagick_orderedPosterizeImage_basic.phpt +@@ -28,5 +28,5 @@ orderedPosterizeImage($orderedPosterizeType) ; + echo "Ok"; + ?> + --EXPECTF-- +-Deprecated: Function Imagick::orderedposterizeimage() is deprecated in %S ++Deprecated: %s Imagick::orderedposterizeimage() is deprecated in %S + Ok +diff --git a/imagick-3.4.4+php8.0/tests/102_Imagick_radialBlurImage_basic.phpt b/imagick-3.4.4+php8.0/tests/102_Imagick_radialBlurImage_basic.phpt +index bfcce5e..9820957 100644 +--- a/imagick-3.4.4+php8.0/tests/102_Imagick_radialBlurImage_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/102_Imagick_radialBlurImage_basic.phpt +@@ -24,9 +24,9 @@ radialBlurImage() ; + echo "Ok"; + ?> + --EXPECTF-- +-Deprecated: Function Imagick::radialblurimage() is deprecated in %s ++Deprecated: %s Imagick::radialblurimage() is deprecated in %s + +-Deprecated: Function Imagick::radialblurimage() is deprecated in %s ++Deprecated: %s Imagick::radialblurimage() is deprecated in %s + +-Deprecated: Function Imagick::radialblurimage() is deprecated in %s ++Deprecated: %s Imagick::radialblurimage() is deprecated in %s + Ok +diff --git a/imagick-3.4.4+php8.0/tests/112_Imagick_roundCorners_basic.phpt b/imagick-3.4.4+php8.0/tests/112_Imagick_roundCorners_basic.phpt +index cdf026f..98c798f 100644 +--- a/imagick-3.4.4+php8.0/tests/112_Imagick_roundCorners_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/112_Imagick_roundCorners_basic.phpt +@@ -40,5 +40,5 @@ roundCorners() ; + echo "Ok"; + ?> + --EXPECTF-- +-Deprecated: Function Imagick::roundcornersimage() is deprecated in %s ++Deprecated: %s Imagick::roundcornersimage() is deprecated in %s + Ok +diff --git a/imagick-3.4.4+php8.0/tests/121_Imagick_setImageBias_basic.phpt b/imagick-3.4.4+php8.0/tests/121_Imagick_setImageBias_basic.phpt +index 2ceab20..662a439 100644 +--- a/imagick-3.4.4+php8.0/tests/121_Imagick_setImageBias_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/121_Imagick_setImageBias_basic.phpt +@@ -34,5 +34,5 @@ setImageBias($bias) ; + echo "Ok"; + ?> + --EXPECTF-- +-Deprecated: Function Imagick::setimagebias() is deprecated in %s ++Deprecated: %s Imagick::setimagebias() is deprecated in %s + Ok +diff --git a/imagick-3.4.4+php8.0/tests/123_Imagick_setImageClipMask_basic.phpt b/imagick-3.4.4+php8.0/tests/123_Imagick_setImageClipMask_basic.phpt +index 7844fa7..a1620ba 100644 +--- a/imagick-3.4.4+php8.0/tests/123_Imagick_setImageClipMask_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/123_Imagick_setImageClipMask_basic.phpt +@@ -48,5 +48,5 @@ setImageClipMask() ; + echo "Ok"; + ?> + --EXPECTF-- +-Deprecated: Function Imagick::setimageclipmask() is deprecated in %s ++Deprecated: %s Imagick::setimageclipmask() is deprecated in %s + Ok +diff --git a/imagick-3.4.4+php8.0/tests/151_Imagick_subImageMatch_basic.phpt b/imagick-3.4.4+php8.0/tests/151_Imagick_subImageMatch_basic.phpt +index 491bb79..f11884f 100644 +--- a/imagick-3.4.4+php8.0/tests/151_Imagick_subImageMatch_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/151_Imagick_subImageMatch_basic.phpt +@@ -2,7 +2,7 @@ + Test Imagick, subImageMatch + --SKIPIF-- + + --FILE-- +diff --git a/imagick-3.4.4+php8.0/tests/159_Imagick_transformImage_basic.phpt b/imagick-3.4.4+php8.0/tests/159_Imagick_transformImage_basic.phpt +index d3764c9..cf90987 100644 +--- a/imagick-3.4.4+php8.0/tests/159_Imagick_transformImage_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/159_Imagick_transformImage_basic.phpt +@@ -22,5 +22,5 @@ transformimage() ; + echo "Ok"; + ?> + --EXPECTF-- +-Deprecated: Function Imagick::transformimage() is deprecated in %s ++Deprecated: %s Imagick::transformimage() is deprecated in %s + Ok +diff --git a/imagick-3.4.4+php8.0/tests/177_ImagickDraw_composite_basic.phpt b/imagick-3.4.4+php8.0/tests/177_ImagickDraw_composite_basic.phpt +index 3c87524..00bd1a3 100644 +--- a/imagick-3.4.4+php8.0/tests/177_ImagickDraw_composite_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/177_ImagickDraw_composite_basic.phpt +@@ -8,6 +8,8 @@ require_once(dirname(__FILE__) . '/skipif.inc'); + --FILE-- + setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setFillOpacity(1); +diff --git a/imagick-3.4.4+php8.0/tests/180_ImagickDraw_matte_basic.phpt b/imagick-3.4.4+php8.0/tests/180_ImagickDraw_matte_basic.phpt +index 88befea..b2ea71a 100644 +--- a/imagick-3.4.4+php8.0/tests/180_ImagickDraw_matte_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/180_ImagickDraw_matte_basic.phpt +@@ -41,5 +41,5 @@ matte($strokeColor, $fillColor, $backgroundColor, $paintType) ; + echo "Ok"; + ?> + --EXPECTF-- +-Deprecated: Function ImagickDraw::matte() is deprecated in %s ++Deprecated: %s ImagickDraw::matte() is deprecated in %s + Ok +diff --git a/imagick-3.4.4+php8.0/tests/206_ImagickDraw_setFontSize_basic.phpt b/imagick-3.4.4+php8.0/tests/206_ImagickDraw_setFontSize_basic.phpt +index b964b30..390f8b3 100644 +--- a/imagick-3.4.4+php8.0/tests/206_ImagickDraw_setFontSize_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/206_ImagickDraw_setFontSize_basic.phpt +@@ -9,6 +9,8 @@ require_once(dirname(__FILE__) . '/skipif.inc'); + --FILE-- + setStrokeOpacity(1); + $draw->setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); +diff --git a/imagick-3.4.4+php8.0/tests/207_ImagickDraw_setFontFamily_basic.phpt b/imagick-3.4.4+php8.0/tests/207_ImagickDraw_setFontFamily_basic.phpt +index 0e2c147..ca4d59c 100644 +--- a/imagick-3.4.4+php8.0/tests/207_ImagickDraw_setFontFamily_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/207_ImagickDraw_setFontFamily_basic.phpt +@@ -9,6 +9,8 @@ require_once(dirname(__FILE__) . '/skipif.inc'); + --FILE-- + setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); +diff --git a/imagick-3.4.4+php8.0/tests/209_ImagickDraw_setFontWeight_basic.phpt b/imagick-3.4.4+php8.0/tests/209_ImagickDraw_setFontWeight_basic.phpt +index cd63dbe..ff7ecda 100644 +--- a/imagick-3.4.4+php8.0/tests/209_ImagickDraw_setFontWeight_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/209_ImagickDraw_setFontWeight_basic.phpt +@@ -9,6 +9,8 @@ require_once(dirname(__FILE__) . '/skipif.inc'); + --FILE-- + setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); +diff --git a/imagick-3.4.4+php8.0/tests/210_ImagickDraw_setFontStyle_basic.phpt b/imagick-3.4.4+php8.0/tests/210_ImagickDraw_setFontStyle_basic.phpt +index f5f5373..b8ecd2e 100644 +--- a/imagick-3.4.4+php8.0/tests/210_ImagickDraw_setFontStyle_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/210_ImagickDraw_setFontStyle_basic.phpt +@@ -9,12 +9,16 @@ require_once(dirname(__FILE__) . '/skipif.inc'); + --FILE-- + setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeWidth(1); +diff --git a/imagick-3.4.4+php8.0/tests/212_ImagickDraw_setGravity_basic.phpt b/imagick-3.4.4+php8.0/tests/212_ImagickDraw_setGravity_basic.phpt +index ea2cc0c..48ae14b 100644 +--- a/imagick-3.4.4+php8.0/tests/212_ImagickDraw_setGravity_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/212_ImagickDraw_setGravity_basic.phpt +@@ -9,6 +9,8 @@ require_once(dirname(__FILE__) . '/skipif.inc'); + --FILE-- + setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeWidth(1); +diff --git a/imagick-3.4.4+php8.0/tests/222_ImagickDraw_setTextAlignment_basic.phpt b/imagick-3.4.4+php8.0/tests/222_ImagickDraw_setTextAlignment_basic.phpt +index 1f6978f..2a9a3f3 100644 +--- a/imagick-3.4.4+php8.0/tests/222_ImagickDraw_setTextAlignment_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/222_ImagickDraw_setTextAlignment_basic.phpt +@@ -9,12 +9,15 @@ require_once(dirname(__FILE__) . '/skipif.inc'); + --FILE-- + setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeWidth(1); +diff --git a/imagick-3.4.4+php8.0/tests/223_ImagickDraw_setTextAntialias_basic.phpt b/imagick-3.4.4+php8.0/tests/223_ImagickDraw_setTextAntialias_basic.phpt +index 0273cb0..714c8d9 100644 +--- a/imagick-3.4.4+php8.0/tests/223_ImagickDraw_setTextAntialias_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/223_ImagickDraw_setTextAntialias_basic.phpt +@@ -9,6 +9,8 @@ require_once(dirname(__FILE__) . '/skipif.inc'); + --FILE-- + setStrokeColor('none'); + $draw->setFillColor($fillColor); + $draw->setStrokeWidth(1); +diff --git a/imagick-3.4.4+php8.0/tests/224_ImagickDraw_setTextUnderColor_basic.phpt b/imagick-3.4.4+php8.0/tests/224_ImagickDraw_setTextUnderColor_basic.phpt +index 11ddbe6..d43870d 100644 +--- a/imagick-3.4.4+php8.0/tests/224_ImagickDraw_setTextUnderColor_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/224_ImagickDraw_setTextUnderColor_basic.phpt +@@ -9,6 +9,8 @@ require_once(dirname(__FILE__) . '/skipif.inc'); + --FILE-- + setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); +diff --git a/imagick-3.4.4+php8.0/tests/225_ImagickDraw_setTextDecoration_basic.phpt b/imagick-3.4.4+php8.0/tests/225_ImagickDraw_setTextDecoration_basic.phpt +index 9cf35c2..f1cd442 100644 +--- a/imagick-3.4.4+php8.0/tests/225_ImagickDraw_setTextDecoration_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/225_ImagickDraw_setTextDecoration_basic.phpt +@@ -9,6 +9,8 @@ require_once(dirname(__FILE__) . '/skipif.inc'); + --FILE-- + setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); +diff --git a/imagick-3.4.4+php8.0/tests/241_Tutorial_psychedelicFont_basic.phpt b/imagick-3.4.4+php8.0/tests/241_Tutorial_psychedelicFont_basic.phpt +index 1365c38..8eeb891 100644 +--- a/imagick-3.4.4+php8.0/tests/241_Tutorial_psychedelicFont_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/241_Tutorial_psychedelicFont_basic.phpt +@@ -9,9 +9,11 @@ require_once(dirname(__FILE__) . '/skipif.inc'); + --FILE-- + setStrokeOpacity(1); +diff --git a/imagick-3.4.4+php8.0/tests/244_Tutorial_psychedelicFontGif_basic.phpt b/imagick-3.4.4+php8.0/tests/244_Tutorial_psychedelicFontGif_basic.phpt +index 26adf1d..894d031 100644 +--- a/imagick-3.4.4+php8.0/tests/244_Tutorial_psychedelicFontGif_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/244_Tutorial_psychedelicFontGif_basic.phpt +@@ -9,6 +9,7 @@ require_once(dirname(__FILE__) . '/skipif.inc'); + --FILE-- + setStrokeOpacity(1); + $draw->setfontsize(150 * $scale); +diff --git a/imagick-3.4.4+php8.0/tests/256_Imagick_exportImagePixels_basic.phpt b/imagick-3.4.4+php8.0/tests/256_Imagick_exportImagePixels_basic.phpt +index d3eceb5..96a57b9 100644 +--- a/imagick-3.4.4+php8.0/tests/256_Imagick_exportImagePixels_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/256_Imagick_exportImagePixels_basic.phpt +@@ -2,7 +2,7 @@ + Test Imagick, Imagick::exportImagePixels + --SKIPIF-- + + --FILE-- +diff --git a/imagick-3.4.4+php8.0/tests/264_ImagickDraw_getTextDirection_basic.phpt b/imagick-3.4.4+php8.0/tests/264_ImagickDraw_getTextDirection_basic.phpt +index 9bedacb..330bbc7 100644 +--- a/imagick-3.4.4+php8.0/tests/264_ImagickDraw_getTextDirection_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/264_ImagickDraw_getTextDirection_basic.phpt +@@ -9,6 +9,8 @@ checkClassMethods('ImagickDraw', array('getTextDirection', 'setTextDirection')); + --FILE-- + setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); +diff --git a/imagick-3.4.4+php8.0/tests/266_ImagickDraw_getFontResolution_basic.phpt b/imagick-3.4.4+php8.0/tests/266_ImagickDraw_getFontResolution_basic.phpt +index 8efe48b..65e6fc2 100644 +--- a/imagick-3.4.4+php8.0/tests/266_ImagickDraw_getFontResolution_basic.phpt ++++ b/imagick-3.4.4+php8.0/tests/266_ImagickDraw_getFontResolution_basic.phpt +@@ -9,13 +9,15 @@ checkClassMethods('ImagickDraw', array('getFontResolution', 'setFontResolution') + --FILE-- + setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); +diff --git a/imagick-3.4.4+php8.0/tests/274_imagick_setImageAlpha.phpt b/imagick-3.4.4+php8.0/tests/274_imagick_setImageAlpha.phpt +index 28f1ef1..760f088 100644 +--- a/imagick-3.4.4+php8.0/tests/274_imagick_setImageAlpha.phpt ++++ b/imagick-3.4.4+php8.0/tests/274_imagick_setImageAlpha.phpt +@@ -8,6 +8,10 @@ require_once(dirname(__FILE__) . '/skipif.inc'); + --FILE-- + newPseudoImage(256, 256, 'xc:purple'); + $imagick->setImageAlpha(0.5); +@@ -18,19 +22,47 @@ $imagick->writeImage("./setAlphaTest.png"); + $pixelTypes = array( + Imagick::PIXEL_CHAR => array(128, 0, 128, 128), + Imagick::PIXEL_FLOAT => array(0.50196081399918, 0, 0.50196081399918, 0.5), +- Imagick::PIXEL_DOUBLE => array(0.50196078431373, 0, 0.50196078431373, 0.5), ++ Imagick::PIXEL_DOUBLE => array(0.50196078431373, 0, 0.50196078431373, 0.5), + Imagick::PIXEL_SHORT => array(32896, 0, 32896, 32768), + ); + ++function getColorError($type, $expected, $actual) { ++ ++ if ($type == Imagick::PIXEL_CHAR || ++ $type == Imagick::PIXEL_SHORT) { ++ $string = "Expected: " . $actual . "\n"; ++ $string .= "Actual : " . $actual . "\n"; ++ ++ return $string; ++ } ++ ++ if ($type == Imagick::PIXEL_FLOAT) { ++ return float_compare_32($expected, $actual); ++ } ++ ++ if ($type == Imagick::PIXEL_DOUBLE) { ++ return float_compare($expected, $actual); ++ } ++ ++ echo "Unknown type: $type \n"; ++ exit(-1); ++ ++} ++ + + foreach ($pixelTypes as $pixelType => $expectedValues) { + $pixels = $imagick->exportImagePixels(0, 0, 1, 1, "RGBA", $pixelType); +- for ($i=0; $i<4; $i++) { +- $actual = $pixels[$i]; +- $expected = $expectedValues[$i]; ++ $channelNames = ['R', 'G', 'B', 'A']; ++ ++ // Loop over the colours ++ for ($channel=0; $channel<4; $channel++) { ++ $actual = $pixels[$channel]; ++ $expected = $expectedValues[$channel]; + if (abs($actual - $expected) > 0.0000001) { +- echo "Pixel values appear incorrect for pixelType $pixelType:"; +- var_dump($pixels); ++ $channelName = $channelNames[$channel]; ++ ++ echo "Pixel values appear incorrect for pixelType $pixelType channel:$channelName\n"; ++ echo getColorError($pixelType, $expected, $actual); + break; + } + } +diff --git a/imagick-3.4.4+php8.0/tests/279_ImagickDraw_setTextInterlineSpacing.phpt b/imagick-3.4.4+php8.0/tests/279_ImagickDraw_setTextInterlineSpacing.phpt +index 3015eb6..bac275c 100644 +--- a/imagick-3.4.4+php8.0/tests/279_ImagickDraw_setTextInterlineSpacing.phpt ++++ b/imagick-3.4.4+php8.0/tests/279_ImagickDraw_setTextInterlineSpacing.phpt +@@ -24,6 +24,8 @@ foreach ($interlineSpacings as $interlineSpacing) { + + $draw = new \ImagickDraw(); + ++ setFontForImagickDraw($draw); ++ + $draw->setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + +diff --git a/imagick-3.4.4+php8.0/tests/281_ini_settings_default.phpt b/imagick-3.4.4+php8.0/tests/281_ini_settings_default.phpt +new file mode 100644 +index 0000000..e397e98 +--- /dev/null ++++ b/imagick-3.4.4+php8.0/tests/281_ini_settings_default.phpt +@@ -0,0 +1,29 @@ ++--TEST-- ++OpenMP segfault hacks ++--SKIPIF-- ++ ++--FILE-- ++ ++--EXPECTF-- ++Complete +diff --git a/imagick-3.4.4+php8.0/tests/282_ini_settings_set_falsy_string.phpt b/imagick-3.4.4+php8.0/tests/282_ini_settings_set_falsy_string.phpt +new file mode 100644 +index 0000000..4ed4f1d +--- /dev/null ++++ b/imagick-3.4.4+php8.0/tests/282_ini_settings_set_falsy_string.phpt +@@ -0,0 +1,41 @@ ++--TEST-- ++OpenMP segfault hacks ++ ++--INI-- ++imagick.shutdown_sleep_count=Off ++imagick.set_single_thread=0 ++--SKIPIF-- ++ ++--FILE-- ++ ++--EXPECTF-- ++Complete +diff --git a/imagick-3.4.4+php8.0/tests/283_ini_settings_set_falsy_zero.phpt b/imagick-3.4.4+php8.0/tests/283_ini_settings_set_falsy_zero.phpt +new file mode 100644 +index 0000000..8e41a35 +--- /dev/null ++++ b/imagick-3.4.4+php8.0/tests/283_ini_settings_set_falsy_zero.phpt +@@ -0,0 +1,33 @@ ++--TEST-- ++OpenMP segfault hacks ++ ++--INI-- ++imagick.shutdown_sleep_count=0 ++imagick.set_single_thread=0 ++--SKIPIF-- ++ ++--FILE-- ++ ++--EXPECTF-- ++Complete +diff --git a/imagick-3.4.4+php8.0/tests/284_ini_settings_set_truthy_number.phpt b/imagick-3.4.4+php8.0/tests/284_ini_settings_set_truthy_number.phpt +new file mode 100644 +index 0000000..fc0a0bb +--- /dev/null ++++ b/imagick-3.4.4+php8.0/tests/284_ini_settings_set_truthy_number.phpt +@@ -0,0 +1,33 @@ ++--TEST-- ++OpenMP segfault hacks ++ ++--INI-- ++imagick.shutdown_sleep_count=20 ++imagick.set_single_thread=1 ++--SKIPIF-- ++ ++--FILE-- ++ ++--EXPECTF-- ++Complete +diff --git a/imagick-3.4.4+php8.0/tests/285_ini_settings_set_truthy_string.phpt b/imagick-3.4.4+php8.0/tests/285_ini_settings_set_truthy_string.phpt +new file mode 100644 +index 0000000..c35a213 +--- /dev/null ++++ b/imagick-3.4.4+php8.0/tests/285_ini_settings_set_truthy_string.phpt +@@ -0,0 +1,33 @@ ++--TEST-- ++OpenMP segfault hacks ++ ++--INI-- ++imagick.shutdown_sleep_count=On ++imagick.set_single_thread=On ++--SKIPIF-- ++ ++--FILE-- ++ ++--EXPECTF-- ++Complete +diff --git a/imagick-3.4.4+php8.0/tests/bug20636.phpt b/imagick-3.4.4+php8.0/tests/bug20636.phpt +index adba98a..eb64b39 100644 +--- a/imagick-3.4.4+php8.0/tests/bug20636.phpt ++++ b/imagick-3.4.4+php8.0/tests/bug20636.phpt +@@ -27,5 +27,5 @@ try { + + ?> + --EXPECTF-- +-Deprecated: Function Imagick::roundcorners() is deprecated in %s ++Deprecated: %s Imagick::roundcorners() is deprecated in %s + success +diff --git a/imagick-3.4.4+php8.0/tests/functions.inc b/imagick-3.4.4+php8.0/tests/functions.inc +index f5c1ef1..5fa3d2f 100644 +--- a/imagick-3.4.4+php8.0/tests/functions.inc ++++ b/imagick-3.4.4+php8.0/tests/functions.inc +@@ -61,5 +61,52 @@ function isVersionGreaterEqual($testIm6Version, $im7Version) + return false; + } + ++/** ++ * On some systems, where the standard fonts aren't available, trying ++ * to draw any text fails as the ImageMagick default font is null. ++ * ++ * This function just find a 'sensible' font to use, either from the ++ * preferred list, or just the first one from queryFonts(). That 'probably' ++ * is the right thing to do, as it makes the tests more stable. ++ */ ++function findDefaultFont() ++{ ++ $knownFonts = [ ++ 'Courier', ++ 'Helvetica', ++ 'Times-Roman', ++ 'Liberation-Mono', ++ 'Utopia', ++ ]; ++ ++ $fontList = \Imagick::queryFonts(); ++ ++ foreach ($knownFonts as $knownFont) { ++ ++ if (in_array($knownFont, $fontList, true) === true) { ++ return $knownFont; ++ } ++ } ++ ++ if (count($fontList) !== 0) { ++ return $fontList[0]; ++ } + ++ throw new \Exception("No fonts available on system, apparently."); ++} + ++// Find and set a font for the Imagick object ++function setFontForImagick(\Imagick $imagick) ++{ ++ $font = findDefaultFont(); ++ ++ $imagick->setFont($font); ++} ++ ++// Find and set a font for the ImagickDraw object ++function setFontForImagickDraw(\ImagickDraw $imagickDraw) ++{ ++ $font = findDefaultFont(); ++ ++ $imagickDraw->setFont($font); ++} diff -Nru php-imagick-3.4.4/debian/patches/0009-set-single-thread-by-default.patch php-imagick-3.4.4+php8.0+3.4.4/debian/patches/0009-set-single-thread-by-default.patch --- php-imagick-3.4.4/debian/patches/0009-set-single-thread-by-default.patch 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/debian/patches/0009-set-single-thread-by-default.patch 2021-03-05 10:49:49.000000000 +0000 @@ -0,0 +1,30 @@ +From: Remi Collet +Date: Fri, 4 Sep 2020 10:46:01 +0200 +Subject: set single thread by default + +--- + imagick-3.4.4+php8.0/imagick.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/imagick-3.4.4+php8.0/imagick.c b/imagick-3.4.4+php8.0/imagick.c +index 0c03cda..db4995f 100644 +--- a/imagick-3.4.4+php8.0/imagick.c ++++ b/imagick-3.4.4+php8.0/imagick.c +@@ -3276,7 +3276,7 @@ PHP_INI_BEGIN() + STD_PHP_INI_ENTRY("imagick.skip_version_check", "1", PHP_INI_ALL, OnUpdateBool, skip_version_check, zend_imagick_globals, imagick_globals) + STD_PHP_INI_ENTRY("imagick.progress_monitor", "0", PHP_INI_SYSTEM, OnUpdateBool, progress_monitor, zend_imagick_globals, imagick_globals) + +- STD_PHP_INI_ENTRY("imagick.set_single_thread", "0", PHP_INI_SYSTEM, OnUpdateBool, set_single_thread, zend_imagick_globals, imagick_globals) ++ STD_PHP_INI_ENTRY("imagick.set_single_thread", "1", PHP_INI_SYSTEM, OnUpdateBool, set_single_thread, zend_imagick_globals, imagick_globals) + STD_PHP_INI_ENTRY("imagick.shutdown_sleep_count", "10", PHP_INI_ALL, OnUpdateLong, shutdown_sleep_count, zend_imagick_globals, imagick_globals) + + PHP_INI_END() +@@ -3286,7 +3286,7 @@ static void php_imagick_init_globals(zend_imagick_globals *imagick_globals) + imagick_globals->locale_fix = 0; + imagick_globals->progress_monitor = 0; + imagick_globals->skip_version_check = 1; +- imagick_globals->set_single_thread = 0; ++ imagick_globals->set_single_thread = 1; + // 10 is magick number, that seems to be enough. + imagick_globals->shutdown_sleep_count = 10; + } diff -Nru php-imagick-3.4.4/debian/patches/0010-simpler-warning-to-avoid-DivisionByZeroError-excepti.patch php-imagick-3.4.4+php8.0+3.4.4/debian/patches/0010-simpler-warning-to-avoid-DivisionByZeroError-excepti.patch --- php-imagick-3.4.4/debian/patches/0010-simpler-warning-to-avoid-DivisionByZeroError-excepti.patch 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/debian/patches/0010-simpler-warning-to-avoid-DivisionByZeroError-excepti.patch 2021-03-05 10:49:49.000000000 +0000 @@ -0,0 +1,28 @@ +From: Remi Collet +Date: Mon, 28 Sep 2020 15:06:14 +0200 +Subject: simpler warning to avoid DivisionByZeroError exception in 8 + +--- + imagick-3.4.4+php8.0/tests/270_imagick_restoreErrorHandler.phpt | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/imagick-3.4.4+php8.0/tests/270_imagick_restoreErrorHandler.phpt b/imagick-3.4.4+php8.0/tests/270_imagick_restoreErrorHandler.phpt +index 77eeb17..ba2f5d1 100644 +--- a/imagick-3.4.4+php8.0/tests/270_imagick_restoreErrorHandler.phpt ++++ b/imagick-3.4.4+php8.0/tests/270_imagick_restoreErrorHandler.phpt +@@ -16,7 +16,7 @@ catch(ImagickException $ie) { + } + + try { +- $x = @(5 / 0); ++ $x = @$x; + echo "Normal warning is suppressed".PHP_EOL; + } + catch(\Exception $e) { +@@ -27,4 +27,4 @@ catch(\Exception $e) { + ?> + --EXPECTF-- + Normal exception +-Normal warning is suppressed +\ No newline at end of file ++Normal warning is suppressed diff -Nru php-imagick-3.4.4/debian/patches/0011-Void-expectation-is-not-allowed-with-PHPUnit-9.patch php-imagick-3.4.4+php8.0+3.4.4/debian/patches/0011-Void-expectation-is-not-allowed-with-PHPUnit-9.patch --- php-imagick-3.4.4/debian/patches/0011-Void-expectation-is-not-allowed-with-PHPUnit-9.patch 2020-12-28 13:08:42.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/debian/patches/0011-Void-expectation-is-not-allowed-with-PHPUnit-9.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ -From: =?utf-8?q?David_Pr=C3=A9vot?= -Date: Mon, 21 Dec 2020 09:37:41 -0400 -Subject: Void expectation is not allowed with PHPUnit 9 - -Bug-Debian: https://bugs.debian.org/977824 ---- - imagick-3.4.4/tests/bug_72226.phpt | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/imagick-3.4.4/tests/bug_72226.phpt b/imagick-3.4.4/tests/bug_72226.phpt -index 6ad5631..6724b87 100644 ---- a/imagick-3.4.4/tests/bug_72226.phpt -+++ b/imagick-3.4.4/tests/bug_72226.phpt -@@ -19,4 +19,5 @@ if (class_exists('ImagickKernelException', false) == true) { - } - - ?> ----EXPECTF-- -+--EXPECTREGEX-- -+^$ diff -Nru php-imagick-3.4.4/debian/patches/armel.patch php-imagick-3.4.4+php8.0+3.4.4/debian/patches/armel.patch --- php-imagick-3.4.4/debian/patches/armel.patch 2020-06-14 09:26:18.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/debian/patches/armel.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -Description: Skip tests that fail with PHP 7.4 on armel -Author: Adrian Bunk -Bug-Debian: https://bugs.debian.org/959386 - ---- php-imagick-3.4.4.orig/imagick-3.4.4/tests/064_cropThumbNailImage.phpt -+++ php-imagick-3.4.4/imagick-3.4.4/tests/064_cropThumbNailImage.phpt -@@ -2,6 +2,7 @@ - Test for round issues - --SKIPIF-- - ---- php-imagick-3.4.4.orig/imagick-3.4.4/tests/072_Imagick_evaluateImage_basic.phpt -+++ php-imagick-3.4.4/imagick-3.4.4/tests/072_Imagick_evaluateImage_basic.phpt -@@ -2,6 +2,7 @@ - Test Imagick, evaluateImage - --SKIPIF-- - diff -Nru php-imagick-3.4.4/debian/patches/no-openmp-threads.patch php-imagick-3.4.4+php8.0+3.4.4/debian/patches/no-openmp-threads.patch --- php-imagick-3.4.4/debian/patches/no-openmp-threads.patch 2020-03-02 09:04:48.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/debian/patches/no-openmp-threads.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -Description: limit the number of openmp threads used to 1 - The php-imagick 3.4.0 test suite fails with various segfaults when openmp - threads are in use. Force the openmp thread count to 1 to avoid this - problem. - . - This patch is a workaround only; it is currently unknown if the root bug - lies in php-imagick or in imagemagick. -Author: Steve Langasek -Bug-Ubuntu: https://bugs.launchpad.net/bugs/1549942 - ---- a/imagick-3.4.4/imagick.c -+++ b/imagick-3.4.4/imagick.c -@@ -3689,6 +3689,8 @@ - checkImagickVersion(); - } - -+ SetMagickResourceLimit(ThreadResource, 1); -+ - return SUCCESS; - } - diff -Nru php-imagick-3.4.4/debian/patches/series php-imagick-3.4.4+php8.0+3.4.4/debian/patches/series --- php-imagick-3.4.4/debian/patches/series 2020-12-28 13:09:26.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/debian/patches/series 2021-03-05 10:49:49.000000000 +0000 @@ -1,7 +1,10 @@ 0001-Hardcode-path-to-usrsharefontstruetypettf-dejavuDeja.patch 0002-Skip-version-check-by-default.patch -no-openmp-threads.patch -0003-Disable-test-014-which-fails-due-to-system-resources.patch -0004-Disable-remaining-tests-failing-with-7.4.patch -armel.patch -0011-Void-expectation-is-not-allowed-with-PHPUnit-9.patch +0003-no-openmp-threads.patch +0004-Disable-test-014-which-fails-due-to-system-resources.patch +0005-Disable-remaining-tests-failing-with-7.4.patch +0006-SPL-is-always-there.patch +0007-thread-limit-per-request.patch +0008-add-patches-for-PHP-8-from-upstream.patch +0009-set-single-thread-by-default.patch +0010-simpler-warning-to-avoid-DivisionByZeroError-excepti.patch diff -Nru php-imagick-3.4.4/debian/rules php-imagick-3.4.4+php8.0+3.4.4/debian/rules --- php-imagick-3.4.4/debian/rules 2020-03-02 09:04:48.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/debian/rules 2021-03-05 10:49:49.000000000 +0000 @@ -1,2 +1,3 @@ #!/usr/bin/make -f +export REPORT_EXIT_STATUS:=0 include /usr/share/dh-php/pkg-pecl.mk diff -Nru php-imagick-3.4.4/debian/tests/control php-imagick-3.4.4+php8.0+3.4.4/debian/tests/control --- php-imagick-3.4.4/debian/tests/control 2020-03-02 09:04:48.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/debian/tests/control 2021-03-05 10:49:49.000000000 +0000 @@ -1,5 +1,8 @@ -Test-Command: cd imagick-*/tests && phpunit --verbose . -Depends: php-cli, php-imagick, gsfonts, imagemagick-6.q16, phpunit -# The tests needs the -extra libmagickcore package but it gets -# renamed on soname bumps. imagemagick-6.q16 recommends it though. +Test-Command: cd imagick-$(xml2 < package.xml | sed -ne "s,/package/version/release=\(.*\),\1,p")/tests && phpunit --verbose . +Depends: gsfonts, + imagemagick-6.q16, + php-cli, + php-imagick, + phpunit, + xml2 Restrictions: needs-recommends diff -Nru php-imagick-3.4.4/debian/watch php-imagick-3.4.4+php8.0+3.4.4/debian/watch --- php-imagick-3.4.4/debian/watch 2020-03-02 09:04:48.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/debian/watch 2021-03-05 10:49:49.000000000 +0000 @@ -1,3 +1,3 @@ version=3 opts=uversionmangle=s/(\d)RC(\d*)$/$1rc$2/;s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha|b|a)[\-\.]?\d*)$/$1~$2/ \ -http://pecl.php.net/package/imagick .*/imagick-(\d.*)\.(?:tgz|tbz2|txz|tar\.(?:gz|bz2|xz)) +https://pecl.php.net/package/imagick .*/imagick-(\d.*)\.(?:tgz|tbz2|txz|tar\.(?:gz|bz2|xz)) diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/ChangeLog php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/ChangeLog --- php-imagick-3.4.4/imagick-3.4.4+php8.0/ChangeLog 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/ChangeLog 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,1019 @@ + +3.4.4 +- Fixes: + * Correct version check to make RemoveAlphaChannel and FlattenAlphaChannel be available when using Imagick with ImageMagick version 6.7.8-x + +3.4.4RC2 +- Fixes: + * Correct stability for RC release + * Fix undefined variable for ZTS build + +3.4.4RC1 +- The 3.4.4 release is intended to be the last release (other than small bug fixes) that will support either PHP 5.x, or ImageMagick 6.x. The next planned release will be PHP > 7.0 and ImageMagick > 7.0 at least, if not higher. +- Added: + * function Imagick::optimizeImageTransparency() + * METRIC_STRUCTURAL_SIMILARITY_ERROR + * METRIC_STRUCTURAL_DISSIMILARITY_ERROR + * COMPRESSION_ZSTD - https://github.com/facebook/zstd + * COMPRESSION_WEBP + * CHANNEL_COMPOSITE_MASK + * FILTER_CUBIC_SPLINE - "Define the lobes with the -define filter:lobes={2,3,4} (reference https://imagemagick.org/discourse-server/viewtopic.php?f=2&t=32506)." + * Imagick now explicitly conflicts with the Gmagick extension. +- Fixes: + * Bug 77128 - Imagick::setImageInterpolateMethod() not available on Windows + * Prevent memory leak when ImagickPixel::__construct called after object instantiation. + * Prevent segfault when ImagickPixel internal constructor not called. + * Imagick::setResourceLimit support for values larger than 2GB (2^31) on 32bit platforms. + * Corrected memory overwrite in Imagick::colorDecisionListImage() + * Bug 77791 - ImagickKernel::fromMatrix() out of bounds write. +- Deprecated: + * The following functions have been deprecated: + ImagickDraw, matte + Imagick::averageimages + Imagick::colorfloodfillimage + Imagick::filter + Imagick::flattenimages + Imagick::getimageattribute + Imagick::getimagechannelextrema + Imagick::getimageclipmask + Imagick::getimageextrema + Imagick::getimageindex + Imagick::getimagematte + Imagick::getimagemattecolor + Imagick::getimagesize + Imagick::mapimage + Imagick::mattefloodfillimage + Imagick::medianfilterimage + Imagick::mosaicimages + Imagick::orderedposterizeimage + Imagick::paintfloodfillimage + Imagick::paintopaqueimage + Imagick::painttransparentimage + Imagick::radialblurimage + Imagick::recolorimage + Imagick::reducenoiseimage + Imagick::roundcornersimage + Imagick::roundcorners + Imagick::setimageattribute + Imagick::setimagebias + Imagick::setimageclipmask + Imagick::setimageindex + Imagick::setimagemattecolor + Imagick::setimagebiasquantum + Imagick::setimageopacity + Imagick::transformimage + +3.4.3 + No changes from 3.4.3RC4. + +3.4.3RC4 +- Fixes: + * Avoid internal segfault. + +3.4.3RC3 +- Fixes: + * Correct file permissions in built package. + +3.4.3RC2 +- Fixes: + * Imagick::getRegistry() now throws an exception if the key does not exist, rather than terminating the program. + * Prevent attempts to resize image to zero width or height, which is not supported by ImageMagick. + * Fix compiling on Windows issue. +- Added: + * function Imagick::setImageAlpha() which replaces ImagickDraw::setOpacity() + +3.4.3RC1 +- Fixes: + * Imagick::transformImage and Imagick::orderedPosterizeImage now correctly excluded from + IM7 build. + * Bug 72311 - compiling against PHP 7.1. + * Bug 72226 - regression for Imagick Exception classes being final on 7.x + * Corrected reference of constants. Imagick::METRIC_MEANERRORPERPIXELMETRIC from MeanErrorPerPixelMetric to MeanErrorPerPixelErrorMetric. Imagick::METRIC_PEAKSIGNALTONOISERATIO from PeakSignalToNoiseRatioMetric to PeakSignalToNoiseRatioErrorMetric +- Added: + * function Imagick::identifyImageType() : int returns one of the Imagick::IMGTYPE_* constants + * Imagick::INTERPOLATE_NEAREST_PIXEL for ImageMagick >= 7 + * In ImageMagick, the names of two filter constants were corrected to the standard spelling. Support for the new spelling has been added. The old constants are left in place for legacy support. + Legacy: FILTER_HANNING, new name: FILTER_HANN + Legacy: FILTER_WELSH, new name: FILTER_WELCH + * The Imagick::IMGTYPE_*MATTE* constants are deprecated for ImageMagick 7. Instead an appropriate Imagick::IMGTYPE_*MATTE* should be used. + IMGTYPE_GRAYSCALEMATTE => IMGTYPE_GRAYSCALEALPHA + IMGTYPE_PALETTEMATTE => IMGTYPE_PALETTEALPHA + IMGTYPE_TRUECOLORALPHA => IMGTYPE_TRUECOLORMATTE + IMGTYPE_COLORSEPARATIONALPHA => IMGTYPE_COLORSEPARATIONMATTE + IMGTYPE_PALETTEBILEVELALPHA => IMGTYPE_PALETTEBILEVELMATTE + * Several ALPHACHANNEL_* constants are only available in ImageMagick < 7 + IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_RESET", ResetAlphaChannel); + IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_COPY", CopyAlphaChannel); + IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_OPAQUE", OpaqueAlphaChannel); + * Several ALPHACHANNEL_* constants are only available in ImageMagick >= 7. These constants re-use the values of the constants removed. + IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_ON", OnAlphaChannel); + IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_OFF", OffAlphaChannel); + IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_DISCRETE", DiscreteAlphaChannel); + +3.4.2 +- Fixes: + * Bug: IM143 Correct ifdef around setOpacity, getOpacity and localContrastImage. + * Bug: IM147 Imagick was Borging PHP's error handler. + +3.4.1 +- Fixes: + * Bug 71742 - arrays that contain data that is held by reference gives error. +- Added: + * Imagick::autoGammaImage([int channel = CHANNEL_ALL]) + * Imagick::autoOrient() + * Imagick::compositeImageGravity(Imagick $image, int COMPOSITE_CONSTANT, int GRAVITY_CONSTANT) + * Imagick::localContrastImage(float radius, float strength) + * Imagick::DIRECTION_LEFT_TO_RIGHT + * Imagick::DIRECTION_RIGHT_TO_LEFT + * Imagick::SPARSECOLORMETHOD_MANHATTAN + * ImagickDraw::getOpacity() : float + * ImagickDraw::setOpacity(float opacity) :bool + * ImagickDraw::getFontResolution() : array + * ImagickDraw::setFontResolution(float x, float y) : bool + * ImagickDraw::getTextDirection() : bool + * ImagickDraw::setTextDirection(int direction) : bool + * ImagickDraw::getBorderColor() : ImagickPixel + * ImagickDraw::setBorderColor(ImagickPixel color) : bool + * ImagickDraw::getDensity() : string|null + * ImagickDraw::setDensity(string density_string) : bool + * ImagickPixel::setColorFromPixel(ImagickPixel $srcPixel) : bool + +3.4.0 + No changes from 3.4.0RC6. + +3.4.0RC6 +- Added: + * Imagick::evaluateImages(int EVALUATE_CONSTANT) : Imagick +- Fixes: + * Imagick::setImageWhitePoint, Imagick::setImageRedPrimary, Imagick::setImageGreenPrimary, + Imagick::setImageBluePrimary now take 3 params when compiled against IM7. + * Imagick::getImageWhitePoint, Imagick::getImageRedPrimary, Imagick::getImageGreenPrimary, + Imagick::getImageBluePrimary now return 3 values when compiled against IM7. + +3.4.0RC5 +- Added: + * Imagick::subImageMatch() added parameters. The signature is now: + Imagick::subimagematch(Imagick $subimage[, array &$bestMatch[, float &similarity[, + float $similarity_threshold = 0[, int $metric = ]]]]) + These parameters are only used when compiled against ImageMagick 7. +- Fixes: + * wrong type for zend_parse_parameters. + +3.4.0RC4 +- Fixes: + * Remove duplicated definitions of class constants. + +3.4.0RC3 +- Fixes: + * Imagick::adaptiveResizeImage, Imagick::cropThumbnailImage Imagick::resizeImage, + Imagick::scaleImage, and Imagick::thumbnailImage have all had a rounding bug fixed. + An additional parameter has been added to each of them, 'bool $legacy'. If legacy + is true, the calculations are done with the small rounding bug that existed in + Imagick before 3.4.0. If false, the calculations should produce the same results as + ImageMagick CLI does. + * Imagick::colorizeImage() and Imagick::tintImage were using the wrong behaviour. + It is now fixed and the legacy behaviour can still be used by passing a 3rd + parameter of `true` to the function to indicate that the legacy behaviour is + desired. + * Imagick::importImagePixels regression fixed. + * Imagick::subImageMatch use correct error metric in IM7 +- Added methods: + * Imagick::similarityImage() which is an alias to Imagick::subImageMatch() + +3.4.0RC2 +- Fixes: + * Version number in extension header. + +3.4.0RC1 +- Added support: + * PHP 7 + * ImageMagick 7. Imagick can be compiled against either ImageMagick 6 or ImageMagick 7 + However it must be run with the exact same version it was compiled against. Trying + to run Imagick with a different version of ImageMagick than it was compiled against + is not supported. Please see http://nextgen.imagemagick.org/script/porting.php for + more information about ImageMagick 7. +- Minimum versions supported are now PHP >= 5.4.0 and ImageMagick >= 6.5.3-10. + Earlier versions may continue to work, but they are no longer supported. +- Added methods: + * Imagick::getConfigureOptions + * Imagick::getFeatures + * Imagick::getHDRIEnabled + * Imagick::setImageChannelMask (IM7 only) +- Added IM7 constants: + * Imagick::CHANNEL_READ_MASK + * Imagick::CHANNEL_WRITE_MASK + * Imagick::CHANNEL_META +- Fixes: + * ImagickPixel::getColorQuantum, ImagickPixel::getColorValueQuantum and + ImagickPixel::setColorValueQuantum now correctly use floats when Imagick + was compiled against a HDRI version of ImageMagick + * Imagick::exportImagePixels works for all storage types + +3.3.0 + No changes + +3.3.0RC2 +- Corrected package versioning to exclude PHP7 +- Correct params for Imagick::getColorValueQuantum + +3.3.0RC1 +- Added ImagickKernel class. These can be used with the Imagick::morphology or + Imagick::filter functions. +- Added methods: + * Imagick::brightnessContrastImage() + * Imagick::colorMatrixImage() + * Imagick::deleteImageProperty() + * Imagick::filter() + * Imagick::forwardFourierTransformImage() + * Imagick::getAntiAlias() + * Imagick::getImageCompression() + * Imagick::getRegistry() + * Imagick::getQuantum() + * Imagick::identifyFormat() + * Imagick::inverseFourierTransformImage() + * Imagick::isPixelSimilarQuantum() + * Imagick::listRegistry() + * Imagick::morphology() + * Imagick::rotationalBlurImage() + * Imagick::selectiveBlurImage() + * Imagick::setAntiAlias() + * Imagick::setImageBiasQuantum() + * Imagick::setProgressMonitor() + * Imagick::setRegistry() - which allows setting the "temporary-path" used by ImageMagick + * Imagick::statisticImage() + * Imagick::subImageMatch() + * ImagickPixel::getColorQuantum() +- Added constants: + * Imagick::RESOURCETYPE_TIME + * Imagick::RESOURCETYPE_THROTTLE + * Imagick::CHANNEL_RGBA + * Imagick::ALPHACHANNEL_BACKGROUND + * Imagick::FUNCTION_ARCSIN + * Imagick::FUNCTION_ARCTAN +- Fixed Imagick::clutImage() parameter parsing +- Fixed tint image bug +- Fixed ImageMagick compiled with HDRI having quantum values as floats +- Fixed memory leaks in: + * Imagick::getImageBlob() + * Imagick::getImagesBlob() + * Imagick::getImageChannelStatistics() + * Imagick::getImageFormat() + * Imagick::getImageMimetype() + * Imagick::getSamplingFactors() + * Imagick::identifyImage() + * Imagick::tintImage +- Fixed segfault when compiling statically +- ImagickDraw::setFontFamily no longer checks whether the font is available. This allows a + font family to be set where the family name is not the same as the font name. However it also + means an invalid family name can be set, leading to the default font being used, instead of an + exception being thrown. See https://github.com/mkoppanen/imagick/issues/77 +- Removed Zend MM support +- Excluded deprecated methods: + * Imagick::getImageMatte() + * Imagick::colorFloodfillImage() + * Imagick::matteFloodfillImage() + * Imagick::paintFloodfillImage() + * Imagick::paintOpaqueImage() + * Imagick::paintTransparentImage() + * Imagick::mapImage() + * Imagick::recolorImage() + * Imagick::setImageIndex() + * Imagick::getImageIndex() + * Imagick::getImageSize() + * Imagick::setImageAttribute() + * Imagick::getImageAttribute() + * Imagick::mosaicImages() + * Imagick::averageImages() + * Imagick::flattenImages() + This is replaced by $im = $im->mergeImageLayers(\Imagick::LAYERMETHOD_FLATTEN) + * Imagick::getImageChannelExtrema() + * Imagick::getImageExtrema() +- Ini file changes + * Added imagick.skip_version_check. Imagick now checks that it was compiled against the same version of + ImageMagick that it is being run with, and will give a warning if it was compiled against a different + version of ImageMagick. The skip_version_check setting allows you to suppress this warning. However + it is strongly recommended to use the version of ImageMagick that Imagick was compiled against. +- Misc: + * CI now compiles with CFLAGS="-Wno-deprecated-declarations -Wdeclaration-after-statement -Werror" + +3.2.0RC1 +- Fix bug #66098: Segfault in zval_addref_p + +3.2.0b2 +- A lot of internal improvements on the code +- Added ImagickPixel::isPixelSimilar and deprecate ImagickPixel::isSimilar #10 +- Added imagick::smushimages +- Added imagick::blueshiftimage and imagick::clampimage +- Added Imagick::autolevelimage +- Added constants: + Imagick::ALPHACHANNEL_REMOVE + Imagick::ALPHACHANNEL_FLATTEN + Imagick::RESOURCETYPE_THREAD + Imagick::COMPOSITE_CHANGEMASK + Imagick::COMPOSITE_LINEARLIGHT + Imagick::COMPOSITE_DIVIDE + Imagick::COMPOSITE_DISTORT + Imagick::COMPOSITE_BLUR + Imagick::COMPOSITE_PEGTOPLIGHT + Imagick::COMPOSITE_VIVIDLIGHT + Imagick::COMPOSITE_PINLIGHT + Imagick::COMPOSITE_LINEARDODGE + Imagick::COMPOSITE_LINEARBURN + Imagick::COMPOSITE_MATHEMATICS + Imagick::COMPOSITE_MODULUSADD + Imagick::COMPOSITE_MODULUSSUBTRACT + Imagick::COMPOSITE_MINUSDST + Imagick::COMPOSITE_DIVIDEDST + Imagick::COMPOSITE_DIVIDESRC + Imagick::COMPOSITE_MINUSSRC + Imagick::COMPOSITE_DARKENINTENSITY + Imagick::COMPOSITE_LIGHTENINTENSITY + Imagick::FILTER_KAISER + Imagick::FILTER_WELSH + Imagick::FILTER_PARZEN + Imagick::FILTER_LAGRANGE + Imagick::FILTER_SENTINEL + Imagick::FILTER_BOHMAN + Imagick::FILTER_BARTLETT + Imagick::FILTER_JINC + Imagick::FILTER_SINCFAST + Imagick::FILTER_ROBIDOUX + Imagick::FILTER_LANCZOSSHARP + Imagick::FILTER_LANCZOS2 + Imagick::FILTER_LANCZOS2SHARP + Imagick::FILTER_ROBIDOUXSHARP + Imagick::FILTER_COSINE + Imagick::FILTER_SPLINE + Imagick::FILTER_LANCZOSRADIUS + Imagick::COMPRESSION_ZIPS + Imagick::COMPRESSION_PIZ + Imagick::COMPRESSION_PXR24 + Imagick::COMPRESSION_B44 + Imagick::COMPRESSION_B44A + Imagick::COMPRESSION_LZMA + Imagick::COMPRESSION_JBIG1 + Imagick::COMPRESSION_JBIG2 + +3.2.0b1 +- Added Countable interface to Imagick class +- Added experimental support for Zend MM. If compiled with --enable-imagick-zend-mm + Imagick will respect PHP memory limits +- Added additional parameter to writeImageFile to allow setting format +- Distribute tests as part of the release +- Fixed Bug #65043: Destroy and clear method do the same things +- Fixed Bug #64945: ZEND_ACC_ALLOW_STATIC vs ZEND_ACC_STATIC +- A lot of internal refactoring: rewrite macros as functions, clean up naming etc + +3.1.2 +- Fixed ZTS build +- Added LICENSE file to comply with Fedora Packaging Guidelines +- Fixed memory leaks +- Added mime type to identifyImage + +3.1.1 +- Reworked identifyImage method + +3.1.0 +- Releasing RC3 as is + +3.1.0RC3 +- Fixed building against latest ImageMagick versions (#GH-2) +- Fixed thumbnail resize bug (#GH-1) +- Fixed building against latest PHP versions + +3.1.0RC2 +- Fixed PHP bug #61879 (Imagick writeImages no longer works with PHP5.4) + +3.1.0RC1 +- Fixed PECL Bug #22722 +- Fixed possible memory leaks in error scenarios +- Added PHP 5.4 support + +3.1.0b1 +- Fixed PECL Bug #21229 +- Fixed PECL Bug #20636 +- Deprecated clone() method in favour of clone keyword +- Added ImagickDraw::setResolution +- Internal refactoring on read/write code + +3.0.1 +- Fixed PECL bug #17244 + +3.0.1RC2 +- Fixed a bug which caused failure in writing files with format prefix + (such as png:test.jpg) + +3.0.1RC1 +- Fixed build against PHP 5.1.x +- Fixed PECL bug #17892 + +3.0.0 +- No bugs reported against RC2 so releasing as stable + +3.0.0RC2 +- Added set/getColorspace +- Added transformImageColorspace (Patrick Durold) +- Fix writeImage logic error in filename_len checking. +- Fix conversion to double in affine matrices +- s,function_entry,zend_function_entry, (Johannes) + +3.0.0RC1 +- Fixes a crash when setResourceLimit is called statically +- Fixes PECL bug #16932 Unable to read image from the filehandle +- Return empty string if original value is empty in: + * ImagickDraw::getClipPath + * ImagickDraw::getEncoding + * ImagickDraw::getFont + * ImagickDraw::getFontFamily +- More relaxed validation on affinematrices +- Initialize the counter properly in polygons. Thanks to Etienne Kneus + +3.0.0b2 +- Fixes building against PHP 5.2.x + +3.0.0b1 +- Fixes incorrect error message "wand contains no images" +- Change cropthumbnailimage behavior to actually do what it is supposed to do +- setimageartifact, getimageartifact, deleteimageartifact +- added fill param to thumbnailImage +- Added support for using imagick objects in other extensions + +2.3.0 +- imagick::setImageVirtualPixelMethod not deprecated anymore +- fixed windows build + +2.3.0RC3 +- Closed bug reports and pushing out RC just in case before stable. + +2.3.0RC2 +- Fixed image reading routines. Page defitions (test.pdf[0]) were broken on RC1 +- Fixed imagick::colorizeImage, it had no effect on images + +2.3.0RC1 +- Fixes PECL bug #16085 (Twice crop returns invalid result) +- Removed unnecessary checks + +2.3.0b1 +- Fixed compilation against older ImageMagick versions (Patch by Tim Herzog) +- Fixed getImageMatte to actually return boolean instead of int + +- Added methods: +* Imagick::getImageMimeType +* Imagick::writeimagefile +* Imagick::writeimagesfile +* Imagick::resetimagepage +* Imagick::setimageclipmask +* Imagick::getimageclipmask +* Imagick::animateimages +* Imagick::recolorimage +* Imagick::floodfillpaintimage +* Imagick::opaquepaintimage +* Imagick::transparentpaintimage +* Imagick::decipherimage +* Imagick::encipherimage +* Imagick::getimagealphachannel +* Imagick::getimagechanneldistortions +* Imagick::getimagegravity +* Imagick::setimagegravity +* Imagick::remapimage +* Imagick::exportimagepixels +* Imagick::getimagechannelkurtosis +* Imagick::functionimage +* Imagick::importImagePixels +* Imagick::sparseColorImage +* Imagick::deskewImage +* Imagick::segmentImage + +* Imagickdraw::gettextkerning +* Imagickdraw::settextkerning +* Imagickdraw::gettextinterwordspacing +* Imagickdraw::gettextinterwordspacing + +* ImagickPixel::getColorValueQuantum +* ImagickPixel::setColorValueQuamtum +* ImagickPixel::getIndex +* ImagickPixel::setIndex + +2.2.2 +- No bugs reported against RC4 so releasing it as is + +2.2.2RC4 +- Check for ImageMagick version in config.m4 before trying to search for headers +- Fixed memory leak where pointinfo is used +- Fixed incorrect memory handling of array where php array is converted to array of doubles +- Cleaned up image writing routines +- Added missing semicolon on constant registration +- Added distortion and alphachannel constants + +2.2.2RC3 +- Fixed clone keyword to actually clone the wand ptr +- Imagick progress monitor name is now correctly cloned +- Fixes PECL Bug #15614 + +2.2.2RC2 ++ Added Imagick::setImageProgressmonitor and Imagick::orderedPosterizeImage +- Fixes http://imagemagick.org/discourse-server/viewtopic.php?f=18&t=12828 +- Fixes error with empty exception messages +- Fixes PECL Bug #15332 +- Fixed a possible memory leak in Imagick::convolveImage + +2.2.2RC1 +- Fixes Pecl bug #15321 +- Added getImageCompressionQuality +- Fixes building against PHP 5.3 + +2.2.1 +- No bugs reported against RC2 so releasing it as is + +2.2.1RC2 +- Fixed ZTS build + +2.2.1RC1 +- Fixes a small memory leak when casting a string to ImagickPixel object +- Added new constants +- Added getImageChannelRange method +- Some cleaning up on the syntax + +2.2.0 +- Changes since 2.1.1: +* Major refactoring of the file structure +* Fixes bugs related to the refactoring + +2.2.0RC1 +- Fix build on Mac related to duplicate symbols + +2.2.0b2 +- Closes PECL Bugs #13841 and #13787 + +2.2.0b1 +- Major refactoring of the internal file structure + +2.1.1 +- Fixed a bug with fit parameter when scaling images with scaling ratio 1:1 + * This is a minor BWC break. Scripts relying on incorrect behavior might need revisiting. + +2.1.1RC1 +- Fixed building against ImageMagick 6.3.8-x + +2.1.0 +- Addded setImageAlphaChannel method +- Fixed sharpenImage parameters being reversed +- Fixed building with pre 5.2 versions + +2.1.0RC3 +- Fixes PECL Bug #12851 +- Some major housekeeping changing numeral values to constants + +2.1.0RC2 +- Closes PECL Bugs #12463 and #12479 +- Fixes the behavior of flattenImages and fximage +- Fixes incorrect thumbnail behavior +- Fixes a bug in Imagick::cropThumbnailImage +- Added new constant Imagick::NOISE_RANDOM + +2.1.0RC1 ++ All methods that expect ImagickPixel now allow a string representing the color ++ Added support for pixeliterator in all supported ImageMagick versions. ++ ImagickPixelIterator now implements the iterator interface ++ It is now possible to set the row with region iterator ++ Added MAXPATHLEN checks for image reads/writes ++ Added a fix to Imagick::cropThumbnailImage() to check if images are already at the desired size ++ Fixed a memory leak in Imagick::getImageHistogram() ++ Speed improvements to Imagick::cropThumbnailImage() ++ Added interpolate constants ++ Fixed ImagickPixel::getColor() ++ Marked ImagickDraw::__construct() with ZEND_ACC_CTOR ++ Added fit parameter and proportional scaling to: +- Imagick::adaptiveResizeImage() +- Imagick::scaleImage() +- Imagick::resizeImage() ++ Added imagick.locale_fix ini setting to fix drawing bug on some locale ++ Suppressed warnings in readImageFile and pingImageFile (PECL Bug #12367) ++ Added methods: +- ImagickPixel::clone() +- ImagickPixel::getColorAsString() +- Imagick::mergeImageLayers() +- Imagick::paintFloodfillImage() +- Imagick::setFont() +- Imagick::getFont() +- Imagick::setPointsize() +- Imagick::getPointsize() + +2.0.1 ++ ImagickDraw::setFont and ImagickDraw::setFontFamily now allow only valid fonts ++ Added IMAGICK_EXTVER and IMAGICK_EXTNUM constants ++ Added check for empty or invalid pseudo format string in Imagick::newPseudoImage ++ Fixed incorrect arg hinting for Imagick::compareImageChannels + +2.0.1RC1 ++ Added Imagick::distortImage and Imagick::setlastiterator ++ Added optional fourth parameter to newImage to set the format when creating a new canvas ++ Fixed fitting to zero size image in Imagick::thumbnailImage ++ Fixed the destroy methods. ++ Most of the operations that read / add images to the stack move the iterator position to the last element ++ Fixed memleaks in methods that replace the internal MagickWand* pointer + +2.0.0 ++ Added Imagick::extentImage ++ Added Imagick::IMAGICK_VERSION_NUMBER and Imagick::IMAGICK_VERSION_STRING constants ++ Fixed a possible crash in Imagick::newPseudoImage + +2.0.0RC4 ++ Moved getimagelength into #if block ++ Added optional third parameter to thumbnailImage ++ Added second optional parameter to getImageProperties and getImageProfiles to return just the available properties. ++ Closes PECL Bug #12006 + +2.0.0RC3 ++ Closes PECL Bug #12006 ++ Fixes a possible crash in queryFontMetrics ++ New methods: ++ Imagick::clutImage ++ Imagick::setImage ++ Imagick::getImageLength ++ Imagick::getImageOrientation ++ Imagick::setImageOrientation ++ Imagick::getImageProperties ++ Imagick::getImageProfiles + +2.0.0RC2 ++ Added support for forcing image format during write operations. ++ Added more interlace constants. They are present if imagick is compiled against ImagickMagick 6.3.4 or newer. ++ Added Imagick::getImageAttribute. ++ Added LAYERMETHOD constants. Available if compiled against ImageMagick 6.2.8 or later. ++ Closes PECL Bug #11934 - setImageVirtualPixelMethod triggers exception ++ Fixed safe_mode and open_basedir bypass for __construct, readImage, readImages and pingImage + +2.0.0RC1 ++ Suppress error when reading image from a stream. ++ Fixed allow_url_fopen bypass in Imagick::newPseudoImage(). ++ Fixed imagick::__tostring to return empty string if the object doesnt contain images. ++ Fixed a problem with Imagick::getImagesBlob() when an older version of ImageMagick is used. ++ Fixed a crash on Windows when no arguments are passed to the Imagick constructor. ++ Fixed a crash when using a threaded SAPI under Windows. ++ Fixed a bug in ImagickDraw::affine(). ++ Added Imagick::getIteratorIndex() and Imagick::setIteratorIndex(). ++ Added Imagick::readImages() + +2.0.0b3 ++ Closes PECL Request #11513 ++ Fixes ImagickPixel bug reported by Imran Nazar. ++ Fixed Imagick::setImageDispose and Imagick::setImageUnits. ++ Fixed Imagick::queryFontMetrics to autodetect multiline text if multiline argument is not passed or is null. ++ Fixed open_basedir bypasses in Imagick::newPseudoImage ++ Fixed "Undefined Exception" error messages + +NOTE: Using threaded SAPI in Windows is not currently recommended. + +2.0.0b2 ++ Fixed open_basedir bypasses. ++ Fixed PECL Bug #11328 ++ Added methods: +- Imagick::queryFonts() +- Imagick::queryFontMetrics() + +NOTE: Using threaded SAPI in Windows is not currently recommended. + +2.0.0b1 +- fix PECL bug #10967 - supplied path fails to compile +- Added new methods ++ Imagick::displayImage() ++ Imagick::displayImages() ++ Imagick::cropThumbnailImage() ++ Imagick::roundCorners() ++ Imagick::polaroidImage() ++ Imagick::getImageProperty() ++ Imagick::setImageProperty() ++ Imagick::newPseudoImage() ++ Imagick::__toString() ++ ImagickPixel::setColorCount() +- Added missing DisposeType constants. +- Merged ImagickPixel::getColorAsString and ImagickPixel::getColorAsNormalizedString into ImagickPixel::getColor( [bool normalized] ) +- Fixed wrong exception type in Imagick::setSamplingFactors +- Removed useless check from ImagickPixelIterator::syncIterator +- Renamed ImagickDraw::pushDrawingWand to ImagickDraw::push +- Renamed ImagickDraw::popDrawingWand to ImagickDraw::pop + +2.0.0a3 +- Removed support for ImagickPixelIterator if compiled against older version of ImageMagick (below 6.2.8) +- Fixed a lot of functions which were not present in older ImageMagick versions. (below 6.2.8) +- Added support for passing color name as parameter for ImagickPixel constructor +- Added support for passing a filename or an array of filenames to Imagick constructor +- Fixed anomalies with ImagickPixelIterator exceptions +- Fixed a possible segfault in Imagick::appendImages +- Fixed double-free errors in some Imagick methods +- Added composite operator constants. +- Fixed ImagickPixelIterator::__construct to accept Imagick object as parameter. + ++ Some of the changes are a bit experimental so please report bugs. + +2.0.0a2 +- Fixed segfaults in ImagickDraw::getFont(), ImagickDraw::getFontFamily(), + ImagickDraw::getTextEncoding() and ImagickDraw::getClipPath() +- Added a PHP version check to config.m4 + +2.0.0a1 +- Initial Release + +0.9.13 +- Fixed compile error with newer versions of GraphicsMagick and ImageMagick +- Fixed assertion when using imagick_setfillcolor +- Fixed segfault when an empty blob is loaded +- Use new API for fetching support image formats / fonts + +0.9.11 +- Fix some segfaults on errors (by Andrei Nigmatulin) +- EXPERIMENTAL support for ImageMagick >= 6.0.0 (hint by Stanislav Yadykin). Please report successes or failures. + +0.9.10 +- A ./configure change release only. +- Changed config.m4 for checking for correct ImageMagick Version. + ImageMagick >= 5.5.3 and < 6.6.0 or GraphicsMagick >= 1.0.0 are needed. +- ImageMagick >= 6.0.0 does not work currently. Patches are welcome ;) + +0.9.9 +- added function imagick_set_image_comment() for setting the comment attribute +of an image. +- function imagick_setcompressiontype() was not setting the correct structure. +This was identified and tested by Sergio Salvatore (sergio@cucinalogica.com). +- added function imagick_transparent() for setting a particular color to be +transparent within an image. +- changed how certain errors are handled in _php_imagick_is_error() to be +less restrictive. This apparently helps fix issues with certain types +of images that otherwise appear corrupt. Thanks to Hien Duy Nguyenxi +(hdn@umich.edu) for finding this, recommending the change and testing it. +- added imagick_set_image_quality() for manipulating the quality of the +resultant image. +- added examples/set_image_quality.php for testing the +imagick_set_image_quality() function. Thanks to Derrick DeLoreno Threatt +(dthreatt@digitalcreations.net) for bringing up the need for this function +and testing it. + +0.9.8 +- fixed critical error in call to strlen() in _php_imagick_set_last_error(). +I strongly recommend you upgrade. + +0.9.7 +- fixed bug in imagick_free() that would cause it to SEGFAULT everytime +it's called. +- fixed to work with versions of ImageMagick >= 5.5.7 - special thanks to +James Huston (hustonjs@itadevelopment.com) for helping make this happen. +- test compiled against ImageMagick 5.5.3, 5.5.6 and 5.5.7 with success. +- test compiled against GraphicsMagick 1.0.1 with success. + +0.9.6 +- functions added: +imagick_getcolorspace() +imagick_error() +- added a new example called transparent_1x1.html and some explanatory text. +I can think of many uses for this code. +- thanks to James Huston (hustonjs@itadevelopment.com) for suggesting +imagick_getcolorspace() and testing it out. +- added GraphicsMagick (http://www.graphicsmagick.org) support to configure +script (enable it with --with-imagick-gm) +- imagick_readimage() now returns false if ImageMagick ReadImage() fails. +- imagick_error() returns 1 string representing any errors that have occurred +on an operation. IT IS LARGELY UNTESTED! Beware! However, you can now +do things like: +$handle = imagick_readimage( "image.jpg" ) or die( imagick_error() ) ; +- fixed configure script. It honours now values returned by Magick-config. + +0.9.5 +- functions added: +imagick_newimagelist() +imagick_pushlist() +imagick_poplist() +imagick_mosaic() +imagick_setcompressiontype() +imagick_setcompressionquality() +- modified how all functions check to see if ImageMagick has been initialized. +- added a number of new examples for demonstrating how to use image lists. +- fixed bugs in _php_imagick_alloc_handle() and _php_imagick_clear_errors() +causing core dump when working with image lists. I wasn't checking to make +sure the structures I was examining were allocated. +- thanks to James Huston (hustonjs@itadevelopment.com) for suggesting +imagick_setcompressiontype() and imagick_setcompressionquality() and +testing them. +- added supporting IMAGICK_COMPRESSION_* constants for use with +imagick_setcompressiontype(). +- renamed imagick_setcompression() to imagick_setcompressiontype(). +(note: this was done before the new version was released so no users should +be impacted.) + +0.9.4 +- functions added: +imagick_flatten() +imagick_getmagick() +imagick_setfillopacity() +- fixed bad code in these functions: +imagick_despeckle() +imagick_edge() +imagick_emboss() +imagick_enhance() +imagick_gaussianblur() +imagick_medianfilter() +imagick_motionblur() +imagick_reducenoise() +imagick_shade() +imagick_sharpen() +imagick_spread() +imagick_unsharpmask() +- for the above functions, if call to corresponding ImageMagick +function the module would probably core dump. If it didn't the +results would be really buddy and weird. +- setfillopacity() thanks to Allen Condit, condit@isri.unlv.edu. + +0.9.3 +- functions added: +imagick_zoom() +- the difference between imagick_zoom() and imagick_resize() is +that zoom applies the blur and filter that are defined by +the image. It is a much simpler way of resizing an image. +- added imagick.dsp and modifications for compiling under Windows. +- changed all instances of le_handle to le_imagick_handle to avoid +future conflicts. + +0.9.2 +- functions added: +imagick_profile() +- created IMAGICK_PROFILE_* to support imagick_profile(). +- this release is significant because of the issue with Microsoft IE +where the image's profile causes the browser to not properly render +images (you only get red X's). See this posting: +http://studio.imagemagick.org/pipermail/magick-users/2002-September/005072.html +- added this filter IMAGICK_FILTER_UNKNOWN. If the user specifies +this filter to imagick_resize(), the resize function will take +whatever filter is defined by the image. +- modified imagick_resize() to take 6th optional parameter that is +the modifier to the geometry to facility building geometries such +as 800x600+200+200! or 450x230>. +- modified imagick_scale() to take 4th optional parameter that is +the modifier to the geometry to facility building geometries such +as 800x600+200+200! or 450x230>. +- modified imagick_sample() to take 4th optional parameter that is +the modifier to the geometry to facility building geometries such +as 800x600+200+200! or 450x230>. + +0.9.1 +- functions added: +imagick_chop() +imagick_crop() +imagick_flip() +imagick_flop() +imagick_roll() +imagick_getimagedepth() +imagick_getnumbercolors() +imagick_isgrayimage() +imagick_ismonochromeimage() +imagick_isopaqueimage() +imagick_ispaletteimage() +imagick_ordereddither() +imagick_composite() +- Added IMAGICK_COMPOSITE_OP_* for use with imagick_composite(). + +0.9.0.1 +IMPORTANT!!! +This release breaks Backwards Compatibility with the 0.1.x series of ext/imagick. read the examples for more information (in $doc_dir/imagick/examples). + +Big Credits go to Michael C. Montero, who wrote the whole extension from scratch. Without him, we would still be at 0.1.x. He will be the future lead for this package (as soon as he has an account on pear). + +0.2-0.5 were never released within PEAR. + +version 0.9.0.1: +- more appropriate changelog/notes, no changes in code. + +version 0.9: +- functions added: +imagick_next() +imagick_prev() +imagick_first() +imagick_goto() +imagick_getlistsize() +imagick_getlistindex() +imagick_getimagefromlist() +imagick_blob2image() +imagick_reducenoise() +imagick_shade() +imagick_sharpen() +imagick_spread() +imagick_threshold() +imagick_unsharpmask() +- cut over deprecation reporting to a more standized and easier to use method +- cut over all php_error calls to standard method +- added Christian's code to info function for displaying a list of supported image formats +- rewrote all code to use proper parameter parsing function +- fixed minor issue with a number of example files; was nothing critical + +version: 0.5a +- functions added: +imagick_getcanvas() +imagick_blur() +imagick_despeckle() +imagick_edge() +imagick_emboss() +imagick_enhance() +imagick_gaussianblur() +imagick_medianfilter() +imagick_motionblur() +- one major change - renamed everything to imagick*; I've joined my efforts with Christian Stocker who had a previously written but smaller extension +- magick_getcanvas() allows you to create a blank image to draw on +- changed comment header in imagick.h to match the one in imagick.c +- added Christian Stocker to credits +- moved over to Christian Stocker's config.m4, removed the need for gen_configm4 +- rewrote INSTALL to reflect new config.m4 +- slight modifications to config.m4 to get it to work properly +- added package.xml +- removed ChangeLog, everything is now in package.xml +- removed imagick_free_reason() and imagick_free_description() since they are no longer necessary +- preceded all internal functions with _php_ +- created imagick_read() for backward compatibility with old extension +- created imagick_write() for backward compatibility with old extension + +version 0.4a +- functions added: +magick_writeimages() +magick_destroyhandle() +magick_image2blob() +magick_drawarc() +magick_drawcircle() +magick_drawpoint() +magick_border() +magick_frame() +magick_raise() +magick_getwidth() +magick_getheight() +magick_getmimetype() +magick_setfillcolor() +magick_setfontface() +magick_charcoal() +magick_implode() +magick_oilpaint() +magick_solarize() +magick_swirl() +magick_wave() +- more preparation for image lists +- fixed incorrect comments in some examples +- fixed incorrect calls to magick_failedreason() and magick_faileddescription() in most examples +- a number of examples weren't exiting properly on errors, that's been fixed +- phpinfo() now displays available font family and font names +- coolest function so far: magick_oilpaint(). The output is awesome! +- added MaxRGB to phpinfo() section + +version 0.2a +- functions added: +magick_rotate() +magick_shear() +magick_contrast() +magick_equalize() +magick_gamma() +magick_level() +magick_modulate() +magick_negate() +magick_normalize() +magick_drawellipse() +- slight changes to output of gen_configm4 +- fixed comments in all examples after the initial magick_readimage(), they were wrong +- fixed all examples so they exit properly on errors +- fixed all examples so they work as either standalone script or web page; they do better output as well +- fixed output of magick info. when calling phpinfo() +- more commenting +- significantly better error handling + +0.9 +IMPORTANT!!! +This release breaks BC with the 0.1.x series of ext/imagick. +read the examples for more information (in $doc_dir/imagick/examples) + +0.2-0.5 were never released within PEAR. + +- functions added: +imagick_next() +imagick_prev() +imagick_first() +imagick_goto() +imagick_getlistsize() +imagick_getlistindex() +imagick_getimagefromlist() +imagick_blob2image() +imagick_reducenoise() +imagick_shade() +imagick_sharpen() +imagick_spread() +imagick_threshold() +imagick_unsharpmask() +- cut over deprecation reporting to a more standized and easier +to use method +- cut over all php_error calls to standard method +- added Christian's code to info function for displaying a list of +supported image formats +- rewrote all code to use proper parameter parsing function +- fixed minor issue with a number of example files; was nothing +critical + +0.1.2 +- Added imagick_border(). (pierre-alain joye) +- Fixed return of annotate and rotate (true on success). (pierre-alain joye) + +0.1.1 +- Make it compatible with ImageMagick 5.4.5 (and this is also the needed version now) +- adjust package.xml to the new "pear build" command diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/config.m4 php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/config.m4 --- php-imagick-3.4.4/imagick-3.4.4+php8.0/config.m4 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/config.m4 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,65 @@ +PHP_ARG_WITH(imagick, whether to enable the imagick extension, +[ --with-imagick[=DIR] Enables the imagick extension. DIR is the prefix to ImageMagick installation directory.], no) + + +if test $PHP_IMAGICK != "no"; then + +# +# Find ImageMagick +# +if test "$ext_shared" != "yes" && test "$ext_shared" != "shared"; then + define('PHP_IMAGICK_STATIC', 1) + PHP_IMAGICK_STATIC=yes +fi +m4_include(ifdef('PHP_IMAGICK_STATIC',PHP_EXT_BUILDDIR(imagick)[/],)[imagemagick.m4]) + +IM_FIND_IMAGEMAGICK([6.2.4], [$PHP_IMAGICK]) + +# +# PHP minimum version +# + AC_MSG_CHECKING([PHP version is at least 5.3.2]) + + if test -z "${PHP_VERSION_ID}"; then + if test -z "${PHP_CONFIG}"; then + AC_MSG_ERROR([php-config not found]) + fi + if test -z "${AWK}"; then + AC_MSG_ERROR([awk not found]) + fi + PHP_IMAGICK_FOUND_VERSION=`${PHP_CONFIG} --version` + PHP_IMAGICK_FOUND_VERNUM=`echo "${PHP_IMAGICK_FOUND_VERSION}" | $AWK 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 100 + [$]2) * 100 + [$]3;}'` + else + PHP_IMAGICK_FOUND_VERNUM="${PHP_VERSION_ID}" + PHP_IMAGICK_FOUND_VERSION="${PHP_VERSION}" + fi + + if test "$PHP_IMAGICK_FOUND_VERNUM" -ge "50302"; then + AC_MSG_RESULT(yes. found $PHP_IMAGICK_FOUND_VERSION) + else + AC_MSG_ERROR(no. found $PHP_IMAGICK_FOUND_VERSION) + fi + +# +# Set libs and CFLAGS for building +# + echo "libs" + echo $IM_IMAGEMAGICK_LIBS + echo "" + echo $IMAGICK_SHARED_LIBADD + + PHP_EVAL_LIBLINE($IM_IMAGEMAGICK_LIBS, IMAGICK_SHARED_LIBADD) + PHP_EVAL_INCLINE($IM_IMAGEMAGICK_CFLAGS) + + old_LIBS=$LIBS + LIBS="$LIBS $IM_IMAGEMAGICK_LIBS" + + PHP_CHECK_FUNC(MagickGetVersion) + + LIBS=$old_LIBS + + PHP_SUBST(IMAGICK_SHARED_LIBADD) + AC_DEFINE(HAVE_IMAGICK,1,[ ]) + PHP_NEW_EXTENSION(imagick, imagick_file.c imagick_class.c imagickdraw_class.c imagickpixel_class.c imagickpixeliterator_class.c imagick_helpers.c imagick.c imagickkernel_class.c shim_im6_to_im7.c, $ext_shared,, $IM_IMAGEMAGICK_CFLAGS) + PHP_INSTALL_HEADERS([ext/imagick], [php_imagick_shared.h]) +fi diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/config.w32 php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/config.w32 --- php-imagick-3.4.4/imagick-3.4.4+php8.0/config.w32 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/config.w32 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,24 @@ +ARG_WITH("imagick", "ImageMagick support", "no"); + +if (PHP_IMAGICK != "no") { + var conf_ok = false; + if (CHECK_HEADER_ADD_INCLUDE("MagickWand/MagickWand.h", "CFLAGS_IMAGICK", PHP_PHP_BUILD + "\\include\\imagemagick;" + PHP_IMAGICK) + && CHECK_LIB("CORE_RL_MagickWand_.lib", "imagick", PHP_PHP_BUILD + "\\lib\\imagemagick;" + PHP_IMAGICK) + && CHECK_LIB("CORE_RL_MagickCore_.lib", "imagick", PHP_PHP_BUILD + "\\lib\\imagemagick;" + PHP_IMAGICK)) { + ADD_FLAG("CFLAGS_IMAGICK", "/D IM_MAGICKWAND_HEADER_STYLE_SEVEN /D IMAGICK_USE_NEW_HEADER /D _MAGICKMOD_ /D _VISUALC_ /D NeedFunctionPrototypes /D _LIB"); + conf_ok = true; + } else if (CHECK_HEADER_ADD_INCLUDE("wand/MagickWand.h", "CFLAGS_IMAGICK", PHP_PHP_BUILD + "\\include\\imagemagick;" + PHP_IMAGICK) + && CHECK_LIB("CORE_RL_wand_.lib", "imagick", PHP_PHP_BUILD + "\\lib\\imagemagick;" + PHP_IMAGICK) + && CHECK_LIB("CORE_RL_magick_.lib", "imagick", PHP_PHP_BUILD + "\\lib\\imagemagick;" + PHP_IMAGICK)) { + ADD_FLAG("CFLAGS_IMAGICK", "/D IMAGICK_USE_NEW_HEADER /D _MAGICKMOD_ /D _VISUALC_ /D NeedFunctionPrototypes /D _LIB"); + conf_ok = true; + } + + if (conf_ok) { + EXTENSION('imagick', 'imagick_class.c imagickdraw_class.c imagickpixel_class.c imagickpixeliterator_class.c imagick_helpers.c imagick_file.c imagick.c imagickkernel_class.c shim_im6_to_im7.c'); + AC_DEFINE('HAVE_IMAGICK', 1); + AC_DEFINE('IMAGICK_EXPORTS', 1); + } else { + WARNING("imagick not enabled; libraries and headers not found"); + } +} diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/CREDITS php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/CREDITS --- php-imagick-3.4.4/imagick-3.4.4+php8.0/CREDITS 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/CREDITS 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,2 @@ +Imagick +Mikko Koppanen, Scott MacVicar diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/examples/captcha.php php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/examples/captcha.php --- php-imagick-3.4.4/imagick-3.4.4+php8.0/examples/captcha.php 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/examples/captcha.php 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,53 @@ +setColor( 'white' ); + +/* Create a drawing object and set the font size */ +$ImagickDraw = new ImagickDraw(); + +/* Set font and font size. You can also specify /path/to/font.ttf */ +$ImagickDraw->setFont( 'Helvetica Regular' ); +$ImagickDraw->setFontSize( 20 ); + +/* Create the text */ +$alphanum = 'ABXZRMHTL23456789'; +$string = substr( str_shuffle( $alphanum ), 2, 6 ); + +/* Create new empty image */ +$Imagick->newImage( 85, 30, $bg ); + +/* Write the text on the image */ +$Imagick->annotateImage( $ImagickDraw, 4, 20, 0, $string ); + +/* Add some swirl */ +$Imagick->swirlImage( 20 ); + +/* Create a few random lines */ +$ImagickDraw->line( rand( 0, 70 ), rand( 0, 30 ), rand( 0, 70 ), rand( 0, 30 ) ); +$ImagickDraw->line( rand( 0, 70 ), rand( 0, 30 ), rand( 0, 70 ), rand( 0, 30 ) ); +$ImagickDraw->line( rand( 0, 70 ), rand( 0, 30 ), rand( 0, 70 ), rand( 0, 30 ) ); +$ImagickDraw->line( rand( 0, 70 ), rand( 0, 30 ), rand( 0, 70 ), rand( 0, 30 ) ); +$ImagickDraw->line( rand( 0, 70 ), rand( 0, 30 ), rand( 0, 70 ), rand( 0, 30 ) ); + +/* Draw the ImagickDraw object contents to the image. */ +$Imagick->drawImage( $ImagickDraw ); + +/* Give the image a format */ +$Imagick->setImageFormat( 'png' ); + +/* Send headers and output the image */ +header( "Content-Type: image/{$Imagick->getImageFormat()}" ); +echo $Imagick->getImageBlob( ); + +?> \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/examples/polygon.php php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/examples/polygon.php --- php-imagick-3.4.4/imagick-3.4.4+php8.0/examples/polygon.php 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/examples/polygon.php 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,72 @@ + 378.1, "y" => 81.72 ), + array( "x" => 381.1, "y" => 79.56 ), + array( "x" => 384.3, "y" => 78.12 ), + array( "x" => 387.6, "y" => 77.33 ), + array( "x" => 391.1, "y" => 77.11 ), + array( "x" => 394.6, "y" => 77.62 ), + array( "x" => 397.8, "y" => 78.77 ), + array( "x" => 400.9, "y" => 80.57 ), + array( "x" => 403.6, "y" => 83.02 ), + array( "x" => 523.9, "y" => 216.8 ), + array( "x" => 526.2, "y" => 219.7 ), + array( "x" => 527.6, "y" => 223 ), + array( "x" => 528.4, "y" => 226.4 ), + array( "x" => 528.6, "y" => 229.8 ), + array( "x" => 528.0, "y" => 233.3 ), + array( "x" => 526.9, "y" => 236.5 ), + array( "x" => 525.1, "y" => 239.5 ), + array( "x" => 522.6, "y" => 242.2 ), + array( "x" => 495.9, "y" => 266.3 ), + array( "x" => 493, "y" => 268.5 ), + array( "x" => 489.7, "y" => 269.9 ), + array( "x" => 486.4, "y" => 270.8 ), + array( "x" => 482.9, "y" => 270.9 ), + array( "x" => 479.5, "y" => 270.4 ), + array( "x" => 476.2, "y" => 269.3 ), + array( "x" => 473.2, "y" => 267.5 ), + array( "x" => 470.4, "y" => 265 ), + array( "x" => 350, "y" => 131.2 ), + array( "x" => 347.8, "y" => 128.3 ), + array( "x" => 346.4, "y" => 125.1 ), + array( "x" => 345.6, "y" => 121.7 ), + array( "x" => 345.4, "y" => 118.2 ), + array( "x" => 346, "y" => 114.8 ), + array( "x" => 347.1, "y" => 111.5 ), + array( "x" => 348.9, "y" => 108.5 ), + array( "x" => 351.4, "y" => 105.8 ), + array( "x" => 378.1, "y" => 81.72 ), + ); + +/* This ImagickPixel is used to set background color */ +$ImagickPixel->setColor( 'gray' ); + +/* Create new image, set color to gray and format to png*/ +$Imagick->newImage( 700, 500, $ImagickPixel ); +$Imagick->setImageFormat( 'png' ); + +/* Create the polygon*/ +$ImagickDraw->polygon( $array ); + +/* Render the polygon to image*/ +$Imagick->drawImage( $ImagickDraw ); + +/* Send headers and output the image */ +header( "Content-Type: image/{$Imagick->getImageFormat()}" ); +echo $Imagick->getImageBlob( ); + +?> diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/examples/thumbnail.php php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/examples/thumbnail.php --- php-imagick-3.4.4/imagick-3.4.4+php8.0/examples/thumbnail.php 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/examples/thumbnail.php 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,22 @@ +readImage( '/tmp/test.png' ); + +/* Thumbnail the image ( width 100, preserve dimensions ) */ +$im->thumbnailImage( 100, null ); + +/* Write the thumbail to disk */ +$im->writeImage( '/tmp/th_test.png' ); + +/* Free resources associated to the Imagick object */ +$im->destroy(); + +?> \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/examples/watermark.php php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/examples/watermark.php --- php-imagick-3.4.4/imagick-3.4.4+php8.0/examples/watermark.php 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/examples/watermark.php 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,30 @@ +setFontSize( 50 ); + +/* Read image into object*/ +$Imagick->readImage( '/tmp/test.jpg' ); + +/* Seek the place for the text */ +$ImagickDraw->setGravity( Imagick::GRAVITY_CENTER ); + +/* Write the text on the image */ +$Imagick->annotateImage( $ImagickDraw, 4, 20, 0, "Test Watermark" ); + +/* Set format to png */ +$Imagick->setImageFormat( 'png' ); + +/* Output */ +header( "Content-Type: image/{$Imagick->getImageFormat()}" ); +echo $Imagick->getImageBlob(); + +?> \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/imagemagick.m4 php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/imagemagick.m4 --- php-imagick-3.4.4/imagick-3.4.4+php8.0/imagemagick.m4 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/imagemagick.m4 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,227 @@ +######################################################### +# Locate ImageMagick configuration program +# ImageMagick has the config program: +# bin/Wand-config +# bin/MagickWand-config +# +# Sets +# IM_WAND_BINARY +# IM_IMAGEMAGICK_PREFIX +# IM_IMAGEMAGICK_VERSION +# IM_IMAGEMAGICK_VERSION_MASK +# IM_USE_PKG_CONFIG +# +# Usage: +# IM_FIND_IMAGEMAGICK (MINIMUM_VERSION, EXTRA_SEARCH_PREFIX) +# +# Note: +# IM_PREFIX - the directory reported by `MagickWand-config --prefix` +# IM_IMAGEMAGICK_PREFIX - the user specified location to use +# +######################################################### + +dnl +dnl PHP_EVAL_LIBLINE(libline, SHARED-LIBADD) +dnl +dnl Use this macro, if you need to add libraries and or library search +dnl paths to the PHP build system which are only given in compiler +dnl notation. +dnl +AC_DEFUN([IM_EVAL_LIBLINE_DEFER],[ + for ac_i in $1; do + case $ac_i in + -pthread[)] + if test "$ext_shared" = "yes"; then + $2="[$]$2 -pthread" + else + PHP_RUN_ONCE(EXTRA_LDFLAGS, [$ac_i], [EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ac_i"]) + fi + ;; + -l*[)] + ac_ii=`echo $ac_i|cut -c 3-` + PHP_ADD_LIBRARY_DEFER($ac_ii,1,$2) + ;; + -L*[)] + ac_ii=`echo $ac_i|cut -c 3-` + PHP_ADD_LIBPATH_DEFER($ac_ii,$2) + ;; + esac + done +]) + +AC_DEFUN([IM_FIND_IMAGEMAGICK],[ + +# +# Variables passed in +# + IM_MINIMUM_VERSION=$1 + IM_EXTRA_SEARCH_PREFIX=$2 + + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + if test "x$PKG_CONFIG" = "xno"; then + AC_MSG_RESULT([pkg-config not found]) + AC_MSG_ERROR([Please reinstall the pkg-config distribution]) + fi + + if test -z "$AWK"; then + AC_MSG_ERROR([awk not found]) + fi + + AC_MSG_CHECKING(ImageMagick MagickWand API configuration program) + + if test "$IM_EXTRA_SEARCH_PREFIX" != "yes"; then + for i in "$IM_EXTRA_SEARCH_PREFIX" /usr/local /usr /usr/sbin /opt /opt/local; + do + AC_MSG_CHECKING([Testing ${i}/bin/MagickWand-config]) + if test -r "${i}/bin/MagickWand-config"; then + IM_WAND_BINARY="${i}/bin/MagickWand-config" + IM_IMAGEMAGICK_PREFIX=$i + AC_MSG_RESULT([It exists]) + break + fi + AC_MSG_RESULT([Doesn't exist]) + + AC_MSG_CHECKING([Testing ${i}/bin/Wand-config]) + if test -r "${i}/bin/Wand-config"; then + IM_WAND_BINARY="${i}/bin/Wand-config" + IM_IMAGEMAGICK_PREFIX=$i + AC_MSG_RESULT([It exists]) + break + fi + AC_MSG_RESULT([Doesn't exist]) + done + else + for i in /usr/local /usr /usr/sbin /opt /opt/local; + do + AC_MSG_CHECKING([Testing ${i}/bin/MagickWand-config]) + if test -r "${i}/bin/MagickWand-config"; then + IM_WAND_BINARY="${i}/bin/MagickWand-config" + IM_IMAGEMAGICK_PREFIX=$i + AC_MSG_RESULT([It exists]) + break + fi + + if test -r "${i}/bin/Wand-config"; then + IM_WAND_BINARY="${i}/bin/Wand-config" + IM_IMAGEMAGICK_PREFIX=$i + AC_MSG_RESULT([It exists]) + break + fi + AC_MSG_RESULT([Doesn't exist]) + done + fi + + IM_USE_PKG_CONFIG=0 + if test "x" = "x$IM_WAND_BINARY"; then + if eval '$PKG_CONFIG --exists MagickWand'; then + IM_USE_PKG_CONFIG=1 + IM_WAND_BINARY=$PKG_CONFIG + else + AC_MSG_ERROR(not found. Please provide a path to MagickWand-config or Wand-config program.) + fi + fi + AC_MSG_RESULT([found in $IM_WAND_BINARY]) + +# This is used later for cflags and libs + export PKG_CONFIG_PATH="${IM_IMAGEMAGICK_PREFIX}/${PHP_LIBDIR}/pkgconfig" + +# Check version +# + if test "$IM_USE_PKG_CONFIG" = "1"; then + IM_IMAGEMAGICK_VERSION=`$IM_WAND_BINARY --modversion MagickWand` + else + IM_IMAGEMAGICK_VERSION=`$IM_WAND_BINARY --version` + fi + IM_IMAGEMAGICK_VERSION_MASK=`echo $IM_IMAGEMAGICK_VERSION | $AWK 'BEGIN { FS = "."; } { printf "%d", ($[1] * 1000 + $[2]) * 1000 + $[3];}'` + + IM_MIMIMUM_VERSION_MASK=`echo $IM_MINIMUM_VERSION | $AWK 'BEGIN { FS = "."; } { printf "%d", ($[1] * 1000 + $[2]) * 1000 + $[3];}'` + + AC_MSG_CHECKING(if ImageMagick version is at least $IM_MINIMUM_VERSION) + if test "$IM_IMAGEMAGICK_VERSION_MASK" -ge $IM_MIMIMUM_VERSION_MASK; then + AC_MSG_RESULT(found version $IM_IMAGEMAGICK_VERSION) + else + AC_MSG_ERROR(no. You need at least ImageMagick version $IM_MINIMUM_VERSION to use this extension.) + fi + +# Potential locations for the header +# include/wand/magick-wand.h +# include/ImageMagick/wand/MagickWand.h +# include/ImageMagick-6/wand/MagickWand.h +# include/ImageMagick-7/MagickWand/MagickWand.h + + AC_MSG_CHECKING(for MagickWand.h or magick-wand.h header) + + if test "$IM_USE_PKG_CONFIG" = "1"; then + IM_PREFIX=`$IM_WAND_BINARY --variable prefix MagickWand` + else + IM_PREFIX=`$IM_WAND_BINARY --prefix` + fi + IM_MAJOR_VERSION=`echo $IM_IMAGEMAGICK_VERSION | $AWK 'BEGIN { FS = "."; } {print $[1]}'` + + # Try the header formats from newest to oldest + if test -r "${IM_IMAGEMAGICK_PREFIX}/include/ImageMagick-${IM_MAJOR_VERSION}/wand/MagickWand.h"; then + + IM_INCLUDE_FORMAT="wand/MagickWand.h" + IM_HEADER_STYLE="SIX" + AC_DEFINE([IM_MAGICKWAND_HEADER_STYLE_SIX], [1], [ImageMagick 6.x style header]) + + AC_MSG_RESULT([user location ${IM_IMAGEMAGICK_PREFIX}/include/ImageMagick-${IM_MAJOR_VERSION}/wand/MagickWand.h]) + + elif test -r "${IM_PREFIX}/include/ImageMagick-${IM_MAJOR_VERSION}/MagickWand/MagickWand.h"; then + + IM_INCLUDE_FORMAT="MagickWand/MagickWand.h" + IM_HEADER_STYLE="SEVEN" + AC_DEFINE([IM_MAGICKWAND_HEADER_STYLE_SEVEN], [1], [ImageMagick 7.x style header]) + + AC_MSG_RESULT([${IM_PREFIX}/include/ImageMagick-${IM_MAJOR_VERSION}/MagickWand/MagickWand.h]) + + elif test -r "${IM_PREFIX}/include/ImageMagick-${IM_MAJOR_VERSION}/wand/MagickWand.h"; then + + IM_INCLUDE_FORMAT="wand/MagickWand.h" + IM_HEADER_STYLE="SIX" + AC_DEFINE([IM_MAGICKWAND_HEADER_STYLE_SIX], [1], [ImageMagick 6.x style header]) + + AC_MSG_RESULT([${IM_PREFIX}/include/ImageMagick-${IM_MAJOR_VERSION}/wand/MagickWand.h]) + + elif test -r "${IM_PREFIX}/include/ImageMagick/wand/MagickWand.h"; then + + IM_INCLUDE_FORMAT="wand/MagickWand.h" + IM_HEADER_STYLE="SIX" + AC_DEFINE([IM_MAGICKWAND_HEADER_STYLE_SIX], [1], [ImageMagick 6.x style header]) + + AC_MSG_RESULT([${IM_PREFIX}/include/ImageMagick/wand/MagickWand.h]) + + elif test -r "${IM_PREFIX}/include/ImageMagick/wand/magick-wand.h"; then + + IM_INCLUDE_FORMAT="wand/magick-wand.h" + IM_HEADER_STYLE="OLD" + AC_DEFINE([IM_MAGICKWAND_HEADER_STYLE_OLD], [1], [ImageMagick old style header]) + + AC_MSG_RESULT([${IM_PREFIX}/include/wand/magick-wand.h]) + + else + AC_MSG_ERROR([Unable to find MagickWand.h or magick-wand.h header]) + fi + +# +# The cflags and libs +# + if test "$IM_USE_PKG_CONFIG" = "1"; then + IM_IMAGEMAGICK_LIBS=`$IM_WAND_BINARY --libs MagickWand` + IM_IMAGEMAGICK_CFLAGS=`$IM_WAND_BINARY --cflags MagickWand` + else + IM_IMAGEMAGICK_LIBS=`$IM_WAND_BINARY --libs` + IM_IMAGEMAGICK_CFLAGS=`$IM_WAND_BINARY --cflags` + fi + export IM_IMAGEMAGICK_PREFIX + export IM_WAND_BINARY + export IM_IMAGEMAGICK_VERSION + export IM_IMAGEMAGICK_VERSION_MASK + export IM_INCLUDE_FORMAT + export IM_HEADER_STYLE + export IM_USE_PKG_CONFIG + + export IM_IMAGEMAGICK_LIBS + export IM_IMAGEMAGICK_CFLAGS +]) + diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/imagick.c php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/imagick.c --- php-imagick-3.4.4/imagick-3.4.4+php8.0/imagick.c 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/imagick.c 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,3905 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 / Imagick | + +----------------------------------------------------------------------+ + | Copyright (c) 2006-2013 Mikko Koppanen, Scott MacVicar | + | ImageMagick (c) ImageMagick Studio LLC | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Mikko Kopppanen | + | Scott MacVicar | + +----------------------------------------------------------------------+ +*/ + +#include "php_imagick.h" +#include "php_imagick_defs.h" +#include "php_imagick_macros.h" +#include "php_imagick_helpers.h" +#include "php_imagick_shared.h" + +#ifdef ZEND_ENGINE_3 +#include "ext/standard/php_smart_string.h" +#else +#include "ext/standard/php_smart_str.h" +#endif + + + +/* For the countable interface */ +#if defined(HAVE_SPL) +#include "ext/spl/spl_iterators.h" +#endif + +ZEND_DECLARE_MODULE_GLOBALS(imagick) + +#ifdef IMAGICK_WITH_KERNEL +HashTable* php_imagickkernel_get_debug_info(zval *obj, int *is_temp TSRMLS_DC); /* {{{ */ +#endif + +zend_class_entry *php_imagick_sc_entry; +zend_class_entry *php_imagick_exception_class_entry; +zend_class_entry *php_imagickdraw_sc_entry; +zend_class_entry *php_imagickdraw_exception_class_entry; +zend_class_entry *php_imagickpixel_sc_entry; +zend_class_entry *php_imagickpixel_exception_class_entry; +zend_class_entry *php_imagickpixeliterator_sc_entry; +zend_class_entry *php_imagickpixeliterator_exception_class_entry; +#ifdef IMAGICK_WITH_KERNEL +zend_class_entry *php_imagickkernel_sc_entry; +zend_class_entry *php_imagickkernel_exception_class_entry; +#endif + +#if defined(ZTS) && defined(PHP_WIN32) +static MUTEX_T imagick_mutex; +static THREAD_T imagick_thread_id; +#endif + +/* Handlers */ +static zend_object_handlers imagick_object_handlers; +static zend_object_handlers imagickdraw_object_handlers; +static zend_object_handlers imagickpixel_object_handlers; +static zend_object_handlers imagickpixeliterator_object_handlers; +#ifdef IMAGICK_WITH_KERNEL +static zend_object_handlers imagickkernel_object_handlers; +#endif + +/* External API */ +PHP_IMAGICK_API zend_class_entry *php_imagick_get_class_entry() +{ + return php_imagick_sc_entry; +} + + + +PHP_IMAGICK_API zend_class_entry *php_imagickdraw_get_class_entry() +{ + return php_imagickdraw_sc_entry; +} + +PHP_IMAGICK_API zend_class_entry *php_imagickpixel_get_class_entry() +{ + return php_imagickdraw_sc_entry; +} + +/* Imagick */ +#if MagickLibVersion > 0x628 + ZEND_BEGIN_ARG_INFO_EX(imagick_shadeimage_args, 0, 0, 3) + ZEND_ARG_INFO(0, gray) + ZEND_ARG_INFO(0, azimuth) + ZEND_ARG_INFO(0, elevation) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimagematte_args, 0, 0, 1) + ZEND_ARG_INFO(0, enable) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_sketchimage_args, 0, 0, 3) + ZEND_ARG_INFO(0, radius) + ZEND_ARG_INFO(0, sigma) + ZEND_ARG_INFO(0, angle) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_pingimageblob_args, 0, 0, 1) + ZEND_ARG_INFO(0, imageContents) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_pingimagefile_args, 0, 0, 1) + ZEND_ARG_INFO(0, fp) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_trimimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, fuzz) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_waveimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, amplitude) + ZEND_ARG_INFO(0, waveLenght) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_vignetteimage_args, 0, 0, 4) + ZEND_ARG_INFO(0, blackPoint) + ZEND_ARG_INFO(0, whitePoint) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_adaptiveresizeimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, columns) + ZEND_ARG_INFO(0, rows) + ZEND_ARG_INFO(0, bestfit) + ZEND_ARG_INFO(0, legacy) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_contraststretchimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, blackPoint) + ZEND_ARG_INFO(0, whitePoint) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_adaptiveblurimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, radius) + ZEND_ARG_INFO(0, sigma) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_adaptivesharpenimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, radius) + ZEND_ARG_INFO(0, sigma) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setsizeoffset_args, 0, 0, 3) + ZEND_ARG_INFO(0, columns) + ZEND_ARG_INFO(0, rows) + ZEND_ARG_INFO(0, offset) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_randomthresholdimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, low) + ZEND_ARG_INFO(0, high) + ZEND_ARG_INFO(0, CHANNELTYPE) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_compareimagelayers_args, 0, 0, 1) + ZEND_ARG_INFO(0, LAYER) + ZEND_END_ARG_INFO() + +#if MagickLibVersion < 0x700 + ZEND_BEGIN_ARG_INFO_EX(imagick_roundcornersimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, xRounding) + ZEND_ARG_INFO(0, yRounding) + ZEND_ARG_INFO(0, strokeWidth) + ZEND_ARG_INFO(0, displace) + ZEND_ARG_INFO(0, sizeCorrection) + ZEND_END_ARG_INFO() +#endif + + ZEND_BEGIN_ARG_INFO_EX(imagick_setiteratorindex_args, 0, 0, 1) + ZEND_ARG_INFO(0, index) + ZEND_END_ARG_INFO() + +#if MagickLibVersion < 0x700 + ZEND_BEGIN_ARG_INFO_EX(imagick_transformimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, crop) + ZEND_ARG_INFO(0, geometry) + ZEND_END_ARG_INFO() +#endif +#endif + +#if MagickLibVersion > 0x631 + ZEND_BEGIN_ARG_INFO_EX(imagick_polaroidimage_args, 0, 0, 2) + ZEND_ARG_OBJ_INFO(0, ImagickDraw, ImagickDraw, 0) + ZEND_ARG_INFO(0, angle) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_getimageproperty_args, 0, 0, 1) + ZEND_ARG_INFO(0, name) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimageproperty_args, 0, 0, 2) + ZEND_ARG_INFO(0, name) + ZEND_ARG_INFO(0, value) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_deleteimageproperty_args, 0, 0, 1) + ZEND_ARG_INFO(0, name) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_identifyformat_args, 0, 0, 1) + ZEND_ARG_INFO(0, embedText) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimageinterpolatemethod_args, 0, 0, 1) + ZEND_ARG_INFO(0, INTERPOLATE) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_linearstretchimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, blackPoint) + ZEND_ARG_INFO(0, whitePoint) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_extentimage_args, 0, 0, 4) + ZEND_ARG_INFO(0, width) + ZEND_ARG_INFO(0, height) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() +#endif + +#if MagickLibVersion > 0x633 + ZEND_BEGIN_ARG_INFO_EX(imagick_setimageorientation_args, 0, 0, 1) + ZEND_ARG_INFO(0, ORIENTATION) + ZEND_END_ARG_INFO() +#endif + +#if MagickLibVersion > 0x634 && MagickLibVersion < 0x700 + ZEND_BEGIN_ARG_INFO_EX(imagick_paintfloodfillimage_args, 0, 0, 6) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_ARG_INFO(0, fill) + ZEND_ARG_INFO(0, fuzz) + ZEND_ARG_INFO(0, bordercolor) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() +#endif + +#if MagickLibVersion > 0x630 +#if MagickLibVersion < 0x700 + ZEND_BEGIN_ARG_INFO_EX(imagick_setimageopacity_args, 0, 0, 1) + ZEND_ARG_INFO(0, opacity) + ZEND_END_ARG_INFO() +#endif + +#if MagickLibVersion < 0x700 + ZEND_BEGIN_ARG_INFO_EX(imagick_orderedposterizeimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, threshold_map) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() +#endif +#endif + +#if MagickLibVersion > 0x700 + ZEND_BEGIN_ARG_INFO_EX(imagick_setimagealpha_args, 0, 0, 1) + ZEND_ARG_INFO(0, alpha) + ZEND_END_ARG_INFO() +#endif + + +#if MagickLibVersion > 0x635 + ZEND_BEGIN_ARG_INFO_EX(imagick_clutimage_args, 0, 0, 1) + ZEND_ARG_OBJ_INFO(0, Imagick, Imagick, 0) + ZEND_ARG_INFO(0, CHANNELTYPE) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_getimageproperties_args, 0, 0, 0) + ZEND_ARG_INFO(0, pattern) + ZEND_ARG_INFO(0, values) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_getimageprofiles_args, 0, 0, 0) + ZEND_ARG_INFO(0, pattern) + ZEND_ARG_INFO(0, values) + ZEND_END_ARG_INFO() +#endif + +#if MagickLibVersion > 0x635 + ZEND_BEGIN_ARG_INFO_EX(imagick_distortimage_args, 0, 0, 3) + ZEND_ARG_INFO(0, method) + ZEND_ARG_INFO(0, arguments) + ZEND_ARG_INFO(0, bestfit) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_writeimagefile_args, 0, 0, 1) + ZEND_ARG_INFO(0, handle) + ZEND_ARG_INFO(0, format) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_writeimagesfile_args, 0, 0, 1) + ZEND_ARG_INFO(0, handle) + ZEND_ARG_INFO(0, format) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_resetimagepage_args, 0, 0, 1) + ZEND_ARG_INFO(0, page) + ZEND_END_ARG_INFO() + +#if MagickLibVersion < 0x700 + ZEND_BEGIN_ARG_INFO_EX(imagick_setimageclipmask_args, 0, 0, 1) + ZEND_ARG_OBJ_INFO(0, Imagick, Imagick, 0) + ZEND_END_ARG_INFO() +#endif + + ZEND_BEGIN_ARG_INFO_EX(imagick_animateimages_args, 0, 0, 1) + ZEND_ARG_INFO(0, server_name) + ZEND_END_ARG_INFO() +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 + ZEND_BEGIN_ARG_INFO_EX(imagick_recolorimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, matrix) + ZEND_END_ARG_INFO() +#endif +#endif +#endif + +#if MagickLibVersion > 0x636 + ZEND_BEGIN_ARG_INFO_EX(imagick_setfont_args, 0, 0, 1) + ZEND_ARG_INFO(0, font) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setpointsize_args, 0, 0, 1) + ZEND_ARG_INFO(0, pointsize) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_mergeimagelayers_args, 0, 0, 1) + ZEND_ARG_INFO(0, LAYERMETHOD) + ZEND_END_ARG_INFO() +#endif + +#if MagickLibVersion > 0x637 + ZEND_BEGIN_ARG_INFO_EX(imagick_setimagealphachannel_args, 0, 0, 1) + ZEND_ARG_INFO(0, ALPHACHANNELTYPE) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_floodfillpaintimage_args, 0, 0, 6) + ZEND_ARG_INFO(0, fill) + ZEND_ARG_INFO(0, fuzz) + ZEND_ARG_INFO(0, bordercolor) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_ARG_INFO(0, invert) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_opaquepaintimage_args, 0, 0, 4) + ZEND_ARG_INFO(0, target) + ZEND_ARG_INFO(0, fill) + ZEND_ARG_INFO(0, fuzz) + ZEND_ARG_INFO(0, invert) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_transparentpaintimage_args, 0, 0, 4) + ZEND_ARG_INFO(0, target) + ZEND_ARG_INFO(0, alpha) + ZEND_ARG_INFO(0, fuzz) + ZEND_ARG_INFO(0, invert) + ZEND_END_ARG_INFO() +#endif + +#if MagickLibVersion > 0x638 + ZEND_BEGIN_ARG_INFO_EX(imagick_liquidrescaleimage_args, 0, 0, 4) + ZEND_ARG_INFO(0, columns) + ZEND_ARG_INFO(0, rows) + ZEND_ARG_INFO(0, delta_x) + ZEND_ARG_INFO(0, rigidity) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_encipherimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, passphrase) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_decipherimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, passphrase) + ZEND_END_ARG_INFO() +#endif + +#if MagickLibVersion > 0x639 + ZEND_BEGIN_ARG_INFO_EX(imagick_setgravity_args, 0, 0, 1) + ZEND_ARG_INFO(0, GRAVITY) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_getimagechannelrange_args, 0, 0, 1) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() +#endif + +#if MagickLibVersion > 0x642 + ZEND_BEGIN_ARG_INFO_EX(imagick_getimagechanneldistortions_args, 0, 0, 1) + ZEND_ARG_OBJ_INFO(0, Imagick, Imagick, 0) + ZEND_ARG_INFO(0, METRICTYPE) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() +#endif + +#if MagickLibVersion > 0x643 + ZEND_BEGIN_ARG_INFO_EX(imagick_setimagegravity_args, 0, 0, 1) + ZEND_ARG_INFO(0, GRAVITY) + ZEND_END_ARG_INFO() +#endif + +#if MagickLibVersion >= 0x645 + ZEND_BEGIN_ARG_INFO_EX(imagick_importimagepixels_args, 0, 0, 7) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_ARG_INFO(0, width) + ZEND_ARG_INFO(0, height) + ZEND_ARG_INFO(0, map) + ZEND_ARG_INFO(0, storage) + ZEND_ARG_INFO(0, PIXEL) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_deskewimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, threshold) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_segmentimage_args, 0, 0, 3) + ZEND_ARG_INFO(0, COLORSPACE) + ZEND_ARG_INFO(0, cluster_threshold) + ZEND_ARG_INFO(0, smooth_threshold) + ZEND_ARG_INFO(0, verbose) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_sparsecolorimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, SPARSE_METHOD) + ZEND_ARG_INFO(0, arguments) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_remapimage_args, 0, 0, 2) + ZEND_ARG_OBJ_INFO(0, Imagick, Imagick, 0) + ZEND_ARG_INFO(0, DITHER) + ZEND_END_ARG_INFO() +#endif + +#if MagickLibVersion > 0x646 + ZEND_BEGIN_ARG_INFO_EX(imagick_exportimagepixels_args, 0, 0, 6) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_ARG_INFO(0, width) + ZEND_ARG_INFO(0, height) + ZEND_ARG_INFO(0, map) + ZEND_ARG_INFO(0, STORAGE) + ZEND_END_ARG_INFO() +#endif + +#if MagickLibVersion > 0x648 + ZEND_BEGIN_ARG_INFO_EX(imagick_getimagechannelkurtosis_args, 0, 0, 0) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_functionimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, FUNCTION) + ZEND_ARG_INFO(0, arguments) + ZEND_END_ARG_INFO() +#endif + +#if MagickLibVersion > 0x652 + ZEND_BEGIN_ARG_INFO_EX(imagick_haldclutimage_args, 0, 0, 1) + ZEND_ARG_OBJ_INFO(0, Imagick, Imagick, 0) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_transformimagecolorspace_args, 0, 0, 1) + ZEND_ARG_INFO(0, COLORSPACE) + ZEND_END_ARG_INFO() +#endif + +#if MagickLibVersion > 0x655 + ZEND_BEGIN_ARG_INFO_EX(imagick_autolevelimage_args, 0, 0, 0) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_blueshiftimage_args, 0, 0, 0) + ZEND_ARG_INFO(0, factor) + ZEND_END_ARG_INFO() +#endif + +#if MagickLibVersion > 0x656 + ZEND_BEGIN_ARG_INFO_EX(imagick_setimageartifact_args, 0, 0, 2) + ZEND_ARG_INFO(0, artifact) + ZEND_ARG_INFO(0, value) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_getimageartifact_args, 0, 0, 1) + ZEND_ARG_INFO(0, artifact) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_deleteimageartifact_args, 0, 0, 1) + ZEND_ARG_INFO(0, artifact) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setcolorspace_args, 0, 0, 1) + ZEND_ARG_INFO(0, COLORSPACE) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_clampimage_args, 0, 0, 0) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() +#endif +#if MagickLibVersion > 0x667 + ZEND_BEGIN_ARG_INFO_EX(imagick_smushimages_args, 0, 0, 2) + ZEND_ARG_INFO(0, stack) + ZEND_ARG_INFO(0, offset) + ZEND_END_ARG_INFO() +#endif + + ZEND_BEGIN_ARG_INFO_EX(imagick_zero_args, 0, 0, 0) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_construct_args, 0, 0, 0) + ZEND_ARG_INFO(0, files) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_getpixelregioniterator_args, 0, 0, 5) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_ARG_INFO(0, columns) + ZEND_ARG_INFO(0, rows) + ZEND_ARG_INFO(0, modify) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_readimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, filename) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_readimages_args, 0, 0, 1) + ZEND_ARG_INFO(0, filenames) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_readimageblob_args, 0, 0, 1) + ZEND_ARG_INFO(0, imageContents) + ZEND_ARG_INFO(0, filename) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimageformat_args, 0, 0, 1) + ZEND_ARG_INFO(0, imageFormat) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_scaleimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, width) + ZEND_ARG_INFO(0, height) + ZEND_ARG_INFO(0, bestfit) + ZEND_ARG_INFO(0, legacy) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_writeimage_args, 0, 0, 0) + ZEND_ARG_INFO(0, filename) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_writeimages_args, 0, 0, 2) + ZEND_ARG_INFO(0, filename) + ZEND_ARG_INFO(0, adjoin) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_blurimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, radius) + ZEND_ARG_INFO(0, sigma) + ZEND_ARG_INFO(0, CHANNELTYPE) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_thumbnailimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, width) + ZEND_ARG_INFO(0, height) + ZEND_ARG_INFO(0, bestfit) + ZEND_ARG_INFO(0, fill) + ZEND_ARG_INFO(0, legacy) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_cropthumbnailimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, width) + ZEND_ARG_INFO(0, height) + ZEND_ARG_INFO(0, legacy) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimagefilename_args, 0, 0, 1) + ZEND_ARG_INFO(0, filename) + ZEND_END_ARG_INFO() + +#if MagickLibVersion < 0x700 + ZEND_BEGIN_ARG_INFO_EX(imagick_setimageindex_args, 0, 0, 1) + ZEND_ARG_INFO(0, index) + ZEND_END_ARG_INFO() +#endif + + ZEND_BEGIN_ARG_INFO_EX(imagick_commentimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, comment) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_cropimage_args, 0, 0, 4) + ZEND_ARG_INFO(0, width) + ZEND_ARG_INFO(0, height) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_labelimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, label) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_drawimage_args, 0, 0, 1) + ZEND_ARG_OBJ_INFO(0, ImagickDraw, ImagickDraw, 0) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimagecompressionquality_args, 0, 0, 1) + ZEND_ARG_INFO(0, quality) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_annotateimage_args, 0, 0, 5) + ZEND_ARG_OBJ_INFO(0, ImagickDraw, ImagickDraw, 0) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_ARG_INFO(0, angle) + ZEND_ARG_INFO(0, text) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_compositeimage_args, 0, 0, 4) + ZEND_ARG_OBJ_INFO(0, Imagick, Imagick, 0) + ZEND_ARG_INFO(0, COMPOSITE) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_ARG_INFO(0, CHANNELTYPE) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_modulateimage_args, 0, 0, 3) + ZEND_ARG_INFO(0, brightness) + ZEND_ARG_INFO(0, saturation) + ZEND_ARG_INFO(0, hue) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_montageimage_args, 0, 0, 5) + ZEND_ARG_OBJ_INFO(0, ImagickDraw, ImagickDraw, 0) + ZEND_ARG_INFO(0, tileGeometry) + ZEND_ARG_INFO(0, thumbnailGeometry) + ZEND_ARG_INFO(0, MONTAGEMODE) + ZEND_ARG_INFO(0, frame) + ZEND_END_ARG_INFO() + +#ifdef IMAGICK_WITH_KERNEL + ZEND_BEGIN_ARG_INFO_EX(imagick_morphology_args, 0, 0, 3) + ZEND_ARG_INFO(0, morphologyMethod) + ZEND_ARG_INFO(0, iterations) + ZEND_ARG_OBJ_INFO(0, ImagickKernel, ImagickKernel, 0) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() + +#if MagickLibVersion < 0x700 + ZEND_BEGIN_ARG_INFO_EX(imagick_filter_args, 0, 0, 1) + ZEND_ARG_OBJ_INFO(0, ImagickKernel, ImagickKernel, 0) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() +#endif +#endif + + ZEND_BEGIN_ARG_INFO_EX(imagick_identifyimage_args, 0, 0, 0) + ZEND_ARG_INFO(0, appendRawOutput) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_thresholdimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, threshold) + ZEND_ARG_INFO(0, CHANNELTYPE) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_adaptivethresholdimage_args, 0, 0, 3) + ZEND_ARG_INFO(0, width) + ZEND_ARG_INFO(0, height) + ZEND_ARG_INFO(0, offset) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_blackthresholdimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, color) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_whitethresholdimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, color) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_appendimages_args, 0, 0, 1) + ZEND_ARG_INFO(0, stack) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_charcoalimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, radius) + ZEND_ARG_INFO(0, sigma) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_normalizeimage_args, 0, 0, 0) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_oilpaintimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, radius) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_posterizeimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, levels) + ZEND_ARG_INFO(0, dither) + ZEND_END_ARG_INFO() + +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 + ZEND_BEGIN_ARG_INFO_EX(imagick_radialblurimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, angle) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() +#endif +#endif + + ZEND_BEGIN_ARG_INFO_EX(imagick_raiseimage_args, 0, 0, 5) + ZEND_ARG_INFO(0, width) + ZEND_ARG_INFO(0, height) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_ARG_INFO(0, raise) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_resampleimage_args, 0, 0, 4) + ZEND_ARG_INFO(0, xResolution) + ZEND_ARG_INFO(0, yResolution) + ZEND_ARG_INFO(0, FILTER) + ZEND_ARG_INFO(0, blur) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_resizeimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_ARG_INFO(0, filter) + ZEND_ARG_INFO(0, blur) + ZEND_ARG_INFO(0, bestfit) + ZEND_ARG_INFO(0, legacy) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_rollimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_rotateimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, color) + ZEND_ARG_INFO(0, degrees) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_sampleimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, columns) + ZEND_ARG_INFO(0, rows) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_solarizeimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, threshold) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_shadowimage_args, 0, 0, 4) + ZEND_ARG_INFO(0, opacity) + ZEND_ARG_INFO(0, sigma) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 + ZEND_BEGIN_ARG_INFO_EX(imagick_setimageattribute_args, 0, 0, 2) + ZEND_ARG_INFO(0, key) + ZEND_ARG_INFO(0, value) + ZEND_END_ARG_INFO() +#endif + +#if MagickLibVersion < 0x700 + ZEND_BEGIN_ARG_INFO_EX(imagick_getimageattribute_args, 0, 0, 1) + ZEND_ARG_INFO(0, key) + ZEND_END_ARG_INFO() +#endif +#endif + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimagebackgroundcolor_args, 0, 0, 1) + ZEND_ARG_INFO(0, color) + ZEND_END_ARG_INFO() + +#if MagickLibVersion >= 0x700 + ZEND_BEGIN_ARG_INFO_EX(imagick_setimagechannelmask_args, 0, 0, 1) + ZEND_ARG_INFO(0, channel) + ZEND_END_ARG_INFO() +#endif + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimagecompose_args, 0, 0, 1) + ZEND_ARG_INFO(0, COMPOSITE) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimagecompression_args, 0, 0, 1) + ZEND_ARG_INFO(0, COMPRESSION) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimagedelay_args, 0, 0, 1) + ZEND_ARG_INFO(0, delay) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimagedepth_args, 0, 0, 1) + ZEND_ARG_INFO(0, depth) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimagegamma_args, 0, 0, 1) + ZEND_ARG_INFO(0, gamma) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimageiterations_args, 0, 0, 1) + ZEND_ARG_INFO(0, iterations) + ZEND_END_ARG_INFO() + +#if MagickLibVersion < 0x700 + ZEND_BEGIN_ARG_INFO_EX(imagick_setimagemattecolor_args, 0, 0, 1) + ZEND_ARG_INFO(0, color) + ZEND_END_ARG_INFO() +#endif + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimagepage_args, 0, 0, 4) + ZEND_ARG_INFO(0, width) + ZEND_ARG_INFO(0, height) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimageprogressmonitor_args, 0, 0, 1) + ZEND_ARG_INFO(0, filename) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setprogressmonitor_args, 0, 0, 1) + ZEND_ARG_INFO(0, callback) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimageresolution_args, 0, 0, 2) + ZEND_ARG_INFO(0, xResolution) + ZEND_ARG_INFO(0, yResolution) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimagescene_args, 0, 0, 1) + ZEND_ARG_INFO(0, scene) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimagetickspersecond_args, 0, 0, 1) + ZEND_ARG_INFO(0, ticksPerSecond) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimagetype_args, 0, 0, 1) + ZEND_ARG_INFO(0, IMGTYPE) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimageunits_args, 0, 0, 1) + ZEND_ARG_INFO(0, RESOLUTION) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_sharpenimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, radius) + ZEND_ARG_INFO(0, sigma) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_shaveimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, columns) + ZEND_ARG_INFO(0, rows) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_shearimage_args, 0, 0, 3) + ZEND_ARG_INFO(0, color) + ZEND_ARG_INFO(0, xShear) + ZEND_ARG_INFO(0, yShear) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_spliceimage_args, 0, 0, 4) + ZEND_ARG_INFO(0, width) + ZEND_ARG_INFO(0, height) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_pingimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, filename) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_readimagefile_args, 0, 0, 1) + ZEND_ARG_INFO(0, fp) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_displayimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, serverName) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_displayimages_args, 0, 0, 1) + ZEND_ARG_INFO(0, serverName) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_spreadimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, radius) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_swirlimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, degrees) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_queryformats_args, 0, 0, 1) + ZEND_ARG_INFO(0, pattern) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_queryfonts_args, 0, 0, 1) + ZEND_ARG_INFO(0, pattern) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_queryfontmetrics_args, 0, 0, 2) + ZEND_ARG_OBJ_INFO(0, ImagickDraw, ImagickDraw, 0) + ZEND_ARG_INFO(0, text) + ZEND_ARG_INFO(0, multiline) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_steganoimage_args, 0, 0, 2) + ZEND_ARG_OBJ_INFO(0, Imagick, Imagick, 0) + ZEND_ARG_INFO(0, offset) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_addnoiseimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, NOISE) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_motionblurimage_args, 0, 0, 3) + ZEND_ARG_INFO(0, radius) + ZEND_ARG_INFO(0, sigma) + ZEND_ARG_INFO(0, angle) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_morphimages_args, 0, 0, 1) + ZEND_ARG_INFO(0, frames) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_affinetransformimage_args, 0, 0, 1) + ZEND_ARG_OBJ_INFO(0, ImagickDraw, ImagickDraw, 0) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_calculatecrop_args, 0, 0, 4) + ZEND_ARG_INFO(0, orig_width) + ZEND_ARG_INFO(0, orig_height) + ZEND_ARG_INFO(0, desired_width) + ZEND_ARG_INFO(0, desired_height) + ZEND_ARG_INFO(0, legacy) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_borderimage_args, 0, 0, 3) + ZEND_ARG_INFO(0, color) + ZEND_ARG_INFO(0, width) + ZEND_ARG_INFO(0, height) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_chopimage_args, 0, 0, 4) + ZEND_ARG_INFO(0, width) + ZEND_ARG_INFO(0, height) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_clippathimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, pathname) + ZEND_ARG_INFO(0, inside) + ZEND_END_ARG_INFO() + +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 + ZEND_BEGIN_ARG_INFO_EX(imagick_colorfloodfillimage_args, 0, 0, 5) + ZEND_ARG_INFO(0, fill_color) + ZEND_ARG_INFO(0, fuzz) + ZEND_ARG_INFO(0, border_color) + ZEND_ARG_INFO(0, y) + ZEND_ARG_INFO(0, x) + ZEND_END_ARG_INFO() +#endif +#endif + + ZEND_BEGIN_ARG_INFO_EX(imagick_colorizeimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, colorize_color) + ZEND_ARG_INFO(0, opacity) + ZEND_ARG_INFO(0, legacy) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_compareimagechannels_args, 0, 0, 3) + ZEND_ARG_OBJ_INFO(0, Imagick, Imagick, 0) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_ARG_INFO(0, METRIC) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_compareimages_args, 0, 0, 2) + ZEND_ARG_OBJ_INFO(0, Imagick, Imagick, 0) + ZEND_ARG_INFO(0, METRIC) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_contrastimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, sharpen) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_convolveimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, kernel) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_cyclecolormapimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, displace) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_edgeimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, radius) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_embossimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, radius) + ZEND_ARG_INFO(0, sigma) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_evaluateimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, EVALUATE) + ZEND_ARG_INFO(0, constant) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() + +#if MagickLibVersion >= 0x687 + ZEND_BEGIN_ARG_INFO_EX(imagick_evaluateimages_args, 0, 0, 1) + ZEND_ARG_INFO(0, EVALUATE) + ZEND_END_ARG_INFO() +#endif //MagickLibVersion >= 0x687 + +#if MagickLibVersion >= 0x655 + ZEND_BEGIN_ARG_INFO_EX(imagick_forwardfouriertransformimage_args, 0, 0, 5) + ZEND_ARG_INFO(0, magnitude) + ZEND_END_ARG_INFO() +#endif + + ZEND_BEGIN_ARG_INFO_EX(imagick_frameimage_args, 0, 0, 5) + ZEND_ARG_INFO(0, color) + ZEND_ARG_INFO(0, width) + ZEND_ARG_INFO(0, height) + ZEND_ARG_INFO(0, innerBevel) + ZEND_ARG_INFO(0, outerBevel) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_fximage_args, 0, 0, 1) + ZEND_ARG_INFO(0, expression) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_gammaimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, gamma) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_gaussianblurimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, radius) + ZEND_ARG_INFO(0, sigma) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_getimagechanneldepth_args, 0, 0, 1) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_getimagechanneldistortion_args, 0, 0, 3) + ZEND_ARG_OBJ_INFO(0, Imagick, Imagick, 0) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_ARG_INFO(0, METRIC) + ZEND_END_ARG_INFO() + +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 + ZEND_BEGIN_ARG_INFO_EX(imagick_getimagechannelextrema_args, 0, 0, 1) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() +#endif +#endif + + ZEND_BEGIN_ARG_INFO_EX(imagick_getimagechannelmean_args, 0, 0, 1) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_getimagecolormapcolor_args, 0, 0, 1) + ZEND_ARG_INFO(0, index) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_getimagedistortion_args, 0, 0, 2) + ZEND_ARG_OBJ_INFO(0, Imagick, Imagick, 0) + ZEND_ARG_INFO(0, METRIC) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_getimagepixelcolor_args, 0, 0, 2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_getimageprofile_args, 0, 0, 1) + ZEND_ARG_INFO(0, name) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_getimagetotalinkdensity_args, 0, 0, 1) + ZEND_ARG_INFO(0, radius) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_getimageregion_args, 0, 0, 4) + ZEND_ARG_INFO(0, width) + ZEND_ARG_INFO(0, height) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + +#if MagickLibVersion >= 0x658 + ZEND_BEGIN_ARG_INFO_EX(imagick_inversefouriertransformimage_args, 0, 0, 3) + ZEND_ARG_INFO(0, complement) + ZEND_ARG_INFO(0, magnitude) + ZEND_END_ARG_INFO() +#endif + + ZEND_BEGIN_ARG_INFO_EX(imagick_levelimage_args, 0, 0, 3) + ZEND_ARG_INFO(0, blackPoint) + ZEND_ARG_INFO(0, gamma) + ZEND_ARG_INFO(0, whitePoint) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() + +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 + ZEND_BEGIN_ARG_INFO_EX(imagick_mapimage_args, 0, 0, 2) + ZEND_ARG_OBJ_INFO(0, Imagick, Imagick, 0) + ZEND_ARG_INFO(0, dither) + ZEND_END_ARG_INFO() +#endif + +#if MagickLibVersion < 0x700 + ZEND_BEGIN_ARG_INFO_EX(imagick_mattefloodfillimage_args, 0, 0, 5) + ZEND_ARG_INFO(0, alpha) + ZEND_ARG_INFO(0, fuzz) + ZEND_ARG_INFO(0, color) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() +#endif +#endif + +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 + ZEND_BEGIN_ARG_INFO_EX(imagick_medianfilterimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, radius) + ZEND_END_ARG_INFO() +#endif +#endif + + ZEND_BEGIN_ARG_INFO_EX(imagick_negateimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, gray) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() + +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 + ZEND_BEGIN_ARG_INFO_EX(imagick_paintopaqueimage_args, 0, 0, 3) + ZEND_ARG_INFO(0, target_color) + ZEND_ARG_INFO(0, fill_color) + ZEND_ARG_INFO(0, fuzz) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() +#endif + +#if MagickLibVersion < 0x700 + ZEND_BEGIN_ARG_INFO_EX(imagick_painttransparentimage_args, 0, 0, 3) + ZEND_ARG_INFO(0, target_color) + ZEND_ARG_INFO(0, alpha) + ZEND_ARG_INFO(0, fuzz) + ZEND_END_ARG_INFO() +#endif +#endif + + ZEND_BEGIN_ARG_INFO_EX(imagick_previewimages_args, 0, 0, 1) + ZEND_ARG_INFO(0, PREVIEW) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_profileimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, name) + ZEND_ARG_INFO(0, profile) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_quantizeimage_args, 0, 0, 5) + ZEND_ARG_INFO(0, numColors) + ZEND_ARG_INFO(0, COLORSPACE) + ZEND_ARG_INFO(0, treeDepth) + ZEND_ARG_INFO(0, dither) + ZEND_ARG_INFO(0, measureError) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_quantizeimages_args, 0, 0, 5) + ZEND_ARG_INFO(0, numColors) + ZEND_ARG_INFO(0, COLORSPACE) + ZEND_ARG_INFO(0, treeDepth) + ZEND_ARG_INFO(0, dither) + ZEND_ARG_INFO(0, measureError) + ZEND_END_ARG_INFO() + +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 + ZEND_BEGIN_ARG_INFO_EX(imagick_reducenoiseimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, radius) + ZEND_END_ARG_INFO() +#endif +#endif + + ZEND_BEGIN_ARG_INFO_EX(imagick_removeimageprofile_args, 0, 0, 1) + ZEND_ARG_INFO(0, name) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_separateimagechannel_args, 0, 0, 1) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_sepiatoneimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, threshold) + ZEND_END_ARG_INFO() + +#if MagickLibVersion < 0x700 + ZEND_BEGIN_ARG_INFO_EX(imagick_setimagebias_args, 0, 0, 1) + ZEND_ARG_INFO(0, bias) + ZEND_END_ARG_INFO() +#endif + +#if MagickLibVersion < 0x700 + ZEND_BEGIN_ARG_INFO_EX(imagick_setimagebiasquantum_args, 0, 0, 1) + ZEND_ARG_INFO(0, bias) + ZEND_END_ARG_INFO() +#endif + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimageblueprimary_args, 0, 0, 2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimagebordercolor_args, 0, 0, 1) + ZEND_ARG_INFO(0, color) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimagechanneldepth_args, 0, 0, 2) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_ARG_INFO(0, depth) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimagecolormapcolor_args, 0, 0, 2) + ZEND_ARG_INFO(0, index) + ZEND_ARG_INFO(0, color) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimagecolorspace_args, 0, 0, 1) + ZEND_ARG_INFO(0, COLORSPACE) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimagedispose_args, 0, 0, 1) + ZEND_ARG_INFO(0, DISPOSETYPE) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimageextent_args, 0, 0, 2) + ZEND_ARG_INFO(0, columns) + ZEND_ARG_INFO(0, rows) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimagegreenprimary_args, 0, 0, 2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimageinterlacescheme_args, 0, 0, 1) + ZEND_ARG_INFO(0, INTERLACE) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimageprofile_args, 0, 0, 2) + ZEND_ARG_INFO(0, name) + ZEND_ARG_INFO(0, profile) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimageredprimary_args, 0, 0, 2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimagerenderingintent_args, 0, 0, 1) + ZEND_ARG_INFO(0, RENDERINGINTENT) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimagevirtualpixelmethod_args, 0, 0, 1) + ZEND_ARG_INFO(0, VIRTUALPIXELMETHOD) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimagewhitepoint_args, 0, 0, 2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_sigmoidalcontrastimage_args, 0, 0, 3) + ZEND_ARG_INFO(0, sharpen) + ZEND_ARG_INFO(0, contrast) + ZEND_ARG_INFO(0, midpoint) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_stereoimage_args, 0, 0, 1) + ZEND_ARG_OBJ_INFO(0, Imagick, Imagick, 0) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_textureimage_args, 0, 0, 1) + ZEND_ARG_OBJ_INFO(0, Imagick, Imagick, 0) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_tintimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, tint_color) + ZEND_ARG_INFO(0, opacity) + ZEND_ARG_INFO(0, legacy) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_unsharpmaskimage_args, 0, 0, 4) + ZEND_ARG_INFO(0, radius) + ZEND_ARG_INFO(0, sigma) + ZEND_ARG_INFO(0, amount) + ZEND_ARG_INFO(0, threshold) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_addimage_args, 0, 0, 1) + ZEND_ARG_OBJ_INFO(0, Imagick, Imagick, 0) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setimage_args, 0, 0, 1) + ZEND_ARG_OBJ_INFO(0, Imagick, Imagick, 0) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_newimage_args, 0, 0, 3) + ZEND_ARG_INFO(0, columns) + ZEND_ARG_INFO(0, rows) + ZEND_ARG_INFO(0, background_color) + ZEND_ARG_INFO(0, format) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_newpseudoimage_args, 0, 0, 3) + ZEND_ARG_INFO(0, columns) + ZEND_ARG_INFO(0, rows) + ZEND_ARG_INFO(0, pseudoString) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_getoption_args, 0, 0, 1) + ZEND_ARG_INFO(0, key) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_getconfigureoptions_args, 0, 0, 0) + ZEND_ARG_INFO(0, pattern) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_getresource_args, 0, 0, 1) + ZEND_ARG_INFO(0, resource_type) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_getresourcelimit_args, 0, 0, 1) + ZEND_ARG_INFO(0, resource_type) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setbackgroundcolor_args, 0, 0, 1) + ZEND_ARG_INFO(0, color) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setcompression_args, 0, 0, 1) + ZEND_ARG_INFO(0, compression) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setcompressionquality_args, 0, 0, 1) + ZEND_ARG_INFO(0, compressionquality) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setfilename_args, 0, 0, 1) + ZEND_ARG_INFO(0, filename) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setformat_args, 0, 0, 1) + ZEND_ARG_INFO(0, format) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setinterlacescheme_args, 0, 0, 1) + ZEND_ARG_INFO(0, INTERLACE) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setoption_args, 0, 0, 2) + ZEND_ARG_INFO(0, key) + ZEND_ARG_INFO(0, value) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setpage_args, 0, 0, 4) + ZEND_ARG_INFO(0, width) + ZEND_ARG_INFO(0, height) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setresourcelimit_args, 0, 0, 2) + ZEND_ARG_INFO(0, RESOURCETYPE) + ZEND_ARG_INFO(0, limit) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setresolution_args, 0, 0, 2) + ZEND_ARG_INFO(0, xResolution) + ZEND_ARG_INFO(0, yResolution) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setsamplingfactors_args, 0, 0, 1) + ZEND_ARG_INFO(0, factors) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setsize_args, 0, 0, 2) + ZEND_ARG_INFO(0, columns) + ZEND_ARG_INFO(0, rows) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_settype_args, 0, 0, 1) + ZEND_ARG_INFO(0, IMGTYPE) + ZEND_END_ARG_INFO() + +#if MagickLibVersion >= 0x659 + ZEND_BEGIN_ARG_INFO_EX(imagick_brightnesscontrastimage_args, 0, 0, 2) + ZEND_ARG_INFO(0, brightness) + ZEND_ARG_INFO(0, contrast) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() +#endif + +#if MagickLibVersion > 0x661 + ZEND_BEGIN_ARG_INFO_EX(imagick_colormatriximage_args, 0, 0, 1) + ZEND_ARG_INFO(0, color_matrix) + ZEND_END_ARG_INFO() +#endif + + ZEND_BEGIN_ARG_INFO_EX(imagick_selectiveblurimage_args, 0, 0, 4) + ZEND_ARG_INFO(0, radius) + ZEND_ARG_INFO(0, sigma) + ZEND_ARG_INFO(0, threshold) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() + +#if MagickLibVersion >= 0x689 + ZEND_BEGIN_ARG_INFO_EX(imagick_rotationalblurimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, angle) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() +#endif + +#if MagickLibVersion >= 0x683 + ZEND_BEGIN_ARG_INFO_EX(imagick_statisticimage_args, 0, 0, 3) + ZEND_ARG_INFO(0, type) + ZEND_ARG_INFO(0, width) + ZEND_ARG_INFO(0, height) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() +#endif + +#if MagickLibVersion >= 0x652 + ZEND_BEGIN_ARG_INFO_EX(imagick_subimagematch_args, 0, 0, 1) + ZEND_ARG_OBJ_INFO(0, Imagick, Imagick, 0) + ZEND_ARG_INFO(1, offset) + ZEND_ARG_INFO(1, similarity) + ZEND_ARG_INFO(1, similarity_threshold) // the minimum similarity to match? + ZEND_ARG_INFO(1, metric) //Which comparison to use METRIC_* + ZEND_END_ARG_INFO() +#endif + +#if PHP_VERSION_ID >= 50600 + ZEND_BEGIN_ARG_INFO_EX(imagick_count_args, 0, 0, 0) + ZEND_ARG_INFO(0, mode) + ZEND_END_ARG_INFO() +#endif + + ZEND_BEGIN_ARG_INFO_EX(imagick_setregistry_args, 0, 0, 2) + ZEND_ARG_INFO(0, key) + ZEND_ARG_INFO(0, value) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_getregistry_args, 0, 0, 1) + ZEND_ARG_INFO(0, key) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_setantialias_args, 0, 0, 1) + ZEND_ARG_INFO(0, antialias) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_colordecisionlistimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, antialias) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_autogammaimage_args, 0, 0, 1) + ZEND_ARG_INFO(0, CHANNEL) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagick_compositeimagegravity_args, 0, 0, 3) + ZEND_ARG_OBJ_INFO(0, Imagick, Imagick, 0) + ZEND_ARG_INFO(0, COMPOSITE) + ZEND_ARG_INFO(0, GRAVITY) + ZEND_END_ARG_INFO() + +#if MagickLibVersion >= 0x693 + ZEND_BEGIN_ARG_INFO_EX(imagick_localContrastImage_args, 0, 0, 2) + ZEND_ARG_INFO(0, radius) + ZEND_ARG_INFO(0, strength) + ZEND_END_ARG_INFO() +#endif // MagickLibVersion >= 0x693 + +/* ImagickDraw */ +#if MagickLibVersion > 0x649 + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_settextkerning_args, 0, 0, 1) + ZEND_ARG_INFO(0, kerning) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_settextinterwordspacing_args, 0, 0, 1) + ZEND_ARG_INFO(0, spacing) + ZEND_END_ARG_INFO() +#endif +#if MagickLibVersion > 0x655 + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_settextinterlinespacing_args, 0, 0, 1) + ZEND_ARG_INFO(0, spacing) + ZEND_END_ARG_INFO() +#endif + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_zero_args, 0, 0, 0) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setfillcolor_args, 0, 0, 1) + ZEND_ARG_INFO(0, color) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setfillalpha_args, 0, 0, 1) + ZEND_ARG_INFO(0, alpha) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setstrokecolor_args, 0, 0, 1) + ZEND_ARG_INFO(0, color) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setresolution_args, 0, 0, 2) + ZEND_ARG_INFO(0, x_resolution) + ZEND_ARG_INFO(0, y_resolution) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setstrokealpha_args, 0, 0, 1) + ZEND_ARG_INFO(0, alpha) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setstrokewidth_args, 0, 0, 1) + ZEND_ARG_INFO(0, width) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_circle_args, 0, 0, 4) + ZEND_ARG_INFO(0, ox) + ZEND_ARG_INFO(0, oy) + ZEND_ARG_INFO(0, px) + ZEND_ARG_INFO(0, py) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_annotation_args, 0, 0, 3) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_ARG_INFO(0, text) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_settextantialias_args, 0, 0, 1) + ZEND_ARG_INFO(0, antialias) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_settextencoding_args, 0, 0, 1) + ZEND_ARG_INFO(0, encoding) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setfont_args, 0, 0, 1) + ZEND_ARG_INFO(0, font) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setfontfamily_args, 0, 0, 1) + ZEND_ARG_INFO(0, fontfamily) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setfontsize_args, 0, 0, 1) + ZEND_ARG_INFO(0, pointsize) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setfontstyle_args, 0, 0, 1) + ZEND_ARG_INFO(0, STYLE) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setfontweight_args, 0, 0, 1) + ZEND_ARG_INFO(0, weight) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_rectangle_args, 0, 0, 4) + ZEND_ARG_INFO(0, x1) + ZEND_ARG_INFO(0, y1) + ZEND_ARG_INFO(0, x2) + ZEND_ARG_INFO(0, y2) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_roundrectangle_args, 0, 0, 6) + ZEND_ARG_INFO(0, x1) + ZEND_ARG_INFO(0, y1) + ZEND_ARG_INFO(0, x2) + ZEND_ARG_INFO(0, y2) + ZEND_ARG_INFO(0, rx) + ZEND_ARG_INFO(0, ry) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_ellipse_args, 0, 0, 6) + ZEND_ARG_INFO(0, ox) + ZEND_ARG_INFO(0, oy) + ZEND_ARG_INFO(0, px) + ZEND_ARG_INFO(0, py) + ZEND_ARG_INFO(0, start) + ZEND_ARG_INFO(0, end) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_skewx_args, 0, 0, 1) + ZEND_ARG_INFO(0, degrees) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_skewy_args, 0, 0, 1) + ZEND_ARG_INFO(0, degrees) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_translate_args, 0, 0, 2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_line_args, 0, 0, 4) + ZEND_ARG_INFO(0, sx) + ZEND_ARG_INFO(0, sy) + ZEND_ARG_INFO(0, ex) + ZEND_ARG_INFO(0, ey) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_arc_args, 0, 0, 6) + ZEND_ARG_INFO(0, sx) + ZEND_ARG_INFO(0, sy) + ZEND_ARG_INFO(0, ex) + ZEND_ARG_INFO(0, ey) + ZEND_ARG_INFO(0, sd) + ZEND_ARG_INFO(0, ed) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_matte_args, 0, 0, 3) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_ARG_INFO(0, METHOD) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_polygon_args, 0, 0, 1) + ZEND_ARG_INFO(0, coordinates) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_point_args, 0, 0, 2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setfontstretch_args, 0, 0, 1) + ZEND_ARG_INFO(0, STRETCH) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setstrokeantialias_args, 0, 0, 1) + ZEND_ARG_INFO(0, antialias) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setfontalignment_args, 0, 0, 1) + ZEND_ARG_INFO(0, ALIGN) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_settextdecoration_args, 0, 0, 1) + ZEND_ARG_INFO(0, DECORATION) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_settextundercolor_args, 0, 0, 1) + ZEND_ARG_INFO(0, color) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setviewbox_args, 0, 0, 4) + ZEND_ARG_INFO(0, sx) + ZEND_ARG_INFO(0, sy) + ZEND_ARG_INFO(0, ex) + ZEND_ARG_INFO(0, ey) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_affine_args, 0, 0, 1) + ZEND_ARG_INFO(0, affineMatrix) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_bezier_args, 0, 0, 1) + ZEND_ARG_INFO(0, coordinateArray) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_composite_args, 0, 0, 6) + ZEND_ARG_INFO(0, COMPOSE) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_ARG_INFO(0, width) + ZEND_ARG_INFO(0, height) + ZEND_ARG_OBJ_INFO(0, Imagick, Imagick, 0) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_color_args, 0, 0, 3) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_ARG_INFO(0, PAINTMETHOD) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_comment_args, 0, 0, 1) + ZEND_ARG_INFO(0, comment) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_pathcurvetoabsolute_args, 0, 0, 6) + ZEND_ARG_INFO(0, x1) + ZEND_ARG_INFO(0, y1) + ZEND_ARG_INFO(0, x2) + ZEND_ARG_INFO(0, y2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_pathcurvetorelative_args, 0, 0, 6) + ZEND_ARG_INFO(0, x1) + ZEND_ARG_INFO(0, y1) + ZEND_ARG_INFO(0, x2) + ZEND_ARG_INFO(0, y2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_pathcurvetoquadraticbezierabsolute_args, 0, 0, 4) + ZEND_ARG_INFO(0, x1) + ZEND_ARG_INFO(0, y1) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_pathcurvetoquadraticbezierrelative_args, 0, 0, 4) + ZEND_ARG_INFO(0, x1) + ZEND_ARG_INFO(0, y1) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_pathcurvetoquadraticbeziersmoothabsolute_args, 0, 0, 2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_pathcurvetoquadraticbeziersmoothrelative_args, 0, 0, 2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_pathcurvetosmoothabsolute_args, 0, 0, 4) + ZEND_ARG_INFO(0, x1) + ZEND_ARG_INFO(0, y1) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_pathcurvetosmoothrelative_args, 0, 0, 4) + ZEND_ARG_INFO(0, x1) + ZEND_ARG_INFO(0, y1) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_pathellipticarcabsolute_args, 0, 0, 7) + ZEND_ARG_INFO(0, rx) + ZEND_ARG_INFO(0, ry) + ZEND_ARG_INFO(0, xAxisRotation) + ZEND_ARG_INFO(0, largeArc) + ZEND_ARG_INFO(0, sweep) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_pathellipticarcrelative_args, 0, 0, 7) + ZEND_ARG_INFO(0, rx) + ZEND_ARG_INFO(0, ry) + ZEND_ARG_INFO(0, xAxisRotation) + ZEND_ARG_INFO(0, largeArc) + ZEND_ARG_INFO(0, sweep) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_pathlinetoabsolute_args, 0, 0, 2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_pathlinetorelative_args, 0, 0, 2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_pathlinetohorizontalabsolute_args, 0, 0, 1) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_pathlinetohorizontalrelative_args, 0, 0, 1) + ZEND_ARG_INFO(0, x) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_pathlinetoverticalabsolute_args, 0, 0, 1) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_pathlinetoverticalrelative_args, 0, 0, 1) + ZEND_ARG_INFO(0, x) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_pathmovetoabsolute_args, 0, 0, 2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_pathmovetorelative_args, 0, 0, 2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_polyline_args, 0, 0, 1) + ZEND_ARG_INFO(0, coordinateArray) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_pushclippath_args, 0, 0, 1) + ZEND_ARG_INFO(0, clipMask) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_pushpattern_args, 0, 0, 5) + ZEND_ARG_INFO(0, pattern_id) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_ARG_INFO(0, width) + ZEND_ARG_INFO(0, height) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_rotate_args, 0, 0, 1) + ZEND_ARG_INFO(0, degrees) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_scale_args, 0, 0, 2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setclippath_args, 0, 0, 1) + ZEND_ARG_INFO(0, clipMask) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setcliprule_args, 0, 0, 1) + ZEND_ARG_INFO(0, FILLRULE) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setclipunits_args, 0, 0, 1) + ZEND_ARG_INFO(0, PATHUNITS) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setfillopacity_args, 0, 0, 1) + ZEND_ARG_INFO(0, fillOpacity) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setfillpatternurl_args, 0, 0, 1) + ZEND_ARG_INFO(0, url) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setfillrule_args, 0, 0, 1) + ZEND_ARG_INFO(0, FILLRULE) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setgravity_args, 0, 0, 1) + ZEND_ARG_INFO(0, GRAVITY) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setstrokepatternurl_args, 0, 0, 1) + ZEND_ARG_INFO(0, url) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setstrokedashoffset_args, 0, 0, 1) + ZEND_ARG_INFO(0, offset) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setstrokelinecap_args, 0, 0, 1) + ZEND_ARG_INFO(0, LINECAP) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setstrokelinejoin_args, 0, 0, 1) + ZEND_ARG_INFO(0, LINEJOIN) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setstrokemiterlimit_args, 0, 0, 1) + ZEND_ARG_INFO(0, miterLimit) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setstrokeopacity_args, 0, 0, 1) + ZEND_ARG_INFO(0, strokeOpacity) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setvectorgraphics_args, 0, 0, 1) + ZEND_ARG_INFO(0, xml) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setstrokedasharray_args, 0, 0, 1) + ZEND_ARG_INFO(0, dashArray) + ZEND_END_ARG_INFO() + +#if MagickLibVersion >= 0x693 + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setopacity_args, 0, 0, 1) + ZEND_ARG_INFO(0, opacity) + ZEND_END_ARG_INFO() +#endif // MagickLibVersion >= 0x693 + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setfontresolution_args, 0, 0, 2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setbordercolor_args, 0, 0, 1) + ZEND_ARG_INFO(0, bordercolor) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_settextdirection_args, 0, 0, 1) + ZEND_ARG_INFO(0, direction) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickdraw_setdensity_args, 0, 0, 1) + ZEND_ARG_INFO(0, density) + ZEND_END_ARG_INFO() + +/* ImagickPixel */ +#if MagickLibVersion > 0x628 + ZEND_BEGIN_ARG_INFO_EX(imagickpixel_sethsl_args, 0, 0, 3) + ZEND_ARG_INFO(0, hue) + ZEND_ARG_INFO(0, saturation) + ZEND_ARG_INFO(0, luminosity) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickpixel_setcolorvaluequantum_args, 0, 0, 1) + ZEND_ARG_INFO(0, color_value) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickpixel_setindex_args, 0, 0, 1) + ZEND_ARG_INFO(0, index) + ZEND_END_ARG_INFO() +#endif + + ZEND_BEGIN_ARG_INFO_EX(imagickpixel_zero_args, 0, 0, 0) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickpixel_construct_args, 0, 0, 0) + ZEND_ARG_INFO(0, color) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickpixel_setcolor_args, 0, 0, 1) + ZEND_ARG_INFO(0, color) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickpixel_ispixelsimilarquantum_args, 0, 0, 1) + ZEND_ARG_INFO(0, color) + ZEND_ARG_INFO(0, fuzz) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickpixel_ispixelsimilar_args, 0, 0, 1) + ZEND_ARG_INFO(0, color) + ZEND_ARG_INFO(0, fuzz) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickpixel_setcolorvalue_args, 0, 0, 2) + ZEND_ARG_INFO(0, color) + ZEND_ARG_INFO(0, value) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickpixel_getcolorvalue_args, 0, 0, 1) + ZEND_ARG_INFO(0, color) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickpixel_setcolorcount_args, 0, 0, 1) + ZEND_ARG_INFO(0, colorCount) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickpixel_getcolor_args, 0, 0, 0) + ZEND_ARG_INFO(0, normalized) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickpixel_setcolorfrompixel_args, 0, 0, 1) + ZEND_ARG_OBJ_INFO(0, srcPixel, ImagickPixel, 0) + ZEND_END_ARG_INFO() + +/* ImagickPixelIterator */ + + ZEND_BEGIN_ARG_INFO_EX(imagickpixeliterator_zero_args, 0, 0, 0) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickpixeliterator_construct_args, 0, 0, 1) + ZEND_ARG_OBJ_INFO(0, Imagick, Imagick, 0) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickpixeliterator_setiteratorrow_args, 0, 0, 1) + ZEND_ARG_INFO(0, row) + ZEND_END_ARG_INFO() + +#ifdef IMAGICK_WITH_KERNEL + ZEND_BEGIN_ARG_INFO_EX(imagickkernel_frommatrix_args, 0, 0, 1) + ZEND_ARG_INFO(0, array) + ZEND_ARG_INFO(0, array) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickkernel_frombuiltin_args, 0, 0, 2) + ZEND_ARG_INFO(0, kerneltype) + ZEND_ARG_INFO(0, paramstring) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickkernel_addkernel_args, 0, 0, 1) + ZEND_ARG_OBJ_INFO(0, ImagickKernel, ImagickKernel, 0) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickkernel_scale_args, 0, 0, 1) + ZEND_ARG_INFO(0, scale) + ZEND_ARG_INFO(0, normalize_flag) + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(imagickkernel_addunitykernel_args, 0, 0, 1) + ZEND_ARG_INFO(0, scale) + ZEND_END_ARG_INFO() +#endif + +static zend_function_entry php_imagick_functions[] = +{ + { NULL, NULL, NULL, 0, 0 } +}; + +static zend_function_entry php_imagickdraw_class_methods[] = +{ +#if MagickLibVersion > 0x628 + PHP_ME(imagickdraw, resetvectorgraphics, imagickdraw_zero_args, ZEND_ACC_PUBLIC) +#endif +#if MagickLibVersion > 0x649 + PHP_ME(imagickdraw, gettextkerning, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, settextkerning, imagickdraw_settextkerning_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, gettextinterwordspacing, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, settextinterwordspacing, imagickdraw_settextinterwordspacing_args, ZEND_ACC_PUBLIC) +#endif +#if MagickLibVersion > 0x655 + PHP_ME(imagickdraw, gettextinterlinespacing, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, settextinterlinespacing, imagickdraw_settextinterlinespacing_args, ZEND_ACC_PUBLIC) +#endif + PHP_ME(imagickdraw, __construct, imagickdraw_zero_args, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) + PHP_ME(imagickdraw, setfillcolor, imagickdraw_setfillcolor_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setfillalpha, imagickdraw_setfillalpha_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setresolution, imagickdraw_setresolution_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setstrokecolor, imagickdraw_setstrokecolor_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setstrokealpha, imagickdraw_setstrokealpha_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setstrokewidth, imagickdraw_setstrokewidth_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, clear, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, circle, imagickdraw_circle_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, annotation, imagickdraw_annotation_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, settextantialias, imagickdraw_settextantialias_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, settextencoding, imagickdraw_settextencoding_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setfont, imagickdraw_setfont_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setfontfamily, imagickdraw_setfontfamily_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setfontsize, imagickdraw_setfontsize_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setfontstyle, imagickdraw_setfontstyle_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setfontweight, imagickdraw_setfontweight_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, getfont, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, getfontfamily, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, getfontsize, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, getfontstyle, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, getfontweight, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + ZEND_MALIAS(imagickdraw, destroy, clear, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, rectangle, imagickdraw_rectangle_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, roundrectangle, imagickdraw_roundrectangle_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, ellipse, imagickdraw_ellipse_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, skewx, imagickdraw_skewx_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, skewy, imagickdraw_skewy_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, translate, imagickdraw_translate_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, line, imagickdraw_line_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, arc, imagickdraw_arc_args, ZEND_ACC_PUBLIC) +#if MagickLibVersion >= 0x700 + PHP_ME(imagickdraw, alpha, imagickdraw_matte_args, ZEND_ACC_PUBLIC) +#else + PHP_ME(imagickdraw, matte, imagickdraw_matte_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) +#endif + PHP_ME(imagickdraw, polygon, imagickdraw_polygon_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, point, imagickdraw_point_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, gettextdecoration, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, gettextencoding, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, getfontstretch, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setfontstretch, imagickdraw_setfontstretch_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setstrokeantialias, imagickdraw_setstrokeantialias_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, settextalignment, imagickdraw_setfontalignment_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, settextdecoration, imagickdraw_settextdecoration_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, settextundercolor, imagickdraw_settextundercolor_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setviewbox, imagickdraw_setviewbox_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, clone, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, affine, imagickdraw_affine_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, bezier, imagickdraw_bezier_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, composite, imagickdraw_composite_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, color, imagickdraw_color_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, comment, imagickdraw_comment_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, getclippath, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, getcliprule, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, getclipunits, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, getfillcolor, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, getfillopacity, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, getfillrule, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, getgravity, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, getstrokeantialias, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, getstrokecolor, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, getstrokedasharray, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, getstrokedashoffset, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, getstrokelinecap, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, getstrokelinejoin, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, getstrokemiterlimit, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, getstrokeopacity, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, getstrokewidth, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, gettextalignment, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, gettextantialias, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, getvectorgraphics, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, gettextundercolor, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, pathclose, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, pathcurvetoabsolute, imagickdraw_pathcurvetoabsolute_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, pathcurvetorelative, imagickdraw_pathcurvetorelative_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, pathcurvetoquadraticbezierabsolute, imagickdraw_pathcurvetoquadraticbezierabsolute_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, pathcurvetoquadraticbezierrelative, imagickdraw_pathcurvetoquadraticbezierrelative_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, pathcurvetoquadraticbeziersmoothabsolute, imagickdraw_pathcurvetoquadraticbeziersmoothabsolute_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, pathcurvetoquadraticbeziersmoothrelative, imagickdraw_pathcurvetoquadraticbeziersmoothrelative_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, pathcurvetosmoothabsolute, imagickdraw_pathcurvetosmoothabsolute_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, pathcurvetosmoothrelative, imagickdraw_pathcurvetosmoothrelative_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, pathellipticarcabsolute, imagickdraw_pathellipticarcabsolute_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, pathellipticarcrelative, imagickdraw_pathellipticarcrelative_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, pathfinish, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, pathlinetoabsolute, imagickdraw_pathlinetoabsolute_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, pathlinetorelative, imagickdraw_pathlinetorelative_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, pathlinetohorizontalabsolute, imagickdraw_pathlinetohorizontalabsolute_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, pathlinetohorizontalrelative, imagickdraw_pathlinetohorizontalrelative_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, pathlinetoverticalabsolute, imagickdraw_pathlinetoverticalabsolute_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, pathlinetoverticalrelative, imagickdraw_pathlinetoverticalrelative_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, pathmovetoabsolute, imagickdraw_pathmovetoabsolute_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, pathmovetorelative, imagickdraw_pathmovetorelative_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, pathstart, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, polyline, imagickdraw_polyline_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, popclippath, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, popdefs, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, poppattern, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, pushclippath, imagickdraw_pushclippath_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, pushdefs, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, pushpattern, imagickdraw_pushpattern_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, render, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, rotate, imagickdraw_rotate_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, scale, imagickdraw_scale_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setclippath, imagickdraw_setclippath_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setcliprule, imagickdraw_setcliprule_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setclipunits, imagickdraw_setclipunits_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setfillopacity, imagickdraw_setfillopacity_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setfillpatternurl, imagickdraw_setfillpatternurl_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setfillrule, imagickdraw_setfillrule_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setgravity, imagickdraw_setgravity_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setstrokepatternurl, imagickdraw_setstrokepatternurl_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setstrokedashoffset, imagickdraw_setstrokedashoffset_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setstrokelinecap, imagickdraw_setstrokelinecap_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setstrokelinejoin, imagickdraw_setstrokelinejoin_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setstrokemiterlimit, imagickdraw_setstrokemiterlimit_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setstrokeopacity, imagickdraw_setstrokeopacity_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setvectorgraphics, imagickdraw_setvectorgraphics_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, pop, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, push, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setstrokedasharray, imagickdraw_setstrokedasharray_args, ZEND_ACC_PUBLIC) +#if MagickLibVersion >= 0x693 + PHP_ME(imagickdraw, getopacity, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setopacity, imagickdraw_setopacity_args, ZEND_ACC_PUBLIC) +#endif //MagickLibVersion >= 0x693 +#if MagickLibVersion >= 0x675 + PHP_ME(imagickdraw, getfontresolution, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setfontresolution, imagickdraw_setfontresolution_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, getbordercolor, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, setbordercolor, imagickdraw_setbordercolor_args, ZEND_ACC_PUBLIC) +#endif //#if MagickLibVersion >= 0x675 + +#if MagickLibVersion >= 0x693 + PHP_ME(imagickdraw, setdensity, imagickdraw_setdensity_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, getdensity, imagickdraw_zero_args, ZEND_ACC_PUBLIC) +#endif// #if MagickLibVersion >= 0x693 + +#if MagickLibVersion >= 0x692 + PHP_ME(imagickdraw, gettextdirection, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickdraw, settextdirection, imagickdraw_settextdirection_args, ZEND_ACC_PUBLIC) +#endif //#if MagickLibVersion >= 0x692 + + { NULL, NULL, NULL, 0, 0 } +}; + +ZEND_BEGIN_ARG_INFO_EX(imagickpixeliterator_getpixeliterator_args, 0, 0, 6) + ZEND_ARG_OBJ_INFO(0, Imagick, Imagick, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(imagickpixeliterator_getpixelregioniterator_args, 0, 0, 6) + ZEND_ARG_OBJ_INFO(0, Imagick, Imagick, 0) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_ARG_INFO(0, columns) + ZEND_ARG_INFO(0, rows) +ZEND_END_ARG_INFO() + +static +zend_function_entry php_imagickpixeliterator_class_methods[] = +{ + PHP_ME(imagickpixeliterator, __construct, imagickpixeliterator_construct_args, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) + PHP_ME(imagickpixeliterator, newpixeliterator, imagickpixeliterator_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickpixeliterator, newpixelregioniterator, imagickpixeliterator_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickpixeliterator, getiteratorrow, imagickpixeliterator_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickpixeliterator, setiteratorrow, imagickpixeliterator_setiteratorrow_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickpixeliterator, setiteratorfirstrow, imagickpixeliterator_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickpixeliterator, setiteratorlastrow, imagickpixeliterator_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickpixeliterator, getpreviousiteratorrow, imagickpixeliterator_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickpixeliterator, getcurrentiteratorrow, imagickpixeliterator_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickpixeliterator, getnextiteratorrow, imagickpixeliterator_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickpixeliterator, resetiterator, imagickpixeliterator_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickpixeliterator, synciterator, imagickpixeliterator_zero_args, ZEND_ACC_PUBLIC) + ZEND_MALIAS(imagickpixeliterator, destroy, clear, imagickpixeliterator_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickpixeliterator, clear, imagickpixeliterator_zero_args, ZEND_ACC_PUBLIC) + + PHP_ME(imagickpixeliterator, getpixeliterator, imagickpixeliterator_getpixeliterator_args, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + PHP_ME(imagickpixeliterator, getpixelregioniterator, imagickpixeliterator_getpixelregioniterator_args, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + + /* Iterator interface */ + PHP_MALIAS(imagickpixeliterator, key, getiteratorrow, imagickpixeliterator_zero_args, ZEND_ACC_PUBLIC) + PHP_MALIAS(imagickpixeliterator, next, getnextiteratorrow, imagickpixeliterator_zero_args, ZEND_ACC_PUBLIC) + PHP_MALIAS(imagickpixeliterator, rewind, resetiterator, imagickpixeliterator_zero_args, ZEND_ACC_PUBLIC) + PHP_MALIAS(imagickpixeliterator, current, getcurrentiteratorrow, imagickpixeliterator_zero_args, ZEND_ACC_PUBLIC) + + PHP_ME(imagickpixeliterator, valid, imagickpixeliterator_zero_args, ZEND_ACC_PUBLIC) + { NULL, NULL, NULL, 0, 0 } +}; + + +static zend_function_entry php_imagickpixel_class_methods[] = +{ +#if MagickLibVersion > 0x628 + PHP_ME(imagickpixel, gethsl, imagickpixel_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickpixel, sethsl, imagickpixel_sethsl_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickpixel, getcolorvaluequantum, imagickpixel_getcolorvalue_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickpixel, setcolorvaluequantum, imagickpixel_setcolorvaluequantum_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickpixel, getindex, imagickpixel_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickpixel, setindex, imagickpixel_setindex_args, ZEND_ACC_PUBLIC) +#endif + PHP_ME(imagickpixel, __construct, imagickpixel_construct_args, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) + PHP_ME(imagickpixel, setcolor, imagickpixel_setcolor_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickpixel, setcolorvalue, imagickpixel_setcolorvalue_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickpixel, getcolorvalue, imagickpixel_getcolorvalue_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickpixel, clear, imagickpixel_zero_args, ZEND_ACC_PUBLIC) + ZEND_MALIAS(imagickpixel, destroy, clear, imagickpixel_zero_args, ZEND_ACC_PUBLIC) + PHP_MALIAS(imagickpixel, issimilar, ispixelsimilarquantum, imagickpixel_ispixelsimilarquantum_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickpixel, ispixelsimilarquantum, imagickpixel_ispixelsimilarquantum_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickpixel, ispixelsimilar, imagickpixel_ispixelsimilar_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickpixel, getcolor, imagickpixel_getcolor_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickpixel, getcolorquantum, imagickpixel_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickpixel, getcolorasstring, imagickpixel_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickpixel, getcolorcount, imagickpixel_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickpixel, setcolorcount, imagickpixel_setcolorcount_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickpixel, clone, imagickpixel_zero_args, ZEND_ACC_PUBLIC) +#if MagickLibVersion >= 0x693 + PHP_ME(imagickpixel, setcolorfrompixel, imagickpixel_setcolorfrompixel_args, ZEND_ACC_PUBLIC) +#endif //#if MagickLibVersion >= 0x693 + + { NULL, NULL, NULL, 0, 0 } +}; + +static zend_function_entry php_imagick_class_methods[] = +{ +#if MagickLibVersion > 0x628 + PHP_ME(imagick, optimizeimagelayers, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, compareimagelayers, imagick_compareimagelayers_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, pingimageblob, imagick_pingimageblob_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, pingimagefile, imagick_pingimagefile_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, transposeimage, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, transverseimage, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, trimimage, imagick_trimimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, waveimage, imagick_waveimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, vignetteimage, imagick_vignetteimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, uniqueimagecolors, imagick_zero_args, ZEND_ACC_PUBLIC) +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 + PHP_ME(imagick, getimagematte, imagick_zero_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) +#endif // #if MagickLibVersion < 0x700 +#endif + PHP_ME(imagick, setimagematte, imagick_setimagematte_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, adaptiveresizeimage, imagick_adaptiveresizeimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, sketchimage, imagick_sketchimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, shadeimage, imagick_shadeimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getsizeoffset, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setsizeoffset, imagick_setsizeoffset_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, adaptiveblurimage, imagick_adaptiveblurimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, contraststretchimage, imagick_contraststretchimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, adaptivesharpenimage, imagick_adaptivesharpenimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, randomthresholdimage, imagick_randomthresholdimage_args, ZEND_ACC_PUBLIC) +#if MagickLibVersion < 0x700 + PHP_ME(imagick, roundcornersimage, imagick_roundcornersimage_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) + /* This alias is due to BWC */ + PHP_MALIAS(imagick, roundcorners, roundcornersimage, imagick_roundcornersimage_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) +#endif + PHP_ME(imagick, setiteratorindex, imagick_setiteratorindex_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getiteratorindex, imagick_zero_args, ZEND_ACC_PUBLIC) +#if MagickLibVersion < 0x700 + PHP_ME(imagick, transformimage, imagick_transformimage_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) +#endif // #if MagickLibVersion < 0x700 +#endif +#if MagickLibVersion > 0x630 +#if MagickLibVersion < 0x700 + PHP_ME(imagick, setimageopacity, imagick_setimageopacity_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) +#endif +#if MagickLibVersion >= 0x700 + PHP_ME(imagick, setimagealpha, imagick_setimagealpha_args, ZEND_ACC_PUBLIC) +#endif +#if MagickLibVersion < 0x700 + PHP_ME(imagick, orderedposterizeimage, imagick_orderedposterizeimage_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) +#endif //#if MagickLibVersion < 0x700 +#endif //#if MagickLibVersion > 0x630 +#if MagickLibVersion > 0x631 + PHP_ME(imagick, polaroidimage, imagick_polaroidimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimageproperty, imagick_getimageproperty_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimageproperty, imagick_setimageproperty_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, deleteimageproperty, imagick_deleteimageproperty_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, identifyformat, imagick_identifyformat_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimageinterpolatemethod, imagick_setimageinterpolatemethod_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimageinterpolatemethod, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, linearstretchimage, imagick_linearstretchimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagelength, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, extentimage, imagick_extentimage_args, ZEND_ACC_PUBLIC) +#endif +#if MagickLibVersion > 0x633 + PHP_ME(imagick, getimageorientation, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimageorientation, imagick_setimageorientation_args, ZEND_ACC_PUBLIC) +#endif +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion > 0x634 +#if MagickLibVersion < 0x700 + PHP_ME(imagick, paintfloodfillimage, imagick_paintfloodfillimage_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) +#endif // #if MagickLibVersion < 0x700 +#endif +#endif +#if MagickLibVersion > 0x635 + PHP_ME(imagick, clutimage, imagick_clutimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimageproperties, imagick_getimageproperties_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimageprofiles, imagick_getimageprofiles_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, distortimage, imagick_distortimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, writeimagefile, imagick_writeimagefile_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, writeimagesfile, imagick_writeimagesfile_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, resetimagepage, imagick_resetimagepage_args, ZEND_ACC_PUBLIC) +#if MagickLibVersion < 0x700 + PHP_ME(imagick, setimageclipmask, imagick_setimageclipmask_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) + PHP_ME(imagick, getimageclipmask, imagick_zero_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) +#endif + PHP_ME(imagick, animateimages, imagick_animateimages_args, ZEND_ACC_PUBLIC) +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 + PHP_ME(imagick, recolorimage, imagick_recolorimage_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) +#endif +#endif +#endif +#if MagickLibVersion > 0x636 + PHP_ME(imagick, setfont, imagick_setfont_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getfont, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setpointsize, imagick_setpointsize_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getpointsize, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, mergeimagelayers, imagick_mergeimagelayers_args, ZEND_ACC_PUBLIC) +#endif +#if MagickLibVersion > 0x637 + PHP_ME(imagick, setimagealphachannel, imagick_setimagealphachannel_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, floodfillpaintimage, imagick_floodfillpaintimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, opaquepaintimage, imagick_opaquepaintimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, transparentpaintimage, imagick_transparentpaintimage_args, ZEND_ACC_PUBLIC) +#endif +#if MagickLibVersion > 0x638 + PHP_ME(imagick, liquidrescaleimage, imagick_liquidrescaleimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, encipherimage, imagick_encipherimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, decipherimage, imagick_decipherimage_args, ZEND_ACC_PUBLIC) +#endif +#if MagickLibVersion > 0x639 + PHP_ME(imagick, setgravity, imagick_setgravity_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getgravity, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagechannelrange, imagick_getimagechannelrange_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagealphachannel, imagick_zero_args, ZEND_ACC_PUBLIC) +#endif +#if MagickLibVersion > 0x642 + PHP_ME(imagick, getimagechanneldistortions, imagick_getimagechanneldistortions_args, ZEND_ACC_PUBLIC) +#endif +#if MagickLibVersion > 0x643 + PHP_ME(imagick, setimagegravity, imagick_setimagegravity_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagegravity, imagick_zero_args, ZEND_ACC_PUBLIC) +#endif +#if MagickLibVersion > 0x645 + PHP_ME(imagick, importimagepixels, imagick_importimagepixels_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, deskewimage, imagick_deskewimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, segmentimage, imagick_segmentimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, sparsecolorimage, imagick_sparsecolorimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, remapimage, imagick_remapimage_args, ZEND_ACC_PUBLIC) +#endif +#if MagickLibVersion > 0x646 + PHP_ME(imagick, exportimagepixels, imagick_exportimagepixels_args, ZEND_ACC_PUBLIC) +#endif +#if MagickLibVersion > 0x648 + PHP_ME(imagick, getimagechannelkurtosis, imagick_getimagechannelkurtosis_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, functionimage, imagick_functionimage_args, ZEND_ACC_PUBLIC) +#endif +#if MagickLibVersion > 0x651 + PHP_ME(imagick, transformimagecolorspace, imagick_transformimagecolorspace_args, ZEND_ACC_PUBLIC) +#endif +#if MagickLibVersion > 0x652 + PHP_ME(imagick, haldclutimage, imagick_haldclutimage_args, ZEND_ACC_PUBLIC) +#endif +#if MagickLibVersion > 0x655 + PHP_ME(imagick, autolevelimage, imagick_autolevelimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, blueshiftimage, imagick_blueshiftimage_args, ZEND_ACC_PUBLIC) +#endif +#if MagickLibVersion > 0x656 + PHP_ME(imagick, getimageartifact, imagick_getimageartifact_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimageartifact, imagick_setimageartifact_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, deleteimageartifact, imagick_deleteimageartifact_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getcolorspace, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setcolorspace, imagick_setcolorspace_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, clampimage, imagick_clampimage_args, ZEND_ACC_PUBLIC) +#endif +#if MagickLibVersion > 0x667 + PHP_ME(imagick, smushimages, imagick_smushimages_args, ZEND_ACC_PUBLIC) +#endif + PHP_ME(imagick, __construct, imagick_construct_args, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) + PHP_ME(imagick, __tostring, NULL, ZEND_ACC_PUBLIC) +#if PHP_VERSION_ID >= 50600 + PHP_ME(imagick, count, imagick_count_args, ZEND_ACC_PUBLIC) +#else + PHP_ME(imagick, count, imagick_zero_args, ZEND_ACC_PUBLIC) +#endif + PHP_ME(imagick, getpixeliterator, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getpixelregioniterator, imagick_getpixelregioniterator_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, readimage, imagick_readimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, readimages, imagick_readimages_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, readimageblob, imagick_readimageblob_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimageformat, imagick_setimageformat_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, scaleimage, imagick_scaleimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, writeimage, imagick_writeimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, writeimages, imagick_writeimages_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, blurimage, imagick_blurimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, thumbnailimage, imagick_thumbnailimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, cropthumbnailimage, imagick_cropthumbnailimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagefilename, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimagefilename, imagick_setimagefilename_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimageformat, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagemimetype, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, removeimage, imagick_zero_args, ZEND_ACC_PUBLIC) + ZEND_MALIAS(imagick, destroy, clear, imagickdraw_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, clear, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, clone, imagick_zero_args, ZEND_ACC_PUBLIC) +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 + PHP_ME(imagick, getimagesize, imagick_zero_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) +#endif // #if MagickLibVersion < 0x700 +#endif + PHP_ME(imagick, getimageblob, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagesblob, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setfirstiterator, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setlastiterator, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, resetiterator, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, previousimage, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, nextimage, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, haspreviousimage, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, hasnextimage, imagick_zero_args, ZEND_ACC_PUBLIC) +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 + PHP_ME(imagick, setimageindex, imagick_setimageindex_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) + PHP_ME(imagick, getimageindex, imagick_zero_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) +#endif // #if MagickLibVersion < 0x700 +#endif + PHP_ME(imagick, commentimage, imagick_commentimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, cropimage, imagick_cropimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, labelimage, imagick_labelimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagegeometry, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, drawimage, imagick_drawimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimagecompressionquality, imagick_setimagecompressionquality_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagecompressionquality, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimagecompression, imagick_setimagecompression_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagecompression, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, annotateimage, imagick_annotateimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, compositeimage, imagick_compositeimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, modulateimage, imagick_modulateimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagecolors, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, montageimage, imagick_montageimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, identifyimage, imagick_identifyimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, thresholdimage, imagick_thresholdimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, adaptivethresholdimage, imagick_adaptivethresholdimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, blackthresholdimage, imagick_blackthresholdimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, whitethresholdimage, imagick_whitethresholdimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, appendimages, imagick_appendimages_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, charcoalimage, imagick_charcoalimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, normalizeimage, imagick_normalizeimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, oilpaintimage, imagick_oilpaintimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, posterizeimage, imagick_posterizeimage_args, ZEND_ACC_PUBLIC) +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 + PHP_ME(imagick, radialblurimage, imagick_radialblurimage_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) +#endif +#endif + PHP_ME(imagick, raiseimage, imagick_raiseimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, resampleimage, imagick_resampleimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, resizeimage, imagick_resizeimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, rollimage, imagick_rollimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, rotateimage, imagick_rotateimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, sampleimage, imagick_sampleimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, solarizeimage, imagick_solarizeimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, shadowimage, imagick_shadowimage_args, ZEND_ACC_PUBLIC) +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 + PHP_ME(imagick, setimageattribute, imagick_setimageattribute_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) +#endif // #if MagickLibVersion < 0x700 +#endif + PHP_ME(imagick, setimagebackgroundcolor, imagick_setimagebackgroundcolor_args, ZEND_ACC_PUBLIC) +#if MagickLibVersion >= 0x700 + PHP_ME(imagick, setimagechannelmask, imagick_setimagechannelmask_args, ZEND_ACC_PUBLIC) +#endif + PHP_ME(imagick, setimagecompose, imagick_setimagecompose_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimagedelay, imagick_setimagedelay_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimagedepth, imagick_setimagedepth_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimagegamma, imagick_setimagegamma_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimageiterations, imagick_setimageiterations_args, ZEND_ACC_PUBLIC) +#if MagickLibVersion < 0x700 + PHP_ME(imagick, setimagemattecolor, imagick_setimagemattecolor_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) +#endif // #if MagickLibVersion < 0x700 + PHP_ME(imagick, setimagepage, imagick_setimagepage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimageprogressmonitor, imagick_setimageprogressmonitor_args, ZEND_ACC_PUBLIC) +#if MagickLibVersion > 0x653 + PHP_ME(imagick, setprogressmonitor, imagick_setprogressmonitor_args, ZEND_ACC_PUBLIC) +#endif + PHP_ME(imagick, setimageresolution, imagick_setimageresolution_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimagescene, imagick_setimagescene_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimagetickspersecond, imagick_setimagetickspersecond_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimagetype, imagick_setimagetype_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimageunits, imagick_setimageunits_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, sharpenimage, imagick_sharpenimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, shaveimage, imagick_shaveimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, shearimage, imagick_shearimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, spliceimage, imagick_spliceimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, pingimage, imagick_pingimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, readimagefile, imagick_readimagefile_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, displayimage, imagick_displayimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, displayimages, imagick_displayimages_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, spreadimage, imagick_spreadimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, swirlimage, imagick_swirlimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, stripimage, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, queryformats, imagick_queryformats_args, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + PHP_ME(imagick, queryfonts, imagick_queryfonts_args, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + PHP_ME(imagick, queryfontmetrics, imagick_queryfontmetrics_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, steganoimage, imagick_steganoimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, addnoiseimage, imagick_addnoiseimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, motionblurimage, imagick_motionblurimage_args, ZEND_ACC_PUBLIC) +#if MagickLibVersion < 0x700 +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) + PHP_ME(imagick, mosaicimages, imagick_zero_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) +#endif +#endif + PHP_ME(imagick, morphimages, imagick_morphimages_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, minifyimage, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, affinetransformimage, imagick_affinetransformimage_args, ZEND_ACC_PUBLIC) +#if MagickLibVersion < 0x700 +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) + PHP_ME(imagick, averageimages, imagick_zero_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) +#endif +#endif + PHP_ME(imagick, borderimage, imagick_borderimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, calculatecrop, imagick_calculatecrop_args, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + PHP_ME(imagick, chopimage, imagick_chopimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, clipimage, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, clippathimage, imagick_clippathimage_args, ZEND_ACC_PUBLIC) + /* clippathimage has been deprecated. Create alias here and use the newer API function if present */ + PHP_MALIAS(imagick, clipimagepath, clippathimage, imagick_clippathimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, coalesceimages, imagick_zero_args, ZEND_ACC_PUBLIC) +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 + PHP_ME(imagick, colorfloodfillimage, imagick_colorfloodfillimage_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) +#endif // #if MagickLibVersion < 0x700 +#endif + PHP_ME(imagick, colorizeimage, imagick_colorizeimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, compareimagechannels, imagick_compareimagechannels_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, compareimages, imagick_compareimages_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, contrastimage, imagick_contrastimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, combineimages, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, convolveimage, imagick_convolveimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, cyclecolormapimage, imagick_cyclecolormapimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, deconstructimages, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, despeckleimage, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, edgeimage, imagick_edgeimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, embossimage, imagick_embossimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, enhanceimage, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, equalizeimage, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, evaluateimage, imagick_evaluateimage_args, ZEND_ACC_PUBLIC) +#if MagickLibVersion >= 0x687 + PHP_ME(imagick, evaluateimages, imagick_evaluateimages_args, ZEND_ACC_PUBLIC) +#endif // MagickLibVersion >= 0x687 +#if MagickLibVersion < 0x700 +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) + PHP_ME(imagick, flattenimages, imagick_zero_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) +#endif +#endif + PHP_ME(imagick, flipimage, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, flopimage, imagick_zero_args, ZEND_ACC_PUBLIC) +#if MagickLibVersion >= 0x655 + PHP_ME(imagick, forwardfouriertransformimage, imagick_forwardfouriertransformimage_args, ZEND_ACC_PUBLIC) +#endif + PHP_ME(imagick, frameimage, imagick_frameimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, fximage, imagick_fximage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, gammaimage, imagick_gammaimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, gaussianblurimage, imagick_gaussianblurimage_args, ZEND_ACC_PUBLIC) +#if MagickLibVersion < 0x700 +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) + PHP_ME(imagick, getimageattribute, imagick_getimageattribute_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) +#endif +#endif + PHP_ME(imagick, getimagebackgroundcolor, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimageblueprimary, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagebordercolor, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagechanneldepth, imagick_getimagechanneldepth_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagechanneldistortion, imagick_getimagechanneldistortion_args, ZEND_ACC_PUBLIC) +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 + PHP_ME(imagick, getimagechannelextrema, imagick_getimagechannelextrema_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) +#endif // #if MagickLibVersion < 0x700 +#endif + PHP_ME(imagick, getimagechannelmean, imagick_getimagechannelmean_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagechannelstatistics, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagecolormapcolor, imagick_getimagecolormapcolor_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagecolorspace, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagecompose, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagedelay, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagedepth, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagedistortion, imagick_getimagedistortion_args, ZEND_ACC_PUBLIC) +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 + PHP_ME(imagick, getimageextrema, imagick_zero_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) +#endif // #if MagickLibVersion < 0x700 +#endif + PHP_ME(imagick, getimagedispose, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagegamma, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagegreenprimary, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimageheight, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagehistogram, NULL, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimageinterlacescheme, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimageiterations, imagick_zero_args, ZEND_ACC_PUBLIC) +#if MagickLibVersion < 0x700 + PHP_ME(imagick, getimagemattecolor, imagick_zero_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) +#endif //#if MagickLibVersion < 0x700 + PHP_ME(imagick, getimagepage, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagepixelcolor, imagick_getimagepixelcolor_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimageprofile, imagick_getimageprofile_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimageredprimary, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagerenderingintent, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimageresolution, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagescene, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagesignature, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagetickspersecond, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagetype, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimageunits, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagevirtualpixelmethod, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagewhitepoint, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagewidth, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getnumberimages, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimagetotalinkdensity, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimageregion, imagick_getimageregion_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, implodeimage, imagick_getimagetotalinkdensity_args, ZEND_ACC_PUBLIC) +#if MagickLibVersion >= 0x658 + PHP_ME(imagick, inversefouriertransformimage, imagick_inversefouriertransformimage_args, ZEND_ACC_PUBLIC) +#endif + PHP_ME(imagick, levelimage, imagick_levelimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, magnifyimage, imagick_zero_args, ZEND_ACC_PUBLIC) +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 + PHP_ME(imagick, mapimage, imagick_mapimage_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) + PHP_ME(imagick, mattefloodfillimage, imagick_mattefloodfillimage_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) +#endif // #if MagickLibVersion < 0x700 +#endif +#if MagickLibVersion < 0x700 +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) + PHP_ME(imagick, medianfilterimage, imagick_medianfilterimage_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) +#endif +#endif + PHP_ME(imagick, negateimage, imagick_negateimage_args, ZEND_ACC_PUBLIC) +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 + PHP_ME(imagick, paintopaqueimage, imagick_paintopaqueimage_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) + PHP_ME(imagick, painttransparentimage, imagick_painttransparentimage_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) +#endif //#if MagickLibVersion < 0x700 +#endif + PHP_ME(imagick, previewimages, imagick_previewimages_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, profileimage, imagick_profileimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, quantizeimage, imagick_quantizeimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, quantizeimages, imagick_quantizeimages_args, ZEND_ACC_PUBLIC) +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 + PHP_ME(imagick, reducenoiseimage, imagick_reducenoiseimage_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) +#endif +#endif + PHP_ME(imagick, removeimageprofile, imagick_removeimageprofile_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, separateimagechannel, imagick_separateimagechannel_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, sepiatoneimage, imagick_sepiatoneimage_args, ZEND_ACC_PUBLIC) +#if MagickLibVersion < 0x700 + PHP_ME(imagick, setimagebias, imagick_setimagebias_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) + PHP_ME(imagick, setimagebiasquantum, imagick_setimagebiasquantum_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) +#endif + PHP_ME(imagick, setimageblueprimary, imagick_setimageblueprimary_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimagebordercolor, imagick_setimagebordercolor_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimagechanneldepth, imagick_setimagechanneldepth_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimagecolormapcolor, imagick_setimagecolormapcolor_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimagecolorspace, imagick_setimagecolorspace_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimagedispose, imagick_setimagedispose_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimageextent, imagick_setimageextent_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimagegreenprimary, imagick_setimagegreenprimary_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimageinterlacescheme, imagick_setimageinterlacescheme_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimageprofile, imagick_setimageprofile_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimageredprimary, imagick_setimageredprimary_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimagerenderingintent, imagick_setimagerenderingintent_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimagevirtualpixelmethod, imagick_setimagevirtualpixelmethod_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimagewhitepoint, imagick_setimagewhitepoint_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, sigmoidalcontrastimage, imagick_sigmoidalcontrastimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, stereoimage, imagick_stereoimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, textureimage, imagick_textureimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, tintimage, imagick_tintimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, unsharpmaskimage, imagick_unsharpmaskimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getimage, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, addimage, imagick_addimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setimage, imagick_setimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, newimage, imagick_newimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, newpseudoimage, imagick_newpseudoimage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getcompression, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getcompressionquality, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getcopyright, imagick_zero_args, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + PHP_ME(imagick, getconfigureoptions, imagick_getconfigureoptions_args, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) +#if MagickLibVersion > 0x660 + PHP_ME(imagick, getfeatures, imagick_zero_args, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) +#endif + PHP_ME(imagick, getfilename, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getformat, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, gethomeurl, imagick_zero_args, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + PHP_ME(imagick, getinterlacescheme, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getoption, imagick_getoption_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getpackagename, imagick_zero_args, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + PHP_ME(imagick, getpage, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getquantum, imagick_zero_args, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + PHP_ME(imagick, gethdrienabled, imagick_zero_args, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + PHP_ME(imagick, getquantumdepth, imagick_zero_args, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + PHP_ME(imagick, getquantumrange, imagick_zero_args, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + PHP_ME(imagick, getreleasedate, imagick_zero_args, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + PHP_ME(imagick, getresource, imagick_getresource_args, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + PHP_ME(imagick, getresourcelimit, imagick_getresourcelimit_args, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + PHP_ME(imagick, getsamplingfactors, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getsize, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getversion, imagick_zero_args, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + PHP_ME(imagick, setbackgroundcolor, imagick_setbackgroundcolor_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setcompression, imagick_setcompression_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setcompressionquality, imagick_setcompressionquality_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setfilename, imagick_setfilename_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setformat, imagick_setformat_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setinterlacescheme, imagick_setinterlacescheme_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setoption, imagick_setoption_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setpage, imagick_setpage_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setresourcelimit, imagick_setresourcelimit_args, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + PHP_ME(imagick, setresolution, imagick_setresolution_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setsamplingfactors, imagick_setsamplingfactors_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, setsize, imagick_setsize_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, settype, imagick_settype_args, ZEND_ACC_PUBLIC) +#if MagickLibVersion > 0x628 + PHP_MALIAS(imagick, key, getiteratorindex, imagick_zero_args, ZEND_ACC_PUBLIC) +#else +# if defined(MAGICKCORE_EXCLUDE_DEPRECATED) +# error "MAGICKCORE_EXCLUDE_DEPRECATED should not be defined with ImageMagick version below 6.2.8" +# else + PHP_MALIAS(imagick, key, getimageindex, imagick_zero_args, ZEND_ACC_PUBLIC) +# endif +#endif + PHP_MALIAS(imagick, next, nextimage, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_MALIAS(imagick, rewind, setfirstiterator, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, valid, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, current, imagick_zero_args, ZEND_ACC_PUBLIC) +#if MagickLibVersion >= 0x659 + PHP_ME(imagick, brightnesscontrastimage, imagick_brightnesscontrastimage_args, ZEND_ACC_PUBLIC) +#endif +#if MagickLibVersion > 0x661 + PHP_ME(imagick, colormatriximage, imagick_colormatriximage_args, ZEND_ACC_PUBLIC) +#endif + PHP_ME(imagick, selectiveblurimage, imagick_selectiveblurimage_args, ZEND_ACC_PUBLIC) +#if MagickLibVersion >= 0x689 + PHP_ME(imagick, rotationalblurimage, imagick_rotationalblurimage_args, ZEND_ACC_PUBLIC) +#endif +#if MagickLibVersion >= 0x683 + PHP_ME(imagick, statisticimage, imagick_statisticimage_args, ZEND_ACC_PUBLIC) +#endif +#if MagickLibVersion >= 0x652 + PHP_ME(imagick, subimagematch, imagick_subimagematch_args, ZEND_ACC_PUBLIC) + ZEND_MALIAS(imagick, similarityimage, subimagematch, imagick_subimagematch_args, ZEND_ACC_PUBLIC) +#endif + PHP_ME(imagick, setregistry, imagick_setregistry_args, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + PHP_ME(imagick, getregistry, imagick_getregistry_args, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + PHP_ME(imagick, listregistry, imagick_zero_args, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) +#if MagickLibVersion >= 0x680 + PHP_ME(imagick, morphology, imagick_morphology_args, ZEND_ACC_PUBLIC) +#if MagickLibVersion < 0x700 + PHP_ME(imagick, filter, imagick_filter_args, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED) +#endif // #if MagickLibVersion < 0x700 +#endif // #if MagickLibVersion >= 0x680 + PHP_ME(imagick, setantialias, imagick_setantialias_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, getantialias, imagick_zero_args, ZEND_ACC_PUBLIC) +#if MagickLibVersion > 0x676 + PHP_ME(imagick, colordecisionlistimage, imagick_colordecisionlistimage_args, ZEND_ACC_PUBLIC) +#endif // #if MagickLibVersion > 0x676 +#if MagickLibVersion >= 0x687 + PHP_ME(imagick, optimizeimagetransparency, imagick_zero_args, ZEND_ACC_PUBLIC) +#endif // #if MagickLibVersion >= 0x687 +#if MagickLibVersion >= 0x660 + PHP_ME(imagick, autogammaimage, imagick_autogammaimage_args, ZEND_ACC_PUBLIC) +#endif // #if MagickLibVersion >= 0x660 +#if MagickLibVersion >= 0x692 + PHP_ME(imagick, autoorient, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagick, compositeimagegravity, imagick_compositeimagegravity_args, ZEND_ACC_PUBLIC) +#endif // #if MagickLibVersion >= 0x692 +#if MagickLibVersion >= 0x693 + PHP_ME(imagick, localcontrastimage, imagick_localContrastImage_args, ZEND_ACC_PUBLIC) +#endif // #if MagickLibVersion >= 0x692 +#if MagickLibVersion >= 0x700 + PHP_ME(imagick, identifyimagetype, imagick_zero_args, ZEND_ACC_PUBLIC) +#endif // #if MagickLibVersion >= 0x700 + + { NULL, NULL, NULL, 0, 0 } +}; + +#ifdef IMAGICK_WITH_KERNEL +static zend_function_entry php_imagickkernel_class_methods[] = +{ + PHP_ME(imagickkernel, __construct, imagick_zero_args, ZEND_ACC_PRIVATE|ZEND_ACC_CTOR) + PHP_ME(imagickkernel, frommatrix, imagickkernel_frommatrix_args, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + PHP_ME(imagickkernel, frombuiltin, imagickkernel_frombuiltin_args, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) + PHP_ME(imagickkernel, addkernel, imagickkernel_addkernel_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickkernel, getmatrix, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickkernel, separate, imagick_zero_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickkernel, scale, imagickkernel_scale_args, ZEND_ACC_PUBLIC) + PHP_ME(imagickkernel, addunitykernel, imagickkernel_addunitykernel_args, ZEND_ACC_PUBLIC) + { NULL, NULL, NULL, 0, 0 } +}; +#endif + +static void php_imagick_object_free_storage(IM_ZEND_OBJECT *object TSRMLS_DC) +{ + php_imagick_object *intern = php_imagick_fetch_object(object); + + if (!intern) { + return; + } + + if (intern->progress_monitor_name) { + //TODO - is this meant to be free by us? + efree(intern->progress_monitor_name); + } + + if (intern->magick_wand != NULL) { + intern->magick_wand = DestroyMagickWand(intern->magick_wand); + } + + zend_object_std_dtor(&intern->zo TSRMLS_CC); +#ifndef ZEND_ENGINE_3 + efree(intern); +#endif +} + + +static void php_imagickdraw_object_free_storage(IM_ZEND_OBJECT *object TSRMLS_DC) +{ + php_imagickdraw_object *intern = php_imagickdraw_fetch_object(object); + + if (!intern) { + return; + } + + if (intern->drawing_wand != NULL) { + intern->drawing_wand = DestroyDrawingWand(intern->drawing_wand); + } + + zend_object_std_dtor(&intern->zo TSRMLS_CC); + + #ifndef ZEND_ENGINE_3 + efree(intern); + #endif +} + +static void php_imagickpixeliterator_object_free_storage(IM_ZEND_OBJECT *object TSRMLS_DC) +{ + php_imagickpixeliterator_object *intern = php_imagickpixeliterator_fetch_object(object); + + if (!intern) { + return; + } + + if (intern->pixel_iterator != NULL) { + intern->pixel_iterator = DestroyPixelIterator(intern->pixel_iterator); + } + + zend_object_std_dtor(&intern->zo TSRMLS_CC); + #ifndef ZEND_ENGINE_3 + efree(intern); + #endif +} + + + +static void php_imagickpixel_object_free_storage(IM_ZEND_OBJECT *object TSRMLS_DC) +{ + php_imagickpixel_object *intern = php_imagickpixel_fetch_object(object); + + if (!intern) { + return; + } + if (!intern->initialized_via_iterator && intern->pixel_wand) + intern->pixel_wand = DestroyPixelWand(intern->pixel_wand); + + zend_object_std_dtor(&intern->zo TSRMLS_CC); + #ifndef ZEND_ENGINE_3 + efree(intern); + #endif +} + +#ifdef IMAGICK_WITH_KERNEL +static void php_imagickkernel_object_free_storage(IM_ZEND_OBJECT *object TSRMLS_DC) +{ + php_imagickkernel_object *intern = php_imagickkernel_fetch_object(object); + + if (!intern) { + return; + } + + if (intern->kernel_info != NULL) { + // This segfaults in PHP 5.6 + //intern->kernel_info = DestroyKernelInfo(intern->kernel_info); + intern->kernel_info = NULL; + } + + zend_object_std_dtor(&intern->zo TSRMLS_CC); +#ifndef ZEND_ENGINE_3 + efree(intern); +#endif +} +#endif + + +#if PHP_VERSION_ID < 50399 +# define object_properties_init(zo, class_type) { \ + zval *tmp; \ + zend_hash_copy((*zo).properties, \ + &class_type->default_properties, \ + (copy_ctor_func_t) zval_add_ref, \ + (void *) &tmp, \ + sizeof(zval *)); \ + } +#endif + +#ifdef ZEND_ENGINE_3 +static zend_object * php_imagick_object_new_ex(zend_class_entry *class_type, php_imagick_object **ptr, zend_bool init_wand TSRMLS_DC) +#else +static zend_object_value php_imagick_object_new_ex(zend_class_entry *class_type, php_imagick_object **ptr, zend_bool init_wand TSRMLS_DC) +#endif + +{ + php_imagick_object *intern; + + /* Allocate memory for it */ +#ifdef ZEND_ENGINE_3 + intern = ecalloc(1, + sizeof(php_imagick_object) + + zend_object_properties_size(class_type)); +#else + zend_object_value retval; + + intern = (php_imagick_object *) emalloc(sizeof(php_imagick_object)); + memset(&intern->zo, 0, sizeof(zend_object)); +#endif + +#if defined(ZTS) && defined(PHP_WIN32) + /* If its our thread then we already have the lock so no need to lock again */ + if (imagick_thread_id != tsrm_thread_id()) { + tsrm_mutex_lock(imagick_mutex); + imagick_thread_id = tsrm_thread_id(); + } +#endif + + if (ptr) { + *ptr = intern; + } + + /* Set the magickwand */ + if (init_wand) { + intern->magick_wand = NewMagickWand(); + + if (!intern->magick_wand) { + zend_error(E_ERROR, "Failed to create Imagick object, could not set magick_wand"); + } + } else { + intern->magick_wand = NULL; + } + intern->next_out_of_bound = 0; + intern->progress_monitor_name = NULL; + + zend_object_std_init(&intern->zo, class_type TSRMLS_CC); + object_properties_init(&intern->zo, class_type); + +#ifdef ZEND_ENGINE_3 + intern->zo.handlers = &imagick_object_handlers; + return &intern->zo; +#else + retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t) php_imagick_object_free_storage, NULL TSRMLS_CC); + retval.handlers = (zend_object_handlers *) &imagick_object_handlers; + return retval; +#endif +} + + +#ifdef ZEND_ENGINE_3 +static zend_object * php_imagick_object_new(zend_class_entry *class_type TSRMLS_DC) +#else +static zend_object_value php_imagick_object_new(zend_class_entry *class_type TSRMLS_DC) +#endif +{ + return php_imagick_object_new_ex(class_type, NULL, 1 TSRMLS_CC); +} + +#ifdef ZEND_ENGINE_3 +static zend_object * php_imagickdraw_object_new_ex(zend_class_entry *class_type, php_imagickdraw_object **ptr, zend_bool init_wand TSRMLS_DC) +#else +static zend_object_value php_imagickdraw_object_new_ex(zend_class_entry *class_type, php_imagickdraw_object **ptr, zend_bool init_wand TSRMLS_DC) +#endif +{ + php_imagickdraw_object *intern; + +#ifdef ZEND_ENGINE_3 + /* Allocate memory for it */ + intern = ecalloc(1, + sizeof(php_imagickdraw_object) + + zend_object_properties_size(class_type)); + + zend_object_std_init(&intern->zo, class_type TSRMLS_CC); + object_properties_init(&intern->zo, class_type); + intern->zo.handlers = &imagickdraw_object_handlers; +#else + zend_object_value retval; + intern = (php_imagickdraw_object *) emalloc(sizeof(php_imagickdraw_object)); + memset(&intern->zo, 0, sizeof(zend_object)); +#endif + + if (ptr) { + *ptr = intern; + } + + /* Set the DrawingWand */ + if (init_wand) { + intern->drawing_wand = NewDrawingWand(); + + if (!intern->drawing_wand) { + zend_error(E_ERROR, "Failed to create ImagickDraw object"); + } + } else { + intern->drawing_wand = NULL; + } +#ifdef ZEND_ENGINE_3 + intern->zo.handlers = &imagickdraw_object_handlers; + + return &intern->zo; +#else + /* ALLOC_HASHTABLE(intern->zo.properties); */ + zend_object_std_init(&intern->zo, class_type TSRMLS_CC); + object_properties_init(&intern->zo, class_type); + retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t) php_imagickdraw_object_free_storage, NULL TSRMLS_CC); + retval.handlers = (zend_object_handlers *) &imagickdraw_object_handlers; + + return retval; +#endif +} + +#ifdef ZEND_ENGINE_3 +static zend_object * php_imagickdraw_object_new(zend_class_entry *class_type TSRMLS_DC) +#else +static zend_object_value php_imagickdraw_object_new(zend_class_entry *class_type TSRMLS_DC) +#endif +{ + return php_imagickdraw_object_new_ex(class_type, NULL, 1 TSRMLS_CC); +} + +#ifdef ZEND_ENGINE_3 +static zend_object * php_imagickpixeliterator_object_new(zend_class_entry *class_type TSRMLS_DC) +#else +static zend_object_value php_imagickpixeliterator_object_new(zend_class_entry *class_type TSRMLS_DC) +#endif +{ + php_imagickpixeliterator_object *intern; + + /* Allocate memory for it */ +#ifdef ZEND_ENGINE_3 + intern = ecalloc(1, + sizeof(php_imagickpixeliterator_object) + + zend_object_properties_size(class_type)); +#else + zend_object_value retval; + intern = (php_imagickpixeliterator_object *) emalloc(sizeof(php_imagickpixeliterator_object)); + memset(&intern->zo, 0, sizeof(zend_object)); +#endif + + /* We cant initialize yet */ + intern->pixel_iterator = NULL; + intern->initialized = 0; + +#if MagickLibVersion <= 0x628 + intern->rows = 0; + intern->iterator_position = 0; +#endif + + zend_object_std_init(&intern->zo, class_type TSRMLS_CC); + object_properties_init(&intern->zo, class_type); + +#ifdef ZEND_ENGINE_3 + intern->zo.handlers = &imagickpixeliterator_object_handlers; + + return &intern->zo; +#else + retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t) php_imagickpixeliterator_object_free_storage, NULL TSRMLS_CC); + retval.handlers = (zend_object_handlers *) &imagickpixeliterator_object_handlers; + + return retval; +#endif +} + +#ifdef ZEND_ENGINE_3 +static zend_object * php_imagickpixel_object_new_ex(zend_class_entry *class_type, php_imagickpixel_object **ptr TSRMLS_DC) +#else +static zend_object_value php_imagickpixel_object_new_ex(zend_class_entry *class_type, php_imagickpixel_object **ptr TSRMLS_DC) +#endif +{ + php_imagickpixel_object *intern; + +#ifdef ZEND_ENGINE_3 + /* Allocate memory for it */ + intern = ecalloc(1, + sizeof(php_imagickpixel_object) + + zend_object_properties_size(class_type)); +#else + zend_object_value retval; + intern = (php_imagickpixel_object *) emalloc(sizeof(php_imagickpixel_object)); + memset(&intern->zo, 0, sizeof(zend_object)); +#endif + + if (ptr) { + *ptr = intern; + } + + /* Set the pixeliterator */ + intern->pixel_wand = NULL; + intern->initialized_via_iterator = 0; + zend_object_std_init(&intern->zo, class_type TSRMLS_CC); + object_properties_init(&intern->zo, class_type); + +#ifdef ZEND_ENGINE_3 + intern->zo.handlers = &imagickpixel_object_handlers; + + return &intern->zo; +#else + retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t) php_imagickpixel_object_free_storage, NULL TSRMLS_CC); + retval.handlers = (zend_object_handlers *) &imagickpixel_object_handlers; + + return retval; +#endif + +} + +#ifdef ZEND_ENGINE_3 +static zend_object * php_imagickpixel_object_new(zend_class_entry *class_type TSRMLS_DC) +#else +static zend_object_value php_imagickpixel_object_new(zend_class_entry *class_type TSRMLS_DC) +#endif +{ + return php_imagickpixel_object_new_ex(class_type, NULL TSRMLS_CC); +} + +#ifdef IMAGICK_WITH_KERNEL + +#ifdef ZEND_ENGINE_3 +static zend_object * php_imagickkernel_object_new_ex(zend_class_entry *class_type, php_imagickkernel_object **ptr TSRMLS_DC) +#else +static zend_object_value php_imagickkernel_object_new_ex(zend_class_entry *class_type, php_imagickkernel_object **ptr TSRMLS_DC) +#endif +{ + + php_imagickkernel_object *intern; + + /* Allocate memory for it */ +#ifdef ZEND_ENGINE_3 + intern = ecalloc(1, + sizeof(php_imagickkernel_object) + + zend_object_properties_size(class_type)); +#else + zend_object_value retval; + intern = (php_imagickkernel_object *) emalloc(sizeof(php_imagickkernel_object)); + memset(&intern->zo, 0, sizeof(zend_object)); +#endif + + if (ptr) { + *ptr = intern; + } + + /* Set the kernel */ + intern->kernel_info = NULL; + + /* ALLOC_HASHTABLE(intern->zo.properties); */ + zend_object_std_init(&intern->zo, class_type TSRMLS_CC); + object_properties_init(&intern->zo, class_type); + +#ifdef ZEND_ENGINE_3 + intern->zo.handlers = &imagickkernel_object_handlers; + + return &intern->zo; +#else + retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t) php_imagickkernel_object_free_storage, NULL TSRMLS_CC); + retval.handlers = (zend_object_handlers *) &imagickkernel_object_handlers; + + return retval; +#endif +} +#endif + +#undef object_properties_init + +#ifdef IMAGICK_WITH_KERNEL +#ifdef ZEND_ENGINE_3 +static zend_object * php_imagickkernel_object_new(zend_class_entry *class_type TSRMLS_DC) +#else +static zend_object_value php_imagickkernel_object_new(zend_class_entry *class_type TSRMLS_DC) +#endif +{ + return php_imagickkernel_object_new_ex(class_type, NULL TSRMLS_CC); +} +#endif + + + +PHP_INI_BEGIN() + STD_PHP_INI_ENTRY("imagick.locale_fix", "0", PHP_INI_ALL, OnUpdateBool, locale_fix, zend_imagick_globals, imagick_globals) + STD_PHP_INI_ENTRY("imagick.skip_version_check", "0", PHP_INI_ALL, OnUpdateBool, skip_version_check, zend_imagick_globals, imagick_globals) + STD_PHP_INI_ENTRY("imagick.progress_monitor", "0", PHP_INI_SYSTEM, OnUpdateBool, progress_monitor, zend_imagick_globals, imagick_globals) +PHP_INI_END() + +static void php_imagick_init_globals(zend_imagick_globals *imagick_globals) +{ + imagick_globals->locale_fix = 0; + imagick_globals->progress_monitor = 0; + imagick_globals->skip_version_check = 0; +} + + +static int php_imagick_count_elements(zval *object, im_long *count TSRMLS_DC) /* {{{ */ +{ + php_imagick_object *intern= Z_IMAGICK_P(object); + + if (intern->magick_wand) { + *count = MagickGetNumberImages(intern->magick_wand); + return SUCCESS; + } + return FAILURE; +} + +#ifdef ZEND_ENGINE_3 +static zval *php_imagick_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv TSRMLS_DC) +{ + int ret; + php_imagick_object *intern; + zval *retval = NULL; + zval tmp_member; + const zend_object_handlers *std_hnd; + + ZVAL_DEREF(member); + if (Z_TYPE_P(member) != IS_STRING) { + tmp_member = *member; + zval_copy_ctor(&tmp_member); + convert_to_string(&tmp_member); + member = &tmp_member; + } + + std_hnd = zend_get_std_object_handlers(); + + ret = std_hnd->has_property(object, member, type, cache_slot TSRMLS_CC); + + if (ret) { + //TODO - this would allow better immutability + //ZVAL_COPY_VALUE(retval, std_hnd->read_property(object, member, type, cache_slot, rv TSRMLS_CC)); + retval = std_hnd->read_property(object, member, type, cache_slot, rv TSRMLS_CC); + } + else { + + intern = Z_IMAGICK_P(object); + /* Do we have any images? */ + if (MagickGetNumberImages(intern->magick_wand)) { + + //TODO - this seems redundant + /* Is this overloaded? */ + if (!strcmp(Z_STRVAL_P(member), "width") || + !strcmp(Z_STRVAL_P(member), "height") || + !strcmp(Z_STRVAL_P(member), "format")) { + + if (!strcmp(Z_STRVAL_P(member), "width")) { + retval = rv; + ZVAL_LONG(retval, MagickGetImageWidth(intern->magick_wand)); + } else if (!strcmp(Z_STRVAL_P(member), "height")) { + retval = rv; + ZVAL_LONG(retval, MagickGetImageHeight(intern->magick_wand)); + } else if (!strcmp(Z_STRVAL_P(member), "format")) { + char *format = MagickGetImageFormat(intern->magick_wand); + + if (format) { + retval = rv; + ZVAL_STRING(retval, format); + IMAGICK_FREE_MAGICK_MEMORY(format); + } else { + retval = rv; + ZVAL_STRING(retval, ""); + } + } + } + } + } + + if (!retval) { + //TODO - why is the error silent - it would be a small BC break + //to enable the warning. I think it would be the correct thing to do though. + //zend_error(E_NOTICE,"Undefined property: \Imagick::$%s", Z_STRVAL_P(member)); + retval = &EG(uninitialized_zval); + } + + if (member == &tmp_member) { + zval_dtor(member); + } + + return retval; +} + +#else + +#if PHP_VERSION_ID < 50399 +static zval *php_imagick_read_property(zval *object, zval *member, int type TSRMLS_DC) +#else +static zval *php_imagick_read_property(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC) +#endif +{ + int ret; + php_imagick_object *intern; + zval *retval = NULL, tmp_member; + zend_object_handlers *std_hnd; + + if (Z_TYPE_P(member) != IS_STRING) { + tmp_member = *member; + zval_copy_ctor(&tmp_member); + convert_to_string(&tmp_member); + member = &tmp_member; + } + + std_hnd = zend_get_std_object_handlers(); +#if PHP_VERSION_ID < 50399 + ret = std_hnd->has_property(object, member, 2 TSRMLS_CC); +#else + ret = std_hnd->has_property(object, member, 2, key TSRMLS_CC); +#endif + + if (ret) { + std_hnd = zend_get_std_object_handlers(); +#if PHP_VERSION_ID < 50399 + retval = std_hnd->read_property(object, member, type TSRMLS_CC); +#else + retval = std_hnd->read_property(object, member, type, key TSRMLS_CC); +#endif + } else { + intern = (php_imagick_object *) zend_object_store_get_object(object TSRMLS_CC); + /* Do we have any images? */ + if (MagickGetNumberImages(intern->magick_wand)) { + /* Is this overloaded? */ + if (!strcmp(Z_STRVAL_P(member), "width") || + !strcmp(Z_STRVAL_P(member), "height") || + !strcmp(Z_STRVAL_P(member), "format")) { + + MAKE_STD_ZVAL(retval); +#ifdef Z_SET_REFCOUNT_P + Z_SET_REFCOUNT_P(retval, 0); +#else + retval->refcount = 0; +#endif + if (!strcmp(Z_STRVAL_P(member), "width")) { + ZVAL_LONG(retval, MagickGetImageWidth(intern->magick_wand)); + } else if (!strcmp(Z_STRVAL_P(member), "height")) { + ZVAL_LONG(retval, MagickGetImageHeight(intern->magick_wand)); + } else if (!strcmp(Z_STRVAL_P(member), "format")) { + char *format = MagickGetImageFormat(intern->magick_wand); + + if (format) { + ZVAL_STRING(retval, format, 1); + IMAGICK_FREE_MAGICK_MEMORY(format); + } else { + ZVAL_STRING(retval, "", 1); + } + } + } + } + } + if (member == &tmp_member) { + zval_dtor(member); + } + + if (!retval) { + retval = EG(uninitialized_zval_ptr); + } + return retval; +} +#endif + +#ifdef ZEND_ENGINE_3 +static zend_object * php_imagick_clone_imagick_object(zval *this_ptr TSRMLS_DC) +#else +static zend_object_value php_imagick_clone_imagick_object(zval *this_ptr TSRMLS_DC) +#endif +{ + MagickWand *wand_copy = NULL; + php_imagick_object *new_obj = NULL; +#ifdef ZEND_ENGINE_3 + php_imagick_object *old_obj = Z_IMAGICK_P(this_ptr); + zend_object * new_zo = php_imagick_object_new_ex(old_obj->zo.ce, &new_obj, 0 TSRMLS_CC); + zend_objects_clone_members(&new_obj->zo, &old_obj->zo TSRMLS_CC); +#else + php_imagick_object *old_obj = (php_imagick_object *) zend_object_store_get_object(this_ptr TSRMLS_CC); + zend_object_value new_zo = php_imagick_object_new_ex(old_obj->zo.ce, &new_obj, 0 TSRMLS_CC); + zend_objects_clone_members(&new_obj->zo, new_zo, &old_obj->zo, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC); +#endif + + wand_copy = CloneMagickWand(old_obj->magick_wand); + if (!wand_copy) { + zend_error(E_ERROR, "Failed to clone Imagick object"); + } else { + php_imagick_replace_magickwand(new_obj, wand_copy); + new_obj->next_out_of_bound = old_obj->next_out_of_bound; + + if (old_obj->progress_monitor_name) { + new_obj->progress_monitor_name = estrdup(old_obj->progress_monitor_name); + } + } + return new_zo; +} + +#ifdef ZEND_ENGINE_3 +static zend_object * php_imagick_clone_imagickdraw_object(zval *this_ptr TSRMLS_DC) +#else +static zend_object_value php_imagick_clone_imagickdraw_object(zval *this_ptr TSRMLS_DC) +#endif +{ + DrawingWand *wand_copy = NULL; + php_imagickdraw_object *new_obj = NULL; +#ifdef ZEND_ENGINE_3 + php_imagickdraw_object *old_obj = Z_IMAGICKDRAW_P(this_ptr); + zend_object * new_zo = php_imagickdraw_object_new_ex(old_obj->zo.ce, &new_obj, 0 TSRMLS_CC); + zend_objects_clone_members(&new_obj->zo, &old_obj->zo TSRMLS_CC); +#else + php_imagickdraw_object *old_obj = (php_imagickdraw_object *) zend_object_store_get_object(this_ptr TSRMLS_CC); + zend_object_value new_zo = php_imagickdraw_object_new_ex(old_obj->zo.ce, &new_obj, 0 TSRMLS_CC); + zend_objects_clone_members(&new_obj->zo, new_zo, &old_obj->zo, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC); +#endif + + wand_copy = CloneDrawingWand(old_obj->drawing_wand); + + if (!wand_copy) { + zend_error(E_ERROR, "Failed to clone ImagickDraw object"); + } else { + php_imagick_replace_drawingwand(new_obj, wand_copy); + } + return new_zo; +} + +#ifdef ZEND_ENGINE_3 +static zend_object * php_imagick_clone_imagickpixel_object(zval *this_ptr TSRMLS_DC) +#else +static zend_object_value php_imagick_clone_imagickpixel_object(zval *this_ptr TSRMLS_DC) +#endif +{ + PixelWand *wand_copy = NULL; + php_imagickpixel_object *new_obj = NULL; +#ifdef ZEND_ENGINE_3 + zend_object *new_zo; + php_imagickpixel_object *old_obj = Z_IMAGICKPIXEL_P(this_ptr); + new_zo = php_imagickpixel_object_new_ex(old_obj->zo.ce, &new_obj TSRMLS_CC); + zend_objects_clone_members(&new_obj->zo, &old_obj->zo TSRMLS_CC); +#else + php_imagickpixel_object *old_obj = (php_imagickpixel_object *) zend_object_store_get_object(this_ptr TSRMLS_CC); + zend_object_value new_zo = php_imagickpixel_object_new_ex(old_obj->zo.ce, &new_obj TSRMLS_CC); + zend_objects_clone_members(&new_obj->zo, new_zo, &old_obj->zo, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC); +#endif + + wand_copy = php_imagick_clone_pixelwand (old_obj->pixel_wand); + if (!wand_copy) { + zend_error(E_ERROR, "Failed to clone ImagickPixel object"); + } else { + php_imagick_replace_pixelwand(new_obj, wand_copy); + new_obj->initialized_via_iterator = 0; + } + return new_zo; +} + +#ifdef IMAGICK_WITH_KERNEL +#ifdef ZEND_ENGINE_3 +static zend_object * php_imagick_clone_imagickkernel_object(zval *this_ptr TSRMLS_DC) +#else +static zend_object_value php_imagick_clone_imagickkernel_object(zval *this_ptr TSRMLS_DC) +#endif +{ + KernelInfo *kernel_info_copy = NULL; + php_imagickkernel_object *new_obj = NULL; + +#ifdef ZEND_ENGINE_3 + zend_object *new_zo; + php_imagickkernel_object *old_obj = Z_IMAGICKKERNEL_P(this_ptr); + new_zo = php_imagickkernel_object_new_ex(old_obj->zo.ce, &new_obj TSRMLS_CC); + zend_objects_clone_members(&new_obj->zo, &old_obj->zo TSRMLS_CC); +#else + zend_object_value new_zo; + php_imagickkernel_object *old_obj = (php_imagickkernel_object *) zend_object_store_get_object(this_ptr TSRMLS_CC); + new_zo = php_imagickkernel_object_new_ex(old_obj->zo.ce, &new_obj TSRMLS_CC); + zend_objects_clone_members(&new_obj->zo, new_zo, &old_obj->zo, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC); +#endif + + if (old_obj->kernel_info != NULL) { + kernel_info_copy = CloneKernelInfo(old_obj->kernel_info); + + if (!kernel_info_copy) { + zend_error(E_ERROR, "Failed to clone ImagickKernel object"); + } + else { + new_obj->kernel_info = kernel_info_copy; + } + } + + return new_zo; +} +#endif + + +static void checkImagickVersion() +{ + //This gets the version that Imagick was compiled against. + size_t imagickVersion = MagickLibVersion; + + //This gets the version of ImageMagick that has been loaded + size_t imageMagickLibraryVersion; + + GetMagickVersion(&imageMagickLibraryVersion); + + if (imagickVersion == imageMagickLibraryVersion) { + return; + } + + zend_error( + E_WARNING, + "Version warning: Imagick was compiled against ImageMagick version %lu but version %lu is loaded. Imagick will run but may behave surprisingly", + (unsigned long)imagickVersion, + (unsigned long)imageMagickLibraryVersion + ); +} + +PHP_MINIT_FUNCTION(imagick) +{ + zend_class_entry ce; + + /* Initialize globals */ + ZEND_INIT_MODULE_GLOBALS(imagick, php_imagick_init_globals, NULL); + + + // This suppresses an 'unused parameter' warning. + (void)type; + + /* + Allocate some memory + */ + memcpy(&imagick_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); + memcpy(&imagickdraw_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); + memcpy(&imagickpixeliterator_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); + memcpy(&imagickpixel_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); +#ifdef IMAGICK_WITH_KERNEL + memcpy(&imagickkernel_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); +#endif + + /* Set custom allocators */ + MagickWandGenesis(); + + /* + Initialize exceptions (Imagick exception) + */ + INIT_CLASS_ENTRY(ce, PHP_IMAGICK_EXCEPTION_SC_NAME, NULL); +#ifdef ZEND_ENGINE_3 + php_imagick_exception_class_entry = zend_register_internal_class_ex(&ce, zend_ce_exception); +#else + php_imagick_exception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC); +#endif + + /* + Initialize exceptions (ImagickDraw exception) + */ + INIT_CLASS_ENTRY(ce, PHP_IMAGICKDRAW_EXCEPTION_SC_NAME, NULL); +#ifdef ZEND_ENGINE_3 + php_imagickdraw_exception_class_entry = zend_register_internal_class_ex(&ce, zend_ce_exception); +#else + php_imagickdraw_exception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC); +#endif + + /* + Initialize exceptions (ImagickPixelIterator exception) + */ + INIT_CLASS_ENTRY(ce, PHP_IMAGICKPIXELITERATOR_EXCEPTION_SC_NAME, NULL); +#ifdef ZEND_ENGINE_3 + php_imagickpixeliterator_exception_class_entry = zend_register_internal_class_ex(&ce, zend_ce_exception); +#else + php_imagickpixeliterator_exception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC); +#endif + + /* + Initialize exceptions (ImagickPixel exception) + */ + INIT_CLASS_ENTRY(ce, PHP_IMAGICKPIXEL_EXCEPTION_SC_NAME, NULL); +#ifdef ZEND_ENGINE_3 + php_imagickpixel_exception_class_entry = zend_register_internal_class_ex(&ce, zend_ce_exception); +#else + php_imagickpixel_exception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC); +#endif + +#ifdef IMAGICK_WITH_KERNEL + /* + Initialize exceptions (ImagickKernel exception) + */ + INIT_CLASS_ENTRY(ce, PHP_IMAGICKKERNEL_EXCEPTION_SC_NAME, NULL); + #ifdef ZEND_ENGINE_3 + php_imagickkernel_exception_class_entry = zend_register_internal_class_ex(&ce, zend_ce_exception); + #else + php_imagickkernel_exception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC); + #endif + +#endif + + /* + Initialize the class (Imagick) + */ + INIT_CLASS_ENTRY(ce, PHP_IMAGICK_SC_NAME, php_imagick_class_methods); + ce.create_object = php_imagick_object_new; + imagick_object_handlers.clone_obj = php_imagick_clone_imagick_object; + imagick_object_handlers.read_property = php_imagick_read_property; + imagick_object_handlers.count_elements = php_imagick_count_elements; +#ifdef ZEND_ENGINE_3 + imagick_object_handlers.offset = XtOffsetOf(php_imagick_object, zo); + imagick_object_handlers.free_obj = php_imagick_object_free_storage; +#endif + + php_imagick_sc_entry = zend_register_internal_class(&ce TSRMLS_CC); +#if defined(HAVE_SPL) + zend_class_implements(php_imagick_sc_entry TSRMLS_CC, 2, zend_ce_iterator, spl_ce_Countable); +#else + zend_class_implements(php_imagick_sc_entry TSRMLS_CC, 1, zend_ce_iterator); +#endif + + /* + Initialize the class (ImagickDraw) + */ + INIT_CLASS_ENTRY(ce, PHP_IMAGICKDRAW_SC_NAME, php_imagickdraw_class_methods); + ce.create_object = php_imagickdraw_object_new; + imagickdraw_object_handlers.clone_obj = php_imagick_clone_imagickdraw_object; +#ifdef ZEND_ENGINE_3 + imagickdraw_object_handlers.offset = XtOffsetOf(php_imagickdraw_object, zo); + imagickdraw_object_handlers.free_obj = php_imagickdraw_object_free_storage; +#endif + php_imagickdraw_sc_entry = zend_register_internal_class(&ce TSRMLS_CC); + + /* + Initialize the class (ImagickPixelIterator) + */ + INIT_CLASS_ENTRY(ce, PHP_IMAGICKPIXELITERATOR_SC_NAME, php_imagickpixeliterator_class_methods); + ce.create_object = php_imagickpixeliterator_object_new; + imagickpixeliterator_object_handlers.clone_obj = NULL; +#ifdef ZEND_ENGINE_3 + imagickpixeliterator_object_handlers.offset = XtOffsetOf(php_imagickpixeliterator_object, zo); + imagickpixeliterator_object_handlers.free_obj = php_imagickpixeliterator_object_free_storage; +#endif + php_imagickpixeliterator_sc_entry = zend_register_internal_class(&ce TSRMLS_CC); + zend_class_implements(php_imagickpixeliterator_sc_entry TSRMLS_CC, 1, zend_ce_iterator); + + /* + Initialize the class (ImagickPixel) + */ + INIT_CLASS_ENTRY(ce, PHP_IMAGICKPIXEL_SC_NAME, php_imagickpixel_class_methods); + ce.create_object = php_imagickpixel_object_new; + imagickpixel_object_handlers.clone_obj = php_imagick_clone_imagickpixel_object; +#ifdef ZEND_ENGINE_3 + imagickpixel_object_handlers.offset = XtOffsetOf(php_imagickpixel_object, zo); + imagickpixel_object_handlers.free_obj = php_imagickpixel_object_free_storage; +#endif + + php_imagickpixel_sc_entry = zend_register_internal_class(&ce TSRMLS_CC); + +#ifdef IMAGICK_WITH_KERNEL + /* + Initialize the class (ImagickKernel) + */ + INIT_CLASS_ENTRY(ce, PHP_IMAGICKKERNEL_SC_NAME, php_imagickkernel_class_methods); + ce.create_object = php_imagickkernel_object_new; + // Disabled until can be compiled under wall correctly + imagickkernel_object_handlers.get_debug_info = php_imagickkernel_get_debug_info; + imagickkernel_object_handlers.clone_obj = php_imagick_clone_imagickkernel_object; + #ifdef ZEND_ENGINE_3 + imagickkernel_object_handlers.offset = XtOffsetOf(php_imagickkernel_object, zo); + imagickkernel_object_handlers.free_obj = php_imagickkernel_object_free_storage; + #endif + + php_imagickkernel_sc_entry = zend_register_internal_class(&ce TSRMLS_CC); +#endif + + php_imagick_initialize_constants (TSRMLS_C); + +#if defined(ZTS) && defined(PHP_WIN32) + imagick_mutex = tsrm_mutex_alloc(); +#endif + + REGISTER_INI_ENTRIES(); + + if (!IMAGICK_G(skip_version_check)) { + checkImagickVersion(); + } + + return SUCCESS; +} + + +PHP_MINFO_FUNCTION(imagick) +{ + +#ifdef ZEND_ENGINE_3 + smart_string formats = {0}; +#else + smart_str formats = {0}; +#endif + + char **supported_formats, *buffer; + unsigned long i; + size_t num_formats; + size_t version_number; + + num_formats = 0; + + supported_formats = MagickQueryFormats("*", &num_formats); + spprintf(&buffer, 0, "%ld", (long)num_formats); + + php_info_print_table_start(); + php_info_print_table_header(2, "imagick module", "enabled"); + php_info_print_table_row(2, "imagick module version", PHP_IMAGICK_VERSION); +#ifdef IMAGICK_WITH_KERNEL + php_info_print_table_row(2, "imagick classes", "Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel"); +#else + php_info_print_table_row(2, "imagick classes", "Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator"); +#endif +#ifdef MagickVersion + php_info_print_table_row(2, "Imagick compiled with ImageMagick version", MagickVersion); +#endif + php_info_print_table_row(2, "Imagick using ImageMagick library version", MagickGetVersion(&version_number)); + php_info_print_table_row(2, "ImageMagick copyright", MagickGetCopyright()); + php_info_print_table_row(2, "ImageMagick release date", MagickGetReleaseDate()); + php_info_print_table_row(2, "ImageMagick number of supported formats: ", buffer); + + efree (buffer); + + if (supported_formats) { + for (i = 0; i < num_formats; i++) { +#ifdef ZEND_ENGINE_3 + if (i != 0) { + smart_string_appends(&formats, ", "); + } + smart_string_appends(&formats, supported_formats[i]); +#else + smart_str_appends(&formats, supported_formats[i]); + if (i != (num_formats - 1)) { + smart_str_appends(&formats, ", "); + } +#endif + IMAGICK_FREE_MAGICK_MEMORY(supported_formats[i]); + } + +#ifdef ZEND_ENGINE_3 + smart_string_0(&formats); + php_info_print_table_row(2, "ImageMagick supported formats", formats.c); + smart_string_free(&formats); +#else + smart_str_0(&formats); + php_info_print_table_row(2, "ImageMagick supported formats", formats.c); + smart_str_free(&formats); +#endif + IMAGICK_FREE_MAGICK_MEMORY(supported_formats); + } + + php_info_print_table_end(); + DISPLAY_INI_ENTRIES(); +} + + +PHP_MSHUTDOWN_FUNCTION(imagick) +{ +// This suppresses an 'unused parameter' warning. + (void)type; + + + MagickWandTerminus(); + +#if defined(ZTS) && defined(PHP_WIN32) + tsrm_mutex_free(imagick_mutex); +#endif + UNREGISTER_INI_ENTRIES(); + return SUCCESS; +} + +PHP_RINIT_FUNCTION(imagick) +{ + // This suppresses an 'unused parameter' warning. + (void)type; + (void)module_number; + + IMAGICK_G(progress_callback) = NULL; + return SUCCESS; +} + +PHP_RSHUTDOWN_FUNCTION(imagick) +{ + php_imagick_callback* progress_callback = IMAGICK_G(progress_callback); + // This suppresses an 'unused parameter' warning. + (void)type; + (void)module_number; + + if (progress_callback) { + php_imagick_cleanup_progress_callback(progress_callback TSRMLS_CC); + efree(progress_callback); + IMAGICK_G(progress_callback) = NULL; + } + +#if defined(ZTS) && defined(PHP_WIN32) + /* We have the lock so lets release it */ + if (imagick_thread_id == tsrm_thread_id()) { + imagick_thread_id = (THREAD_T)NULL; + tsrm_mutex_unlock(imagick_mutex); + } +#endif + return SUCCESS; +} + +#if ZEND_MODULE_API_NO >= 20050922 +static const zend_module_dep imagick_deps[] = { + ZEND_MOD_CONFLICTS("gmagick") + ZEND_MOD_REQUIRED("standard") +#ifdef HAVE_SPL + ZEND_MOD_REQUIRED("spl") +#endif + ZEND_MOD_END +}; +#endif + +zend_module_entry imagick_module_entry = +{ +#if ZEND_MODULE_API_NO >= 20050922 + STANDARD_MODULE_HEADER_EX, NULL, + imagick_deps, +#else + STANDARD_MODULE_HEADER, +#endif + PHP_IMAGICK_EXTNAME, + php_imagick_functions, /* Functions */ + PHP_MINIT(imagick), /* MINIT */ + PHP_MSHUTDOWN(imagick), /* MSHUTDOWN */ + PHP_RINIT(imagick), /* RINIT */ + PHP_RSHUTDOWN(imagick), + PHP_MINFO(imagick), /* MINFO */ + PHP_IMAGICK_VERSION, + STANDARD_MODULE_PROPERTIES +}; + +#ifdef COMPILE_DL_IMAGICK +ZEND_GET_MODULE(imagick) +#endif diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/imagick_class.c php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/imagick_class.c --- php-imagick-3.4.4/imagick-3.4.4+php8.0/imagick_class.c 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/imagick_class.c 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,12938 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 / Imagick | + +----------------------------------------------------------------------+ + | Copyright (c) 2006-2013 Mikko Koppanen, Scott MacVicar | + | ImageMagick (c) ImageMagick Studio LLC | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Mikko Kopppanen | + | Scott MacVicar | + +----------------------------------------------------------------------+ +*/ + +#include "php_imagick.h" +#include "php_imagick_defs.h" +#include "php_imagick_macros.h" +#include "php_imagick_helpers.h" +#include "php_imagick_file.h" + + +#if MagickLibVersion > 0x628 +/* {{{ proto bool Imagick::pingImageFile(resource filehandle) + Query image information without reading the whole image to memory +*/ +PHP_METHOD(imagick, pingimagefile) +{ + char *filename = NULL; + IM_LEN_TYPE filename_len; + php_imagick_object *intern; + zval *zstream; + php_stream *stream; + zend_bool result; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|s!", &zstream, &filename, &filename_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + +#ifdef ZEND_ENGINE_3 + php_stream_from_zval(stream, zstream); +#else + php_stream_from_zval(stream, &zstream); +#endif + result = php_imagick_stream_handler(intern, stream, ImagickPingImageFile TSRMLS_CC); + + if (result == 0) { + if (!EG(exception)) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to ping image from the filehandle" TSRMLS_CC); + } + return; + } + + if (filename) { + MagickSetImageFilename(intern->magick_wand, filename); + MagickSetLastIterator(intern->magick_wand); + } + RETURN_TRUE; +} +/* }}} */ + + +/* {{{ proto bool Imagick::pingImageBlob(string image ) + Query image information without reading the whole image to memory +*/ +PHP_METHOD(imagick, pingimageblob) +{ + char *image_string; + IM_LEN_TYPE image_string_len; + MagickBooleanType status; + php_imagick_object *intern; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &image_string, &image_string_len) == FAILURE) { + return; + } + + if (image_string_len == 0) { + php_imagick_throw_exception(IMAGICK_CLASS, "Empty image string passed" TSRMLS_CC); + return; + } + + intern = Z_IMAGICK_P(getThis()); + status = MagickPingImageBlob(intern->magick_wand, image_string, image_string_len); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to ping image blob" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::vignetteImage(float blackPoint, float whitePoint, int x, int y ) + Adds vignette filter to the image +*/ +PHP_METHOD(imagick, vignetteimage) +{ + double black_point, white_point; + im_long x, y; + php_imagick_object *intern; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ddll", &black_point, &white_point, &x, &y) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickVignetteImage(intern->magick_wand, black_point, white_point, x, y); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to apply vignette filter" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::transposeImage() + Creates a vertical mirror image +*/ +PHP_METHOD(imagick, transposeimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickTransposeImage(intern->magick_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to transpose image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::transverseImage() + Creates a horizontal mirror image +*/ +PHP_METHOD(imagick, transverseimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickTransverseImage(intern->magick_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to transverse image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::adaptiveBlurImage(float radius, float sigma[, int channel] ) + Adds adaptive blur filter to image +*/ +PHP_METHOD(imagick, adaptiveblurimage) +{ + double radius, sigma; + php_imagick_object *intern; + MagickBooleanType status; + im_long channel = IM_DEFAULT_CHANNEL; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd|l", &radius, &sigma, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickAdaptiveBlurImageChannel(intern->magick_wand, channel, radius, sigma); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to adaptive blur image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::uniqueImageColors() + Discards all but one of any pixel color +*/ +PHP_METHOD(imagick, uniqueimagecolors) +{ + php_imagick_object *intern; + MagickBooleanType status; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickUniqueImageColors(intern->magick_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to get unique image colors" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::contrastStretchImage(float black_point, float white_point[, int channel]) + Enhances the contrast of a color image +*/ +PHP_METHOD(imagick, contraststretchimage) +{ + php_imagick_object *intern; + double black_point, white_point; + MagickBooleanType status; + im_long channel = IM_DEFAULT_CHANNEL; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd|l", &black_point, &white_point, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickContrastStretchImageChannel(intern->magick_wand, channel, black_point, white_point); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to contrast strech image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 +/* {{{ proto int Imagick::getImageMatte() + Returns true if the image has a matte channel otherwise false +*/ +PHP_METHOD(imagick, getimagematte) +{ + php_imagick_object *intern; + MagickBooleanType matte; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + IMAGICK_METHOD_DEPRECATED ("Imagick", "getImageMatte"); + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + matte = MagickGetImageMatte(intern->magick_wand); + + if (matte == MagickTrue) { + RETURN_TRUE; + } else { + RETURN_FALSE; + } +} +/* }}} */ +#endif //#if MagickLibVersion < 0x700 +#endif + +/* {{{ proto bool Imagick::setImageMatte(bool matte) + Sets the image matte channel +*/ +PHP_METHOD(imagick, setimagematte) +{ + php_imagick_object *intern; + zend_bool matte; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &matte) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageMatte(intern->magick_wand, matte); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image matte" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::adaptiveResizeImage(int width, int height[, bool bestfit[, bool legacy]]]) + Adaptively resize image with data dependent triangulation + If legacy is true, the calculations are done with the small rounding bug that existed in + Imagick before 3.4.0. If false, the calculations should produce the same results as + ImageMagick CLI does. +*/ +PHP_METHOD(imagick, adaptiveresizeimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + im_long width, height, new_width, new_height; + zend_bool bestfit = 0; + zend_bool legacy = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll|bb", &width, &height, &bestfit, &legacy) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + if (!php_imagick_thumbnail_dimensions(intern->magick_wand, bestfit, width, height, &new_width, &new_height, legacy)) { + php_imagick_throw_exception(IMAGICK_CLASS, "Invalid image geometry" TSRMLS_CC); + return; + } + + status = MagickAdaptiveResizeImage(intern->magick_wand, new_width, new_height); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to adaptive resize image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ +/* {{{ proto bool Imagick::sketchImage(float radius, float sigma, float angle) + Simulates a pencil sketch +*/ +PHP_METHOD(imagick, sketchimage) +{ + double radius, sigma, angle; + MagickBooleanType status; + php_imagick_object *intern; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ddd", &radius, &sigma, &angle) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSketchImage(intern->magick_wand, sigma, radius, angle); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to sketch image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::shadeImage(bool gray, float azimuth, float elevation) + Shines a distant light on an image +*/ +PHP_METHOD(imagick, shadeimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + double azimuth, elevation; + zend_bool gray; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "bdd", &gray, &azimuth, &elevation) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickShadeImage(intern->magick_wand, gray, azimuth, elevation); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to shade image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto int Imagick::getSizeOffset() + Returns the size offset associated with the Imagick object +*/ +PHP_METHOD(imagick, getsizeoffset) +{ + php_imagick_object *intern; + ssize_t offset; + MagickBooleanType status; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + status = MagickGetSizeOffset(intern->magick_wand, &offset); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to get size offset" TSRMLS_CC); + return; + } + + RETVAL_LONG(offset); +} +/* }}} */ + +/* {{{ proto bool Imagick::setSizeOffset(int columns, int rows, int offset) + Sets the size and offset of the Imagick object +*/ +PHP_METHOD(imagick, setsizeoffset) +{ + php_imagick_object *intern; + im_long columns, rows, offset; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &columns, &rows, &offset) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + status = MagickSetSizeOffset(intern->magick_wand, columns, rows, offset); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set size offset" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::adaptiveSharpenImage(float radius, float sigma[, int channel]) + Adaptively sharpen image with data dependent triangulation +*/ +PHP_METHOD(imagick, adaptivesharpenimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + double radius, sigma; + im_long channel = IM_DEFAULT_CHANNEL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd|l", &radius, &sigma, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickAdaptiveSharpenImageChannel(intern->magick_wand, channel, radius, sigma); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to adaptive sharpen image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + + +/* {{{ proto bool Imagick::randomThresholdImage(float low, float high[, int channel]) + Changes the value of individual pixels +*/ +PHP_METHOD(imagick, randomthresholdimage) +{ + php_imagick_object *intern; + double low, high; + MagickBooleanType status; + im_long channel = IM_DEFAULT_CHANNEL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd|l", &low, &high, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickRandomThresholdImageChannel(intern->magick_wand, channel, low, high); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to random threshold image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto string Imagick::roundCornersImage(float x_rounding, float y_rounding[, float stroke_width = 10[, float displace = 5[, float size_correction = -6]]] ) + Rounds image corners +*/ +#if MagickLibVersion < 0x700 +PHP_METHOD(imagick, roundcornersimage) +{ + char *old_locale; + double x_rounding, y_rounding; + DrawingWand *draw; + MagickWand *mask_image; + PixelWand *color; + php_imagick_object *intern; + long image_width, image_height; + MagickBooleanType status; + double stroke_width = 10, displace = 5, correction = -6; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd|ddd", &x_rounding, &y_rounding, &stroke_width, &displace, &correction) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + image_width = MagickGetImageWidth(intern->magick_wand); + image_height = MagickGetImageHeight(intern->magick_wand); + + if (!image_width || !image_height) { + php_imagick_throw_exception(IMAGICK_CLASS, "Unable to round corners on empty image" TSRMLS_CC); + return; + } + + status = MagickSetImageMatte(intern->magick_wand, MagickTrue); + + if (status == MagickFalse) { + php_imagick_throw_exception(IMAGICK_CLASS, "Unable to set image matte" TSRMLS_CC); + return; + } + + /* Here we go.. */ + color = NewPixelWand(); + if (!color) { + php_imagick_throw_exception (IMAGICK_CLASS, "Failed to allocate PixelWand structure" TSRMLS_CC); + return; + } + + draw = NewDrawingWand(); + if (!draw) { + DestroyPixelWand (color); + php_imagick_throw_exception (IMAGICK_CLASS, "Failed to allocate DrawingWand structure" TSRMLS_CC); + return; + } + + mask_image = NewMagickWand(); + if (!mask_image) { + DestroyPixelWand (color); + DestroyDrawingWand (draw); + php_imagick_throw_exception (IMAGICK_CLASS, "Failed to allocate MagickWand structure" TSRMLS_CC); + return; + } + + +#define exit_cleanup() \ + if (color != NULL) color = DestroyPixelWand(color); \ + if (draw != NULL) draw = DestroyDrawingWand(draw); \ + if (mask_image != NULL) mask_image = DestroyMagickWand(mask_image); + + status = PixelSetColor(color, "transparent"); + + if (status == MagickFalse) { + exit_cleanup(); + php_imagick_throw_exception(IMAGICK_CLASS, "Unable to set pixel color" TSRMLS_CC); + return; + } + + status = MagickNewImage(mask_image, image_width, image_height, color); + + if (status == MagickFalse) { + exit_cleanup(); + php_imagick_throw_exception(IMAGICK_CLASS, "Unable to allocate mask image" TSRMLS_CC); + return; + } + + MagickSetImageBackgroundColor(mask_image, color); + status = PixelSetColor(color, "white"); + + if (status == MagickFalse) { + exit_cleanup(); + php_imagick_throw_exception(IMAGICK_CLASS, "Unable to set pixel color" TSRMLS_CC); + return; + } + + DrawSetFillColor(draw, color); + status = PixelSetColor(color, "black"); + + if (status == MagickFalse) { + exit_cleanup(); + php_imagick_throw_exception(IMAGICK_CLASS, "Unable to set pixel color" TSRMLS_CC); + return; + } + + DrawSetStrokeColor(draw, color); + DrawSetStrokeWidth(draw, stroke_width); + DrawRoundRectangle(draw, displace, displace, image_width + correction, image_height + correction, x_rounding, y_rounding); + + old_locale = php_imagick_set_locale (TSRMLS_C); + + status = MagickDrawImage(mask_image, draw); + + php_imagick_restore_locale (old_locale); + + if (old_locale) + efree (old_locale); + + if (status == MagickFalse) { + exit_cleanup(); + php_imagick_throw_exception(IMAGICK_CLASS, "Unable to draw on image" TSRMLS_CC); + return; + } + + status = MagickCompositeImage(intern->magick_wand, mask_image, DstInCompositeOp, 0, 0); + + if (status == MagickFalse) { + exit_cleanup(); + php_imagick_throw_exception(IMAGICK_CLASS, "Unable to composite image" TSRMLS_CC); + return; + } + + exit_cleanup(); + RETURN_TRUE; +#undef exit_cleanup +} +/* }}} */ +#endif + +/* {{{ proto int Imagick::getIteratorIndex() + Returns the index of the current active image +*/ +PHP_METHOD(imagick, getiteratorindex) +{ + MagickBooleanType status; + php_imagick_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + status = MagickGetIteratorIndex(intern->magick_wand); + ZVAL_LONG(return_value, (long)status); + return; +} +/* }}} */ + +/* {{{ proto bool Imagick::setIteratorIndex(int index) + Sets the index of the Imagick object +*/ +PHP_METHOD(imagick, setiteratorindex) +{ + const im_long index; + MagickBooleanType status; + php_imagick_object *intern; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &index) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + status = MagickSetIteratorIndex(intern->magick_wand, index); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set iterator index" TSRMLS_CC); + return; + } + + intern->next_out_of_bound = 0; + RETURN_TRUE; +} +/* }}} */ + +#if MagickLibVersion < 0x700 +/* {{{ proto Imagick Imagick::transformimage(string crop, string geometry ) + Comfortability method for crop and resize +*/ +PHP_METHOD(imagick, transformimage) +{ + char *crop, *geometry; + IM_LEN_TYPE crop_len, geometry_len; + MagickWand *transformed; + php_imagick_object *intern, *intern_return; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &crop, &crop_len, &geometry, &geometry_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + transformed = MagickTransformImage(intern->magick_wand, crop, geometry); + + if (!transformed) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Transforming image failed" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagick_sc_entry); + intern_return = Z_IMAGICK_P(return_value); + + php_imagick_replace_magickwand(intern_return, transformed); + return; +} +#endif //#if MagickLibVersion < 0x700 + +/* }}} */ +#endif + +#if MagickLibVersion > 0x630 +#if MagickLibVersion < 0x700 +/* {{{ proto bool Imagick::setImageOpacity(float opacity) + Sets the image to the specified opacity level +*/ +PHP_METHOD(imagick, setimageopacity) +{ + double opacity; + MagickBooleanType status; + php_imagick_object *intern; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &opacity) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageOpacity(intern->magick_wand, opacity); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image opacity" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ +#endif + + + +#if MagickLibVersion >= 0x700 +/* {{{ proto bool Imagick::setImageAlpha(float alpha) + Sets the image to the specified alpha level +*/ +PHP_METHOD(imagick, setimagealpha) +{ + double alpha; + MagickBooleanType status; + php_imagick_object *intern; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &alpha) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageAlpha(intern->magick_wand, alpha); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image alpha" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ +#endif + + + +#if MagickLibVersion < 0x700 +/* {{{ proto bool Imagick::orderedposterizeImage(string threshold_map[, int CHANNEL]) + Performs an ordered dither +*/ +PHP_METHOD(imagick, orderedposterizeimage) +{ + char *map; + IM_LEN_TYPE map_len; + MagickBooleanType status; + php_imagick_object *intern; + im_long channel = IM_DEFAULT_CHANNEL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &map, &map_len, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickOrderedPosterizeImageChannel(intern->magick_wand, channel, map); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to posterize image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ +#endif //#if MagickLibVersion < 0x700 +#endif //#if MagickLibVersion > 0x630 + +#if MagickLibVersion > 0x631 +/* {{{ proto bool Imagick::polaroidImage(ImagickDraw properties, double angle ) + Simulates a Polaroid picture +*/ +PHP_METHOD(imagick, polaroidimage) +{ + zval *objvar; + php_imagick_object *intern; + MagickBooleanType status; + php_imagickdraw_object *internd; + double angle; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Od", &objvar, php_imagickdraw_sc_entry, &angle) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + internd = Z_IMAGICKDRAW_P(objvar); +#if MagickLibVersion >= 0x700 + { + PixelInterpolateMethod method = BilinearInterpolatePixel; + char *caption = "TODO FIXME"; + status = MagickPolaroidImage(intern->magick_wand,internd->drawing_wand,caption,angle,method); + } +#else + status = MagickPolaroidImage(intern->magick_wand, internd->drawing_wand, angle); +#endif + + + + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to polaroid image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto string Imagick::getImageProperty(string name ) + Eeturns a value associated with the specified property +*/ +PHP_METHOD(imagick, getimageproperty) +{ + php_imagick_object *intern; + char *name, *value; + IM_LEN_TYPE name_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + value = MagickGetImageProperty(intern->magick_wand, name); + + if (value) { + IM_ZVAL_STRING(return_value, (char *)value); + IMAGICK_FREE_MAGICK_MEMORY(value); + return; + } + RETURN_FALSE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setImageProperty(string name, string value ) + returns a value associated with the specified property +*/ +PHP_METHOD(imagick, setimageproperty) +{ + php_imagick_object *intern; + char *name, *value; + IM_LEN_TYPE name_len, value_len; + MagickBooleanType status; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &name, &name_len, &value, &value_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + status = MagickSetImageProperty(intern->magick_wand, name, value); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image property" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::deleteimageproperty(string name) + Deletes an image property. +*/ +PHP_METHOD(imagick, deleteimageproperty) +{ + php_imagick_object *intern; + char *name; + IM_LEN_TYPE name_len; + MagickBooleanType status; + + Image *image; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + image = GetImageFromMagickWand(intern->magick_wand); + status = DeleteImageProperty(image, name); + + if (status == MagickFalse) { + RETURN_FALSE; + } + + RETURN_TRUE; +} +/* }}} */ + + +/* {{{ proto bool Imagick::identifyformat(string embedText) + Replaces any embedded formatting characters with the appropriate image property and returns the interpreted text. See http://www.imagemagick.org/script/escape.php for escape sequences. +*/ +PHP_METHOD(imagick, identifyformat) +{ + php_imagick_object *intern; + char *embedText; + IM_LEN_TYPE embedText_len; + char *result; + + ImageInfo *image_info; + Image *image; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &embedText, &embedText_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) { + return; + } + + image_info = AcquireImageInfo(); + image = GetImageFromMagickWand(intern->magick_wand); + +#if MagickLibVersion >= 0x700 + { + //TODO - handle exception info. + ExceptionInfo *exception = NULL; + result = InterpretImageProperties(image_info, image, embedText, exception); + } +#else + result = InterpretImageProperties(image_info, image, embedText); +#endif + image_info = DestroyImageInfo(image_info); + + if (result) { +#ifdef ZEND_ENGINE_3 + RETVAL_STRING(result); +#else + RETVAL_STRING(result, 1); +#endif + IMAGICK_FREE_MAGICK_MEMORY(result); + + return; + } + + RETURN_FALSE; +} +/* }}} */ + +/* {{{ proto int Imagick::getImageInterpolateMethod() + Returns the interpolation method for the sepcified image. +*/ +PHP_METHOD(imagick, getimageinterpolatemethod) +{ + php_imagick_object *intern; + long interpolate; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + interpolate = MagickGetImageInterpolateMethod(intern->magick_wand); + RETVAL_LONG(interpolate); +} +/* }}} */ + +#if MagickLibVersion >= 0x631 +/* {{{ proto bool Imagick::setImageInterpolateMethod(int method) + Sets the image interpolate pixel method. +*/ +PHP_METHOD(imagick, setimageinterpolatemethod) +{ + php_imagick_object *intern; + im_long interpolate; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &interpolate) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageInterpolateMethod(intern->magick_wand, interpolate); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set the image interpolate method" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ +#endif // #if MagickLibVersion >= 0x631 + +/* {{{ proto bool Imagick::linearStretchImage(float blackPoint, float whitePoint) + Stretches with saturation the image intensity. +*/ +PHP_METHOD(imagick, linearstretchimage) +{ + php_imagick_object *intern; + double blackPoint, whitePoint; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &blackPoint, &whitePoint) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickLinearStretchImage(intern->magick_wand, blackPoint, whitePoint); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to linear strech image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto int Imagick::getImageLength() + returns the image length in bytes +*/ +PHP_METHOD(imagick, getimagelength) +{ + php_imagick_object *intern; + MagickSizeType length; + MagickBooleanType status; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickGetImageLength(intern->magick_wand, &length); + + if (status == MagickFalse) { + php_imagick_throw_exception(IMAGICK_CLASS, "Unable to acquire image length" TSRMLS_CC); + return; + } + + RETVAL_LONG(length); +} +/* }}} */ + +/* {{{ proto bool Imagick::extentImage(int width, int height, int x, int y ) + Sets the image size +*/ +PHP_METHOD(imagick, extentimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + im_long width, height, x, y; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &width, &height, &x, &y) == FAILURE) + { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickExtentImage(intern->magick_wand, width, height, x, y); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to extent image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ +#endif + +#if MagickLibVersion > 0x633 +/* {{{ proto Imagick Imagick::getImageOrientation(void) + Gets the image orientation +*/ +PHP_METHOD(imagick, getimageorientation) +{ + php_imagick_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + RETVAL_LONG(MagickGetImageOrientation(intern->magick_wand)); +} +/* }}} */ + +/* {{{ proto Imagick Imagick::setImageOrientation(int orientation) + Sets the image orientation +*/ +PHP_METHOD(imagick, setimageorientation) +{ + php_imagick_object *intern; + im_long orientation; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &orientation) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageOrientation(intern->magick_wand, orientation); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image orientation" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ +#endif + +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion > 0x634 +#if MagickLibVersion < 0x700 +/* {{{ proto Imagick Imagick::paintFloodfillImage(mixed fill, float fuzz, mixed bordercolor, int x, int y[, int channel]) + Sets the image orientation +*/ +PHP_METHOD(imagick, paintfloodfillimage) +{ + php_imagick_object *intern; + zval *fill_param, *border_param; + im_long x, y, channel = DefaultChannels; + double fuzz; + MagickBooleanType status; + PixelWand *fill_wand, *border_wand = NULL; + zend_bool fill_allocated = 0, border_allocated = 0; + + IMAGICK_METHOD_DEPRECATED ("Imagick", "paintFloodfillImage"); + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zdzll|l", &fill_param, &fuzz, &border_param, &x, &y, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + fill_wand = php_imagick_zval_to_pixelwand (fill_param, IMAGICK_CLASS, &fill_allocated TSRMLS_CC); + if (!fill_wand) + return; + + if (Z_TYPE_P(border_param) == IS_NULL) { + status = MagickPaintFloodfillImage(intern->magick_wand, channel, fill_wand, fuzz, NULL, x, y); + } else { + border_wand = php_imagick_zval_to_pixelwand (border_param, IMAGICK_CLASS, &border_allocated TSRMLS_CC); + if (!border_wand) { + if (fill_allocated) + DestroyPixelWand (fill_wand); + return; + } + status = MagickPaintFloodfillImage(intern->magick_wand, channel, fill_wand, fuzz, border_wand, x, y); + } + + if (fill_allocated) + DestroyPixelWand (fill_wand); + + if (border_wand) + DestroyPixelWand (border_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to paint floodfill image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ +#endif // #if MagickLibVersion < 0x700 +#endif +#endif + +#if MagickLibVersion > 0x635 +/* {{{ proto Imagick Imagick::clutImage(Imagick lookup[, int channel] ) + Replaces colors in the image from a color lookup table +*/ +PHP_METHOD(imagick, clutimage) +{ + zval *objvar; + php_imagick_object *intern, *lookup; + MagickBooleanType status; + im_long channel = IM_DEFAULT_CHANNEL; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|l", &objvar, php_imagick_sc_entry, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + lookup = Z_IMAGICK_P(objvar); + if (php_imagick_ensure_not_empty (lookup->magick_wand) == 0) + return; + + status = MagickClutImageChannel(intern->magick_wand, channel, lookup->magick_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to replace colors in the image from a color lookup table" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto Imagick Imagick::getImageProperties([string pattern, bool values] ) + Returns all the property names that match the specified pattern +*/ +PHP_METHOD(imagick, getimageproperties) +{ + zend_bool values = 1; + char *pattern = "*", **properties, *property; + IM_LEN_TYPE pattern_len; + unsigned long i; + size_t properties_count; + php_imagick_object *intern; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sb", &pattern, &pattern_len, &values) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + properties = MagickGetImageProperties(intern->magick_wand, pattern, &properties_count); + + if (!properties) { + php_imagick_throw_exception(IMAGICK_CLASS, "Unable to get image properties" TSRMLS_CC); + return; + } + + array_init(return_value); + + if (values) { + + for (i = 0; i < properties_count; i++) { + property = MagickGetImageProperty(intern->magick_wand, properties[i]); + IM_add_assoc_string(return_value, properties[i], property); + IMAGICK_FREE_MAGICK_MEMORY(property); + } + + } else { + + for (i = 0; i < properties_count; i++) { + IM_add_next_index_string(return_value, properties[i]); + } + } + + IMAGICK_FREE_MAGICK_MEMORY(properties); + return; +} +/* }}} */ + +/* {{{ proto Imagick Imagick::getImageProfiles([string pattern, bool values] ) + Returns all the profile names that match the specified pattern +*/ +PHP_METHOD(imagick, getimageprofiles) +{ + zend_bool values = 1; + char *pattern = "*", **profiles, *profile; + IM_LEN_TYPE pattern_len; + unsigned long i; + php_imagick_object *intern; + size_t length, profiles_count; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sb", &pattern, &pattern_len, &values) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + profiles = MagickGetImageProfiles(intern->magick_wand, pattern, &profiles_count); + + if (!profiles) { + php_imagick_throw_exception(IMAGICK_CLASS, "Unable to get image profiles" TSRMLS_CC); + return; + } + + array_init(return_value); + + if (values) { + + for (i = 0; i < profiles_count; i++) { + + profile = (char *)MagickGetImageProfile(intern->magick_wand, profiles[i], &length); +#ifdef ZEND_ENGINE_3 + add_assoc_stringl(return_value, profiles[i], profile, length); +#else + add_assoc_stringl(return_value, profiles[i], profile, length, 1); +#endif + IMAGICK_FREE_MAGICK_MEMORY(profile); + } + + } else { + + for (i = 0; i < profiles_count; i++) { + IM_add_next_index_string(return_value, profiles[i]); + } + } + + IMAGICK_FREE_MAGICK_MEMORY(profiles); + return; +} +/* }}} */ +#endif + +#if MagickLibVersion > 0x635 +/* {{{ proto Imagick Imagick::distortImage(int distortMethod, array arguments, bool bestfit ) + Distorts an image using various distortion methods +*/ +PHP_METHOD(imagick, distortimage) +{ + php_imagick_object *intern; + double *arguments; + im_long distort_method, elements; + zend_bool bestfit; + zval *arg_array; + MagickBooleanType status; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lab", &distort_method, &arg_array, &bestfit) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + arguments = php_imagick_zval_to_double_array(arg_array, &elements TSRMLS_CC); + + if (!arguments) { + php_imagick_throw_exception (IMAGICK_CLASS, "Can't read argument array" TSRMLS_CC); + return; + } + + status = MagickDistortImage(intern->magick_wand, distort_method, elements, arguments, bestfit); + efree(arguments); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to distort the image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::writeImageFile(resource $handle[, string $format]) + Writes image to an open filehandle. Optional parameter format defines the format the file + is stored with +*/ +PHP_METHOD(imagick, writeimagefile) +{ + php_imagick_object *intern; + zval *zstream; + php_stream *stream; + zend_bool result; + char *format = NULL; + IM_LEN_TYPE format_len; + char *orig_name = NULL, *buffer; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|s!", &zstream, &format, &format_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + // Get the current name + if (format) { + orig_name = MagickGetImageFilename (intern->magick_wand); + + spprintf (&buffer, 0, "%s:", format); + MagickSetImageFilename (intern->magick_wand, buffer); + efree (buffer); + } + +#ifdef ZEND_ENGINE_3 + php_stream_from_zval(stream, zstream); +#else + php_stream_from_zval(stream, &zstream); +#endif + result = php_imagick_stream_handler(intern, stream, ImagickWriteImageFile TSRMLS_CC); + + /* Restore the original name after write */ + if (orig_name) { + MagickSetImageFilename (intern->magick_wand, orig_name); + MagickRelinquishMemory (orig_name); + } + + if (result == 0) { + /* php_stream_cast returns warning on some streams but still does not return FAILURE */ + if (!EG(exception)) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to write image to the filehandle" TSRMLS_CC); + return; + } + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::writeImagesFile(resource $handle[, string $format]) + Writes images to an open filehandle +*/ +PHP_METHOD(imagick, writeimagesfile) +{ + php_imagick_object *intern; + zval *zstream; + php_stream *stream; + zend_bool result; + char *format = NULL; + IM_LEN_TYPE format_len; + char *orig_name = NULL, *buffer; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|s!", &zstream, &format, &format_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + // Get the current name + if (format) { + orig_name = MagickGetImageFilename (intern->magick_wand); + + spprintf (&buffer, 0, "%s:", format); + MagickSetImageFilename (intern->magick_wand, buffer); + efree (buffer); + } + +#ifdef ZEND_ENGINE_3 + php_stream_from_zval(stream, zstream); +#else + php_stream_from_zval(stream, &zstream); +#endif + result = php_imagick_stream_handler(intern, stream, ImagickWriteImagesFile TSRMLS_CC); + + /* Restore the original name after write */ + if (orig_name) { + MagickSetImageFilename (intern->magick_wand, orig_name); + MagickRelinquishMemory (orig_name); + } + + if (result == 0) { + if (!EG(exception)) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to write images to the filehandle" TSRMLS_CC); + return; + } + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::resetImagePage(string page) + Resets the page canvas and position +*/ +PHP_METHOD(imagick, resetimagepage) +{ + php_imagick_object *intern; + MagickBooleanType status; + char *page; + IM_LEN_TYPE page_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &page, &page_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickResetImagePage(intern->magick_wand, page); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to reset image page" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + + +/* {{{ proto Imagick Imagick::getImageClipMask() + Gets image clip mask +*/ +#if MagickLibVersion < 0x700 +PHP_METHOD(imagick, getimageclipmask) +{ + MagickWand *tmp_wand; + php_imagick_object *intern; + php_imagick_object *intern_return; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + tmp_wand = MagickGetImageClipMask(intern->magick_wand); + + /* No magick is going to happen */ + if (!tmp_wand) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to get image clip mask" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagick_sc_entry); + intern_return = Z_IMAGICK_P(return_value); + + php_imagick_replace_magickwand(intern_return, tmp_wand); + return; +} +#endif +/* }}} */ + +/* {{{ proto bool Imagick::setImageClipMask(Imagick clip_mask) + Sets the image clip mask +*/ +#if MagickLibVersion < 0x700 +PHP_METHOD(imagick, setimageclipmask) +{ + php_imagick_object *intern; + php_imagick_object *clip_mask; + MagickBooleanType status; + zval *objvar; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &objvar, php_imagick_sc_entry) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + clip_mask = Z_IMAGICK_P(objvar); + if (php_imagick_ensure_not_empty (clip_mask->magick_wand) == 0) + return; + + status = MagickSetImageClipMask(intern->magick_wand, clip_mask->magick_wand); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image clip mask" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +#endif +/* }}} */ + +/* {{{ proto bool Imagick::animateImages(string server_name) + Animates an image or image sequence +*/ +PHP_METHOD(imagick, animateimages) +{ + php_imagick_object *intern; + MagickBooleanType status; + char *server_name; + IM_LEN_TYPE server_name_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &server_name, &server_name_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + /* TODO: should this call be there? Not sure */ + (void)MagickSetFirstIterator(intern->magick_wand); + status = MagickAnimateImages(intern->magick_wand, server_name); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to animate images" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 +/* {{{ proto bool Imagick::recolorImage(array matrix) + Translate, scale, shear, or rotate image colors +*/ +PHP_METHOD(imagick, recolorimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + im_long num_elements; + zval *matrix; + double *array; + unsigned long order; + + IMAGICK_METHOD_DEPRECATED ("Imagick", "recolorImage"); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &matrix) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + array = php_imagick_zval_to_double_array(matrix, &num_elements TSRMLS_CC); + + if (!array) { + php_imagick_throw_exception (IMAGICK_CLASS, "The map contains disallowed characters" TSRMLS_CC); + return; + } + + order = (unsigned long)sqrt(num_elements); + + if ((order * order) != num_elements) { + efree(array); + php_imagick_throw_exception(IMAGICK_CLASS, "The color matrix must contain a square number of elements" TSRMLS_CC); + return; + } + + status = MagickRecolorImage(intern->magick_wand, order, array); + efree(array); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to recolor image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ +#endif +#endif +#endif + +#if MagickLibVersion > 0x636 +PHP_METHOD(imagick, setfont) +{ + php_imagick_object *intern; + char *font, *absolute; + IM_LEN_TYPE font_len; + MagickBooleanType status; + php_imagick_rw_result_t rc; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &font, &font_len) == FAILURE) { + return; + } + + /* Check that no empty string is passed */ + if (font_len == 0) { + php_imagick_throw_exception(IMAGICK_CLASS, "Can not set empty font" TSRMLS_CC); + return; + } + + intern = Z_IMAGICK_P(getThis()); + + /* And if it wasn't */ + if (!php_imagick_check_font(font, font_len TSRMLS_CC)) { + + if (!(absolute = expand_filepath(font, NULL TSRMLS_CC))) { + php_imagick_throw_exception(IMAGICK_CLASS, "Unable to set font" TSRMLS_CC); + return; + } + + if ((rc = php_imagick_file_access_check (absolute TSRMLS_CC)) != IMAGICK_RW_OK) { + php_imagick_rw_fail_to_exception (intern->magick_wand, rc, absolute TSRMLS_CC); + efree(absolute); + return; + } + status = MagickSetFont(intern->magick_wand, absolute); + efree(absolute); + } else { + status = MagickSetFont(intern->magick_wand, font); + } + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set font" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} + +PHP_METHOD(imagick, getfont) +{ + char *font; + php_imagick_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + font = MagickGetFont(intern->magick_wand); + + if (font) { + IM_ZVAL_STRING(return_value, font); + IMAGICK_FREE_MAGICK_MEMORY(font); + return; + } + RETURN_FALSE; +} + +PHP_METHOD(imagick, setpointsize) +{ + php_imagick_object *intern; + double point_size; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &point_size) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + status = MagickSetPointsize(intern->magick_wand, point_size); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set point size" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} + +PHP_METHOD(imagick, getpointsize) +{ + php_imagick_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + RETVAL_DOUBLE(MagickGetPointsize(intern->magick_wand)); +} + +PHP_METHOD(imagick, mergeimagelayers) +{ + php_imagick_object *intern, *intern_return; + im_long layer_method; + MagickWand *merged; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &layer_method) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + /* TODO: SHOULD THIS BE HERE? + Reset the iterator */ + (void)MagickSetFirstIterator(intern->magick_wand); + + merged = MagickMergeImageLayers(intern->magick_wand, layer_method); + + /* No magick is going to happen */ + if (!merged) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to merge image layers" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagick_sc_entry); + intern_return = Z_IMAGICK_P(return_value); + + php_imagick_replace_magickwand(intern_return, merged); + return; +} +#endif + +#if MagickLibVersion > 0x637 +/* {{{ proto bool Imagick::floodfillPaintImage(mixed fill, float fuzz, mixed bordercolor, int x, int y, bool invert[, int CHANNEL]) + Changes the color value of any pixel that matches target +*/ +PHP_METHOD(imagick, floodfillpaintimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + zval *fill_param, *border_param; + im_long x, y, channel = IM_DEFAULT_CHANNEL; + zend_bool invert; + double fuzz; + PixelWand *fill_wand, *border_wand; + zend_bool fill_allocated = 0, border_allocated = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zdzllb|l", + &fill_param, &fuzz, &border_param, &x, &y, &invert, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + fill_wand = php_imagick_zval_to_pixelwand (fill_param, IMAGICK_CLASS, &fill_allocated TSRMLS_CC); + if (!fill_wand) + return; + + border_wand = php_imagick_zval_to_pixelwand (border_param, IMAGICK_CLASS, &border_allocated TSRMLS_CC); + if (!border_wand) { + if (fill_allocated) + fill_wand = DestroyPixelWand (fill_wand); + + return; + } + +#if MagickLibVersion >= 0x700 + status = MagickFloodfillPaintImageChannel(intern->magick_wand, channel, fill_wand, fuzz, border_wand, x, y, invert); +#else + status = MagickFloodfillPaintImage(intern->magick_wand, channel, fill_wand, fuzz, border_wand, x, y, invert); +#endif + + if (fill_allocated) + fill_wand = DestroyPixelWand (fill_wand); + + if (border_allocated) + border_wand = DestroyPixelWand (border_wand); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception (intern->magick_wand, "Unable to floodfill paint image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::opaquePaintImage(mixed target, mixed fill, float fuzz, bool invert[, int CHANNEL]) + Changes any pixel that matches color with the color defined by fill. +*/ +PHP_METHOD(imagick, opaquepaintimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + zval *fill_param, *target_param; + zend_bool invert; + double fuzz; + im_long channel = IM_DEFAULT_CHANNEL; + PixelWand *fill_wand, *target_wand; + zend_bool fill_allocated = 0, target_allocated = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzdb|l", &fill_param, &target_param, &fuzz, &invert, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + fill_wand = php_imagick_zval_to_pixelwand (fill_param, IMAGICK_CLASS, &fill_allocated TSRMLS_CC); + if (!fill_wand) + return; + + target_wand = php_imagick_zval_to_pixelwand (target_param, IMAGICK_CLASS, &target_allocated TSRMLS_CC); + if (!target_wand) { + if (fill_allocated) + DestroyPixelWand (fill_wand); + return; + } + + status = MagickOpaquePaintImageChannel(intern->magick_wand, channel, fill_wand, target_wand, fuzz, invert); + + if (fill_allocated) + DestroyPixelWand (fill_wand); + + if (target_allocated) + DestroyPixelWand (target_wand); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to opaque paint image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::transparentPaintImage(mixed target, float alpha, float fuzz, bool invert) + Changes any pixel that matches color with the color defined by fill +*/ +PHP_METHOD(imagick, transparentpaintimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + zval *target_param; + zend_bool invert; + double fuzz, alpha; + PixelWand *target_wand; + zend_bool target_allocated; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zddb", &target_param, &alpha, &fuzz, &invert) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + target_wand = php_imagick_zval_to_pixelwand (target_param, IMAGICK_CLASS, &target_allocated TSRMLS_CC); + if (!target_wand) + return; + + status = MagickTransparentPaintImage(intern->magick_wand, target_wand, alpha, fuzz, invert); + + if (target_allocated) + target_wand = DestroyPixelWand (target_wand); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to paint transparent image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto Imagick Imagick::setImageAlphaChannel(int ALPHACHANNEL ) + Activates, deactivates, resets, or sets the alpha channel +*/ +PHP_METHOD(imagick, setimagealphachannel) +{ + php_imagick_object *intern; + im_long alpha_channel; + MagickBooleanType status; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &alpha_channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageAlphaChannel(intern->magick_wand, alpha_channel); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image alpha channel" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +#endif + +#if MagickLibVersion > 0x638 +/* {{{ proto Imagick Imagick::liquidRescaleImage(int cols, int rows, float delta_x, float rigidity ) + Rescales image with seam carving +*/ +PHP_METHOD(imagick, liquidrescaleimage) +{ + php_imagick_object *intern; + im_long cols, rows; + double delta_x, rigidity; + MagickBooleanType status; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lldd", &cols, &rows, &delta_x, &rigidity) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickLiquidRescaleImage(intern->magick_wand, cols, rows, delta_x, rigidity); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to liquid rescale image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::decipherImage(string passphrase) + Converts cipher pixels to plain pixels +*/ +PHP_METHOD(imagick, decipherimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + char *passphrase; + IM_LEN_TYPE passphrase_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &passphrase, &passphrase_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickDecipherImage(intern->magick_wand, passphrase); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to decipher image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::encipherImage(string passphrase) + Converts plain pixels to cipher pixels +*/ +PHP_METHOD(imagick, encipherimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + char *passphrase; + IM_LEN_TYPE passphrase_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &passphrase, &passphrase_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickEncipherImage(intern->magick_wand, passphrase); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to encipher image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ +#endif + +#if MagickLibVersion > 0x639 +/* {{ proto bool Imagick::setGravity(int GRAVITY) + Sets the gravity value +*/ +PHP_METHOD(imagick, setgravity) +{ + php_imagick_object *intern; + im_long gravity; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &gravity) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (MagickSetGravity(intern->magick_wand, gravity) == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set gravity" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{ proto int Imagick::getGravity() + Gets the gravity value +*/ +PHP_METHOD(imagick, getgravity) +{ + php_imagick_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + RETVAL_LONG(MagickGetGravity(intern->magick_wand)); +} +/* }}} */ + +/* {{ proto Imagick Imagick::getImageChannelRange(int CHANNEL) + Gets the image channel's range + */ +PHP_METHOD(imagick, getimagechannelrange) +{ + php_imagick_object *intern; + im_long channel; + double maxima, minima; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (MagickGetImageChannelRange(intern->magick_wand, channel, &minima, &maxima) == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to get channel range" TSRMLS_CC); + return; + } + + array_init(return_value); + + add_assoc_double(return_value, "minima", minima); + add_assoc_double(return_value, "maxima", maxima); + + return; +} +/* }}} */ + +/* {{{ proto int Imagick::getImageAlphaChannel() + Gets the image alpha channel value +*/ +PHP_METHOD(imagick, getimagealphachannel) +{ + php_imagick_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + RETVAL_LONG(MagickGetImageAlphaChannel(intern->magick_wand)); +} +/* }}} */ +#endif + +#if MagickLibVersion > 0x642 +/* {{{ proto float Imagick::getImageChannelDistortions(Imagick reference, int METRICTYPE[, int CHANNEL]) + Compares one or more image channels of an image to a reconstructed image and returns the specified distortion metrics +*/ +PHP_METHOD(imagick, getimagechanneldistortions) +{ + php_imagick_object *intern; + php_imagick_object *intern_reference; + zval *reference_param; + double distortion; + im_long metric, channel = DefaultChannels; + MagickBooleanType status; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol|l", &reference_param, php_imagick_sc_entry, &metric, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + intern_reference = Z_IMAGICK_P(reference_param); + if (php_imagick_ensure_not_empty (intern_reference->magick_wand) == 0) + return; + + status = MagickGetImageChannelDistortion(intern->magick_wand, intern_reference->magick_wand, channel, metric, &distortion); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to get image channel distortion metrics" TSRMLS_CC); + return; + } + + RETVAL_DOUBLE(distortion); +} +/* }}} */ +#endif + +#if MagickLibVersion > 0x643 +/* {{{ proto int Imagick::getImageGravity() + Gets the image gravity +*/ +PHP_METHOD(imagick, getimagegravity) +{ + php_imagick_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + RETVAL_LONG(MagickGetImageGravity(intern->magick_wand)); +} +/* }}} */ + +/* {{{ proto bool Imagick::setImageGravity(int GRAVITY) + Sets the image gravity +*/ +PHP_METHOD(imagick, setimagegravity) +{ + php_imagick_object *intern; + MagickBooleanType status; + im_long gravity; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &gravity) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageGravity(intern->magick_wand, gravity); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image gravity" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ +#endif + +#if MagickLibVersion > 0x645 +/* {{ proto Imagick Imagick::importImagePixels(int x, int y, int width, int height, string map, int STORAGE, array pixels) + Accepts pixel data and stores it in the image at the location you specify + */ +PHP_METHOD(imagick, importimagepixels) +{ + double *double_array; + im_long *long_array; + unsigned char *char_array; + + php_imagick_object *intern; + MagickBooleanType status; + + im_long storage, num_elements; + im_long x, y, width, height; + IM_LEN_TYPE map_len; + char *map; + zval *pixels; + HashTable *array; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llllsla", &x, &y, &width, &height, &map, &map_len, &storage, &pixels) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + if (x < 0 || y < 0) { + php_imagick_throw_exception (IMAGICK_CLASS, "The coordinates must be non-negative" TSRMLS_CC); + return; + } + + if (width <= 0 || height <= 0) { + php_imagick_throw_exception(IMAGICK_CLASS, "The width and height must be greater than zero" TSRMLS_CC); + return; + } + + array = Z_ARRVAL_P(pixels); + + if (zend_hash_num_elements(array) != ((width * height) * map_len)) { + php_imagick_throw_exception(IMAGICK_CLASS, "The map contains incorrect number of elements" TSRMLS_CC); + return; + } else { + if (!php_imagick_validate_map(map TSRMLS_CC)) { + php_imagick_throw_exception(IMAGICK_CLASS, "The map contains disallowed characters" TSRMLS_CC); + return; + } + } + + switch (storage) { + case FloatPixel: + case DoublePixel: + /* Use doubles */ + storage = DoublePixel; + double_array = php_imagick_zval_to_double_array(pixels, &num_elements TSRMLS_CC); + if (!double_array) { + php_imagick_throw_exception(IMAGICK_CLASS, "The map must contain only numeric values" TSRMLS_CC); + return; + } + status = MagickImportImagePixels(intern->magick_wand, x, y, width, height, map, storage, double_array); + efree(double_array); + break; + + case ShortPixel: +#if MagickLibVersion < 0x700 + case IntegerPixel: +#endif + case LongPixel: + /* Use longs */ + storage = LongPixel; + long_array = php_imagick_zval_to_long_array(pixels, &num_elements TSRMLS_CC); + if (!long_array) { + php_imagick_throw_exception(IMAGICK_CLASS, "The map must contain only numeric values" TSRMLS_CC); + return; + } + status = MagickImportImagePixels(intern->magick_wand, x, y, width, height, map, storage, long_array); + efree(long_array); + break; + + case CharPixel: + char_array = php_imagick_zval_to_char_array(pixels, &num_elements TSRMLS_CC); + if (!char_array) { + php_imagick_throw_exception(IMAGICK_CLASS, "The character array contains incorrect values" TSRMLS_CC); + return; + } + status = MagickImportImagePixels(intern->magick_wand, x, y, width, height, map, storage, char_array); + efree(char_array); + break; + + default: + php_imagick_throw_exception(IMAGICK_CLASS, "Unknown storage format" TSRMLS_CC); + return; + break; + } + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to import image pixels" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +PHP_METHOD(imagick, deskewimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + double threshold; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &threshold) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickDeskewImage(intern->magick_wand, threshold); + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to deskew image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} + +PHP_METHOD(imagick, segmentimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + im_long colorspace; + zend_bool verbose = 0; + double cluster_threshold, smooth_threshold; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ldd|b", &colorspace, &cluster_threshold, &smooth_threshold, &verbose) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSegmentImage(intern->magick_wand, colorspace, verbose, cluster_threshold, smooth_threshold); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to segment image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} + +PHP_METHOD(imagick, sparsecolorimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + im_long num_elements, sparse_method, channel = IM_DEFAULT_CHANNEL; + zval *arguments; + double *double_array; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "la|l", &sparse_method, &arguments, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + double_array = php_imagick_zval_to_double_array(arguments, &num_elements TSRMLS_CC); + + if (!double_array) { + php_imagick_throw_exception(IMAGICK_CLASS, "The map must contain only numeric values" TSRMLS_CC); + return; + } + +#if MagickLibVersion >= 0x700 + status = MagickSparseColorImageChannel(intern->magick_wand, channel, sparse_method, num_elements, double_array); +#else + status = MagickSparseColorImage(intern->magick_wand, channel, sparse_method, num_elements, double_array); +#endif + + efree(double_array); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to sparse color image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} + +/* {{{ proto bool Imagick::remapImage(Imagick remap, int DITHERMETHOD) + replaces the colors of an image with the closest color from a reference image +*/ +PHP_METHOD(imagick, remapimage) +{ + php_imagick_object *intern; + php_imagick_object *intern_remap; + MagickBooleanType status; + im_long dither_method; + zval *remap_param; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol", &remap_param, php_imagick_sc_entry, &dither_method) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + intern_remap = Z_IMAGICK_P(remap_param); + if (php_imagick_ensure_not_empty (intern_remap->magick_wand) == 0) + return; + + status = MagickRemapImage(intern->magick_wand, intern_remap->magick_wand, dither_method); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to remap image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ +#endif + +#if MagickLibVersion > 0x646 +/* {{{ proto bool Imagick::exportImagePixels(int x, int y, int width, int height, string map, INT STORAGE) + +The types for the PixelStorage types are: + +CharPixel - unsigned 1 byte integer +DoublePixel - 8 byte floating point +FloatPixel - 4 byte floating point +IntegerPixel - Removed in IM7 unsigned 4 byte integer +LongPixel - unsigned 4 byte integer +QuantumPixel - Quantum, use the defined type from the IM headers. +ShortPixel - unsigned 2 byte integer + + +*/ +PHP_METHOD(imagick, exportimagepixels) +{ + php_imagick_object *intern; + MagickBooleanType status; + im_long x, y, width, height, storage; + char *map; + int map_size, i = 0; + IM_LEN_TYPE map_len; + double *double_array; + float *float_array; + unsigned char *char_array; + unsigned short *short_array; + unsigned int *long_array; // The long pixel type is implemented in ImageMagick as 'unsigned int' + Quantum *quantum_array; +#if MagickLibVersion >= 0x700 + unsigned long long int *longlong_array; +#endif + +#if INT_MAX != 0x7FFFFFFF + #error "INT_MAX is not 0x7FFFFFFF, the code below assumes it is, as does the ImageMagick code" + // If this happens, you will need to figure out how to make long_array be an array of + // 4 byte unsigned ints +#endif + + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llllsl", &x, &y, &width, &height, &map, &map_len, &storage) == FAILURE) { + return; + } + + if ((x < 0) || (y < 0)) { + php_imagick_throw_exception(IMAGICK_CLASS, "The coordinates must be non-negative" TSRMLS_CC); + return; + } + + if (width <= 0 || height <= 0) { + php_imagick_throw_exception(IMAGICK_CLASS, "The width and height must be greater than zero" TSRMLS_CC); + return; + } + + if (!php_imagick_validate_map(map TSRMLS_CC)) { + php_imagick_throw_exception(IMAGICK_CLASS, "The map contains disallowed characters" TSRMLS_CC); + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + map_size = (map_len * width * height); + + switch (storage) { + case FloatPixel: + float_array = emalloc(map_size * sizeof(float)); + status = MagickExportImagePixels(intern->magick_wand, x, y, width, height, map, FloatPixel, (void *)float_array); + + if (status != MagickFalse) { + array_init(return_value); + for (i = 0; i < map_size; i++) { + add_next_index_double(return_value, float_array[i]); + } + efree(float_array); + return; + } + break; + + case DoublePixel: + double_array = emalloc(map_size * sizeof(double)); + status = MagickExportImagePixels(intern->magick_wand, x, y, width, height, map, DoublePixel, (void *)double_array); + + if (status != MagickFalse) { + array_init(return_value); + for (i = 0; i < map_size; i++) { + add_next_index_double(return_value, double_array[i]); + } + efree(double_array); + return; + } + break; + + case ShortPixel: + short_array = emalloc(map_size * sizeof(unsigned short)); + status = MagickExportImagePixels(intern->magick_wand, x, y, width, height, map, ShortPixel, (void *)short_array); + + if (status != MagickFalse) { + array_init(return_value); + for (i = 0; i < map_size; i++) { + add_next_index_long(return_value, short_array[i]); + } + efree(short_array); + return; + } + break; + +#if MagickLibVersion >= 0x700 + case LongLongPixel: + longlong_array = emalloc(map_size * sizeof(unsigned long long int)); + status = MagickExportImagePixels(intern->magick_wand, x, y, width, height, map, LongLongPixel, (void *)longlong_array); + + if (status != MagickFalse) { + array_init(return_value); + for (i = 0; i < map_size; i++) { + //TODO - think about this. + // on 32bit platforms this will be truncating data + // on 64bit platforms where sizeof(longlong) > 64bits, it will be truncating + // on 64bit platforms where sizeof(longlong) = 64bits, PHP will be + // converting values close to 64bit to be floats... + add_next_index_long(return_value, longlong_array[i]); + } + efree(longlong_array); + return; + } + break; +#endif + +#if MagickLibVersion < 0x700 + case IntegerPixel: +#endif + case LongPixel: + long_array = emalloc(map_size * sizeof(unsigned int)); + status = MagickExportImagePixels(intern->magick_wand, x, y, width, height, map, LongPixel, (void *)long_array); + + if (status != MagickFalse) { + array_init(return_value); + for (i = 0; i < map_size; i++) { + add_next_index_long(return_value, long_array[i]); + } + efree(long_array); + return; + } + break; + + case CharPixel: + char_array = emalloc(map_size * sizeof(char)); + status = MagickExportImagePixels(intern->magick_wand, x, y, width, height, map, CharPixel, (void *)char_array); + + if (status != MagickFalse) { + array_init(return_value); + for (i = 0; i < map_size; i++) { + add_next_index_long(return_value, (int)char_array[i]); + } + efree(char_array); + return; + } + break; + + case QuantumPixel: + quantum_array = emalloc(map_size * sizeof(Quantum)); + status = MagickExportImagePixels(intern->magick_wand, x, y, width, height, map, QuantumPixel, (void *)quantum_array); + + if (status != MagickFalse) { + array_init(return_value); + for (i = 0; i < map_size; i++) { +#if MAGICKCORE_HDRI_ENABLE + add_next_index_double(return_value, quantum_array[i]); +#else + add_next_index_long(return_value, quantum_array[i]); +#endif + } + efree(quantum_array); + return; + } + break; + + default: + php_imagick_throw_exception(IMAGICK_CLASS, "Unknown pixel type " TSRMLS_CC); + return; + break; + } + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to export image pixels" TSRMLS_CC); + return; + } + return; +} +/* }}} */ +#endif + +#if MagickLibVersion > 0x648 +/* {{{ proto array Imagick::getImageChannelKurtosis([int CHANNEL]) + Gets the kurtosis and skewness of one or more image channels +*/ +PHP_METHOD(imagick, getimagechannelkurtosis) +{ + php_imagick_object *intern; + MagickBooleanType status; + double kurtosis, skewness; + im_long channel = DefaultChannels; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickGetImageChannelKurtosis(intern->magick_wand, channel, &kurtosis, &skewness); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to get image channel kurtosis" TSRMLS_CC); + return; + } + + array_init(return_value); + add_assoc_double(return_value, "kurtosis", kurtosis); + add_assoc_double(return_value, "skewness", skewness); + return; +} +/* }}} */ + +/* {{{ proto bool Imagick::functionImage(int FUNCTION, array arguments[, int CHANNEL]) + Applies an arithmetic, relational, or logical expression to an image +*/ +PHP_METHOD(imagick, functionimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + zval *arguments; + im_long func, num_elements, channel = IM_DEFAULT_CHANNEL; + double *array; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "la|l", &func, &arguments, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + array = php_imagick_zval_to_double_array(arguments, &num_elements TSRMLS_CC); + + if (!array) { + php_imagick_throw_exception(IMAGICK_CLASS, "The arguments array contains disallowed characters or is empty." TSRMLS_CC); + return; + } + + status = MagickFunctionImageChannel(intern->magick_wand, channel, func, num_elements, array); + efree(array); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to execute function on the image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ +#endif + +#if MagickLibVersion > 0x651 +/* {{{ proto boolean Imagick::transformImageColorspace(int COLORSPACE) + Transform image colorspace +*/ +PHP_METHOD(imagick, transformimagecolorspace) +{ + php_imagick_object *intern; + im_long colorspace; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &colorspace) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickTransformImageColorspace(intern->magick_wand, colorspace); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to transform image colorspace" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ +#endif + +#if MagickLibVersion > 0x652 +/* {{{ proto boolean Imagick::haldClutImage(Imagick hald[, int CHANNEL]) + Replaces colors in the image from a Hald color lookup table +*/ +PHP_METHOD(imagick, haldclutimage) +{ + zval *objvar; + MagickBooleanType status; + php_imagick_object *intern, *hald; + im_long channel = IM_DEFAULT_CHANNEL; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|l", &objvar, php_imagick_sc_entry, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + hald = Z_IMAGICK_P(objvar); + if (php_imagick_ensure_not_empty (hald->magick_wand) == 0) + return; + + status = MagickHaldClutImageChannel(intern->magick_wand, channel, hald->magick_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to hald clut image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ +#endif + +#if MagickLibVersion > 0x655 +/* {{{ proto boolean Imagick::autolevelImage([int CHANNEL]) + Adjusts the levels of a particular image channel by scaling the minimum and maximum values to the full quantum range. +*/ +PHP_METHOD(imagick, autolevelimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + im_long channel = IM_DEFAULT_CHANNEL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickAutoLevelImageChannel(intern->magick_wand, channel); + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to autolevel image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto boolean Imagick::blueShiftImage([float $factor = 1.5]) + Mutes the colors of the image to simulate a scene at nighttime in the moonlight. +*/ +PHP_METHOD(imagick, blueshiftimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + double factor = 1.5; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|d", &factor) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickBlueShiftImage(intern->magick_wand, factor); + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to blue shift image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ +#endif + +#if MagickLibVersion > 0x656 +PHP_METHOD(imagick, setimageartifact) +{ + php_imagick_object *intern; + MagickBooleanType status; + char *artifact, *value; + IM_LEN_TYPE artifact_len, value_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &artifact, &artifact_len, &value, &value_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageArtifact(intern->magick_wand, artifact, value); + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image artifact" TSRMLS_CC); + return; + } + RETURN_TRUE; +} + + +PHP_METHOD(imagick, getimageartifact) +{ + php_imagick_object *intern; + char *artifact, *value; + IM_LEN_TYPE artifact_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &artifact, &artifact_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + value = MagickGetImageArtifact(intern->magick_wand, artifact); + + if (!value) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to get image artifact" TSRMLS_CC); + return; + } +#ifdef ZEND_ENGINE_3 + RETVAL_STRING(value); +#else + RETVAL_STRING(value, 1); +#endif + IMAGICK_FREE_MAGICK_MEMORY(value); + return; +} + +/* {{{ proto boolean Imagick::deleteImageArtifact(string $artifact) + Delete image artifact +*/ +PHP_METHOD(imagick, deleteimageartifact) +{ + php_imagick_object *intern; + MagickBooleanType status; + char *artifact; + IM_LEN_TYPE artifact_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &artifact, &artifact_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickDeleteImageArtifact(intern->magick_wand, artifact); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to delete image artifact" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto integer Imagick::getColorspace() + Get the object colorspace property +*/ +PHP_METHOD(imagick, getcolorspace) +{ + php_imagick_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + RETURN_LONG(MagickGetColorspace(intern->magick_wand)); +} +/* }}} */ + +/* {{{ proto boolean Imagick::setColorspace([int COLORSPACE]) + Set the object colorspace property +*/ +PHP_METHOD(imagick, setcolorspace) +{ + php_imagick_object *intern; + im_long colorspace; + MagickBooleanType status; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &colorspace) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + status = MagickSetColorspace(intern->magick_wand, colorspace); + + RETURN_BOOL(status == MagickTrue); +} +/* }}} */ + +/* {{{ proto boolean Imagick::clampImage([int CHANNEL]) + Restricts the color range from 0 to the quantum depth. +*/ +PHP_METHOD(imagick, clampimage) +{ + php_imagick_object *intern; + im_long channel = IM_DEFAULT_CHANNEL; + MagickBooleanType status; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickClampImageChannel(intern->magick_wand, channel); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to clamp image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ +#endif + +#if MagickLibVersion > 0x667 +/* {{{ proto Imagick Imagick::smushimages(boolean stack, int offset) + Takes all images from the current image pointer to the end of the image list and smushs + them to each other top-to-bottom if the stack parameter is true, otherwise left-to-right. +*/ +PHP_METHOD(imagick, smushimages) +{ + php_imagick_object *intern, *intern_return; + zend_bool stack; + long offset; + MagickWand *retwand; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "bl", &stack, &offset) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + retwand = MagickSmushImages(intern->magick_wand, (stack ? MagickTrue : MagickFalse), offset); + + if (!retwand) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to smush images" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagick_sc_entry); + intern_return = Z_IMAGICK_P(return_value); + php_imagick_replace_magickwand(intern_return, retwand); + return; +} +/* }}} */ +#endif + +/* {{{ proto Imagick Imagick::__construct([mixed files] ) + The Imagick constructor +*/ +#ifdef ZEND_ENGINE_3 +PHP_METHOD(imagick, __construct) +{ + php_imagick_object *intern; + zval *files = NULL; + + zval *pzval; + php_imagick_rw_result_t rc; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z!/", &files) == FAILURE) { + return; + } + + /* No files given.. or null passed */ + if (!files) { + return; + } + intern = Z_IMAGICK_P(getThis()); + + if (Z_TYPE_P (files) == IS_LONG || Z_TYPE_P (files) == IS_DOUBLE) { + convert_to_string (files); + } + + /* A single file was given */ + if (Z_TYPE_P(files) == IS_STRING) { + struct php_imagick_file_t file = {0}; + + if (!php_imagick_file_init(&file, Z_STRVAL_P(files), Z_STRLEN_P(files) TSRMLS_CC)) { + php_imagick_throw_exception(IMAGICK_CLASS, "Invalid filename provided" TSRMLS_CC); + return; + } + rc = php_imagick_read_file(intern, &file, ImagickReadImage TSRMLS_CC); + php_imagick_file_deinit(&file); + + if (rc != IMAGICK_RW_OK) { + php_imagick_rw_fail_to_exception (intern->magick_wand, rc, Z_STRVAL_P(files) TSRMLS_CC); + return; + } + } + + /* an array of filenames was given */ + else + if (Z_TYPE_P(files) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(files), pzval) { + struct php_imagick_file_t file = {0}; + ZVAL_DEREF(pzval); + + if (!php_imagick_file_init(&file, Z_STRVAL_P(pzval), Z_STRLEN_P(pzval) TSRMLS_CC)) { + php_imagick_throw_exception(IMAGICK_CLASS, "Invalid filename provided" TSRMLS_CC); + return; + } + + rc = php_imagick_read_file(intern, &file, ImagickReadImage TSRMLS_CC); + php_imagick_file_deinit(&file); + + if (rc != IMAGICK_RW_OK) { + php_imagick_rw_fail_to_exception (intern->magick_wand, rc, Z_STRVAL_P(pzval) TSRMLS_CC); + return; + } + } ZEND_HASH_FOREACH_END(); + } + if (Z_TYPE_P(files) == IS_FALSE || Z_TYPE_P(files) == IS_TRUE) { + php_imagick_throw_exception(IMAGICK_CLASS, "Constructor shouldn't be called with a boolean as the filename"); + } + + RETURN_TRUE; +} +#else +PHP_METHOD(imagick, __construct) +{ + php_imagick_object *intern; + zval *files = NULL; + HashPosition pos; + php_imagick_rw_result_t rc; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z!/", &files) == FAILURE) { + return; + } + + /* No files given.. or null passed */ + if (!files) { + return; + } + intern = Z_IMAGICK_P(getThis()); + + if (Z_TYPE_P (files) == IS_LONG || Z_TYPE_P (files) == IS_DOUBLE) { + convert_to_string (files); + } + + /* A single file was given */ + if (Z_TYPE_P(files) == IS_STRING) { + struct php_imagick_file_t file = {0}; + + if (!php_imagick_file_init(&file, Z_STRVAL_P(files), Z_STRLEN_P(files) TSRMLS_CC)) { + php_imagick_throw_exception(IMAGICK_CLASS, "Invalid filename provided" TSRMLS_CC); + return; + } + rc = php_imagick_read_file(intern, &file, ImagickReadImage TSRMLS_CC); + php_imagick_file_deinit(&file); + + if (rc != IMAGICK_RW_OK) { + php_imagick_rw_fail_to_exception (intern->magick_wand, rc, Z_STRVAL_P(files) TSRMLS_CC); + return; + } + } + + /* an array of filenames was given */ + else + if (Z_TYPE_P(files) == IS_ARRAY) { + for(zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(files), &pos); + zend_hash_has_more_elements_ex(Z_ARRVAL_P(files), &pos) == SUCCESS; + zend_hash_move_forward_ex(Z_ARRVAL_P(files), &pos)) { + + struct php_imagick_file_t file = {0}; + zval **ppzval; + + if (zend_hash_get_current_data_ex(Z_ARRVAL_P(files), (void**)&ppzval, &pos) == FAILURE) { + continue; + } + + if (!php_imagick_file_init(&file, Z_STRVAL_PP(ppzval), Z_STRLEN_PP(ppzval) TSRMLS_CC)) { + php_imagick_throw_exception(IMAGICK_CLASS, "Invalid filename provided" TSRMLS_CC); + return; + } + + rc = php_imagick_read_file(intern, &file, ImagickReadImage TSRMLS_CC); + php_imagick_file_deinit(&file); + + if (rc != IMAGICK_RW_OK) { + php_imagick_rw_fail_to_exception (intern->magick_wand, rc, Z_STRVAL_PP(ppzval) TSRMLS_CC); + return; + } + } + } + + if (Z_TYPE_P(files) == IS_BOOL) { + php_imagick_throw_exception(IMAGICK_CLASS, "Constructor shouldn't be called with a boolean as the filename" TSRMLS_CC); + } + + RETURN_TRUE; +} +#endif +/* }}} */ + +/* {{{ proto string Imagick::__toString() + Returns the current image as string +*/ +PHP_METHOD(imagick, __tostring) +{ + php_imagick_object *intern; + unsigned char *image; + char *buffer; + size_t image_size; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (MagickGetNumberImages(intern->magick_wand) == 0) { + IM_ZVAL_STRING(return_value, ""); + return; + } + + buffer = MagickGetImageFormat(intern->magick_wand); + + if (!buffer) { + IM_ZVAL_STRING(return_value, ""); + return; + } else { + IMAGICK_FREE_MAGICK_MEMORY(buffer); + } + + image = MagickGetImageBlob(intern->magick_wand, &image_size); + IM_ZVAL_STRINGL(return_value, (char *)image, image_size); + IMAGICK_FREE_MAGICK_MEMORY(image); + return; +} +/* }}} */ + +/* {{{ proto string Imagick::count() + Returns the number of images +*/ +PHP_METHOD(imagick, count) +{ + php_imagick_object *intern; + im_long mode = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &mode) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + RETVAL_LONG (MagickGetNumberImages(intern->magick_wand)); +} +/* }}} */ + +/* {{{ proto array Imagick::queryFormats([string pattern] ) + Returns formats supported by ImageMagick +*/ +PHP_METHOD(imagick, queryformats) +{ + char **supported_formats; + unsigned long i; + char *pattern = "*"; + IM_LEN_TYPE pattern_len = 1; + size_t num_formats = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &pattern, &pattern_len) == FAILURE) { + return; + } + + supported_formats = (char **) MagickQueryFormats(pattern, &num_formats); + array_init(return_value); + + for (i = 0 ; i < num_formats ; i++) { + IM_add_next_index_string(return_value, supported_formats[i]); + IMAGICK_FREE_MAGICK_MEMORY(supported_formats[i]); + } + + IMAGICK_FREE_MAGICK_MEMORY(supported_formats); + return; +} +/* }}} */ + +/* {{{ proto array Imagick::queryFonts([string pattern] ) + Returns fonts supported by ImageMagick +*/ +PHP_METHOD(imagick, queryfonts) +{ + char **fonts; + unsigned long i; + char *pattern = "*"; + IM_LEN_TYPE pattern_len = 1; + size_t num_fonts; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &pattern, &pattern_len) == FAILURE) { + return; + } + + fonts = (char **) MagickQueryFonts(pattern, &num_fonts); + array_init(return_value); + + for (i = 0 ; i < num_fonts ; i++) { + IM_add_next_index_string(return_value, fonts[i]); + IMAGICK_FREE_MAGICK_MEMORY(fonts[i]); + } + + IMAGICK_FREE_MAGICK_MEMORY(fonts); + return; +} +/* }}} */ + +/* {{{ proto array Imagick::queryFontMetrics(ImagickDraw draw, string text[, bool multiline] ) + Returns a 13 element array representing the font metrics +*/ +PHP_METHOD(imagick, queryfontmetrics) +{ + zval *objvar, *multiline; + zend_bool remove_canvas, query_multiline; + php_imagick_object *intern; + php_imagickdraw_object *internd; + char *text; + IM_LEN_TYPE text_len; + double *metrics; + + multiline = NULL; + remove_canvas = 0; + query_multiline = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os|z!", &objvar, php_imagickdraw_sc_entry, &text, &text_len, &multiline) == FAILURE) { + return; + } + + /* No parameter passed, this means we should autodetect */ + if (!multiline) { + if (strchr (text, '\n') != NULL) { + query_multiline = 1; + } + } else { + convert_to_boolean(multiline); +#ifdef ZEND_ENGINE_3 + if (Z_TYPE_P(multiline) == IS_TRUE) { + query_multiline = 1; + } +#else + query_multiline = Z_BVAL_P(multiline); +#endif + } + + /* fetch the objects */ + intern = Z_IMAGICK_P(getThis()); + internd = Z_IMAGICKDRAW_P(objvar); + + /* If wand is empty, create a 1x1 pixel image to use as a temporary canvas */ + if (MagickGetNumberImages(intern->magick_wand) < 1) { + PixelWand *pixel_wand; + MagickBooleanType status; + + /* Empty bg color */ + pixel_wand = NewPixelWand(); + + if (!pixel_wand) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to allocate background color for the temporary canvas" TSRMLS_CC); + return; + } + + /* 1x1 should be enough to get the metrics */ + status = MagickNewImage(intern->magick_wand, 1, 1, pixel_wand); + pixel_wand = DestroyPixelWand(pixel_wand); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to allocate temporary canvas" TSRMLS_CC); + return; + } + remove_canvas = 1; + } + + /* Multiline testing */ + if (query_multiline) { + metrics = MagickQueryMultilineFontMetrics(intern->magick_wand, internd->drawing_wand, text); + } else { + metrics = MagickQueryFontMetrics(intern->magick_wand, internd->drawing_wand, text); + } + + /* Remove the image from the stack*/ + if (remove_canvas) { + MagickRemoveImage(intern->magick_wand); + } + + if (!metrics) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Failed to query the font metrics" TSRMLS_CC); + return; + } else { + zval *pbounding; +#ifdef ZEND_ENGINE_3 + zval bounding; + pbounding = &bounding; +#else + MAKE_STD_ZVAL(pbounding) +#endif + + array_init(return_value); + add_assoc_double(return_value, "characterWidth", metrics[0]); + add_assoc_double(return_value, "characterHeight", metrics[1]); + add_assoc_double(return_value, "ascender", metrics[2]); + add_assoc_double(return_value, "descender", metrics[3]); + add_assoc_double(return_value, "textWidth", metrics[4]); + add_assoc_double(return_value, "textHeight", metrics[5]); + add_assoc_double(return_value, "maxHorizontalAdvance", metrics[6]); + + array_init(pbounding); + add_assoc_double(pbounding, "x1", metrics[7]); + add_assoc_double(pbounding, "y1", metrics[8]); + add_assoc_double(pbounding, "x2", metrics[9]); + add_assoc_double(pbounding, "y2", metrics[10]); + add_assoc_zval(return_value, "boundingBox", pbounding); + add_assoc_double(return_value, "originX", metrics[11]); + add_assoc_double(return_value, "originY", metrics[12]); + + IMAGICK_FREE_MAGICK_MEMORY(metrics); + return; + } +} +/* }}} */ + +/* {{{ proto bool Imagick::valid() + Checks if the current item is valid +*/ +PHP_METHOD(imagick, valid) +{ + php_imagick_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + if (intern->next_out_of_bound) { + RETURN_FALSE; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto Imagick Imagick::current() + Returns reference to the current imagick object with image pointer at the correct sequence. +*/ +PHP_METHOD(imagick, current) +{ + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + RETURN_ZVAL(getThis(), 1, 0); +} +/* }}} */ + +/* {{{ proto bool Imagick::readImage(string filename) + Reads image from filename +*/ +PHP_METHOD(imagick, readimage) +{ + char *filename; + IM_LEN_TYPE filename_len; + php_imagick_object *intern; + struct php_imagick_file_t file = {0}; + php_imagick_rw_result_t rc; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (!php_imagick_file_init(&file, filename, filename_len TSRMLS_CC)) { + php_imagick_throw_exception(IMAGICK_CLASS, "Invalid filename provided" TSRMLS_CC); + return; + } + + rc = php_imagick_read_file(intern, &file, ImagickReadImage TSRMLS_CC); + php_imagick_file_deinit(&file); + + if (rc != IMAGICK_RW_OK) { + php_imagick_rw_fail_to_exception (intern->magick_wand, rc, filename TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::readImages(array files ) + Reads image from an array of filenames +*/ +#ifdef ZEND_ENGINE_3 +PHP_METHOD(imagick, readimages) +{ + + zval *value; + zval *files; + php_imagick_object *intern; + php_imagick_rw_result_t rc; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &files) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(files), value) { + struct php_imagick_file_t file = {0}; + ZVAL_DEREF(value); + + if (!php_imagick_file_init(&file, Z_STRVAL_P(value), Z_STRLEN_P(value) TSRMLS_CC)) { + php_imagick_throw_exception(IMAGICK_CLASS, "Invalid filename provided" TSRMLS_CC); + return; + } + + rc = php_imagick_read_file(intern, &file, ImagickReadImage TSRMLS_CC); + php_imagick_file_deinit(&file); + + if (rc != IMAGICK_RW_OK) { + php_imagick_rw_fail_to_exception (intern->magick_wand, rc, Z_STRVAL_P(value) TSRMLS_CC); + return; + } + } ZEND_HASH_FOREACH_END(); + RETURN_TRUE; +} +#else +PHP_METHOD(imagick, readimages) +{ + zval *files; + php_imagick_object *intern; + HashPosition pos; + php_imagick_rw_result_t rc; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &files) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + for(zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(files), &pos); + zend_hash_has_more_elements_ex(Z_ARRVAL_P(files), &pos) == SUCCESS; + zend_hash_move_forward_ex(Z_ARRVAL_P(files), &pos)) { + + struct php_imagick_file_t file = {0}; + zval **ppzval; + + if (zend_hash_get_current_data_ex(Z_ARRVAL_P(files), (void**)&ppzval, &pos) == FAILURE) { + continue; + } + + if (!php_imagick_file_init(&file, Z_STRVAL_PP(ppzval), Z_STRLEN_PP(ppzval) TSRMLS_CC)) { + php_imagick_throw_exception(IMAGICK_CLASS, "Invalid filename provided" TSRMLS_CC); + return; + } + + rc = php_imagick_read_file(intern, &file, ImagickReadImage TSRMLS_CC); + php_imagick_file_deinit(&file); + + if (rc != IMAGICK_RW_OK) { + php_imagick_rw_fail_to_exception (intern->magick_wand, rc, Z_STRVAL_PP(ppzval) TSRMLS_CC); + return; + } + } + RETURN_TRUE; +} +#endif + + +/* {{{ proto bool Imagick::pingImage(string filename ) + This method can be used to query image width, height, size, and format without reading the whole image in to memory. +*/ +PHP_METHOD(imagick, pingimage) +{ + char *filename; + IM_LEN_TYPE filename_len; + php_imagick_object *intern; + struct php_imagick_file_t file = {0}; + php_imagick_rw_result_t rc; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (!php_imagick_file_init(&file, filename, filename_len TSRMLS_CC)) { + php_imagick_throw_exception(IMAGICK_CLASS, "Invalid filename provided" TSRMLS_CC); + return; + } + rc = php_imagick_read_file(intern, &file, ImagickPingImage TSRMLS_CC); + php_imagick_file_deinit(&file); + + if (rc != IMAGICK_RW_OK) { + php_imagick_rw_fail_to_exception (intern->magick_wand, rc, filename TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::readImageFile(resource filehandle[, string filename]) + Reads image from open filehandle +*/ +PHP_METHOD(imagick, readimagefile) +{ + char *filename = NULL; + IM_LEN_TYPE filename_len; + php_imagick_object *intern; + zval *zstream; + zend_bool result; + php_stream *stream; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|s!", &zstream, &filename, &filename_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + +#ifdef ZEND_ENGINE_3 + php_stream_from_zval(stream, zstream); +#else + php_stream_from_zval(stream, &zstream); +#endif + result = php_imagick_stream_handler(intern, stream, ImagickReadImageFile TSRMLS_CC); + + if (result == 0) { + if (!EG(exception)) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to read image from the filehandle" TSRMLS_CC); + return; + } + return; + } + + if (filename) { + MagickSetImageFilename(intern->magick_wand, filename); + MagickSetLastIterator(intern->magick_wand); + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::displayImage(string serverName ) + Displays an image +*/ +PHP_METHOD(imagick, displayimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + char *server_name; + IM_LEN_TYPE server_name_len; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &server_name, &server_name_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickDisplayImage(intern->magick_wand, server_name); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to display image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::displayImages(string serverName ) + displays an image or image sequence +*/ +PHP_METHOD(imagick, displayimages) +{ + php_imagick_object *intern; + MagickBooleanType status; + char *server_name; + IM_LEN_TYPE server_name_len; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &server_name, &server_name_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickDisplayImages(intern->magick_wand, server_name); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to display images" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::readBlob(string image ) + Reads image from a binary string +*/ +PHP_METHOD(imagick, readimageblob) +{ + char *image_string; + char *filename = NULL; + long filename_len; + IM_LEN_TYPE image_string_len; + MagickBooleanType status; + php_imagick_object *intern; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!", &image_string, &image_string_len, &filename, &filename_len) == FAILURE) { + return; + } + + if (!image_string_len) { + php_imagick_throw_exception(IMAGICK_CLASS, "Zero size image string passed" TSRMLS_CC); + return; + } + + intern = Z_IMAGICK_P(getThis()); + status = MagickReadImageBlob(intern->magick_wand, image_string, image_string_len); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to read image blob" TSRMLS_CC); + return; + } + + /* Even if filename is null we need to give a name here. Otherwise segfaults will happen */ + MagickSetImageFilename(intern->magick_wand, filename); + MagickSetLastIterator(intern->magick_wand); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::blurImage(float radius, float sigma[, int channel ] ) + Adds blur filter to image. Optional third parameter to blur a specific channel. +*/ +PHP_METHOD(imagick, blurimage) +{ + double radius, sigma; + php_imagick_object *intern; + MagickBooleanType status; + /* Initialize channel type to all channels*/ + im_long channel = IM_DEFAULT_CHANNEL; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd|l", &radius, &sigma, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickBlurImageChannel(intern->magick_wand, channel, radius, sigma); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to blur image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::waveImage(float amplitude, float length ) + Adds wave filter to the image. +*/ +PHP_METHOD(imagick, waveimage) +{ + double amplitude, wave_length; + php_imagick_object *intern; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &litude, &wave_length) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + +#if MagickLibVersion >= 0x700 + { + //TODO allow PixelInterpolateMethod be set + PixelInterpolateMethod method = BilinearInterpolatePixel; + status = MagickWaveImage(intern->magick_wand, amplitude, wave_length, method); + } +#else + status = MagickWaveImage(intern->magick_wand, amplitude, wave_length); +#endif + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to wave image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::clear() + Clears all resources associated to Imagick object +*/ +PHP_METHOD(imagick, clear) +{ + php_imagick_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (!intern->magick_wand) { + RETURN_FALSE; + } + + ClearMagickWand(intern->magick_wand); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::scaleImage(int width, int height[, bool bestfit = false[, bool legacy]] ) + Scales the size of an image to the given dimensions. Passing zero as either of + the arguments will preserve dimension while scaling. + If legacy is true, the calculations are done with the small rounding bug that existed in + Imagick before 3.4.0. If false, the calculations should produce the same results as + ImageMagick CLI does. +*/ +PHP_METHOD(imagick, scaleimage) +{ + im_long width, height, new_width, new_height; + php_imagick_object *intern; + MagickBooleanType status; + zend_bool bestfit = 0; + zend_bool legacy = 0; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll|bb", &width, &height, &bestfit, &legacy) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + if (!php_imagick_thumbnail_dimensions(intern->magick_wand, bestfit, width, height, &new_width, &new_height, legacy)) { + php_imagick_throw_exception(IMAGICK_CLASS, "Invalid image geometry" TSRMLS_CC); + return; + } + + status = MagickScaleImage(intern->magick_wand, new_width, new_height); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to scale image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::cropImage(int width, height, int x, int y ) + Extracts a region of the image. +*/ +PHP_METHOD(imagick, cropimage) +{ + im_long width, height, x, y; + php_imagick_object *intern; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &width, &height, &x, &y) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickCropImage(intern->magick_wand, width, height, x, y); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to crop image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::spreadImage(float radius ) + Special effects method that randomly displaces each pixel in a block defined by the radius parameter. +*/ +PHP_METHOD(imagick, spreadimage) +{ + double radius; + php_imagick_object *intern; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &radius) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + +#if MagickLibVersion >= 0x700 + { + //TODO allow PixelInterpolateMethod be set + PixelInterpolateMethod method = BilinearInterpolatePixel; + status = MagickSpreadImage(intern->magick_wand, radius, method); + } +#else + status = MagickSpreadImage(intern->magick_wand, radius); +#endif + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to spread image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::swirlImage(float degrees ) + Swirls the pixels about the center of the image, where degrees indicates the sweep of the arc through which each pixel is moved. You get a more dramatic effect as the degrees move from 1 to 360. +*/ +PHP_METHOD(imagick, swirlimage) +{ + double degrees; + php_imagick_object *intern; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", °rees) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + +#if MagickLibVersion >= 0x700 + { + //TODO allow PixelInterpolateMethod be set + PixelInterpolateMethod method = BilinearInterpolatePixel; + status = MagickSwirlImage(intern->magick_wand, degrees, method); + } +#else + status = MagickSwirlImage(intern->magick_wand, degrees); +#endif + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to swirl image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::stripImage() + Strips an image of all profiles and comments. +*/ +PHP_METHOD(imagick, stripimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickStripImage(intern->magick_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to strip image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::trimImage(double fuzz) + Remove edges that are the background color from the image. +*/ +PHP_METHOD(imagick, trimimage) +{ + double fuzz; + php_imagick_object *intern; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &fuzz) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickTrimImage(intern->magick_wand, fuzz); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to trim image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::chopImage(int width, int height, int x, int y) + Removes a region of an image and collapses the image to occupy the removed portion +*/ +PHP_METHOD(imagick, chopimage) +{ + php_imagick_object *intern; + im_long width, height, x, y; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &width, &height, &x, &y) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickChopImage(intern->magick_wand, width, height, x, y); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to chop image" TSRMLS_CC); + return; + } + + RETURN_TRUE; + +} +/* }}} */ + +/* {{{ proto bool Imagick::clipImage() + Clips along the first path from the 8BIM profile, if present. +*/ +PHP_METHOD(imagick, clipimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + status = MagickClipImage(intern->magick_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to clip image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::clipPathImage(string pathname, bool inside) + Clips along the named paths from the 8BIM profile, if present. Later operations take effect inside the path. Id may be a number if preceded with #, to work on a numbered path, e.g., "#1" to use the first path. +*/ +PHP_METHOD(imagick, clippathimage) +{ + php_imagick_object *intern; + char *clip_path; + IM_LEN_TYPE clip_path_len; + zend_bool inside; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sb", &clip_path, &clip_path_len, &inside) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; +#if MagickLibVersion > 0x636 + status = MagickClipImagePath(intern->magick_wand, clip_path, inside); +#else + status = MagickClipPathImage(intern->magick_wand, clip_path, inside); +#endif + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to clip path image" TSRMLS_CC); + return; + } + + RETURN_TRUE; + +} +/* }}} */ + +/* {{{ proto Imagick Imagick::coalesceImages() + Composites a set of images while respecting any page offsets and disposal methods. GIF, MIFF, and MNG animation sequences typically start with an image background and each subsequent image varies in size and offset. returns a new sequence where each image in the sequence is the same size as the first and composited with the next image in the sequence. +*/ +PHP_METHOD(imagick, coalesceimages) +{ + MagickWand *tmp_wand; + php_imagick_object *intern, *intern_return; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + tmp_wand = MagickCoalesceImages(intern->magick_wand); + + if (tmp_wand == NULL) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Coalesce image failed" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagick_sc_entry); + intern_return = Z_IMAGICK_P(return_value); + php_imagick_replace_magickwand(intern_return, tmp_wand); + return; + +} +/* }}} */ + +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 +/* {{{ proto bool Imagick::colorFloodfillImage(ImagickPixel fill, double fuzz, ImagickPixel bordercolor, int x, int y) + Changes the color value of any pixel that matches target and is an immediate neighbor. +*/ +PHP_METHOD(imagick, colorfloodfillimage) +{ + php_imagick_object *intern; + zval *fill_param, *border_param; + im_long x, y; + double fuzz; + MagickBooleanType status; + PixelWand *fill_wand, *border_wand; + zend_bool fill_allocated = 0, border_allocated = 0; + + IMAGICK_METHOD_DEPRECATED("Imagick", "colorFloodFillImage"); + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zdzll", &fill_param, &fuzz, &border_param, &x, &y) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + fill_wand = php_imagick_zval_to_pixelwand (fill_param, IMAGICK_CLASS, &fill_allocated TSRMLS_CC); + if (!fill_wand) + return; + + border_wand = php_imagick_zval_to_pixelwand (border_param, IMAGICK_CLASS, &border_allocated TSRMLS_CC); + if (!border_wand) { + if (fill_allocated) + fill_wand = DestroyPixelWand (fill_wand); + return; + } + + status = MagickColorFloodfillImage(intern->magick_wand, fill_wand, fuzz, border_wand, x, y); + + if (fill_allocated) + fill_wand = DestroyPixelWand (fill_wand); + + if (border_allocated) + border_wand = DestroyPixelWand (border_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to color floodfill image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ +#endif // #if MagickLibVersion < 0x700 +#endif + +/* {{{ proto Imagick Imagick::combineImages() + Combines one or more images into a single image. The grayscale value of the pixels of each image in the sequence is assigned in order to the specified channels of the combined image. The typical ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc. +*/ +PHP_METHOD(imagick, combineimages) +{ + MagickWand *tmp_wand; + php_imagick_object *intern, *intern_return; + im_long channel_type; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &channel_type) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + tmp_wand = MagickCombineImages(intern->magick_wand, channel_type); + + if (tmp_wand == NULL) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Combine images failed" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagick_sc_entry); + intern_return = Z_IMAGICK_P(return_value); + php_imagick_replace_magickwand(intern_return, tmp_wand); + + return; +} +/* }}} */ + +/* {{{ proto Imagick Imagick::setImage(Imagick replace ) + Replaces the current sequence +*/ +PHP_METHOD(imagick, setimage) +{ + zval *objvar; + MagickBooleanType status; + php_imagick_object *intern, *replace; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &objvar, php_imagick_sc_entry) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + replace = Z_IMAGICK_P(objvar); + if (php_imagick_ensure_not_empty (replace->magick_wand) == 0) + return; + + status = MagickSetImage(intern->magick_wand, replace->magick_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set the image" TSRMLS_CC); + return; + } + RETURN_TRUE; + +} +/* }}} */ + +/* {{{ proto Imagick Imagick::getImage() + Returns a new Imagick object with the current image sequence. +*/ +PHP_METHOD(imagick, getimage) +{ + MagickWand *tmp_wand; + php_imagick_object *intern, *intern_return; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + tmp_wand = MagickGetImage(intern->magick_wand); + + if (tmp_wand == NULL) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Get image failed" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagick_sc_entry); + intern_return = Z_IMAGICK_P(return_value); + php_imagick_replace_magickwand(intern_return, tmp_wand); + + return; +} +/* }}} */ + +/* {{{ proto bool Imagick::addImage(Imagick source ) + Adds new image to Imagick object from the current position of the source object. +*/ +PHP_METHOD(imagick, addimage) +{ + php_imagick_object *intern, *intern_add; + zval *add_obj; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &add_obj, php_imagick_sc_entry) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + intern_add = Z_IMAGICK_P(add_obj); + + if (php_imagick_ensure_not_empty (intern_add->magick_wand) == 0) + return; + + status = MagickAddImage(intern->magick_wand, intern_add->magick_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to add image" TSRMLS_CC); + return; + } + + MagickSetLastIterator(intern->magick_wand); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::newImage(int cols, int rows, ImagickPixel background[, string format] ) + Creates a new image and associates ImagickPixel value as background color +*/ +PHP_METHOD(imagick, newimage) +{ + php_imagick_object *intern; + zval *param; + MagickBooleanType status; + im_long columns, rows; + char *format = NULL; + IM_LEN_TYPE format_len = 0; + PixelWand *color_wand; + zend_bool allocated; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llz|s", &columns, &rows, ¶m, &format, &format_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + color_wand = php_imagick_zval_to_pixelwand (param, IMAGICK_CLASS, &allocated TSRMLS_CC); + if (!color_wand) + return; + + status = MagickNewImage(intern->magick_wand, columns, rows, color_wand); + + if (allocated) + color_wand = DestroyPixelWand (color_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to create new image" TSRMLS_CC); + return; + } + + /* If the optional fourth parameter was given + set the image format here */ + if (format != NULL && format_len > 0) { + + status = MagickSetImageFormat(intern->magick_wand, format); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set the image format" TSRMLS_CC); + return; + } + } + + MagickSetLastIterator(intern->magick_wand); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::newPseudoImage(int cols, int rows, string pseudoString ) + Creates a new image using pseudo format +*/ +PHP_METHOD(imagick, newpseudoimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + im_long columns, rows; + char *pseudo_string; + IM_LEN_TYPE pseudo_string_len; + struct php_imagick_file_t file = {0}; + php_imagick_rw_result_t rc; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lls", &columns, &rows, &pseudo_string, &pseudo_string_len) == FAILURE) { + return; + } + + /* Allow only pseudo formats in this method */ + if (strchr (pseudo_string, ':') == NULL) { + php_imagick_throw_exception(IMAGICK_CLASS, "Invalid pseudo format string" TSRMLS_CC); + return; + } + + intern = Z_IMAGICK_P(getThis()); + + /* Pseudo image needs a size set manually */ + status = MagickSetSize(intern->magick_wand, columns, rows); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to create new pseudo image" TSRMLS_CC); + return; + } + + if (!php_imagick_file_init(&file, pseudo_string, pseudo_string_len TSRMLS_CC)) { + php_imagick_throw_exception(IMAGICK_CLASS, "Invalid filename provided" TSRMLS_CC); + return; + } + rc = php_imagick_read_file(intern, &file, ImagickReadImage TSRMLS_CC); + php_imagick_file_deinit(&file); + + if (rc != IMAGICK_RW_OK) { + php_imagick_rw_fail_to_exception (intern->magick_wand, rc, pseudo_string TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::getImageTotalInkDensity() + Gets the image total ink density. +*/ +PHP_METHOD(imagick, getimagetotalinkdensity) +{ + php_imagick_object *intern; + double ink_density; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + ink_density = MagickGetImageTotalInkDensity(intern->magick_wand); + RETVAL_DOUBLE(ink_density); +} +/* }}} */ + +/* {{{ proto bool Imagick::implodeImage(float radius ) + Creates a new image that is a copy of an existing one with the image pixels "implode" by the specified percentage. It allocates the memory necessary for the new Image structure and returns a pointer to the new image. +*/ +PHP_METHOD(imagick, implodeimage) +{ + php_imagick_object *intern; + double radius; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &radius) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + +#if MagickLibVersion >= 0x700 + { + //TODO allow PixelInterpolateMethod be set + PixelInterpolateMethod method = BilinearInterpolatePixel; + status = MagickImplodeImage(intern->magick_wand, radius, method); + } +#else + status = MagickImplodeImage(intern->magick_wand, radius); +#endif + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to implode image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +#if MagickLibVersion >= 0x658 +//Only stable as of 658 +//http://upstream-tracker.org/compat_reports/imagemagick/6.5.7.7_to_6.5.7.8/abi_compat_report.html + +/* {{{ proto bool Imagick::inversefouriertransformimage(Imagick complement, bool magnitude) +*/ +PHP_METHOD(imagick, inversefouriertransformimage) +{ + php_imagick_object *intern, *intern_complement; + zval *complement_obj; + zend_bool magnitude; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ob", &complement_obj, php_imagick_sc_entry, &magnitude) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + intern_complement = Z_IMAGICK_P(complement_obj); + status = MagickInverseFourierTransformImage(intern->magick_wand, intern_complement->magick_wand, magnitude); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to inversefouriertransformimage image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ +#endif + +/* {{{ proto bool Imagick::levelImage(float blackPoint, float gamma, float whitePoint[, int channel] ) + Adjusts the levels of an image by scaling the colors falling between specified white and black points to the full available quantum range. The parameters provided represent the black, mid, and white points. The black point specifies the darkest color in the image. Colors darker than the black point are set to zero. Mid point specifies a gamma correction to apply to the image. White point specifies the lightest color in the image. Colors brighter than the white point are set to the maximum quantum value. +*/ +PHP_METHOD(imagick, levelimage) +{ + php_imagick_object *intern; + double black_point, gamma, white_point; + MagickBooleanType status; + im_long channel = IM_DEFAULT_CHANNEL; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ddd|l", &black_point, &gamma, &white_point, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickLevelImageChannel(intern->magick_wand, channel, black_point, gamma, white_point); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to level image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::magnifyImage() + Is a convenience method that scales an image proportionally to twice its original size. +*/ +PHP_METHOD(imagick, magnifyimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickMagnifyImage(intern->magick_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to magnify image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 +/* {{{ proto bool Imagick::cycleColormapImage(Imagick map, bool dither) + Replaces the colors of an image with the closest color from a reference image. +*/ +PHP_METHOD(imagick, mapimage) +{ + php_imagick_object *intern, *intern_map; + zval *map_obj; + zend_bool dither; + MagickBooleanType status; + + IMAGICK_METHOD_DEPRECATED ("Imagick", "mapImage"); + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ob", &map_obj, php_imagick_sc_entry, &dither) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + intern_map = Z_IMAGICK_P(map_obj); + status = MagickMapImage(intern->magick_wand, intern_map->magick_wand, dither); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to map image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ +#endif // #if MagickLibVersion < 0x700 + +#if MagickLibVersion < 0x700 +/* {{{ proto bool Imagick::matteFloodfillImage(float alpha,float fuzz,ImagickPixel bordercolor, int x, int y) + Changes the transparency value of any pixel that matches target and is an immediate neighbor +*/ +PHP_METHOD(imagick, mattefloodfillimage) +{ + php_imagick_object *intern; + zval *param; + im_long x, y; + double alpha, fuzz; + MagickBooleanType status; + PixelWand *color_wand; + zend_bool allocated; + + IMAGICK_METHOD_DEPRECATED("Imagick", "matteFloodfillImage"); + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ddzll", &alpha, &fuzz, ¶m, &x, &y) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + color_wand = php_imagick_zval_to_pixelwand (param, IMAGICK_CLASS, &allocated TSRMLS_CC); + if (!color_wand) + return; + + status = MagickMatteFloodfillImage(intern->magick_wand, alpha, fuzz, color_wand, x, y); + + if (allocated) + color_wand = DestroyPixelWand (color_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to matte floodfill image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ +#endif // #if MagickLibVersion < 0x700 +#endif + +#if MagickLibVersion < 0x700 +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +/* {{{ proto bool Imagick::medianFilterImage(float radius) + Applies a digital filter that improves the quality of a noisy image. Each pixel is replaced by the median in a set of neighboring pixels as defined by radius. +*/ +PHP_METHOD(imagick, medianfilterimage) +{ + php_imagick_object *intern; + double radius; + MagickBooleanType status; + + IMAGICK_METHOD_DEPRECATED ("Imagick", "medianFilterImage"); + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &radius) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickMedianFilterImage(intern->magick_wand, radius); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to median filter image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ +#endif +#endif + +/* {{{ proto bool Imagick::negateImage(bool gray[, int channel] ) + Negates the colors in the reference image. The Grayscale option means that only grayscale values within the image are negated. +*/ +PHP_METHOD(imagick, negateimage) +{ + php_imagick_object *intern; + zend_bool gray; + MagickBooleanType status; + im_long channel = IM_DEFAULT_CHANNEL; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b|l", &gray, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickNegateImageChannel(intern->magick_wand, channel, gray); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to negate image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 +/* {{{ proto bool Imagick::paintOpaqueImage(ImagickPixel target, ImagickPixel fill, float fuzz[, int channel]) + Changes any pixel that matches color with the color defined by fill. Channel argument is supported in ImageMagick 6.2.8+. +*/ +PHP_METHOD(imagick, paintopaqueimage) +{ + php_imagick_object *intern; + zval *target_param, *fill_param; + double fuzz; + MagickBooleanType status; + im_long channel = DefaultChannels; + PixelWand *target_wand, *fill_wand; + zend_bool target_allocated = 0, fill_allocated = 0; + + IMAGICK_METHOD_DEPRECATED ("Imagick", "paintOpaqueImage"); + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzd|l", &target_param, &fill_param, &fuzz, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + target_wand = php_imagick_zval_to_pixelwand (target_param, IMAGICK_CLASS, &target_allocated TSRMLS_CC); + if (!target_wand) + return; + + fill_wand = php_imagick_zval_to_pixelwand (fill_param, IMAGICK_CLASS, &fill_allocated TSRMLS_CC); + if (!fill_wand) { + if (target_allocated) + target_wand = DestroyPixelWand (target_wand); + return; + } + +#if MagickLibVersion > 0x628 + status = MagickPaintOpaqueImageChannel(intern->magick_wand, channel, target_wand, fill_wand, fuzz); +#else + status = MagickPaintOpaqueImage(intern->magick_wand, target_wand, fill_wand, fuzz); +#endif + + if (fill_allocated) + fill_wand = DestroyPixelWand (fill_wand); + + if (target_allocated) + target_wand = DestroyPixelWand (target_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable paint opaque image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ +#endif // #if MagickLibVersion < 0x700 +#endif + +#if MagickLibVersion > 0x628 +/* {{{ proto Imagick Imagick::optimizeImageLayers() + Compares each image the GIF disposed forms of the previous image in the sequence. From this it attempts to select the smallest cropped image to replace each frame, while preserving the results of the animation. +*/ +PHP_METHOD(imagick, optimizeimagelayers) +{ + MagickWand *tmp_wand; + php_imagick_object *intern, *intern_return; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + tmp_wand = MagickOptimizeImageLayers(intern->magick_wand); + + if (tmp_wand == NULL) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Optimize image layers failed" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagick_sc_entry); + intern_return = Z_IMAGICK_P(return_value); + php_imagick_replace_magickwand(intern_return, tmp_wand); + + return; +} +/* }}} */ + +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 +/* {{{ proto bool Imagick::paintTransparentImage(ImagickPixel target, float alpha, float fuzz) + Changes any pixel that matches color with the color defined by fill. +*/ +PHP_METHOD(imagick, painttransparentimage) +{ + php_imagick_object *intern; + zval *param; + double alpha, fuzz; + MagickBooleanType status; + PixelWand *color_wand; + zend_bool allocated; + + IMAGICK_METHOD_DEPRECATED ("Imagick", "paintTransparentImage"); + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zdd", ¶m, &alpha, &fuzz) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + color_wand = php_imagick_zval_to_pixelwand (param, IMAGICK_CLASS, &allocated TSRMLS_CC); + if (!color_wand) + return; + + status = MagickPaintTransparentImage(intern->magick_wand, color_wand, alpha, fuzz); + + if (allocated) + color_wand = DestroyPixelWand (color_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to paint transparent image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ +#endif // #if MagickLibVersion < 0x700 +#endif +#endif + +/* {{{ proto Imagick Imagick::previewImages(int preview ) + Tiles 9 thumbnails of the specified image with an image processing operation applied at varying strengths. + This is helpful to quickly pin-point an appropriate parameter for an image processing operation. +*/ +PHP_METHOD(imagick, previewimages) +{ + php_imagick_object *intern, *intern_return; + im_long preview; + MagickWand *tmp_wand; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &preview) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + tmp_wand = MagickPreviewImages(intern->magick_wand, preview); + + if (tmp_wand == NULL) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Preview images failed" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagick_sc_entry); + intern_return = Z_IMAGICK_P(return_value); + php_imagick_replace_magickwand(intern_return, tmp_wand); + return; +} +/* }}} */ + +/* {{{ proto bool Imagick::profileImage(string name,string profile) + Adds or removes a ICC, IPTC, or generic profile from an image. If the profile is NULL, it is removed from the image otherwise added. Use a name of '*' and a profile of NULL to remove all profiles from the image. +*/ +PHP_METHOD(imagick, profileimage) +{ + php_imagick_object *intern; + char *name, *profile; + IM_LEN_TYPE name_len, profile_len; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &name, &name_len, &profile, &profile_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickProfileImage(intern->magick_wand, name, profile, profile_len); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to profile image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::quantizeImage(int numberColors, int colorspace, int treedepth, bool dither, + bool measureError) + Analyzes the colors within a reference image +*/ +PHP_METHOD(imagick, quantizeimage) +{ + php_imagick_object *intern; + long number_colors, colorspace, tree_depth; + zend_bool dither, measure_error; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lllbb", &number_colors, &colorspace, &tree_depth, &dither, &measure_error) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickQuantizeImage(intern->magick_wand, number_colors, colorspace, tree_depth, dither, measure_error); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to quantize image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::quantizeImages(int number_colors, int colorspace, int treedepth, bool dither, + bool measure_error) + Analyzes the colors within a sequence of images +*/ +PHP_METHOD(imagick, quantizeimages) +{ + php_imagick_object *intern; + im_long number_colors, colorspace, tree_depth; + zend_bool dither, measure_error; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lllbb", &number_colors, &colorspace, &tree_depth, &dither, &measure_error) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickQuantizeImages(intern->magick_wand, number_colors, colorspace, tree_depth, dither, measure_error); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to quantize images" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 +/* {{{ proto bool Imagick::reduceNoiseImage(float radius) + Smooths the contours of an image +*/ +PHP_METHOD(imagick, reducenoiseimage) +{ + php_imagick_object *intern; + double radius; + MagickBooleanType status; + + IMAGICK_METHOD_DEPRECATED ("Imagick", "reduceNoiseImage"); + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &radius) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickReduceNoiseImage(intern->magick_wand, radius); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to reduce image noise" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ +#endif +#endif + +/* {{{ proto string Imagick::removeImageProfile(string name) + Removes the named image profile and returns it +*/ +PHP_METHOD(imagick, removeimageprofile) +{ + php_imagick_object *intern; + char *name; + unsigned char *profile; + IM_LEN_TYPE name_len; +#if MagickLibVersion < 0x628 + long profile_len; +#else + size_t profile_len; +#endif + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + profile = MagickRemoveImageProfile(intern->magick_wand, name, &profile_len); + + if (!profile) { + php_imagick_throw_exception(IMAGICK_CLASS, "The image profile does not exist" TSRMLS_CC); + return; + } + + IM_ZVAL_STRING(return_value, (char *)profile); + IMAGICK_FREE_MAGICK_MEMORY(profile); + return; +} +/* }}} */ + +/* {{{ proto bool Imagick::separateImageChannel(int channel) + Separates a channel from the image +*/ +PHP_METHOD(imagick, separateimagechannel) +{ + php_imagick_object *intern; + im_long channel; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + +#if MagickLibVersion >= 0x700 + status = MagickSeparateImage(intern->magick_wand, channel); +#else + status = MagickSeparateImageChannel(intern->magick_wand, channel); +#endif + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to separate image channel" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::sepiaToneImage(float threshold) + Applies a special effect to the image +*/ +PHP_METHOD(imagick, sepiatoneimage) +{ + php_imagick_object *intern; + double threshold; + double c_opacity; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &threshold) == FAILURE) { + return; + } + + c_opacity = (threshold * QuantumRange) / 100; + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSepiaToneImage(intern->magick_wand, c_opacity); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to sepia tone image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +#if MagickLibVersion < 0x700 +/* {{{ proto bool Imagick::setImageBias(float bias) + Sets the image bias +*/ +static +void s_set_image_bias(INTERNAL_FUNCTION_PARAMETERS, zend_bool use_quantum) +{ + php_imagick_object *intern; + double bias; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &bias) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + if (use_quantum) { + bias *= QuantumRange; + } + + status = MagickSetImageBias(intern->magick_wand, bias); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image bias" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ +#endif // #if MagickLibVersion < 0x700 + + +/* {{{ proto bool Imagick::setImageBiasQuantum(float bias) + Sets the image bias. Bias should be scaled with 0 = no adjustment, 1 = quantum value +*/ +#if MagickLibVersion < 0x700 +PHP_METHOD(imagick, setimagebiasquantum) +{ + s_set_image_bias (INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); +} +#endif +/* }}} */ + + +/* {{{ proto bool Imagick::setImageBias(float bias) + Sets the image bias. Bias should be scaled with 0 = no adjustment, 2^^x = adjust black to white + where x = the quantum depth ImageMagick was compiled with +*/ +#if MagickLibVersion < 0x700 +PHP_METHOD(imagick, setimagebias) +{ + s_set_image_bias (INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); +} +#endif +/* }}} */ + + + +/* {{{ proto bool Imagick::setImageBluePrimary(float x,float y) +For IM7 the prototype is +proto bool Imagick::setImageBluePrimary(float x, float y, float z) + + Sets the image chromaticity blue primary point +*/ +PHP_METHOD(imagick, setimageblueprimary) +{ + php_imagick_object *intern; + double x, y; +#if MagickLibVersion >= 0x700 + double z; +#endif + MagickBooleanType status; + + /* Parse parameters given to function */ +#if MagickLibVersion >= 0x700 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ddd", &x, &y, &z) == FAILURE) { +#else + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) { +#endif + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + +#if MagickLibVersion >= 0x700 + status = MagickSetImageBluePrimary(intern->magick_wand, x, y, z); +#else + status = MagickSetImageBluePrimary(intern->magick_wand, x, y); +#endif + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image blue primary" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setImageBorderColor(ImagickPixel border) + Sets the image border color +*/ +PHP_METHOD(imagick, setimagebordercolor) +{ + zval *param; + php_imagick_object *intern; + MagickBooleanType status; + PixelWand *color_wand; + zend_bool allocated; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶m) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + color_wand = php_imagick_zval_to_pixelwand (param, IMAGICK_CLASS, &allocated TSRMLS_CC); + if (!color_wand) + return; + + status = MagickSetImageBorderColor(intern->magick_wand, color_wand); + + if (allocated) + color_wand = DestroyPixelWand (color_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image border color" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setImageChannelDepth(int channel, int depth) + Sets the depth of a particular image channel +*/ +PHP_METHOD(imagick, setimagechanneldepth) +{ + php_imagick_object *intern; + im_long channel_type, depth; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &channel_type, &depth) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageChannelDepth(intern->magick_wand, channel_type, depth); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image channel depth" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setImageColormapColor(int index, ImagickPixel color) + Sets the color of the specified colormap index +*/ +PHP_METHOD(imagick, setimagecolormapcolor) +{ + php_imagick_object *intern; + zval *param; + long index; + MagickBooleanType status; + PixelWand *color_wand; + zend_bool allocated; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz", &index, ¶m) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + color_wand = php_imagick_zval_to_pixelwand (param, IMAGICK_CLASS, &allocated TSRMLS_CC); + if (!color_wand) + return; + + status = MagickSetImageColormapColor(intern->magick_wand, index, color_wand); + + if (allocated) + color_wand = DestroyPixelWand (color_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image color map color" TSRMLS_CC); + return; + } + RETURN_TRUE; + +} +/* }}} */ + +/* {{{ proto bool Imagick::setImageColorspace(int colorspace) + Sets the image colorspace +*/ +PHP_METHOD(imagick, setimagecolorspace) +{ + php_imagick_object *intern; + im_long colorspace; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &colorspace) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageColorspace(intern->magick_wand, colorspace); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image colorspace" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setImageDispose(int dispose) + Sets the image disposal method +*/ +PHP_METHOD(imagick, setimagedispose) +{ + php_imagick_object *intern; + im_long dispose; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &dispose) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageDispose(intern->magick_wand, dispose); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image dispose" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setImageExtent(int columns, int rows) + Sets the image size +*/ +PHP_METHOD(imagick, setimageextent) +{ + php_imagick_object *intern; + im_long rows, columns; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &rows, &columns) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageExtent(intern->magick_wand, rows, columns); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image extent" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setImageGreenPrimary(float x, float y) +For IM7 the prototype is +proto bool Imagick::setImageGreenPrimary(float x, float y, float z) + Sets the image chromaticity green primary point +*/ +PHP_METHOD(imagick, setimagegreenprimary) +{ + php_imagick_object *intern; + double x, y; +#if MagickLibVersion >= 0x700 + double z; +#endif + MagickBooleanType status; + + + /* Parse parameters given to function */ +#if MagickLibVersion >= 0x700 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ddd", &x, &y, &z) == FAILURE) { +#else + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) { +#endif + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + +#if MagickLibVersion >= 0x700 + status = MagickSetImageGreenPrimary(intern->magick_wand, x, y, z); +#else + status = MagickSetImageGreenPrimary(intern->magick_wand, x, y); +#endif + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image green primary" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setImageInterlaceScheme(int interlace_scheme) + Sets the image interlace scheme +*/ +PHP_METHOD(imagick, setimageinterlacescheme) +{ + php_imagick_object *intern; + im_long interlace; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &interlace) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageInterlaceScheme(intern->magick_wand, interlace); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image interlace scheme" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setImageProfile(string name, string profile) + Adds a named profile to the Imagick object +*/ +PHP_METHOD(imagick, setimageprofile) +{ + php_imagick_object *intern; + char *name, *profile; + IM_LEN_TYPE profile_len, name_len; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &name, &name_len, &profile, &profile_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageProfile(intern->magick_wand, name, profile, profile_len); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image profile" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setImageRedPrimary(float x,float y) +For IM7 the prototype is +proto bool Imagick::setImageRedPrimary(float x, float y, float z) + + Sets the image chromaticity red primary point. +*/ +PHP_METHOD(imagick, setimageredprimary) +{ + php_imagick_object *intern; + double x, y; +#if MagickLibVersion >= 0x700 + double z; +#endif + MagickBooleanType status; + + /* Parse parameters given to function */ +#if MagickLibVersion >= 0x700 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ddd", &x, &y, &z) == FAILURE) { +#else + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) { +#endif + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + +#if MagickLibVersion >= 0x700 + status = MagickSetImageRedPrimary(intern->magick_wand, x, y, z); +#else + status = MagickSetImageRedPrimary(intern->magick_wand, x, y); +#endif + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image red primary" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setImageRenderingIntent(int rendering_intent) + Sets the image rendering intent. +*/ +PHP_METHOD(imagick, setimagerenderingintent) +{ + php_imagick_object *intern; + im_long rendering_intent; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &rendering_intent) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageRenderingIntent(intern->magick_wand, rendering_intent); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image rendering intent" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setImageVirtualPixelMethod(int method) + Sets the image virtual pixel method. +*/ +PHP_METHOD(imagick, setimagevirtualpixelmethod) +{ + php_imagick_object *intern; + im_long virtual_pixel; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &virtual_pixel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + MagickSetImageVirtualPixelMethod(intern->magick_wand, virtual_pixel); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setImageWhitePoint(float x, float y) + +For IM7 the prototype is +proto bool Imagick::setImageWhitePoint(float x, float y, float z) + + Sets the image chromaticity white point. +*/ +PHP_METHOD(imagick, setimagewhitepoint) +{ + php_imagick_object *intern; + double x, y; +#if MagickLibVersion >= 0x700 + double z; +#endif + MagickBooleanType status; + + /* Parse parameters given to function */ +#if MagickLibVersion >= 0x700 + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ddd", &x, &y, &z) == FAILURE) { +#else + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) { +#endif + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + +#if MagickLibVersion >= 0x700 + status = MagickSetImageWhitePoint(intern->magick_wand, x, y, z); +#else + status = MagickSetImageWhitePoint(intern->magick_wand, x, y); +#endif + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image white point" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::sigmoidalContrastImage(bool sharpen, float contrast, float midpoint[, int channel]) + Adjusts the contrast of an image with a non-linear sigmoidal contrast algorithm. Increase the contrast of the image using a sigmoidal transfer function without saturating highlights or shadows. Contrast indicates how much to increase the contrast (0 is none; 3 is typical; 20 is pushing it); mid-point indicates where midtones fall in the resultant image (0 is white; 50 is middle-gray; 100 is black). Set sharpen to true to increase the image contrast otherwise the contrast is reduced. +*/ +PHP_METHOD(imagick, sigmoidalcontrastimage) +{ + php_imagick_object *intern; + zend_bool sharpen; + double contrast, midpoint; + MagickBooleanType status; + im_long channel = IM_DEFAULT_CHANNEL; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "bdd|l", &sharpen, &contrast, &midpoint, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSigmoidalContrastImageChannel(intern->magick_wand, channel, sharpen, contrast, midpoint); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to sigmoidal contrast image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::stereoImage(Imagick offset_wand) + Composites two images and produces a single image that is the composite of a left and right image of a stereo pair +*/ +PHP_METHOD(imagick, stereoimage) +{ + MagickWand *tmp_wand; + zval *magick_object; + php_imagick_object *intern, *intern_second, *intern_return; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &magick_object, php_imagick_sc_entry) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + intern_second = Z_IMAGICK_P(magick_object); + if (php_imagick_ensure_not_empty (intern_second->magick_wand) == 0) + return; + + tmp_wand = MagickStereoImage(intern->magick_wand, intern_second->magick_wand); + + if (tmp_wand == NULL) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Stereo image failed" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagick_sc_entry); + intern_return = Z_IMAGICK_P(return_value); + php_imagick_replace_magickwand(intern_return, tmp_wand); + + return; +} +/* }}} */ + +/* {{{ proto Imagick Imagick::textureImage(Imagick texture_wand) + Repeatedly tiles the texture image across and down the image canvas. +*/ +PHP_METHOD(imagick, textureimage) +{ + MagickWand *tmp_wand; + zval *magick_object; + php_imagick_object *intern, *intern_second, *intern_return; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &magick_object, php_imagick_sc_entry) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + intern_second = Z_IMAGICK_P(magick_object); + if (php_imagick_ensure_not_empty (intern_second->magick_wand) == 0) + return; + + tmp_wand = MagickTextureImage(intern->magick_wand, intern_second->magick_wand); + + if (!tmp_wand) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Texture image failed" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagick_sc_entry); + intern_return = Z_IMAGICK_P(return_value); + php_imagick_replace_magickwand(intern_return, tmp_wand); + + return; +} +/* }}} */ + +/* {{{ proto bool Imagick::tintImage(ImagickPixel tint, ImagickPixel opacity, bool legacy = false) + Applies a color vector to each pixel in the image. The 'opacity' color is a per channel + strength factor for how strongly the color should be applied. If legacy is true, the behaviour + of this function is incorrect, but consistent with how it behaved before Imagick version 3.4.0 +*/ +PHP_METHOD(imagick, tintimage) +{ + php_imagick_object *intern; + zval *tint_param, *opacity_param; + MagickBooleanType status; + PixelWand *tint_wand, *opacity_wand; + zend_bool tint_allocated, opacity_allocated; + zend_bool legacy = 0; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|b", &tint_param, &opacity_param, &legacy) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + tint_wand = php_imagick_zval_to_pixelwand (tint_param, IMAGICK_CLASS, &tint_allocated TSRMLS_CC); + if (!tint_wand) + return; + + if (legacy) { + opacity_wand = php_imagick_zval_to_opacity(opacity_param, IMAGICK_CLASS, &opacity_allocated TSRMLS_CC); + } + else { + opacity_wand = php_imagick_zval_to_pixelwand(opacity_param, IMAGICK_CLASS, &opacity_allocated TSRMLS_CC); + } + + + if (!opacity_wand) { + if (tint_allocated) + tint_wand = DestroyPixelWand (tint_wand); + return; + } + + status = MagickTintImage(intern->magick_wand, tint_wand, opacity_wand); + + if (tint_allocated) + tint_wand = DestroyPixelWand (tint_wand); + + if (opacity_allocated) + opacity_wand = DestroyPixelWand (opacity_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable tint image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::unsharpMaskImage(float radius, float sigma, float amount, float threshold[, int channel]) + Sharpens an image. We convolve the image with a Gaussian operator of the given radius and standard deviation (sigma). For reasonable results, radius should be larger than sigma. Use a radius of 0 and Imagick::UnsharpMaskImage() selects a suitable radius for you. +*/ +PHP_METHOD(imagick, unsharpmaskimage) +{ + php_imagick_object *intern; + double radius, sigma, amount, threshold; + MagickBooleanType status; + im_long channel = IM_DEFAULT_CHANNEL; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddd|l", &radius, &sigma, &amount, &threshold, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickUnsharpMaskImageChannel(intern->magick_wand, channel, radius, sigma, amount, threshold); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to unsharp mask image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + + + + +#if MagickLibVersion >= 0x700 + +/* {{{ proto bool Imagick::convolveImage(array kernel[, int channel]) + Applies a custom convolution kernel to the image. +*/ +PHP_METHOD(imagick, convolveimage) +{ + zval *objvar; + php_imagick_object *intern; + php_imagickkernel_object *kernel; + MagickBooleanType status; + im_long channel = IM_DEFAULT_CHANNEL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|l", &objvar, php_imagickkernel_sc_entry, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + kernel = Z_IMAGICKKERNEL_P(objvar); + + IMAGICK_KERNEL_NOT_NULL_EMPTY(kernel); + status = MagickConvolveImageChannel(intern->magick_wand, channel, kernel->kernel_info); + + // No magick is going to happen + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Failed to filter image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} + +#else + +/* {{{ proto bool Imagick::convolveImage(array kernel[, int channel]) + Applies a custom convolution kernel to the image. +*/ +PHP_METHOD(imagick, convolveimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + zval *kernel_array; + double *kernel; + im_long channel = DefaultChannels; + unsigned long order = 0; + im_long num_elements = 0; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|l", &kernel_array, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + kernel = php_imagick_zval_to_double_array(kernel_array, &num_elements TSRMLS_CC); + + if (!kernel) { + php_imagick_throw_exception(IMAGICK_CLASS, "Unable to read matrix array" TSRMLS_CC); + return; + } + + order = (unsigned long) sqrt(num_elements); + status = MagickConvolveImageChannel(intern->magick_wand, channel, order, kernel); + efree(kernel); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to convolve image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ +#endif + +/* {{{ proto bool Imagick::cycleColormapImage(int displace) + Displaces an image's colormap by a given number of positions. If you cycle the colormap a number of times you can produce a psychodelic effect. +*/ +PHP_METHOD(imagick, cyclecolormapimage) +{ + php_imagick_object *intern; + im_long displace; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &displace) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickCycleColormapImage(intern->magick_wand, displace); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to cycle image colormap" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto Imagick Imagick::deconstructImages() + Compares each image with the next in a sequence and returns the maximum bounding region of any pixel differences it discovers. +*/ +PHP_METHOD(imagick, deconstructimages) +{ + MagickWand *tmp_wand; + php_imagick_object *intern, *intern_return; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + tmp_wand = MagickDeconstructImages(intern->magick_wand); + + if (tmp_wand == NULL) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Deconstruct image failed" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagick_sc_entry); + intern_return = Z_IMAGICK_P(return_value); + php_imagick_replace_magickwand(intern_return, tmp_wand); + + return; +} +/* }}} */ + +/* {{{ proto Imagick Imagick::getImageRegion(int width, int height, int x, int y) + Extracts a region of the image and returns it as a new image. +*/ +PHP_METHOD(imagick, getimageregion) +{ + MagickWand *tmp_wand; + php_imagick_object *intern, *intern_return; + im_long width, height, x, y; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &width, &height, &x, &y) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + tmp_wand = MagickGetImageRegion(intern->magick_wand, width, height, x, y); + + if (tmp_wand == NULL) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Get image region failed" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagick_sc_entry); + intern_return = Z_IMAGICK_P(return_value); + php_imagick_replace_magickwand(intern_return, tmp_wand); + + return; + +} +/* }}} */ + +/* {{{ proto bool Imagick::despeckleImage() + Reduces the speckle noise in an image while perserving the edges of the original image. +*/ +PHP_METHOD(imagick, despeckleimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickDespeckleImage(intern->magick_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to despeckle image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::edgeImage(float radius) + Enhance edges within the image with a convolution filter of the given radius. Use a radius of 0 and Edge() selects a suitable radius for you. +*/ +PHP_METHOD(imagick, edgeimage) +{ + php_imagick_object *intern; + double radius; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &radius) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickEdgeImage(intern->magick_wand, radius); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to edge image" TSRMLS_CC); + return; + } + + RETURN_TRUE; + +} +/* }}} */ + +/* {{{ proto bool Imagick::embossImage(float radius, float sigma) + Returns a grayscale image with a three-dimensional effect. We convolve the image with a Gaussian operator of the given radius and standard deviation (sigma). For reasonable results, radius should be larger than sigma. Use a radius of 0 and it will choose a suitable radius for you. +*/ +PHP_METHOD(imagick, embossimage) +{ + php_imagick_object *intern; + double radius, sigma; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &radius, &sigma) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickEmbossImage(intern->magick_wand, radius, sigma); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to emboss image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::enhanceImage() + Applies a digital filter that improves the quality of a noisy image. +*/ +PHP_METHOD(imagick, enhanceimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickEnhanceImage(intern->magick_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to enchance image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::equalizeImage() + Equalizes the image histogram. +*/ +PHP_METHOD(imagick, equalizeimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickEqualizeImage(intern->magick_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to equalize image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::evaluateImage(int op, float constant[, int channel]) + Applys an arithmetic, relational, or logical expression to an image. Use these operators to lighten or darken an image, to increase or decrease contrast in an image, or to produce the "negative" of an image. +*/ +PHP_METHOD(imagick, evaluateimage) +{ + php_imagick_object *intern; + im_long evaluate_operator; + double constant; + MagickBooleanType status; + im_long channel = IM_DEFAULT_CHANNEL; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ld|l", &evaluate_operator, &constant, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickEvaluateImageChannel(intern->magick_wand, channel, evaluate_operator, constant); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to evaluate image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + + +#if MagickLibVersion >= 0x687 +/* {{{ proto bool Imagick::evaluateImages(int EVALUATE_CONSTANT) + Merge multiple images of the same size together with the selected operator. +http://www.imagemagick.org/Usage/layers/#evaluate-sequence +*/ +PHP_METHOD(imagick, evaluateimages) +{ + php_imagick_object *intern, *intern_return; + im_long evaluate_operator; + MagickBooleanType status; + MagickWand *evaluated_wand; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &evaluate_operator) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + +// MagickEvaluateImages appears to crash if index is not zero. +#if MagickLibVersion > 0x628 + /* Get the current iterator position */ + status = MagickSetIteratorIndex(intern->magick_wand, 0); +#else + status = MagickSetImageIndex(intern->magick_wand, 0); +#endif + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set iterator index" TSRMLS_CC); + return; + } + + evaluated_wand = MagickEvaluateImages(intern->magick_wand, evaluate_operator); + + object_init_ex(return_value, php_imagick_sc_entry); + intern_return = Z_IMAGICK_P(return_value); + php_imagick_replace_magickwand(intern_return, evaluated_wand); + return; +} +/* }}} */ +#endif //MagickLibVersion >= 0x687 + +#if MagickLibVersion > 0x655 + +/* {{{ proto bool Imagick::forwardfouriertransformimage(bool magnitude) + //http://www.fftw.org/ + yum install fftw-devel fftw + ./configure --enable-hdri +*/ +PHP_METHOD(imagick, forwardfouriertransformimage) +{ + php_imagick_object *intern; + zend_bool magnitude; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &magnitude) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickForwardFourierTransformImage(intern->magick_wand, magnitude); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to forwardfouriertransformimage image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +#endif + + +/* {{{ proto array Imagick::getImageGeometry() + Returns the width and height as an associative array. +*/ +PHP_METHOD(imagick, getimagegeometry) +{ + long width,height; + php_imagick_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + width = MagickGetImageWidth(intern->magick_wand); + height = MagickGetImageHeight(intern->magick_wand); + + array_init(return_value); + add_assoc_long(return_value, "width", width); + add_assoc_long(return_value, "height", height); + + return; +} +/* }}} */ + +#if MagickLibVersion < 0x700 +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +/* {{{ proto ImagickPixel Imagick::getImageAttribute(string key ) + Returns a named attribute +*/ +PHP_METHOD(imagick, getimageattribute) +{ + php_imagick_object *intern; + char *key, *attribute; + IM_LEN_TYPE key_len; + + IMAGICK_METHOD_DEPRECATED("Imagick", "getImageAttribute"); + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &key, &key_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + attribute = MagickGetImageAttribute(intern->magick_wand, key); + + if (!attribute) { + RETURN_FALSE; + } + + IM_ZVAL_STRING(return_value, attribute); + IMAGICK_FREE_MAGICK_MEMORY(attribute); + + return; +} +/* }}} */ +#endif +#endif + +/* {{{ proto ImagickPixel Imagick::getImageBackgroundColor() + Returns the image background color. +*/ +PHP_METHOD(imagick, getimagebackgroundcolor) +{ + php_imagick_object *intern; + php_imagickpixel_object *internp; + MagickBooleanType status; + PixelWand *tmp_wand; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + tmp_wand = NewPixelWand(); + status = MagickGetImageBackgroundColor(intern->magick_wand, tmp_wand); + + if (tmp_wand == (PixelWand *)NULL) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to get image background color" TSRMLS_CC); + return; + } + + if (status == MagickFalse) { + tmp_wand = DestroyPixelWand(tmp_wand); + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to get image background color" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagickpixel_sc_entry); + internp = Z_IMAGICKPIXEL_P(return_value); + php_imagick_replace_pixelwand(internp, tmp_wand); + + return; +} +/* }}} */ + +/* {{{ proto array Imagick::getImageBluePrimary() + Returns the chromaticy green primary point. IM6: Returns an array with the keys "x" and "y". + IM7: Returns an array with the keys "x", "y" and "z". +*/ +PHP_METHOD(imagick, getimageblueprimary) +{ + php_imagick_object *intern; + MagickBooleanType status; + double x, y; +#if MagickLibVersion >= 0x700 + double z; +#endif + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + +#if MagickLibVersion >= 0x700 + status = MagickGetImageBluePrimary(intern->magick_wand, &x, &y, &z); +#else + status = MagickGetImageBluePrimary(intern->magick_wand, &x, &y); +#endif + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to get image blue primary" TSRMLS_CC); + return; + } + + array_init(return_value); + add_assoc_double(return_value, "x", x); + add_assoc_double(return_value, "y", y); +#if MagickLibVersion >= 0x700 + add_assoc_double(return_value, "z", z); +#endif + + return; +} +/* }}} */ + +/* {{{ proto ImagickPixel Imagick::getImageBorderColor() + Returns the image border color. +*/ +PHP_METHOD(imagick, getimagebordercolor) +{ + php_imagick_object *intern; + php_imagickpixel_object *internp; + MagickBooleanType status; + PixelWand *tmp_wand; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + tmp_wand = NewPixelWand(); + status = MagickGetImageBorderColor(intern->magick_wand, tmp_wand); + + if (tmp_wand == (PixelWand *)NULL) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to get image border color" TSRMLS_CC); + return; + } + + if (status == MagickFalse) { + tmp_wand = DestroyPixelWand(tmp_wand); + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to get image border color" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagickpixel_sc_entry); + internp = Z_IMAGICKPIXEL_P(return_value); + php_imagick_replace_pixelwand(internp, tmp_wand); + + return; +} +/* }}} */ + +/* {{{ proto int Imagick::getImageChannelDepth() + Gets the depth for a particular image channel. +*/ +PHP_METHOD(imagick, getimagechanneldepth) +{ + php_imagick_object *intern; + im_long channel_type, channel_depth; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &channel_type) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + channel_depth = MagickGetImageChannelDepth(intern->magick_wand, channel_type); + RETVAL_LONG(channel_depth); +} +/* }}} */ + +/* {{{ proto float Imagick::getImageChannelDistortion(Imagick reference, int channel, int metric) + Compares one or more image channels of an image to a reconstructed image and returns the specified distortion metric. +*/ +PHP_METHOD(imagick, getimagechanneldistortion) +{ + zval *objvar; + php_imagick_object *intern, *intern_second; + im_long channel_type, metric_type; + double distortion; + MagickBooleanType status; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Oll", &objvar, php_imagick_sc_entry, &channel_type, &metric_type) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + intern_second = Z_IMAGICK_P(objvar); + if (php_imagick_ensure_not_empty (intern_second->magick_wand) == 0) + return; + + status = MagickGetImageChannelDistortion(intern->magick_wand, intern_second->magick_wand, channel_type, metric_type, &distortion); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to get image channel distortion" TSRMLS_CC); + return; + } + + RETVAL_DOUBLE(distortion); + +} +/* }}} */ + +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 +/* {{{ proto array Imagick::getImageChannelExtrema(int channel) + Gets the extrema for one or more image channels. Return value is an associative array with the keys "minima" and "maxima". +*/ +PHP_METHOD(imagick, getimagechannelextrema) +{ + php_imagick_object *intern; + im_long channel_type; + size_t minima, maxima; + MagickBooleanType status; + + IMAGICK_METHOD_DEPRECATED ("Imagick", "getImageChannelExtrema"); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &channel_type) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickGetImageChannelExtrema(intern->magick_wand, channel_type, &minima, &maxima); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to get image channel extrema" TSRMLS_CC); + return; + } + + array_init(return_value); + add_assoc_long(return_value, "minima", minima); + add_assoc_long(return_value, "maxima", maxima); + + return; +} +/* }}} */ +#endif //#if MagickLibVersion < 0x700 +#endif + +/* {{{ proto array Imagick::getImageChannelMean(int channel) + Gets the mean and standard deviation of one or more image channels. Return value is an associative array with the keys "mean" and "standardDeviation". +*/ +PHP_METHOD(imagick, getimagechannelmean) +{ + php_imagick_object *intern; + im_long channel_type; + double mean, standard_deviation; + MagickBooleanType status; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &channel_type) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickGetImageChannelMean(intern->magick_wand, channel_type, &mean, &standard_deviation); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to get image channel mean" TSRMLS_CC); + return; + } + + array_init(return_value); + add_assoc_double(return_value, "mean", mean); + add_assoc_double(return_value, "standardDeviation", standard_deviation); + + return; +} +/* }}} */ + +/* {{{ proto array Imagick::getImageChannelStatistics() + Returns statistics for each channel in the image. The statistics incude the channel depth, its minima and maxima, the mean, and the standard deviation. You can access the red channel mean, for example, like this: +*/ +PHP_METHOD(imagick, getimagechannelstatistics) +{ +#ifdef ZEND_ENGINE_3 + zval tmp; +#else + zval *tmp; +#endif + + const long channels[] = { + UndefinedChannel, RedChannel, CyanChannel, + GreenChannel, MagentaChannel, BlueChannel, + YellowChannel, OpacityChannel, BlackChannel, +#if MagickLibVersion < 0x700 + MatteChannel +#endif + }; + php_imagick_object *intern; + ChannelStatistics *statistics; + unsigned int i; +#if MagickLibVersion < 0x700 + unsigned int elements = 10; +#endif // #if MagickLibVersion >= 0x700 + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + +#if MagickLibVersion >= 0x700 + statistics = MagickGetImageStatistics(intern->magick_wand); +#else + statistics = MagickGetImageChannelStatistics(intern->magick_wand); +#endif + + array_init(return_value); + +#if MagickLibVersion >= 0x700 + for (i=0; i < sizeof(channels)/sizeof(channels[0]); i++) { +#ifdef ZEND_ENGINE_3 + ZVAL_NEW_ARR(&tmp); + array_init(&tmp); + add_assoc_double(&tmp, "mean", statistics[i].mean); + add_assoc_double(&tmp, "minima", statistics[i].minima); + add_assoc_double(&tmp, "maxima", statistics[i].maxima); + add_assoc_double(&tmp, "standardDeviation", statistics[i].standard_deviation); +#if MagickLibVersion < 0x635 + add_assoc_long(&tmp, "scale", statistics[i].scale); +#endif //0x635 + add_assoc_long(&tmp, "depth", statistics[i].depth); + add_index_zval(return_value, i, &tmp); +#else //not ZE3 + MAKE_STD_ZVAL(tmp); + array_init(tmp); + add_assoc_double(tmp, "mean", statistics[i].mean); + add_assoc_double(tmp, "minima", statistics[i].minima); + add_assoc_double(tmp, "maxima", statistics[i].maxima); + add_assoc_double(tmp, "standardDeviation", statistics[i].standard_deviation); +#if MagickLibVersion < 0x635 + add_assoc_long(&tmp, "scale", statistics[i].scale); +#endif //0x635 + add_assoc_long(tmp, "depth", statistics[i].depth); + add_index_zval(return_value, channels[i], tmp); +#endif //end ZE3 + } +#else //below MagickLibVersion>= 0x700 + for (i = 0; i < elements ; i++) { +#ifdef ZEND_ENGINE_3 + ZVAL_NEW_ARR(&tmp); + array_init(&tmp); + add_assoc_double(&tmp, "mean", statistics[channels[i]].mean); + add_assoc_double(&tmp, "minima", statistics[channels[i]].minima); + add_assoc_double(&tmp, "maxima", statistics[channels[i]].maxima); + add_assoc_double(&tmp, "standardDeviation", statistics[channels[i]].standard_deviation); +#if MagickLibVersion < 0x635 + add_assoc_long(&tmp, "scale", statistics[channels[i]].scale); +#endif + add_assoc_long(&tmp, "depth", statistics[channels[i]].depth); + add_index_zval(return_value, channels[i], &tmp); +#else + MAKE_STD_ZVAL(tmp); + array_init(tmp); + add_assoc_double(tmp, "mean", statistics[channels[i]].mean); + add_assoc_double(tmp, "minima", statistics[channels[i]].minima); + add_assoc_double(tmp, "maxima", statistics[channels[i]].maxima); + add_assoc_double(tmp, "standardDeviation", statistics[channels[i]].standard_deviation); +#if MagickLibVersion < 0x635 + add_assoc_long(&tmp, "scale", statistics[channels[i]].scale); +#endif + add_assoc_long(tmp, "depth", statistics[channels[i]].depth); + add_index_zval(return_value, channels[i], tmp); +#endif + + } +#endif + +//etc. +// channel_statistics[i].sum_squared*=area; +// channel_statistics[i].sum_cubed*=area; +// channel_statistics[i].sum_fourth_power*=area; + + MagickRelinquishMemory(statistics); + return; +} +/* }}} */ + +/* {{{ proto ImagickPixel Imagick::getImageColormapColor(int index, ImagickPixel color) + Returns the color of the specified colormap index. +*/ +PHP_METHOD(imagick, getimagecolormapcolor) +{ + php_imagick_object *intern; + php_imagickpixel_object *internp; + MagickBooleanType status; + PixelWand *tmp_wand; + im_long index; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &index) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + tmp_wand = NewPixelWand(); + status = MagickGetImageColormapColor(intern->magick_wand, index , tmp_wand); + + if (tmp_wand == (PixelWand *)NULL) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to get image colormap color" TSRMLS_CC); + return; + } + + if (status == MagickFalse) { + tmp_wand = DestroyPixelWand(tmp_wand); + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to get image colormap color" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagickpixel_sc_entry); + internp = Z_IMAGICKPIXEL_P(return_value); + php_imagick_replace_pixelwand(internp, tmp_wand); + + return; +} +/* }}} */ + +/* {{{ proto int Imagick::getImageColorspace() + Gets the image colorspace. +*/ +PHP_METHOD(imagick, getimagecolorspace) +{ + php_imagick_object *intern; + long colorSpace; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + colorSpace = MagickGetImageColorspace(intern->magick_wand); + RETVAL_LONG(colorSpace); +} +/* }}} */ + +/* {{{ proto int Imagick::getImageCompose() + Returns the composite operator associated with the image. +*/ +PHP_METHOD(imagick, getimagecompose) +{ + php_imagick_object *intern; + long composite; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + composite = MagickGetImageCompose(intern->magick_wand); + RETVAL_LONG(composite); +} +/* }}} */ + +/* {{{ proto int Imagick::getImageDelay() + Gets the image delay. +*/ +PHP_METHOD(imagick, getimagedelay) +{ + php_imagick_object *intern; + long delay; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + delay = MagickGetImageDelay(intern->magick_wand); + RETVAL_LONG(delay); +} +/* }}} */ + +/* {{{ proto int Imagick::getImageDepth() + Gets the image depth. +*/ +PHP_METHOD(imagick, getimagedepth) +{ + php_imagick_object *intern; + long depth; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + depth = MagickGetImageDepth(intern->magick_wand); + RETVAL_LONG(depth); +} +/* }}} */ + +/* {{{ proto float Imagick::getImageDistortion(MagickWand reference, int metric) + Compares an image to a reconstructed image and returns the specified distortion metric. +*/ +PHP_METHOD(imagick, getimagedistortion) +{ + zval *objvar; + php_imagick_object *intern, *intern_second; + im_long metric_type; + double distortion; + MagickBooleanType status; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol", &objvar, php_imagick_sc_entry, &metric_type) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + intern_second = Z_IMAGICK_P(objvar); + if (php_imagick_ensure_not_empty (intern_second->magick_wand) == 0) + return; + + status = MagickGetImageDistortion(intern->magick_wand, intern_second->magick_wand, metric_type, &distortion); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to get image distortion" TSRMLS_CC); + return; + } + + RETVAL_DOUBLE(distortion); +} +/* }}} */ + +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 +/* {{{ proto array Imagick::getImageExtrema() + Gets the extrema for the image. Returns an associative array with the keys "min" and "max". +*/ +PHP_METHOD(imagick, getimageextrema) +{ + php_imagick_object *intern; + size_t min, max; + MagickBooleanType status; + + IMAGICK_METHOD_DEPRECATED ("Imagick", "getImageExtrema"); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickGetImageExtrema(intern->magick_wand, &min, &max); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to get image extrema" TSRMLS_CC); + return; + } + + array_init(return_value); + add_assoc_long(return_value, "min", min); + add_assoc_long(return_value, "max", max); + + return; +} +/* }}} */ +#endif //#if MagickLibVersion < 0x700 +#endif + +/* {{{ proto long Imagick::getImageDispose() + Gets the image disposal method. +*/ +PHP_METHOD(imagick, getimagedispose) +{ + php_imagick_object *intern; + long dispose; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + dispose = MagickGetImageDispose(intern->magick_wand); + RETVAL_LONG(dispose); +} +/* }}} */ + +/* {{{ proto float Imagick::getImageGamma() + Gets the image gamma. +*/ +PHP_METHOD(imagick, getimagegamma) +{ + php_imagick_object *intern; + double gamma; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + gamma = MagickGetImageGamma(intern->magick_wand); + RETVAL_DOUBLE(gamma); +} +/* }}} */ + +/* {{{ proto array Imagick::getImageGreenPrimary() + Returns the chromaticy green primary point. IM6: Returns an array with the keys "x" and "y". + IM7: Returns an array with the keys "x", "y" and "z". +*/ +PHP_METHOD(imagick, getimagegreenprimary) +{ + php_imagick_object *intern; + double x, y; +#if MagickLibVersion >= 0x700 + double z; +#endif + MagickBooleanType status; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + +#if MagickLibVersion >= 0x700 + status = MagickGetImageGreenPrimary(intern->magick_wand, &x, &y, &z); +#else + status = MagickGetImageGreenPrimary(intern->magick_wand, &x, &y); +#endif + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to get image green primary" TSRMLS_CC); + return; + } + + array_init(return_value); + add_assoc_double(return_value, "x", x); + add_assoc_double(return_value, "y", y); +#if MagickLibVersion >= 0x700 + add_assoc_double(return_value, "z", z); +#endif + + return; +} +/* }}} */ + +/* {{{ proto int Imagick::getImageHeight() + Returns the image height. +*/ +PHP_METHOD(imagick, getimageheight) +{ + php_imagick_object *intern; + long height; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + height = MagickGetImageHeight(intern->magick_wand); + RETVAL_LONG(height); +} +/* }}} */ + +/* {{{ proto array Imagick::getImageHistogram() + Returns the image histogram as an array of ImagickPixel objects. +*/ +PHP_METHOD(imagick, getimagehistogram) +{ + php_imagick_object *intern; + php_imagickpixel_object *internp; + PixelWand **wand_array; + size_t colors = 0; + unsigned long i; +#ifdef ZEND_ENGINE_3 + zval tmp_pixelwand; +#else + zval *tmp_pixelwand; +#endif + + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + wand_array = MagickGetImageHistogram(intern->magick_wand, &colors); + array_init(return_value); + + for (i = 0; i < colors; i++) { + if (wand_array[i]) { +#ifdef ZEND_ENGINE_3 + object_init_ex(&tmp_pixelwand, php_imagickpixel_sc_entry); + internp = Z_IMAGICKPIXEL_P(&tmp_pixelwand); + php_imagick_replace_pixelwand(internp, wand_array[i]); + add_next_index_zval(return_value, &tmp_pixelwand); +#else + MAKE_STD_ZVAL(tmp_pixelwand); + object_init_ex(tmp_pixelwand, php_imagickpixel_sc_entry); + internp = (php_imagickpixel_object *)zend_object_store_get_object(tmp_pixelwand TSRMLS_CC); + php_imagick_replace_pixelwand(internp, wand_array[i]); + add_next_index_zval(return_value, tmp_pixelwand); +#endif + } + } + + IMAGICK_FREE_MAGICK_MEMORY(wand_array); + return; +} +/* }}} */ + +/* {{{ proto int Imagick::getImageInterlaceScheme() + Gets the image interlace scheme. +*/ +PHP_METHOD(imagick, getimageinterlacescheme) +{ + php_imagick_object *intern; + long interlace; + + IMAGICK_METHOD_DEPRECATED ("Imagick", "getImageInterlaceScheme"); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + interlace = MagickGetImageInterlaceScheme(intern->magick_wand); + RETVAL_LONG(interlace); +} +/* }}} */ + +/* {{{ proto int Imagick::getImageIterations() + Gets the image iterations. +*/ +PHP_METHOD(imagick, getimageiterations) +{ + php_imagick_object *intern; + long iterations; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + iterations = MagickGetImageIterations(intern->magick_wand); + RETVAL_LONG(iterations); +} +/* }}} */ + +#if MagickLibVersion < 0x700 +/* {{{ proto ImagickPixel Imagick::getImageMatteColor() + Returns the image matte color. +*/ +PHP_METHOD(imagick, getimagemattecolor) +{ + php_imagick_object *intern; + php_imagickpixel_object *internp; + MagickBooleanType status; + PixelWand *tmp_wand; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + tmp_wand = NewPixelWand(); + status = MagickGetImageMatteColor(intern->magick_wand, tmp_wand); + + if (tmp_wand == (PixelWand *)NULL) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to get image matte color" TSRMLS_CC); + return; + } + + if (status == MagickFalse) { + tmp_wand = DestroyPixelWand(tmp_wand); + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable get image matter color" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagickpixel_sc_entry); + internp = Z_IMAGICKPIXEL_P(return_value); + php_imagick_replace_pixelwand(internp, tmp_wand); + + return; +} +/* }}} */ +#endif //#if MagickLibVersion < 0x700 + +/* {{{ proto array Imagick::getImagePage() + Returns the page geometry associated with the image in an array with the keys "width", "height", "x", and "y". +*/ +PHP_METHOD(imagick, getimagepage) +{ + php_imagick_object *intern; + MagickBooleanType status; + size_t width, height; + ssize_t x, y; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickGetImagePage(intern->magick_wand, &width, &height, &x, &y); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to get image page" TSRMLS_CC); + return; + } + + array_init(return_value); + + add_assoc_long(return_value, "width", width); + add_assoc_long(return_value, "height", height); + add_assoc_long(return_value, "x", x); + add_assoc_long(return_value, "y", y); + + return; +} +/* }}} */ + +/* {{{ proto ImagickPixel Imagick::getImagePixelColor(int x, int y) + Returns the color of the specified pixel. +*/ +PHP_METHOD(imagick, getimagepixelcolor) +{ + php_imagick_object *intern; + php_imagickpixel_object *internp; + MagickBooleanType status; + PixelWand *tmp_wand; + im_long x, y; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &x, &y) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + tmp_wand = NewPixelWand(); + + if (!tmp_wand) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Failed to allocate new PixelWand" TSRMLS_CC); + return; + } + + status = MagickGetImagePixelColor(intern->magick_wand, x, y , tmp_wand); + + if (status == MagickFalse) { + tmp_wand = DestroyPixelWand(tmp_wand); + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable get image pixel color" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagickpixel_sc_entry); + internp = Z_IMAGICKPIXEL_P(return_value); + php_imagick_replace_pixelwand(internp, tmp_wand); + + return; +} +/* }}} */ + +/* {{{ proto string Imagick::getImageProfile(string name) + Returns the named image profile. +*/ +PHP_METHOD(imagick, getimageprofile) +{ + php_imagick_object *intern; + char *profile, *name; + IM_LEN_TYPE name_len; +#if MagickLibVersion < 0x628 + long length; +#else + size_t length; +#endif + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + profile = (char *)MagickGetImageProfile(intern->magick_wand, name, &length); + + if (profile) { + IM_ZVAL_STRINGL(return_value, profile, length); + IMAGICK_FREE_MAGICK_MEMORY(profile); + return; + } + + php_imagick_throw_exception(IMAGICK_CLASS, "Can not get image profile" TSRMLS_CC); + return; +} +/* }}} */ + +/* {{{ proto array Imagick::getImageRedPrimary() + Returns the chromaticy red primary point as an array. IM6: with the keys "x" and "y". + IM7: Returns an array with the keys "x", "y" and "z". +*/ +PHP_METHOD(imagick, getimageredprimary) +{ + php_imagick_object *intern; + MagickBooleanType status; + double x, y; +#if MagickLibVersion >= 0x700 + double z; +#endif + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + +#if MagickLibVersion >= 0x700 + status = MagickGetImageRedPrimary(intern->magick_wand, &x, &y, &z); +#else + status = MagickGetImageRedPrimary(intern->magick_wand, &x, &y); +#endif + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to get image red primary" TSRMLS_CC); + return; + } + + array_init(return_value); + add_assoc_double(return_value, "x", x); + add_assoc_double(return_value, "y", y); +#if MagickLibVersion >= 0x700 + add_assoc_double(return_value, "z", z); +#endif + + return; +} +/* }}} */ + +/* {{{ proto int Imagick::getImageRenderingIntent() + Gets the image rendering intent. +*/ +PHP_METHOD(imagick, getimagerenderingintent) +{ + php_imagick_object *intern; + long renderingIntent; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + renderingIntent = MagickGetImageRenderingIntent(intern->magick_wand); + RETVAL_LONG(renderingIntent); +} +/* }}} */ + +/* {{{ proto array Imagick::getImageResolution() + Gets the image X and Y resolution. +*/ +PHP_METHOD(imagick, getimageresolution) +{ + php_imagick_object *intern; + MagickBooleanType status; + double x, y; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickGetImageResolution(intern->magick_wand, &x, &y); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to get image resolution" TSRMLS_CC); + return; + } + + array_init(return_value); + add_assoc_double(return_value, "x", x); + add_assoc_double(return_value, "y", y); + + return; +} +/* }}} */ + +/* {{{ proto int Imagick::getImageScene() + Gets the image scene. +*/ +PHP_METHOD(imagick, getimagescene) +{ + php_imagick_object *intern; + unsigned long scene; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + scene = MagickGetImageScene(intern->magick_wand); + RETVAL_LONG(scene); +} +/* }}} */ + +/* {{{ proto string Imagick::getImageSignature() + Generates an SHA-256 message digest for the image pixel stream. +*/ +PHP_METHOD(imagick, getimagesignature) +{ + php_imagick_object *intern; + char *signature; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + signature = MagickGetImageSignature(intern->magick_wand); + IM_ZVAL_STRING(return_value, signature); + IMAGICK_FREE_MAGICK_MEMORY(signature); + return; +} +/* }}} */ + +/* {{{ proto int Imagick::getImageTicksPerSecond() + Gets the image ticks-per-second. +*/ +PHP_METHOD(imagick, getimagetickspersecond) +{ + php_imagick_object *intern; + unsigned long ticks; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + ticks = MagickGetImageTicksPerSecond(intern->magick_wand); + RETVAL_LONG(ticks); +} +/* }}} */ + +/* {{{ proto int Imagick::getImageType() + Gets the potential image type: +*/ +PHP_METHOD(imagick, getimagetype) +{ + php_imagick_object *intern; + long imageType; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + imageType = MagickGetImageType(intern->magick_wand); + RETVAL_LONG(imageType); +} +/* }}} */ + +/* {{{ proto int Imagick::getImageUnits() + Gets the image units of resolution. +*/ +PHP_METHOD(imagick, getimageunits) +{ + php_imagick_object *intern; + long resolutionType; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + resolutionType = MagickGetImageUnits(intern->magick_wand); + RETVAL_LONG(resolutionType); +} +/* }}} */ + +/* {{{ proto int Imagick::getImageVirtualPixelMethod() + Returns the virtual pixel method for the sepcified image. +*/ +PHP_METHOD(imagick, getimagevirtualpixelmethod) +{ + php_imagick_object *intern; + long pixelMethod; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + pixelMethod = MagickGetImageVirtualPixelMethod(intern->magick_wand); + RETVAL_LONG(pixelMethod); +} +/* }}} */ + +/* {{{ proto array Imagick::getImageWhitePoint() + Returns the chromaticy white point as an associative array. IM6: with the keys "x" and "y". + IM7: with the keys "x", "y" and "z". +*/ +PHP_METHOD(imagick, getimagewhitepoint) +{ + php_imagick_object *intern; + MagickBooleanType status; + double x, y; +#if MagickLibVersion >= 0x700 + double z; +#endif + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + +#if MagickLibVersion >= 0x700 + status = MagickGetImageWhitePoint(intern->magick_wand, &x, &y, &z); +#else + status = MagickGetImageWhitePoint(intern->magick_wand, &x, &y); +#endif + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to get image white point" TSRMLS_CC); + return; + } + + array_init(return_value); + add_assoc_double(return_value, "x", x); + add_assoc_double(return_value, "y", y); +#if MagickLibVersion >= 0x700 + add_assoc_double(return_value, "z", z); +#endif + + return; +} +/* }}} */ + +/* {{{ proto int Imagick::getImageWidth() + Returns the image width. +*/ +PHP_METHOD(imagick, getimagewidth) +{ + php_imagick_object *intern; + unsigned long width; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + width = MagickGetImageWidth(intern->magick_wand); + RETVAL_LONG(width); +} +/* }}} */ + +/* {{{ proto int Imagick::getNumberImages() + Returns the number of images associated with Imagick object. +*/ +PHP_METHOD(imagick, getnumberimages) +{ + php_imagick_object *intern; + unsigned long num_images; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + num_images = MagickGetNumberImages(intern->magick_wand); + RETVAL_LONG(num_images); +} +/* }}} */ + +/* + Resizes an image so that it is 'bestfit' for the bounding box + If the image does not fill the box completely the box is filled with + image's background color. The background color can be set using MagickSetImageBackgroundColor +*/ +#if MagickLibVersion > 0x631 +static +zend_bool s_resize_bounding_box(MagickWand *magick_wand, im_long box_width, im_long box_height, zend_bool fill, zend_bool legacy) +{ + im_long new_width, new_height; + im_long extent_x, extent_y; + + /* Calculate dimensions */ + if (!php_imagick_thumbnail_dimensions(magick_wand, 1, box_width, box_height, &new_width, &new_height, legacy)) { + return 0; + } + + /* Resize the image to the new size */ + if (MagickThumbnailImage(magick_wand, new_width, new_height) == MagickFalse) { + return 0; + } + + /* If user does not want to fill we are all done here */ + if (!fill) { + return 1; + } + + /* In case user wants to fill use extent for it rather than creating a new canvas */ + extent_x = (box_width > new_width) ? ((box_width - new_width) / 2) : 0; + extent_y = (box_height > new_height) ? ((box_height - new_height) / 2) : 0; + + if (MagickExtentImage(magick_wand, box_width, box_height, extent_x * -1, extent_y * -1) == MagickFalse) { + return 0; + } + return 1; +} +#endif + +/* {{{ proto bool Imagick::thumbnailImage(int columns, int rows[, bool bestfit = false[, bool fill = false[, bool legacy = false]]]) + Changes the size of an image to the given dimensions and removes any associated profiles. + If legacy is true, the calculations are done with the small rounding bug that existed in + Imagick before 3.4.0. If false, the calculations should produce the same results as + ImageMagick CLI does. +*/ +PHP_METHOD(imagick, thumbnailimage) +{ + im_long width, height, new_width, new_height; + php_imagick_object *intern; + zend_bool bestfit = 0, fill = 0; + zend_bool legacy = 0; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll|bbb", &width, &height, &bestfit, &fill, &legacy) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + if (bestfit && fill) { +#if MagickLibVersion > 0x631 + if (!s_resize_bounding_box(intern->magick_wand, width, height, fill, legacy)) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to resize and fill image" TSRMLS_CC); + return; + } +#else + php_imagick_throw_exception(IMAGICK_CLASS, "Fill parameter is only supported with ImageMagick 6.3.2+" TSRMLS_CC); + return; +#endif + } else { + if (!php_imagick_thumbnail_dimensions(intern->magick_wand, bestfit, width, height, &new_width, &new_height, legacy)) { + php_imagick_throw_exception(IMAGICK_CLASS, "Invalid image geometry" TSRMLS_CC); + return; + } + /* No magick is going to happen */ + if (MagickThumbnailImage(intern->magick_wand, new_width, new_height) == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to thumbnail image" TSRMLS_CC); + return; + } + } + RETURN_TRUE; +} +/* }}} */ + +/* This is not universally safe to use, but is safe enough for values that will + be encountered for image dimensions. +*/ +static inline double im_round_helper_class(double value) { + if (value >= 0.0) { + return floor(value + 0.5); + } else { + return ceil(value - 0.5); + } +} + +static +void s_calculate_crop( + im_long orig_width, im_long orig_height, + im_long desired_width, im_long desired_height, + im_long *new_width, im_long *new_height, + im_long *offset_x, im_long *offset_y, + zend_bool legacy +) { + double ratio_x, ratio_y; + long temp_new_width, temp_new_height; + + ratio_x = ((double) desired_width / (double) orig_width); + ratio_y = ((double) desired_height / (double) orig_height); + + if (ratio_x > ratio_y) { + temp_new_width = desired_width; + + if (legacy) { + temp_new_height = (long)(ratio_x * (double)orig_height); + } + else { + temp_new_height = im_round_helper_class(ratio_x * (double)orig_height); + } + } else { + temp_new_height = desired_height; + if (legacy) { + temp_new_width = (long)(ratio_y * (double)orig_width); + } + else { + temp_new_width = im_round_helper_class(ratio_y * (double)orig_width); + } + } + + *new_width = temp_new_width; + *new_height = temp_new_height; + + *offset_x = (long) ((temp_new_width - desired_width) / 2); + *offset_y = (long) ((temp_new_height - desired_height) / 2); +} + + +/* {{{ proto array Imagick::calculateCrop(long orig_width, long orig_height, long desired_width, long desired_height[, bool legacy = false]) + Calculates the cropping values that will be used by a crop operation. +*/ +PHP_METHOD(imagick, calculatecrop) +{ + im_long orig_width, orig_height; + im_long desired_width, desired_height; + im_long new_width, new_height; + im_long offset_x, offset_y; + zend_bool legacy = 0; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll|b", + &orig_width, &orig_height, &desired_width, &desired_height, &legacy) == FAILURE) { + return; + } + + if (orig_width <= 0 || orig_height <= 0 || + desired_width <= 0 || desired_height <= 0) { + php_imagick_throw_exception(IMAGICK_CLASS, "All values must be above zero." TSRMLS_CC); + } + + s_calculate_crop( + orig_width, orig_height, + desired_width, desired_height, + &new_width, &new_height, + &offset_x, &offset_y, + legacy + ); + + array_init(return_value); + add_assoc_long(return_value, "width", new_width); + add_assoc_long(return_value, "height", new_height); + + add_assoc_long(return_value, "offset_x", offset_x); + add_assoc_long(return_value, "offset_y", offset_y); + + return; +} +/* }}} */ + + +static +zend_bool s_crop_thumbnail_image(MagickWand *magick_wand, im_long desired_width, im_long desired_height, zend_bool legacy TSRMLS_DC) +{ + im_long offset_x = 0, offset_y = 0, new_width, new_height; + im_long orig_width = (im_long)MagickGetImageWidth(magick_wand); + im_long orig_height = (im_long)MagickGetImageHeight(magick_wand); + + /* Already at the size, just strip profiles */ + if ((orig_width == desired_width) && (orig_height == desired_height)) { + if (!MagickStripImage(magick_wand)) { + return 0; + } + return 1; + } + + s_calculate_crop( + orig_width, orig_height, + desired_width, desired_height, + &new_width, &new_height, + &offset_x, &offset_y, + legacy + ); + + if (MagickThumbnailImage(magick_wand, new_width, new_height) == MagickFalse) { + return 0; + } + + /* all done here */ + if ((new_width == desired_width) && (new_height == desired_height)) { + return 1; + } + + if (MagickCropImage(magick_wand, desired_width, desired_height, offset_x, offset_y) == MagickFalse) { + return 0; + } + + MagickSetImagePage(magick_wand, desired_width, desired_height, 0, 0); + return 1; +} + +// +/* {{{ proto bool Imagick::cropthumbnailImage(int columns, int rows[, bool legacy = false] ) + Creates a cropped thumbnail at the requested size. If legacy is true, uses the + incorrect behaviour that was present until Imagick 3.4.0. If false it uses the correct + behaviour. +*/ +PHP_METHOD(imagick, cropthumbnailimage) +{ + im_long crop_width, crop_height; + zend_bool legacy = 0; + php_imagick_object *intern; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll|b", &crop_width, &crop_height, &legacy) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + /* The world collapses.. */ + if (!s_crop_thumbnail_image(intern->magick_wand, crop_width, crop_height, legacy TSRMLS_CC)) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to crop-thumbnail image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::resetIterator(); + Resets the iterator. Use it in conjunction with Imagick::nextImage() to iterate over all the images in a wand container. +*/ +PHP_METHOD(imagick, resetiterator) +{ + php_imagick_object *intern; + intern = Z_IMAGICK_P(getThis()); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + /* No magick is going to happen */ + if (intern->magick_wand == NULL) { + RETURN_FALSE; + } + intern->next_out_of_bound = 0; + MagickResetIterator(intern->magick_wand); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setFirstIterator() + Sets the wand iterator to the first image. +*/ +PHP_METHOD(imagick, setfirstiterator) +{ + php_imagick_object *intern; + intern = Z_IMAGICK_P(getThis()); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + /* No magick is going to happen */ + if (intern->magick_wand == NULL) { + RETURN_FALSE; + } + intern->next_out_of_bound = 0; + MagickSetFirstIterator(intern->magick_wand); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setLastIterator() + Sets the wand iterator to the last image. +*/ +PHP_METHOD(imagick, setlastiterator) +{ + php_imagick_object *intern; + intern = Z_IMAGICK_P(getThis()); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + /* No magick is going to happen */ + if (intern->magick_wand == NULL) { + RETURN_FALSE; + } + intern->next_out_of_bound = 0; + MagickSetLastIterator(intern->magick_wand); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::previousImage() + Assocates the previous image in an image list with the Imagick object. +*/ +PHP_METHOD(imagick, previousimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + status = MagickPreviousImage(intern->magick_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + RETURN_FALSE; + } + intern->next_out_of_bound = 0; + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::nextImage() + Associates the next image in the image list with an Imagick object. +*/ +PHP_METHOD(imagick, nextimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + status = MagickNextImage(intern->magick_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + intern->next_out_of_bound = 1; + RETURN_FALSE; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::hasPreviousImage() + Returns true if the wand has more images when traversing the list in the reverse direction +*/ +PHP_METHOD(imagick, haspreviousimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + status = MagickHasPreviousImage(intern->magick_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + RETURN_FALSE; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::hasNextImage() + Returns true if the wand has more images when traversing the list in the forward direction +*/ +PHP_METHOD(imagick, hasnextimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + status = MagickHasNextImage(intern->magick_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + RETURN_FALSE; + } + + RETURN_TRUE; +} +/* }}} */ + +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 +/* {{{ proto int Imagick::getImageIndex() + Returns the index of the current active image, within the Imagick object. +*/ +PHP_METHOD(imagick, getimageindex) +{ + MagickBooleanType status; + php_imagick_object *intern; + +#if MagickLibVersion > 0x628 + IMAGICK_METHOD_DEPRECATED("Imagick", "getImageindex"); +#endif + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + status = MagickGetImageIndex(intern->magick_wand); + ZVAL_LONG(return_value, (long)status); + return; +} +/* }}} */ +#endif // #if MagickLibVersion < 0x700 + + +#if MagickLibVersion < 0x700 + +/* {{{ proto bool Imagick::setImageIndex(int index) + Returns the index of the current active image, within the Imagick object. +*/ +PHP_METHOD(imagick, setimageindex) +{ + im_long index; + MagickBooleanType status; + php_imagick_object *intern; + +#if MagickLibVersion > 0x628 + IMAGICK_METHOD_DEPRECATED("Imagick", "setImageIndex"); +#endif + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &index) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); +#if MagickLibVersion > 0x628 + /* Get the current iterator position */ + status = MagickSetIteratorIndex(intern->magick_wand, index); +#else + status = MagickSetImageIndex(intern->magick_wand, index); +#endif + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image index" TSRMLS_CC); + return; + } + intern->next_out_of_bound = 0; + RETURN_TRUE; + +} +/* }}} */ +#endif // #if MagickLibVersion < 0x700 +#endif + +/* {{{ proto bool Imagick::removeImage() + Removes an image from the image list. +*/ +PHP_METHOD(imagick, removeimage) +{ + MagickBooleanType status; + php_imagick_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickRemoveImage(intern->magick_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to remove image" TSRMLS_CC); + return; + } + intern->next_out_of_bound = 0; + MagickSetLastIterator(intern->magick_wand); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto string Imagick::getImageFilename() + Returns the filename of a particular image in a sequence +*/ +PHP_METHOD(imagick, getimagefilename) +{ + php_imagick_object *intern; + char *filename; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + filename = MagickGetImageFilename(intern->magick_wand); + + if (filename == (char *)NULL) { + return; + } + + IM_ZVAL_STRING(return_value, filename); + IMAGICK_FREE_MAGICK_MEMORY(filename); + return; +} +/* }}} */ + +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 +/* {{{ proto int Imagick::getImageSize() + returns the image length in bytes +*/ +PHP_METHOD(imagick, getimagesize) +{ + php_imagick_object *intern; + + IMAGICK_METHOD_DEPRECATED_USE_INSTEAD("Imagick", "getImageSize", "Imagick", "getImageLength"); + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + ZVAL_LONG(return_value, (long)MagickGetImageSize(intern->magick_wand)); + return; +} +/* }}} */ +#endif +#endif + +static +zend_bool s_image_has_format (MagickWand *magick_wand) +{ + char *buffer; + zend_bool ret; + buffer = MagickGetImageFormat(magick_wand); + ret = buffer && *buffer != '\0'; + if (buffer) { + MagickRelinquishMemory (buffer); + } + return ret; +} + +/* {{{ proto string Imagick::getImageBlob() + Returns the current image sequence as a string +*/ +PHP_METHOD(imagick, getimageblob) +{ + php_imagick_object *intern; + unsigned char *image_contents; + size_t image_size; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + if (!s_image_has_format (intern->magick_wand)) { + php_imagick_throw_exception(IMAGICK_CLASS, "Image has no format" TSRMLS_CC); + return; + } + + image_contents = MagickGetImageBlob(intern->magick_wand, &image_size); + if (!image_contents) { + return; + } + + IM_ZVAL_STRINGL(return_value, (char *)image_contents, image_size); + IMAGICK_FREE_MAGICK_MEMORY(image_contents); + return; +} +/* }}} */ + +/* {{{ proto string Imagick::getImagesBlob() + Returns all image sequences as a string +*/ +PHP_METHOD(imagick, getimagesblob) +{ + php_imagick_object *intern; + unsigned char *image_contents; + size_t image_size; + int current; + MagickBooleanType status; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + +#if MagickLibVersion > 0x628 + /* Get the current iterator position */ + current = MagickGetIteratorIndex(intern->magick_wand); +#else + /* Get the current iterator position */ + current = MagickGetImageIndex(intern->magick_wand); +#endif + + /* Reset the iterator */ + MagickResetIterator(intern->magick_wand); + + /* Loop all images to make sure they have a format */ + while (MagickNextImage(intern->magick_wand)) { + if (!s_image_has_format (intern->magick_wand)) { + php_imagick_throw_exception(IMAGICK_CLASS, "Image has no format" TSRMLS_CC); + return; + } + } + +#if MagickLibVersion > 0x628 + /* Get the current iterator position */ + status = MagickSetIteratorIndex(intern->magick_wand, current); +#else + /* Get the current iterator position */ + status = MagickSetImageIndex(intern->magick_wand, current); +#endif + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set the iterator index" TSRMLS_CC); + return; + } + + image_contents = MagickGetImagesBlob(intern->magick_wand, &image_size); + if (!image_contents) { + return; + } + + IM_ZVAL_STRINGL(return_value, (char *)image_contents, image_size); + IMAGICK_FREE_MAGICK_MEMORY(image_contents); + return; +} +/* }}} */ + +/* {{{ proto string Imagick::getImageFormat() + Returns the format of a particular image in a sequence. +*/ +PHP_METHOD(imagick, getimageformat) +{ + php_imagick_object *intern; + char *format; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + intern = Z_IMAGICK_P(getThis()); + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + if (!s_image_has_format (intern->magick_wand)) { + php_imagick_throw_exception(IMAGICK_CLASS, "Image has no format" TSRMLS_CC); + return; + } + + format = MagickGetImageFormat (intern->magick_wand); + IM_ZVAL_STRING(return_value, format); + IMAGICK_FREE_MAGICK_MEMORY(format); + return; +} +/* }}} */ + +/* {{{ proto string Imagick::getImageMimeType() + Returns the image mime-type +*/ +PHP_METHOD(imagick, getimagemimetype) +{ + php_imagick_object *intern; + char *format = NULL, *mime_type = NULL; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + if (!s_image_has_format (intern->magick_wand)) { + php_imagick_throw_exception(IMAGICK_CLASS, "Image has no format" TSRMLS_CC); + return; + } + + format = MagickGetImageFormat (intern->magick_wand); + + mime_type = (char *) MagickToMime(format); + IMAGICK_FREE_MAGICK_MEMORY(format); + + if (!mime_type) { + php_imagick_throw_exception(IMAGICK_CLASS, "Unable to get image mime-type" TSRMLS_CC); + return; + } + + IM_ZVAL_STRING(return_value, mime_type); + IMAGICK_FREE_MAGICK_MEMORY(mime_type); + return; +} +/* }}} */ + + +static +void s_add_assoc_str (zval *array, const char *key, const char *value) +{ + //add_assoc_string (array, key, (char *)(value ? value : ""), copy); + IM_add_assoc_string (array, key, (char *)(value ? value : "")); + //TODO - if copy == 0 free the string? +} + +static +void s_add_named_strings (zval *array, const char *haystack TSRMLS_DC) +{ + unsigned int i, found; + char *last_ptr = NULL, *buffer; + size_t num_keys; + +#ifdef ZEND_ENGINE_3 + zend_string *trim; + zend_string *line_string; +#else + char *trim; +#endif + + char *line; + + const char *str_keys [] = { + "Format: ", + "Units: ", + "Type: ", + "Colorspace: ", + "Filesize: ", + "Compression: " + }; + + const char *arr_keys [] = { + "format", + "units", + "type", + "colorSpace", + "fileSize", + "compression" + }; + + found = 0; + + + buffer = estrdup (haystack); + + num_keys = sizeof (str_keys) / sizeof (str_keys[0]); + line = php_strtok_r (buffer, "\r\n", &last_ptr); + + while ((found < num_keys) && line) { + // Break the line further into tokens + +#ifdef ZEND_ENGINE_3 + line_string = zend_string_init(line, strlen(line), 0); + //str, what, what_len, mode + trim = php_trim(line_string, NULL, 0, 3); + for (i = 0; i < num_keys; i++) { + if (trim->val) { + if (strncmp (trim->val, str_keys [i], strlen (str_keys [i])) == 0) { + // This should be our line + IM_add_assoc_string (array, arr_keys [i], trim->val + strlen (str_keys [i])); + found++; + } + } + } + // zend_string_release(line_string); - 0 in zend_string_init means no need to free? + zend_string_release(trim); + line = php_strtok_r (NULL, "\r\n", &last_ptr); +#else + trim = php_trim(line, strlen(line), NULL, 0, NULL, 3 TSRMLS_CC); + for (i = 0; i < num_keys; i++) { + if (strncmp (trim, str_keys [i], strlen (str_keys [i])) == 0) { + // This should be our line + IM_add_assoc_string (array, arr_keys [i], trim + strlen (str_keys [i])); + found++; + } + } + efree (trim); + line = php_strtok_r (NULL, "\r\n", &last_ptr); +#endif + } + efree (buffer); +} + +/* {{{ proto array Imagick::identifyImage([bool appendRawOutput] ) + Identifies an image and returns the attributes. Attributes include the image width, height, size, and others. + If true is passed as argument, then the raw output is appended to the array. +*/ +PHP_METHOD(imagick, identifyimage) +{ + char *format, *identify, *filename, *signature; + php_imagick_object *intern; + zend_bool append_raw_string = 0; + double x, y; + +#ifdef ZEND_ENGINE_3 + zval array; +#else + zval *array; +#endif + + zval *pArray; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &append_raw_string) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + // This is to parse some string options, ugly hack but easier than using CommandOptionToMNemonic + // or MagickOptionToMnemonic and FormatMagickSize, which have changed names and signatures between + // versions that we support + identify = MagickIdentifyImage (intern->magick_wand); + + // Actually generate the array ourselves + array_init(return_value); + + // Name of the image + filename = MagickGetImageFilename (intern->magick_wand); + s_add_assoc_str (return_value, "imageName", filename); + IMAGICK_FREE_MAGICK_MEMORY(filename); + + format = MagickGetImageFormat (intern->magick_wand); + if (format) { + char *mime_type = MagickToMime(format); + if (mime_type) { + s_add_assoc_str (return_value, "mimetype", mime_type); + IMAGICK_FREE_MAGICK_MEMORY(mime_type); + } else + s_add_assoc_str (return_value, "mimetype", "unknown"); + + IMAGICK_FREE_MAGICK_MEMORY(format); + } + else + s_add_assoc_str (return_value, "mimetype", "unknown"); + + s_add_named_strings (return_value, identify TSRMLS_CC); + + // Geometry is an associative array + +#ifdef ZEND_ENGINE_3 + ZVAL_NEW_ARR(&array); + pArray = &array; +#else + MAKE_STD_ZVAL(array); + pArray = array; +#endif + + array_init(pArray); + + add_assoc_long (pArray, "width", MagickGetImageWidth (intern->magick_wand)); + add_assoc_long (pArray, "height", MagickGetImageHeight (intern->magick_wand)); + add_assoc_zval (return_value, "geometry", pArray); + + if (MagickGetImageResolution(intern->magick_wand, &x, &y) == MagickTrue) { +#ifdef ZEND_ENGINE_3 + zval geometry_array; + array_init(&geometry_array); + add_assoc_double(&geometry_array, "x", x); + add_assoc_double(&geometry_array, "y", y); + add_assoc_zval(return_value, "resolution", &geometry_array); +#else + zval *p_geometry_array; + MAKE_STD_ZVAL(p_geometry_array); + array_init(p_geometry_array); + add_assoc_double(p_geometry_array, "x", x); + add_assoc_double(p_geometry_array, "y", y); + add_assoc_zval(return_value, "resolution", p_geometry_array); +#endif + } + + signature = MagickGetImageSignature(intern->magick_wand); + s_add_assoc_str (return_value, "signature", signature); + IMAGICK_FREE_MAGICK_MEMORY(signature); + + if (append_raw_string == 1) + IM_add_assoc_string (return_value, "rawOutput", identify); + + IMAGICK_FREE_MAGICK_MEMORY(identify); + return; +} +/* }}} */ + +#undef imagick_option_to_string + +/* {{{ proto int Imagick::getImageColors() + Gets the number of unique colors in the image. +*/ +PHP_METHOD(imagick, getimagecolors) +{ + php_imagick_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + ZVAL_LONG(return_value, (long)MagickGetImageColors(intern->magick_wand)); + return; +} +/* }}} */ + +/* {{{ proto bool Imagick::commentImage(string comment) + Adds a comment to your image. +*/ +PHP_METHOD(imagick, commentimage) +{ + php_imagick_object *intern; + char *comment; + IM_LEN_TYPE comment_len; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &comment, &comment_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickCommentImage(intern->magick_wand, comment); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to comment image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setImageFilename(string filename) + Sets the filename of a particular image in a sequence. +*/ +PHP_METHOD(imagick, setimagefilename) +{ + php_imagick_object *intern; + char *filename; + IM_LEN_TYPE filename_len; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageFilename(intern->magick_wand, filename); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image filename" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 +/* PS, DEPRECATED please remove: http://www.imagemagick.org/discourse-server/viewtopic.php?f=6&t=8196 */ +PHP_METHOD(imagick, setimageattribute) +{ + php_imagick_object *intern; + char *key, *attribute; + IM_LEN_TYPE key_len, attribute_len; + MagickBooleanType status; + + /* Tell user that this method has been deprecated. */ + IMAGICK_METHOD_DEPRECATED("Imagick", "setImageAttribute"); + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &key, &key_len, &attribute, &attribute_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageAttribute(intern->magick_wand, key, attribute); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image attribute" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +#endif // #if MagickLibVersion < 0x700 +#endif + +/* {{{ proto bool Imagick::setImageBackgroundColor(ImagickPixel background) + Sets the image background color. +*/ +PHP_METHOD(imagick, setimagebackgroundcolor) +{ + zval *param; + php_imagick_object *intern; + MagickBooleanType status; + PixelWand *color_wand; + zend_bool allocated; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶m) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + color_wand = php_imagick_zval_to_pixelwand (param, IMAGICK_CLASS, &allocated TSRMLS_CC); + if (!color_wand) + return; + + status = MagickSetImageBackgroundColor(intern->magick_wand, color_wand); + + if (allocated) + color_wand = DestroyPixelWand (color_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image background color" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +#if MagickLibVersion >= 0x700 +/* {{{ proto int Imagick::setImageChannelMask(int channel) + Sets the image channel mask. Returns the previous set channel mask. +*/ +PHP_METHOD(imagick, setimagechannelmask) +{ + php_imagick_object *intern; + im_long channel; + ChannelType previous_channel_type; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + previous_channel_type = MagickSetImageChannelMask(intern->magick_wand, channel); + + RETURN_LONG(previous_channel_type); +} +/* }}} */ +#endif + + +/* {{{ proto bool Imagick::setImageCompose(int compose) + Sets the image composite operator, useful for specifying how to composite the image thumbnail when using the Imagick::montageImage() method. +*/ +PHP_METHOD(imagick, setimagecompose) +{ + php_imagick_object *intern; + im_long compose; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &compose) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageCompose(intern->magick_wand, compose); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image composite operator" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto int Imagick::getImageCompression() + Gets the image compression type +*/ +PHP_METHOD(imagick, getimagecompression) +{ + php_imagick_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + RETVAL_LONG(MagickGetImageCompression(intern->magick_wand)); +} +/* }}} */ + +/* {{{ proto bool Imagick::setImageCompression(int compression) + Sets the image compression. +*/ +PHP_METHOD(imagick, setimagecompression) +{ + php_imagick_object *intern; + im_long compression; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &compression) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageCompression(intern->magick_wand, compression); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image compression" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setImageDelay(int delay) + Sets the image delay. +*/ +PHP_METHOD(imagick, setimagedelay) +{ + php_imagick_object *intern; + im_long delay; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &delay) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageDelay(intern->magick_wand, delay); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image delay" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::colorizeImage(ImagickPixel colorize, ImagickPixel opacity, bool legacy) + Blends the fill color with each pixel in the image. The 'opacity' color is a + per channel strength factor for how strongly the color should be applied. If + legacy is true, the behaviour of this function is incorrect, but consistent + with how it behaved before Imagick version 3.4.0 +*/ +PHP_METHOD(imagick, colorizeimage) +{ + PixelWand *param_wand = NULL; + php_imagick_object *intern; + zval *color_param, *opacity_param; + MagickBooleanType status; + PixelWand *color_wand, *opacity_wand; + zend_bool color_allocated, opacity_allocated; + zend_bool legacy = 0; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|b", &color_param, &opacity_param, &legacy) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + color_wand = php_imagick_zval_to_pixelwand (color_param, IMAGICK_CLASS, &color_allocated TSRMLS_CC); + if (!color_wand) + return; + + if (legacy) { + opacity_wand = php_imagick_zval_to_opacity (opacity_param, IMAGICK_CLASS, &opacity_allocated TSRMLS_CC); + } + else { + opacity_wand = php_imagick_zval_to_pixelwand(opacity_param, IMAGICK_CLASS, &opacity_allocated TSRMLS_CC); + } + + if (!opacity_wand) { + if (color_allocated) + color_wand = DestroyPixelWand (color_wand); + + return; + } + + if (legacy) { + /* Colorize wants both wands to be of same instance */ + param_wand = php_imagick_clone_pixelwand (color_wand); + if (!param_wand) { + php_imagick_throw_exception (IMAGICK_CLASS, "Failed to allocate" TSRMLS_CC); + return; + } +#if MagickLibVersion < 0x700 + PixelSetOpacity(param_wand, PixelGetOpacity(opacity_wand)); +#endif + PixelSetAlpha(param_wand, PixelGetAlpha(opacity_wand)); + status = MagickColorizeImage(intern->magick_wand, param_wand, param_wand); + param_wand = DestroyPixelWand(param_wand); + } else { + status = MagickColorizeImage(intern->magick_wand, color_wand, opacity_wand); + } + + if (color_allocated) + color_wand = DestroyPixelWand (color_wand); + + if (opacity_allocated) + opacity_wand = DestroyPixelWand (opacity_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to colorize image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto Imagick Imagick::compareImageChannels(Imagick reference, int channel, int metric) + Compares one or more image channels of an image to a reconstructed image and returns the difference image. +*/ +PHP_METHOD(imagick, compareimagechannels) +{ + MagickWand *tmp_wand; + zval *objvar; + php_imagick_object *intern, *intern_second, *intern_return; + im_long channel_type, metric_type; + double distortion; +#ifdef ZEND_ENGINE_3 + zval new_wand; +#else + zval *new_wand; +#endif + + zval *pNewWand; + + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Oll", &objvar, php_imagick_sc_entry, &channel_type, &metric_type) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + intern_second = Z_IMAGICK_P(objvar); + if (php_imagick_ensure_not_empty (intern_second->magick_wand) == 0) + return; + + tmp_wand = MagickCompareImageChannels(intern->magick_wand, intern_second->magick_wand, channel_type, metric_type, &distortion); + + if (!tmp_wand) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Compare image channels failed" TSRMLS_CC); + return; + } + +#ifdef ZEND_ENGINE_3 + pNewWand = &new_wand; +#else + MAKE_STD_ZVAL(new_wand); + pNewWand = new_wand; +#endif + array_init(return_value); + + object_init_ex(pNewWand, php_imagick_sc_entry); + intern_return = Z_IMAGICK_P(pNewWand); + php_imagick_replace_magickwand(intern_return, tmp_wand); + + add_next_index_zval(return_value, pNewWand); + add_next_index_double(return_value, distortion); + + return; +} +/* }}} */ +#if MagickLibVersion > 0x628 +/* {{{ proto Imagick Imagick::compareImageLayers(int method) + Compares each image with the next in a sequence and returns the maximum bounding region of any pixel differences it discovers. +*/ +PHP_METHOD(imagick, compareimagelayers) +{ + MagickWand *tmp_wand; + php_imagick_object *intern, *intern_return; + im_long compare_method; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &compare_method) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + +#if MagickLibVersion >= 0x700 + tmp_wand = (MagickWand *)MagickCompareImagesLayers(intern->magick_wand, compare_method); +#else + tmp_wand = (MagickWand *)MagickCompareImageLayers(intern->magick_wand, compare_method); +#endif + + if (tmp_wand == NULL) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Compare image layers failed" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagick_sc_entry); + intern_return = Z_IMAGICK_P(return_value); + php_imagick_replace_magickwand(intern_return, tmp_wand); + + return; +} +/* }}} */ +#endif + +#if MagickLibVersion < 0x700 +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +/* {{{ proto Imagick Imagick::flattenImages() + Merges a sequence of images. This is useful for combining Photoshop layers into a single image. +*/ +PHP_METHOD(imagick, flattenimages) +{ + php_imagick_object *intern, *intern_return; + MagickWand *tmp_wand; + + IMAGICK_METHOD_DEPRECATED ("Imagick", "flattenImages"); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + + /* TODO: SHOULD THIS BE HERE? */ + MagickSetFirstIterator(intern->magick_wand); + + tmp_wand = MagickFlattenImages(intern->magick_wand); + + if (tmp_wand == NULL) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Flatten images failed" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagick_sc_entry); + intern_return = Z_IMAGICK_P(return_value); + php_imagick_replace_magickwand(intern_return, tmp_wand); + + return; +} +/* }}} */ +#endif +#endif + +/* {{{ proto bool Imagick::flipImage() + Creates a vertical mirror image by reflecting the pixels around the central x-axis. +*/ +PHP_METHOD(imagick, flipimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickFlipImage(intern->magick_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to flip image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::flopImage() + Creates a horizontal mirror image by reflecting the pixels around the central y-axis. +*/ +PHP_METHOD(imagick, flopimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickFlopImage(intern->magick_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to flop image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::frameImage(ImagickPixel matte_color, int width, int height, int inner_bevel, int outer_bevel) + Adds a simulated three-dimensional border around the image +*/ +PHP_METHOD(imagick, frameimage) +{ + zval *param; + php_imagick_object *intern; + MagickBooleanType status; + im_long width, height, inner_bevel, outer_bevel; + PixelWand *color_wand; + zend_bool allocated; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zllll", ¶m, &width, &height, &inner_bevel, &outer_bevel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + color_wand = php_imagick_zval_to_pixelwand (param, IMAGICK_CLASS, &allocated TSRMLS_CC); + if (!color_wand) + return; + +#if MagickLibVersion >= 0x700 + { + //TODO - understand and allow compose to be set. + CompositeOperator compose = AtopCompositeOp; + status = MagickFrameImage(intern->magick_wand, color_wand, width, height, inner_bevel, outer_bevel, compose); + } +#else + status = MagickFrameImage(intern->magick_wand, color_wand, width, height, inner_bevel, outer_bevel); +#endif + + if (allocated) + color_wand = DestroyPixelWand (color_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to frame image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto Imagick Imagick::fxImage(string expression[, int channel]) + Evaluate expression for each pixel in the image. +*/ +PHP_METHOD(imagick, fximage) +{ + MagickWand *tmp_wand; + php_imagick_object *intern, *intern_return; + char *expression; + IM_LEN_TYPE expression_len; + im_long channel = IM_DEFAULT_CHANNEL; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &expression, &expression_len, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + tmp_wand = MagickFxImageChannel(intern->magick_wand, channel, expression); + + if (tmp_wand == NULL) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Fx image failed" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagick_sc_entry); + intern_return = Z_IMAGICK_P(return_value); + php_imagick_replace_magickwand(intern_return, tmp_wand); + + return; +} +/* }}} */ + +/* {{{ proto bool Imagick::gammaImage(float gamma[, int channel]) + Gamma-corrects an image. The same image viewed on different devices will have perceptual differences in the way the image's intensities are represented on the screen. Specify individual gamma levels for the red, green, and blue channels, or adjust all three with the gamma parameter. Values typically range from 0.8 to 2.3. +*/ +PHP_METHOD(imagick, gammaimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + double gamma; + im_long channel = IM_DEFAULT_CHANNEL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|l", &gamma, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickGammaImageChannel(intern->magick_wand, channel, gamma); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to gamma image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::gaussianBlurImage(float radius, float sigma[, int channel]) + Blurs an image. We convolve the image with a Gaussian operator of the given radius and standard deviation (sigma). For reasonable results, the radius should be larger than sigma. Use a radius of 0 and selects a suitable radius for you. +*/ +PHP_METHOD(imagick, gaussianblurimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + double radius, sigma; + im_long channel = IM_DEFAULT_CHANNEL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd|l", &radius, &sigma, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickGaussianBlurImageChannel(intern->magick_wand, channel, radius, sigma); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to gaussian blur image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto Imagick Imagick::compareImageChannels(int metric, int distortion) + Compares one or more images and returns the difference image. +*/ +PHP_METHOD(imagick, compareimages) +{ + MagickWand *tmp_wand; + zval *objvar; + php_imagick_object *intern, *intern_second, *intern_return; + im_long metric_type; + double distortion; +#ifdef ZEND_ENGINE_3 + zval new_wand; +#else + zval *new_wand; +#endif + + zval *pNewWand; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol", &objvar, php_imagick_sc_entry, &metric_type) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + intern_second = Z_IMAGICK_P(objvar); + if (php_imagick_ensure_not_empty (intern_second->magick_wand) == 0) + return; + +#ifdef ZEND_ENGINE_3 + pNewWand = &new_wand; +#else + MAKE_STD_ZVAL(new_wand); + pNewWand = new_wand; +#endif + array_init(return_value); + + tmp_wand = MagickCompareImages(intern->magick_wand, intern_second->magick_wand, metric_type, &distortion); + + if (!tmp_wand) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Compare images failed" TSRMLS_CC); + return; + } + + object_init_ex(pNewWand, php_imagick_sc_entry); + intern_return = Z_IMAGICK_P(pNewWand); + php_imagick_replace_magickwand(intern_return, tmp_wand); + + add_next_index_zval(return_value, pNewWand); + add_next_index_double(return_value, distortion); + + return; +} +/* }}} */ + +/* {{{ proto bool Imagick::contrastImage(bool sharpen) + Enhances the intensity differences between the lighter and darker elements of the image. Set sharpen to a value other than 0 to increase the image contrast otherwise the contrast is reduced. +*/ +PHP_METHOD(imagick, contrastimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + zend_bool contrast; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &contrast) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickContrastImage(intern->magick_wand, contrast); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to contrast image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setImageDepth(int depth) + Sets the image depth. +*/ +PHP_METHOD(imagick, setimagedepth) +{ + php_imagick_object *intern; + im_long depth; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &depth) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageDepth(intern->magick_wand, depth); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image depth" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setImageGamma(float gamma) + Sets the image gamma. +*/ +PHP_METHOD(imagick, setimagegamma) +{ + php_imagick_object *intern; + double gamma; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &gamma) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageGamma(intern->magick_wand, gamma); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image gamma" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setImageIterations(int iterations) + Sets the image iterations. +*/ +PHP_METHOD(imagick, setimageiterations) +{ + php_imagick_object *intern; + im_long iterations; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &iterations) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageIterations(intern->magick_wand, iterations); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image iterations" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +#if MagickLibVersion < 0x700 +/* {{{ proto bool Imagick::setImageMatteColor(ImagickPixel matte) + Sets the image matte color. +*/ +PHP_METHOD(imagick, setimagemattecolor) +{ + zval *param; + php_imagick_object *intern; + MagickBooleanType status; + PixelWand *color_wand; + zend_bool allocated; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶m) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + color_wand = php_imagick_zval_to_pixelwand (param, IMAGICK_CLASS, &allocated TSRMLS_CC); + if (!color_wand) + return; + + status = MagickSetImageMatteColor(intern->magick_wand, color_wand); + + if (allocated) + color_wand = DestroyPixelWand (color_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image matte color" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ +#endif //#if MagickLibVersion < 0x700 + +/* {{{ proto bool Imagick::setImagePage(int width, int height, int x, int y) + Sets the page geometry of the image. +*/ +PHP_METHOD(imagick, setimagepage) +{ + php_imagick_object *intern; + im_long width, height, x, y; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &width, &height, &x, &y) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImagePage(intern->magick_wand, width, height, x, y); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image page" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setImageResolution(float x_resolution,const float y_resolution) + Sets the image resolution. +*/ +PHP_METHOD(imagick, setimageresolution) +{ + php_imagick_object *intern; + double x_res, y_res; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x_res, &y_res) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageResolution(intern->magick_wand, x_res, y_res); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image resolution" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setImageScene(int scene) + Sets the image scene. +*/ +PHP_METHOD(imagick, setimagescene) +{ + php_imagick_object *intern; + im_long scene; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &scene) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageScene(intern->magick_wand, scene); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image scene" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setImageTicksPerSecond(int ticks_per-second) + Sets the image ticks-per-second. +*/ +PHP_METHOD(imagick, setimagetickspersecond) +{ + php_imagick_object *intern; + im_long ticks_per_second; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &ticks_per_second) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageTicksPerSecond(intern->magick_wand, ticks_per_second); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image ticks per second" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setImageType(int image_type) + Sets the image type. +*/ +PHP_METHOD(imagick, setimagetype) +{ + php_imagick_object *intern; + im_long image_type; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &image_type) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageType(intern->magick_wand, image_type); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image type" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setImageUnits(int units) + Sets the image units of resolution. +*/ +PHP_METHOD(imagick, setimageunits) +{ + php_imagick_object *intern; + im_long units; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &units) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageUnits(intern->magick_wand, units); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image units" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setImageFormat(string format) + Sets the format of a particular image in a sequence. +*/ +PHP_METHOD(imagick, setimageformat) +{ + char *format; + IM_LEN_TYPE format_len; + MagickBooleanType status; + php_imagick_object *intern; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &format, &format_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageFormat(intern->magick_wand, format); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image format" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::charcoalImage(float radius, float sigma) + Simulates a charcoal drawing. +*/ +PHP_METHOD(imagick, charcoalimage) +{ + double sigma, radius; + MagickBooleanType status; + php_imagick_object *intern; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &radius, &sigma) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickCharcoalImage(intern->magick_wand, sigma, radius); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to charcoal image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::oilPaintImage(float radius) + Applies a special effect filter that simulates an oil painting. Each pixel is replaced by the most frequent color occurring in a circular region defined by radius. +*/ +PHP_METHOD(imagick, oilpaintimage) +{ + double radius; + MagickBooleanType status; + php_imagick_object *intern; +#if MagickLibVersion >= 0x700 + float sigma = 1.0; + //TODO - allow sigma to be set. +#endif // #if MagickLibVersion >= 0x700 + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &radius) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + +#if MagickLibVersion >= 0x700 + status = MagickOilPaintImage(intern->magick_wand, radius, sigma); +#else + status = MagickOilPaintImage(intern->magick_wand, radius); +#endif + + /* No magick is going to happen */ + if (status == MagickFalse) + { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to oilpaint image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::normalizeImage([int channel]) + Enhances the contrast of a color image by adjusting the pixels color to span the entire range of colors available, Channel parameter is ignored in ImageMagick below 6.2.8 +*/ +PHP_METHOD(imagick, normalizeimage) +{ + MagickBooleanType status; + php_imagick_object *intern; + im_long channel = IM_DEFAULT_CHANNEL; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + +#if MagickLibVersion > 0x628 + status = MagickNormalizeImageChannel(intern->magick_wand, channel); +#else + status = MagickNormalizeImage(intern->magick_wand); +#endif + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to normalize image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::labelImage(string label) + Adds a label to your image. +*/ +PHP_METHOD(imagick, labelimage) +{ + char *label; + IM_LEN_TYPE label_len; + MagickBooleanType status; + php_imagick_object *intern; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &label, &label_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + status = MagickLabelImage(intern->magick_wand, label); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to label image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::writeImage(string filename) + Writes an image to the specified filename +*/ +PHP_METHOD(imagick, writeimage) +{ + char *filename = NULL; + IM_LEN_TYPE filename_len = 0; + zend_bool free_filename = 0; + php_imagick_object *intern; + struct php_imagick_file_t file = {0}; + php_imagick_rw_result_t rc; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!", &filename, &filename_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + if (!filename) { + filename = MagickGetImageFilename(intern->magick_wand); + + if (!filename) { + php_imagick_throw_exception(IMAGICK_CLASS, "No image filename specified" TSRMLS_CC); + return; + } + filename_len = strlen(filename); + free_filename = 1; + } + + if (!filename_len) { + php_imagick_throw_exception(IMAGICK_CLASS, "Can not use empty string as a filename" TSRMLS_CC); + return; + } + + if (!php_imagick_file_init(&file, filename, filename_len TSRMLS_CC)) { + php_imagick_throw_exception(IMAGICK_CLASS, "Invalid filename provided" TSRMLS_CC); + return; + } + rc = php_imagick_write_file(intern, &file, ImagickWriteImage, 0 TSRMLS_CC); + php_imagick_file_deinit(&file); + + if (rc != IMAGICK_RW_OK) { + php_imagick_rw_fail_to_exception (intern->magick_wand, rc, filename TSRMLS_CC); + if (free_filename) { + IMAGICK_FREE_MAGICK_MEMORY(filename); + } + return; + } + + if (free_filename) { + IMAGICK_FREE_MAGICK_MEMORY(filename); + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::writeImages(string filename, bool adjoin) + Writes an image or image sequence. +*/ +PHP_METHOD(imagick, writeimages) +{ + char *filename; + zend_bool adjoin; + IM_LEN_TYPE filename_len; + php_imagick_object *intern; + struct php_imagick_file_t file = {0}; + php_imagick_rw_result_t rc; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sb", &filename, &filename_len, &adjoin) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + if (!filename_len) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Can not use empty string as a filename" TSRMLS_CC); + return; + } + + if (!php_imagick_file_init(&file, filename, filename_len TSRMLS_CC)) { + php_imagick_throw_exception(IMAGICK_CLASS, "Invalid filename provided" TSRMLS_CC); + return; + } + rc = php_imagick_write_file(intern, &file, ImagickWriteImages, adjoin TSRMLS_CC); + php_imagick_file_deinit(&file); + + if (rc != IMAGICK_RW_OK) { + php_imagick_rw_fail_to_exception (intern->magick_wand, rc, filename TSRMLS_CC); + return; + } + RETURN_TRUE; + +} +/* }}} */ + +/* {{{ proto bool Imagick::drawImage(ImagickDraw drawing_wand) + Renders the ImagickDrawing object on the current image. +*/ +PHP_METHOD(imagick, drawimage) +{ + zval *objvar; + php_imagick_object *intern; + MagickBooleanType status; + php_imagickdraw_object *internd; + char *old_locale; + + intern = Z_IMAGICK_P(getThis()); + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &objvar, php_imagickdraw_sc_entry) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(objvar); + + old_locale = php_imagick_set_locale (TSRMLS_C); + + status = MagickDrawImage(intern->magick_wand, internd->drawing_wand); + + php_imagick_restore_locale (old_locale); + + if (old_locale) + efree (old_locale); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to draw image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::annotateImage(ImagickDraw drawing_wand, float x, float y, float angle, string text) + Annotates an image with text. +*/ +PHP_METHOD(imagick, annotateimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + php_imagickdraw_object *internd; + double x, y, angle; + char *text; + IM_LEN_TYPE text_len; + zval *objvar; +#if MagickLibVersion < 0x632 + char *font; +#endif + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Oddds", &objvar, php_imagickdraw_sc_entry, &x, &y, &angle, &text, &text_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + internd = Z_IMAGICKDRAW_P(objvar); + +#if MagickLibVersion < 0x632 + font = DrawGetFont(internd->drawing_wand); + + /* Fixes PECL Bug #11328 */ + if (!font) { + php_imagick_throw_exception(IMAGICK_CLASS, "Font needs to be set before annotating an image" TSRMLS_CC); + return; + } +#endif + + status = MagickAnnotateImage(intern->magick_wand, internd->drawing_wand, x, y, angle, text); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to annotate image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::getImageCompressionQuality(int quality) + Gets the image compression quality +*/ +PHP_METHOD(imagick, getimagecompressionquality) +{ + php_imagick_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + RETVAL_LONG(MagickGetImageCompressionQuality(intern->magick_wand)); +} +/* }}} */ + +/* {{{ proto bool Imagick::setImageCompressionQuality(int quality) + Sets the image compression quality +*/ +PHP_METHOD(imagick, setimagecompressionquality) +{ + im_long quality; + php_imagick_object *intern; + MagickBooleanType status; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &quality) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSetImageCompressionQuality(intern->magick_wand, quality); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set image compression quality" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + + +/* {{{ proto bool Imagick::compositeImage(Imagick composite_wand, int compose, int x, int y[, int channel] ) + Composite one image onto another at the specified offset. Channel parameter is ignored in ImageMagick below 6.2.8 +*/ +PHP_METHOD(imagick, compositeimage) +{ + zval *objvar; + php_imagick_object *intern; + php_imagick_object *intern_second; + im_long x, y; + im_long composite_id = 0; + im_long channel = IM_DEFAULT_CHANNEL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Olll|l", &objvar, php_imagick_sc_entry, &composite_id, &x, &y, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + intern_second = Z_IMAGICK_P(objvar); + if (php_imagick_ensure_not_empty (intern_second->magick_wand) == 0) + return; + +#if MagickLibVersion > 0x628 + MagickCompositeImageChannel(intern->magick_wand, channel, intern_second->magick_wand, composite_id, x, y); +#else + MagickCompositeImage(intern->magick_wand, intern_second->magick_wand, composite_id, x, y); +#endif + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::modulateImage(float brightness, float saturation, float hue) + Lets you control the brightness, saturation, and hue of an image. Hue is the percentage of absolute rotation from the current position. For example 50 results in a counter-clockwise rotation of 90 degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200 both resulting in a rotation of 180 degrees. +*/ +PHP_METHOD(imagick, modulateimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + double brightness, saturation, hue; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ddd", &brightness, &saturation, &hue) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickModulateImage(intern->magick_wand, brightness, saturation, hue); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to modulate image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::addNoiseImage(int noise_type[, int channel]) + Adds random noise to the image. Channel parameter is ignored in ImageMagick below 6.2.8 +*/ +PHP_METHOD(imagick, addnoiseimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + im_long noise; + im_long channel = IM_DEFAULT_CHANNEL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &noise, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + +#if MagickLibVersion > 0x628 + status = MagickAddNoiseImageChannel(intern->magick_wand, channel, noise); +#else + status = MagickAddNoiseImage(intern->magick_wand, noise); +#endif + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to add image noise" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto Imagick Imagick::montageImage(ImagickDraw drawing_wand, string tile_geometry, string thumbnail_geometry, int mode, string frame) + Creates a composite image by combining several separate images. The images are tiled on the composite image with the name of the image optionally appearing just below the individual tile. +*/ + +PHP_METHOD(imagick, montageimage) +{ + MagickWand *tmp_wand; + zval *objvar; + php_imagick_object *intern, *intern_return; + php_imagickdraw_object *internd; + char *tile_geometry, *thumbnail_geometry, *frame; + IM_LEN_TYPE tile_geometry_len, thumbnail_geometry_len, frame_len; + im_long montage_mode = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ossls", &objvar, php_imagickdraw_sc_entry, + &tile_geometry, &tile_geometry_len, + &thumbnail_geometry, &thumbnail_geometry_len, + &montage_mode, + &frame, &frame_len) == FAILURE) + { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + internd = Z_IMAGICKDRAW_P(objvar); + + tmp_wand = MagickMontageImage(intern->magick_wand, internd->drawing_wand, tile_geometry, thumbnail_geometry, montage_mode, frame); + + if (tmp_wand == NULL) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Montage image failed" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagick_sc_entry); + intern_return = Z_IMAGICK_P(return_value); + php_imagick_replace_magickwand(intern_return, tmp_wand); + + return; +} +/* }}} */ + +/* {{{ proto bool Imagick::affineTransformImage(ImagickDraw drawing_wand) + Transforms an image as dictated by the affine matrix of the drawing wand. +*/ +PHP_METHOD(imagick, affinetransformimage) +{ + zval *objvar; + php_imagick_object *intern; + php_imagickdraw_object *internd; + MagickBooleanType status; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &objvar, php_imagickdraw_sc_entry) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + internd = Z_IMAGICKDRAW_P(objvar); + status = MagickAffineTransformImage(intern->magick_wand, internd->drawing_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to affine transform image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +#if MagickLibVersion < 0x700 +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +/* {{{ proto Imagick Imagick::averageImages() + Average a set of images. +*/ +PHP_METHOD(imagick, averageimages) +{ + MagickWand *tmp_wand; + php_imagick_object *intern, *intern_return; + + IMAGICK_METHOD_DEPRECATED ("Imagick", "averageImages"); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + tmp_wand = MagickAverageImages(intern->magick_wand); + + if (tmp_wand == NULL) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Averaging images failed" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagick_sc_entry); + intern_return = Z_IMAGICK_P(return_value); + php_imagick_replace_magickwand(intern_return, tmp_wand); + return; +} +/* }}} */ +#endif +#endif + +/* {{{ proto bool Imagick::borderImage(ImagickPixel bordercolor, int width, int height) + Surrounds the image with a border of the color defined by the bordercolor pixel wand. +*/ +PHP_METHOD(imagick, borderimage) +{ + zval *param; + php_imagick_object *intern; + MagickBooleanType status; + im_long width, height; + PixelWand *color_wand; + zend_bool allocated; + +#if MagickLibVersion >= 0x700 + //TODO - understand and allow compose to be set. + CompositeOperator compose = AtopCompositeOp; +#endif // #if MagickLibVersion >= 0x700 + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zll", ¶m, &width, &height) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + color_wand = php_imagick_zval_to_pixelwand (param, IMAGICK_CLASS, &allocated TSRMLS_CC); + if (!color_wand) + return; + +#if MagickLibVersion >= 0x700 + status = MagickBorderImage(intern->magick_wand, color_wand, width, height, compose); +#else + status = MagickBorderImage(intern->magick_wand, color_wand, width, height); +#endif + + if (allocated) + color_wand = DestroyPixelWand (color_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to border image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::thresholdImage(float threshold[, int channel] ) + Changes the value of individual pixels based on the intensity of each pixel compared to threshold. The result is a high-contrast, two color image. +*/ +PHP_METHOD(imagick, thresholdimage) +{ + php_imagick_object *intern; + double threshold; + MagickBooleanType status; + im_long channel = DefaultChannels; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|l", &threshold, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickThresholdImageChannel(intern->magick_wand, channel, threshold); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to threshold image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::adaptiveThresholdImage(int width, int height, int offset) + Selects an individual threshold for each pixel based on the range of intensity values in its local neighborhood. This allows for thresholding of an image whose global intensity histogram doesn't contain distinctive peaks. +*/ +PHP_METHOD(imagick, adaptivethresholdimage) +{ + php_imagick_object *intern; + im_long width, height, offset; + MagickBooleanType status; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &width, &height, &offset) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickAdaptiveThresholdImage(intern->magick_wand, width, height, offset); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to adaptive threshold image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::sharpenImage(float radius, float sigma[, int channel]) + Sharpens an image. We convolve the image with a Gaussian operator of the given radius and standard deviation (sigma). For reasonable results, the radius should be larger than sigma. Use a radius of 0 and selects a suitable radius for you. +*/ +PHP_METHOD(imagick, sharpenimage) +{ + double sigma, radius; + MagickBooleanType status; + php_imagick_object *intern; + im_long channel = IM_DEFAULT_CHANNEL; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd|l", &radius, &sigma, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSharpenImageChannel(intern->magick_wand, channel, radius, sigma); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to sharpen image" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::shaveImage(int columns, int rows) + Shaves pixels from the image edges. It allocates the memory necessary for the new Image structure and returns a pointer to the new image. +*/ +PHP_METHOD(imagick, shaveimage) +{ + php_imagick_object *intern; + im_long columns, rows; + MagickBooleanType status; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &columns, &rows) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickShaveImage(intern->magick_wand, columns, rows); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to shave image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::shearImage(ImagickPixel background, float x_shear, float y_shear) + Slides one edge of an image along the X or Y axis +*/ +PHP_METHOD(imagick, shearimage) +{ + zval *param; + php_imagick_object *intern; + double x_shear, y_shear; + MagickBooleanType status; + PixelWand *color_wand; + zend_bool allocated; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zdd", ¶m, &x_shear, &y_shear) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + color_wand = php_imagick_zval_to_pixelwand (param, IMAGICK_CLASS, &allocated TSRMLS_CC); + if (!color_wand) + return; + + status = MagickShearImage(intern->magick_wand, color_wand, x_shear, y_shear); + + if (allocated) + color_wand = DestroyPixelWand (color_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to shear image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::spliceImage(int width, int height, int x, int y) + Splices a solid color into the image. +*/ +PHP_METHOD(imagick, spliceimage) +{ + im_long width, height, x, y; + php_imagick_object *intern; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &width, &height, &x, &y) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSpliceImage(intern->magick_wand, width, height, x, y); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to splice image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto Imagick Imagick::steganoImage(Imagick watermark_wand, int offset) + Hides a digital watermark within the image. Recover the hidden watermark later to prove that the authenticity of an image. Offset defines the start position within the image to hide the watermark. +*/ +PHP_METHOD(imagick, steganoimage) +{ + zval *objvar; + php_imagick_object *intern, *intern_second, *intern_return; + im_long offset; + MagickWand *tmp_wand; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol", &objvar, php_imagick_sc_entry, &offset) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + intern_second = Z_IMAGICK_P(objvar); + if (php_imagick_ensure_not_empty (intern_second->magick_wand) == 0) + return; + + tmp_wand = MagickSteganoImage(intern->magick_wand, intern_second->magick_wand, offset); + + if (!tmp_wand) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Stegano image failed" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagick_sc_entry); + intern_return = Z_IMAGICK_P(return_value); + php_imagick_replace_magickwand(intern_return, tmp_wand); + return; +} +/* }}} */ + +/* {{{ proto Imagick Imagick::clone() + Makes an exact copy of the Imagick object. +*/ +PHP_METHOD(imagick, clone) +{ + php_imagick_object *intern, *intern_return; + MagickWand *tmp_wand; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + IMAGICK_METHOD_DEPRECATED("Imagick", "clone"); + intern = Z_IMAGICK_P(getThis()); + tmp_wand = CloneMagickWand(intern->magick_wand); + + if (tmp_wand == NULL) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Cloning Imagick object failed" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagick_sc_entry); + intern_return = Z_IMAGICK_P(return_value); + php_imagick_replace_magickwand(intern_return, tmp_wand); + return; +} +/* }}} */ + +/* {{{ proto bool Imagick::rotateImage(ImagickPixel background, float degrees) + Rotates an image the specified number of degrees. Empty triangles left over from rotating the image are filled with the background color. +*/ +PHP_METHOD(imagick, rotateimage) +{ + zval *param; + php_imagick_object *intern; + double degrees; + MagickBooleanType status; + PixelWand *color_wand; + zend_bool allocated; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zd", ¶m, °rees) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + color_wand = php_imagick_zval_to_pixelwand (param, IMAGICK_CLASS, &allocated TSRMLS_CC); + if (!color_wand) + return; + + status = MagickRotateImage(intern->magick_wand, color_wand, degrees); + + if (allocated) + color_wand = DestroyPixelWand (color_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to rotate image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::sampleImage(int columns, int rows) + Scales an image to the desired dimensions with pixel sampling. Unlike other scaling methods, this method does not introduce any additional color into the scaled image. +*/ +PHP_METHOD(imagick, sampleimage) +{ + php_imagick_object *intern; + im_long columns, rows; + MagickBooleanType status; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &columns, &rows) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSampleImage(intern->magick_wand, columns, rows); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to sample image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::solarizeImage(float threshold) + Applies a special effect to the image, similar to the effect achieved in a photo darkroom by selectively exposing areas of photo sensitive paper to light. Threshold ranges from 0 to QuantumRange and is a measure of the extent of the solarization. +*/ +PHP_METHOD(imagick, solarizeimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + im_long threshold; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &threshold) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSolarizeImage(intern->magick_wand, threshold); + + /* No magick is going to happen */ + if (status == MagickFalse) + { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to solarize image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::shadowImage(float opacity, float sigma, int x, int y) + Simulates an image shadow. +*/ +PHP_METHOD(imagick, shadowimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + double opacity, sigma; + long x, y; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ddll", &opacity, &sigma, &x, &y) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickShadowImage(intern->magick_wand, opacity, sigma, x, y); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to shadow image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::motionBlurImage(float radius, float sigma, float angle[, int CHANNEL]) + Simulates motion blur. We convolve the image with a Gaussian operator of the given radius and standard deviation (sigma). For reasonable results, radius should be larger than sigma. Use a radius of 0 and MotionBlurImage() selects a suitable radius for you. Angle gives the angle of the blurring motion. +*/ +PHP_METHOD(imagick, motionblurimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + double radius, sigma, angle; + im_long channel = IM_DEFAULT_CHANNEL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ddd|l", &radius, &sigma, &angle, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + +#if MagickLibVersion > 0x643 + status = MagickMotionBlurImageChannel(intern->magick_wand, channel, radius, sigma, angle); +#else + status = MagickMotionBlurImage(intern->magick_wand, radius, sigma, angle); +#endif + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to motion blur image" TSRMLS_CC); + return; + } + + RETURN_TRUE; + + +} +/* }}} */ + +#if MagickLibVersion < 0x700 +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +/* {{{ proto Imagick Imagick::mosaicImages() + Inlays an image sequence to form a single coherent picture. It returns a wand with each image in the sequence composited at the location defined by the page offset of the image. +*/ +PHP_METHOD(imagick, mosaicimages) +{ + MagickWand *tmp_wand = NULL; + php_imagick_object *intern, *intern_return; + + IMAGICK_METHOD_DEPRECATED ("Imagick", "mosaicImages"); + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + /* TODO: should this be here? */ + MagickSetFirstIterator(intern->magick_wand); + tmp_wand = MagickMosaicImages(intern->magick_wand); + + if (!tmp_wand) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Mosaic image failed" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagick_sc_entry); + intern_return = Z_IMAGICK_P(return_value); + php_imagick_replace_magickwand(intern_return, tmp_wand); + + return; + +} +/* }}} */ +#endif +#endif +/* {{{ proto Imagick Imagick::morphImages(int number_frames) + Method morphs a set of images. Both the image pixels and size are linearly interpolated to give the appearance of a meta-morphosis from one image to the next. +*/ +PHP_METHOD(imagick, morphimages) +{ + MagickWand *tmp_wand; + php_imagick_object *intern, *intern_return; + im_long frames; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &frames) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + tmp_wand = MagickMorphImages(intern->magick_wand, frames); + + if (!tmp_wand) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Morphing images failed" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagick_sc_entry); + intern_return = Z_IMAGICK_P(return_value); + php_imagick_replace_magickwand(intern_return, tmp_wand); + + return; + +} +/* }}} */ + +/* {{{ proto bool Imagick::minifyImage() + Is a convenience method that scales an image proportionally to one-half its original size +*/ +PHP_METHOD(imagick, minifyimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickMinifyImage(intern->magick_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to minify image" TSRMLS_CC); + return; + } + + RETURN_TRUE; + +} +/* }}} */ + +/* {{{ proto bool Imagick::posterizeImage(int levels, bool dither) + Reduces the image to a limited number of color level. +*/ +PHP_METHOD(imagick, posterizeimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + im_long levels; + zend_bool dither; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lb", &levels, &dither) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickPosterizeImage(intern->magick_wand, levels, dither); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to posterize image" TSRMLS_CC); + return; + } + + RETURN_TRUE; + +} +/* }}} */ + +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 +/* {{{ proto bool Imagick::radialBlurImage(float angle[, int channel]) + Radial blurs an image. +*/ +PHP_METHOD(imagick, radialblurimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + double angle; + im_long channel = DefaultChannels; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|l", &angle, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickRadialBlurImageChannel(intern->magick_wand, channel, angle); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to radial blur image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ +#endif +#endif + +/* {{{ proto bool Imagick::raiseImage(int width, int height, int x, int y, bool raise) + Creates a simulated three-dimensional button-like effect by lightening and darkening the edges of the image. Members width and height of raise_info define the width of the vertical and horizontal edge of the effect. +*/ +PHP_METHOD(imagick, raiseimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + im_long width, height, x, y; + zend_bool raise; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llllb", &width, &height, &x, &y, &raise) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickRaiseImage(intern->magick_wand, width, height, x, y, raise); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to raise image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::blackThresholdImage(ImagickPixel threshold) + Is like MagickThresholdImage() but forces all pixels below the threshold into black while leaving all pixels above the threshold unchanged. +*/ +PHP_METHOD(imagick, blackthresholdimage) +{ + php_imagick_object *intern; + zval *param; + MagickBooleanType status; + PixelWand *color_wand; + zend_bool allocated; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶m) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + color_wand = php_imagick_zval_to_pixelwand (param, IMAGICK_CLASS, &allocated TSRMLS_CC); + if (!color_wand) + return; + + status = MagickBlackThresholdImage(intern->magick_wand, color_wand); + + if (allocated) + color_wand = DestroyPixelWand (color_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to black threshold image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::resampleImage(float x_resolution, float y_resolution, int filter, float blur) + Resample image to desired resolution. +*/ +PHP_METHOD(imagick, resampleimage) +{ + double xRes, yRes, blur; + im_long filter = 0; + php_imagick_object *intern; + MagickBooleanType status; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ddld", &xRes, &yRes, &filter, &blur) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + +#if MagickLibVersion >= 0x700 + //TODO - allow filter to be set. + //TODO - figure out what to do about blur. + status = MagickResampleImage(intern->magick_wand, xRes, yRes, LanczosFilter); +#else + status = MagickResampleImage(intern->magick_wand, xRes, yRes, filter, blur); +#endif + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to resample image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::resizeImage(int width, int height, int filter, float blur[, bool bestfit = false[, bool legacy]]) + Scales an image to the desired dimensions with one of these filters: + If legacy is true, the calculations are done with the small rounding bug that existed in + Imagick before 3.4.0. If false, the calculations should produce the same results as + ImageMagick CLI does. +*/ +PHP_METHOD(imagick, resizeimage) +{ + double blur; + im_long width, height, new_width, new_height, filter = 0; + php_imagick_object *intern; + MagickBooleanType status; + zend_bool bestfit = 0; + zend_bool legacy = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llld|bb", &width, &height, &filter, &blur, &bestfit, &legacy) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + if (!php_imagick_thumbnail_dimensions(intern->magick_wand, bestfit, width, height, &new_width, &new_height, legacy)) { + php_imagick_throw_exception(IMAGICK_CLASS, "Invalid image geometry" TSRMLS_CC); + return; + } + +#if MagickLibVersion >= 0x700 + //TODO - remove blur from params + status = MagickResizeImage(intern->magick_wand, new_width, new_height, filter); +#else + status = MagickResizeImage(intern->magick_wand, new_width, new_height, filter, blur); +#endif + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to resize image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::rollImage(int x, int y) + Offsets an image as defined by x and y. +*/ +PHP_METHOD(imagick, rollimage) +{ + im_long x, y; + php_imagick_object *intern; + MagickBooleanType status; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &x, &y) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + status = MagickRollImage(intern->magick_wand, x, y); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to roll image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto Imagick Imagick::appendImages(bool stack) + Append a set of images. +*/ +PHP_METHOD(imagick, appendimages) +{ + php_imagick_object *intern, *intern_return; + MagickWand *tmp_wand; + zend_bool stack; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &stack) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + tmp_wand = MagickAppendImages(intern->magick_wand, stack); + + if (!tmp_wand) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to append images" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagick_sc_entry); + intern_return = Z_IMAGICK_P(return_value); + php_imagick_replace_magickwand(intern_return, tmp_wand); + return; +} +/* }}} */ + +/* {{{ proto bool Imagick::whiteThresholdImage(ImagickPixel threshold) + Is like ThresholdImage() but force all pixels above the threshold into white while leaving all pixels below the threshold unchanged. +*/ +PHP_METHOD(imagick, whitethresholdimage) +{ + php_imagick_object *intern; + zval *param; + MagickBooleanType status; + PixelWand *color_wand; + zend_bool allocated; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶m) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + color_wand = php_imagick_zval_to_pixelwand (param, IMAGICK_CLASS, &allocated TSRMLS_CC); + if (!color_wand) + return; + + status = MagickWhiteThresholdImage(intern->magick_wand, color_wand); + + if (allocated) + color_wand = DestroyPixelWand (color_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to white threshold image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto ImagickPixelIterator Imagick::getPixelIterator() + Returns a MagickPixelIterator. +*/ +PHP_METHOD(imagick, getpixeliterator) +{ + PixelIterator *pixel_it; + php_imagick_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + pixel_it = NewPixelIterator(intern->magick_wand); + + if (!pixel_it) { + php_imagick_throw_exception (IMAGICKPIXELITERATOR_CLASS, "Can not allocate ImagickPixelIterator" TSRMLS_CC); + return; + } + + php_imagick_pixel_iterator_new (pixel_it, return_value TSRMLS_CC); + return; +} +/* }}} */ + +/* {{{ proto ImagickPixelIterator Imagick::getPixelRegionIterator(long x, long y, long columns, long rows) + Returns a subset of pixels in a MagickPixelIterator object. +*/ +PHP_METHOD(imagick, getpixelregioniterator) +{ + PixelIterator *pixel_it; + php_imagick_object *intern; + im_long x, y, columns, rows; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &x, &y, &columns, &rows) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + pixel_it = NewPixelRegionIterator(intern->magick_wand, x, y, columns, rows); + + if (!pixel_it) { + php_imagick_throw_exception (IMAGICKPIXELITERATOR_CLASS, "Can not allocate ImagickPixelIterator" TSRMLS_CC); + return; + } + + php_imagick_pixel_iterator_new (pixel_it, return_value TSRMLS_CC); + return; +} +/* }}} */ + +/* {{{ proto int Imagick::getCompression() + Gets the wand compression type. +*/ +PHP_METHOD(imagick, getcompression) +{ + php_imagick_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + RETVAL_LONG(MagickGetCompression(intern->magick_wand)); +} +/* }}} */ + +/* {{{ proto int Imagick::getCompressionQuality() + Gets the wand compression quality. +*/ +PHP_METHOD(imagick, getcompressionquality) +{ + php_imagick_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + RETVAL_LONG(MagickGetCompressionQuality(intern->magick_wand)); +} +/* }}} */ + +/* {{{ proto string Imagick::getCopyright() + Returns the ImageMagick API copyright as a string constant. +*/ +PHP_METHOD(imagick, getcopyright) +{ + char *copyright; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + copyright = (char *)MagickGetCopyright(); + IM_ZVAL_STRING(return_value, copyright); + return; +} +/* }}} */ + + +/* {{{ proto string Imagick::getConfigureOptions() + Returns any ImageMagick configure options that match the specified pattern (e.g. "*" for all). Options include NAME, VERSION, LIB_VERSION, etc. +*/ +PHP_METHOD(imagick, getconfigureoptions) +{ + size_t number_options; + + char *pattern = "*"; + IM_LEN_TYPE pattern_len; + char **result; + char *option_value; + unsigned int i; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &pattern, &pattern_len) == FAILURE) { + return; + } + + result = MagickQueryConfigureOptions(pattern, &number_options); + + array_init(return_value); + + for (i=0; i 0x660 +/* {{{ proto string Imagick::getFeatures() + GetFeatures() returns the ImageMagick features that have been compiled into the runtime. +*/ +PHP_METHOD(imagick, getfeatures) +{ + const char *features; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + features = GetMagickFeatures(); + + IM_ZVAL_STRING(return_value, features); +} +/* }}} */ +#endif + + + +/* {{{ proto string Imagick::getFilename() + Returns the filename associated with an image sequence. +*/ +PHP_METHOD(imagick, getfilename) +{ + php_imagick_object *intern; + char *filename; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + filename = (char *)MagickGetFilename(intern->magick_wand); + + if (filename) { + IM_ZVAL_STRING(return_value, filename); + IMAGICK_FREE_MAGICK_MEMORY(filename); + } + return; +} +/* }}} */ + +/* {{{ proto string Imagick::getFormat() + Returns the format of the Imagick object. +*/ +PHP_METHOD(imagick, getformat) +{ + php_imagick_object *intern; + char *format; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + format = (char *)MagickGetFormat(intern->magick_wand); + + if (format) { + IM_ZVAL_STRING(return_value, format); + IMAGICK_FREE_MAGICK_MEMORY(format); + } + return; +} +/* }}} */ + +/* {{{ proto string Imagick::getHomeURL() + Returns the ImageMagick home URL. +*/ +PHP_METHOD(imagick, gethomeurl) +{ + char *home_url; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + home_url = (char *)MagickGetHomeURL(); + if (home_url) { + IM_ZVAL_STRING(return_value, home_url); + IMAGICK_FREE_MAGICK_MEMORY(home_url); + } + return; +} +/* }}} */ + +/* {{{ proto int Imagick::getInterlaceScheme() + Gets the wand interlace scheme. +*/ +PHP_METHOD(imagick, getinterlacescheme) +{ + php_imagick_object *intern; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + RETVAL_LONG(MagickGetInterlaceScheme(intern->magick_wand)); +} +/* }}} */ + +/* {{{ proto string Imagick::getOption(string key) + Returns a value associated with a wand and the specified key. Use MagickRelinquishMemory() to free the value when you are finished with it. +*/ +PHP_METHOD(imagick, getoption) +{ + php_imagick_object *intern; + char *key, *value; + IM_LEN_TYPE key_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &key, &key_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + value = MagickGetOption(intern->magick_wand, key); + + if (value) { + IM_ZVAL_STRING(return_value, value); + IMAGICK_FREE_MAGICK_MEMORY(value); + } + return; +} +/* }}} */ + +/* {{{ proto string Imagick::getPackageName() + Returns the ImageMagick package name as a string constant. +*/ +PHP_METHOD(imagick, getpackagename) +{ + char *package_name; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + package_name = (char *)MagickGetPackageName(); + IM_ZVAL_STRING(return_value, package_name); + return; +} +/* }}} */ + +/* {{{ proto array Imagick::getPage() + Returns the page geometry associated with the Imagick object in an associative array with the keys "width", "height", "x", and "y". +*/ +PHP_METHOD(imagick, getpage) +{ + php_imagick_object *intern; + MagickBooleanType status; + size_t width, height; + ssize_t x, y; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + status = MagickGetPage(intern->magick_wand, &width, &height, &x, &y); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to get page" TSRMLS_CC); + return; + } + + array_init(return_value); + add_assoc_long(return_value, "width", width); + add_assoc_long(return_value, "height", height); + add_assoc_long(return_value, "x", x); + add_assoc_long(return_value, "y", y); + + return; +} +/* }}} */ + +/* {{{ proto int Imagick::getHDRIEnabled() + Returns true if Imagick was compiled against a HDRI verison of ImageMagick. +*/ +PHP_METHOD(imagick, gethdrienabled) +{ + if (zend_parse_parameters_none() == FAILURE) { + return; + } + +#if MAGICKCORE_HDRI_ENABLE + RETURN_TRUE; +#else + RETURN_FALSE; +#endif + return; +} +/* }}} */ + + +/* {{{ proto int Imagick::getQuantum() + Returns the ImageMagick quantum range as an integer. +*/ +PHP_METHOD(imagick, getquantum) +{ + size_t range; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + MagickGetQuantumRange(&range); + ZVAL_LONG(return_value, range); + +//#ifdef MAGICKCORE_HDRI_ENABLE +// RETVAL_DOUBLE(color_value); +//#else +// RETVAL_LONG(color_value); +//#endif + return; +} +/* }}} */ + + +/* {{{ proto array Imagick::getQuantumDepth() + Returns the ImageMagick quantum depth as a string constant. +*/ +PHP_METHOD(imagick, getquantumdepth) +{ + const char *quantum_depth; + size_t depth; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + quantum_depth = MagickGetQuantumDepth(&depth); + + array_init(return_value); + add_assoc_long(return_value, "quantumDepthLong", depth); + IM_add_assoc_string(return_value, "quantumDepthString", (char *)quantum_depth); + + return; +} +/* }}} */ + +/* {{{ proto array Imagick::getQuantumRange() + Returns the ImageMagick quantum range as a string constant. +*/ +PHP_METHOD(imagick, getquantumrange) +{ + const char *quantum_range; + size_t range; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + quantum_range = MagickGetQuantumRange(&range); + array_init(return_value); + + add_assoc_long(return_value, "quantumRangeLong", range); + IM_add_assoc_string(return_value, "quantumRangeString", (char *)quantum_range); + return; +} +/* }}} */ + +/* {{{ proto string Imagick::getReleaseDate() + Returns the ImageMagick release date as a string constant. +*/ +PHP_METHOD(imagick, getreleasedate) +{ + char *release_date; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + release_date = (char *)MagickGetReleaseDate(); + IM_ZVAL_STRING(return_value, release_date); + return; +} +/* }}} */ + +/* {{{ proto int Imagick::getResource(int type) + Returns the specified resource in megabytes. +*/ +PHP_METHOD(imagick, getresource) +{ + im_long resource_type; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &resource_type) == FAILURE) { + return; + } + + RETVAL_LONG(MagickGetResource(resource_type)); +} +/* }}} */ + +/* {{{ proto Imagick Imagick::getResourceLimit(int type) + Returns the specified resource limit in megabytes. +*/ +PHP_METHOD(imagick, getresourcelimit) +{ + im_long resource_type; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &resource_type) == FAILURE) { + return; + } + + RETVAL_DOUBLE(MagickGetResourceLimit(resource_type)); +} +/* }}} */ + +/* {{{ proto array Imagick::getSamplingFactors() + Gets the horizontal and vertical sampling factor. +*/ +PHP_METHOD(imagick, getsamplingfactors) +{ + php_imagick_object *intern; + double *sampling_factors; + unsigned long i; + size_t number_factors = 0; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + sampling_factors = (double *)MagickGetSamplingFactors(intern->magick_wand, &number_factors); + + array_init(return_value); + + for (i = 0 ; i < number_factors; i++) { + add_next_index_double(return_value, sampling_factors[i]); + } + + MagickRelinquishMemory(sampling_factors); + + return; +} +/* }}} */ + +/* {{{ proto array Imagick::getSize() + Returns the size associated with the Imagick object as an array with the keys "columns" and "rows". +*/ +PHP_METHOD(imagick, getsize) +{ + php_imagick_object *intern; + size_t columns, rows; + MagickBooleanType status; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + status = MagickGetSize(intern->magick_wand, &columns, &rows); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to get size" TSRMLS_CC); + return; + } + + array_init(return_value); + add_assoc_long(return_value, "columns", columns); + add_assoc_long(return_value, "rows", rows); + + return; +} +/* }}} */ + +/* {{{ proto array Imagick::getVersion() + Returns the ImageMagick API version as a string constant and as a number. +*/ +PHP_METHOD(imagick, getversion) +{ + char *version_string; + size_t version_number; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + version_string = (char *)MagickGetVersion(&version_number); + array_init(return_value); + + add_assoc_long(return_value, "versionNumber", (long) version_number); + IM_add_assoc_string(return_value, "versionString", version_string); + return; +} +/* }}} */ + +/* {{{ proto bool Imagick::setBackgroundColor(ImagickPixel background) + Sets the wand background color. +*/ +PHP_METHOD(imagick, setbackgroundcolor) +{ + zval *param; + php_imagick_object *intern; + MagickBooleanType status; + PixelWand *background_wand; + zend_bool allocated = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶m) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + background_wand = php_imagick_zval_to_pixelwand (param, IMAGICK_CLASS, &allocated TSRMLS_CC); + if (!background_wand) + return; + + status = MagickSetBackgroundColor(intern->magick_wand, background_wand); + + if (allocated) + background_wand = DestroyPixelWand (background_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set background color" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setCompression(COMPRESSIONTYPE compression) + Sets the wand compression type. +*/ +PHP_METHOD(imagick, setcompression) +{ + php_imagick_object *intern; + im_long compression; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &compression) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + status = MagickSetCompression(intern->magick_wand, compression); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set compression" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setCompressionQuality(int quality) + Sets the wand compression quality. +*/ +PHP_METHOD(imagick, setcompressionquality) +{ + php_imagick_object *intern; + im_long quality; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &quality) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + status = MagickSetCompressionQuality(intern->magick_wand, quality); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set compression quality" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setFilename(string filename) + Sets the filename before you read or write an image file. +*/ +PHP_METHOD(imagick, setfilename) +{ + php_imagick_object *intern; + char *filename; + IM_LEN_TYPE filename_len; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + status = MagickSetFilename(intern->magick_wand, filename); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set filename" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setFormat(string format) + Sets the format of the Imagick object. +*/ +PHP_METHOD(imagick, setformat) +{ + php_imagick_object *intern; + char *format; + IM_LEN_TYPE format_len; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &format, &format_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + status = MagickSetFormat(intern->magick_wand, format); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set format" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setInterlaceScheme(INTERLACETYPE interlace_scheme) + Sets the image compression. +*/ +PHP_METHOD(imagick, setinterlacescheme) +{ + php_imagick_object *intern; + im_long schema; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &schema) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + status = MagickSetInterlaceScheme(intern->magick_wand, schema); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set interlace scheme" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setOption(string key, string value) + Associates one or options with the wand (.e.g MagickSetOption(wand,"jpeg:perserve","yes")). +*/ +PHP_METHOD(imagick, setoption) +{ + php_imagick_object *intern; + MagickBooleanType status; + char *key, *value; + IM_LEN_TYPE key_len, value_len; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &key, &key_len, &value, &value_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + status = MagickSetOption(intern->magick_wand, key, value); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set option" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setPage(int width, int height, int x, int y) + Sets the page geometry of the Imagick object. +*/ +PHP_METHOD(imagick, setpage) +{ + php_imagick_object *intern; + MagickBooleanType status; + im_long width, height, x, y; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &width, &height, &x, &y) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + status = MagickSetPage(intern->magick_wand, width, height, x, y); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set page" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +PHP_METHOD(imagick, setimageprogressmonitor) +{ + char *filename; + IM_LEN_TYPE filename_len; + php_imagick_object *intern; + php_imagick_rw_result_t rc; + + if (!IMAGICK_G(progress_monitor)) { + php_imagick_throw_exception(IMAGICK_CLASS, "Progress monitoring is disabled in ini-settings" TSRMLS_CC); + return; + } + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + + if ((rc = php_imagick_file_access_check (filename TSRMLS_CC)) != IMAGICK_RW_OK) { + php_imagick_rw_fail_to_exception (intern->magick_wand, rc, filename TSRMLS_CC); + return; + } + + if (intern->progress_monitor_name) { + efree(intern->progress_monitor_name); + } + + intern->progress_monitor_name = estrdup(filename); + MagickSetImageProgressMonitor(intern->magick_wand, php_imagick_progress_monitor, intern); + RETURN_TRUE; +} + +/* {{{ proto bool Imagick::setProgressMonitor(callable callback) + Set a callback that will be called during the processing of the Imagick image. +*/ +#if MagickLibVersion > 0x653 +PHP_METHOD(imagick, setprogressmonitor) +{ + zval *user_callback; + + php_imagick_object *intern; + php_imagick_callback *callback; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &user_callback) == FAILURE) { + RETURN_FALSE; + } + + // Check whether the callback is valid now, rather than failing later + if (!user_callback || !zend_is_callable(user_callback, 0, NULL TSRMLS_CC)) { + php_imagick_throw_exception(IMAGICK_CLASS, "First argument to setProgressMonitor is expected to be a valid callback" TSRMLS_CC); + RETURN_FALSE; + } + + callback = (php_imagick_callback *) emalloc(sizeof(php_imagick_callback)); + + TSRMLS_SET_CTX(callback->thread_ctx); + //We can't free the previous callback as we can't guarantee that + //ImageMagick won't use it at some point. There is no 'unbind' function + //for previously set 'MagickSetImageProgressMonitor' + callback->previous_callback = IMAGICK_G(progress_callback); + + //Add a ref and store the user's callback +#ifdef ZEND_ENGINE_3 + Z_TRY_ADDREF_P(user_callback); + ZVAL_COPY_VALUE(&callback->user_callback, user_callback); +#else + Z_ADDREF_P(user_callback); + callback->user_callback = user_callback; +#endif + + //The callback is now valid, store it in the global + IMAGICK_G(progress_callback) = callback; + intern = Z_IMAGICK_P(getThis()); + + MagickSetImageProgressMonitor(intern->magick_wand, php_imagick_progress_monitor_callable, callback); + RETURN_TRUE; +} +#endif + +/* {{{ proto bool Imagick::setResourceLimit(RESOURCETYPE type, int limit) + Sets the limit for a particular resource in megabytes. +*/ +PHP_METHOD(imagick, setresourcelimit) +{ + MagickBooleanType status; + im_long type; + double limit; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ld", &type, &limit) == FAILURE) { + return; + } + + status = MagickSetResourceLimit(type, (MagickSizeType)limit); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_throw_exception(IMAGICK_CLASS, "Unable to set resource limit" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setResolution(float x_resolution, float y_resolution) + Sets the image resolution. +*/ +PHP_METHOD(imagick, setresolution) +{ + php_imagick_object *intern; + MagickBooleanType status; + double x_resolution, y_resolution; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x_resolution, &y_resolution) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + status = MagickSetResolution(intern->magick_wand, x_resolution, y_resolution); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set resolution" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setSamplingFactors(array factors) + Sets the image sampling factors. +*/ +PHP_METHOD(imagick, setsamplingfactors) +{ + php_imagick_object *intern; + MagickBooleanType status; + zval *factors; + double *double_array; + im_long elements = 0; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &factors) == FAILURE) { + return; + } + + double_array = php_imagick_zval_to_double_array(factors, &elements TSRMLS_CC); + + if (!double_array) { + php_imagick_throw_exception(IMAGICK_CLASS, "Can't read array" TSRMLS_CC); + return; + } + + intern = Z_IMAGICK_P(getThis()); + + status = MagickSetSamplingFactors(intern->magick_wand, elements, double_array); + efree(double_array); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set sampling factors" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setSize(int columns, int rows) + Sets the size of the Imagick object. Set it before you read a raw image format such as RGB, GRAY, or CMYK. +*/ +PHP_METHOD(imagick, setsize) +{ + php_imagick_object *intern; + im_long columns, rows; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &columns, &rows) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + status = MagickSetSize(intern->magick_wand, columns, rows); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set size" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::setType(IMAGETYPE image_type) + Sets the image type attribute. +*/ +PHP_METHOD(imagick, settype) +{ + php_imagick_object *intern; + im_long type; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &type) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + status = MagickSetType(intern->magick_wand, type); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to set type" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +#if MagickLibVersion >= 0x659 +/* {{{ proto bool Imagick::brightnessContrastImage(float brigthness, float contrast[, int channel]) + Change the brightness and/or contrast of an image. It converts the brightness and contrast parameters into slope and intercept and calls a polynomical function to apply to the image. +*/ +PHP_METHOD(imagick, brightnesscontrastimage) +{ + php_imagick_object *intern; + double brightness, contrast; + MagickBooleanType status; + im_long channel = IM_DEFAULT_CHANNEL; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd|l", &brightness, &contrast, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickBrightnessContrastImageChannel(intern->magick_wand, channel, brightness, contrast); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to brightnesscontrastimage" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ +#endif + + +#if MagickLibVersion > 0x661 + +static KernelInfo *php_imagick_getKernelInfo(const double *color_matrix, const size_t order) +{ + KernelInfo *kernel_info; + +#if MagickLibVersion >= 0x700 + ExceptionInfo *ex_info = NULL; + //TODO - inspect exception info + kernel_info=AcquireKernelInfo(NULL, ex_info); +#else + kernel_info=AcquireKernelInfo(NULL); +#endif + if (kernel_info == (KernelInfo *) NULL) { + return NULL; + } + + kernel_info->width = order; + kernel_info->height = order; +#if MagickLibVersion >= 0x700 + { + unsigned int i; + kernel_info->values = (MagickRealType *)AcquireAlignedMemory(order, order*sizeof(MagickRealType)); + for (i=0 ; ivalues[i] = color_matrix[i]; + } + } +#else + kernel_info->values = (double *)AcquireAlignedMemory(order, order*sizeof(double)); + memcpy(kernel_info->values, color_matrix, order * order * sizeof(double)); +#endif + + return kernel_info; +} + + +/* {{{ proto bool Imagick::ColorMatrixImage(array kernel) + apply color transformation to an image. The method permits saturation changes, hue rotation, luminance to alpha, and various other effects. Although variable-sized transformation matrices can be used, typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA (or RGBA with offsets). The matrix is similar to those used by Adobe Flash except offsets are in column 6 rather than 5 (in support of CMYKA images) and offsets are normalized (divide Flash offset by 255). +*/ +PHP_METHOD(imagick, colormatriximage) +{ + php_imagick_object *intern; + MagickBooleanType status; + zval *color_matrix_array; + double *colors; + size_t order = 0; + im_long num_elements = 0; + KernelInfo *kernel_color_matrix; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &color_matrix_array) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + colors = php_imagick_zval_to_double_array(color_matrix_array, &num_elements TSRMLS_CC); + + if (!colors) { + php_imagick_throw_exception(IMAGICK_CLASS, "Unable to read color matrix array" TSRMLS_CC); + return; + } + + if (num_elements == 25) { + order = 5; + } + else if (num_elements == 36) { + order = 6; + } + else { + efree(colors); + php_imagick_throw_exception(IMAGICK_CLASS, "Color matrix array must be 5x5 or 6x6" TSRMLS_CC); + return; + } + + kernel_color_matrix = php_imagick_getKernelInfo(colors, order); + + //TODO - add check that matrix is 5x5 or 6x6? + status = MagickColorMatrixImage(intern->magick_wand, kernel_color_matrix); + + //Free the memory +#if MagickLibVersion >= 0x700 + kernel_color_matrix->values = (MagickRealType *) NULL; +#else + kernel_color_matrix->values = (double *) NULL; +#endif + kernel_color_matrix = DestroyKernelInfo(kernel_color_matrix); + efree(colors); + + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to colormatriximage" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ +#endif + +/* {{{ proto bool Imagick::selectiveBlurImage(float radius, float sigma, float threshold[, int channel]) + Selectively blur an image within a contrast threshold. It is similar to the unsharpen mask that sharpens everything with contrast above a certain threshold. +*/ +PHP_METHOD(imagick, selectiveblurimage) +{ + php_imagick_object *intern; + double brightness, contrast, threshold; + MagickBooleanType status; + im_long channel = IM_DEFAULT_CHANNEL; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ddd|l", &brightness, &contrast, &threshold, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickSelectiveBlurImageChannel(intern->magick_wand, channel, brightness, contrast, threshold); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to selectiveblurimage" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + + + +#if MagickLibVersion >= 0x689 +/* {{{ proto bool Imagick::rotationalblurimage(float angle[, int channel]) + Rotational blurs an image. +*/ +PHP_METHOD(imagick, rotationalblurimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + double angle; + im_long channel = IM_DEFAULT_CHANNEL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|l", &angle, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickRotationalBlurImageChannel(intern->magick_wand, channel, angle); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to rotational blur image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ +#endif + +#if MagickLibVersion >= 0x683 + +//Technically, this version is available in 0x682. However there was an incompatible +//change to the methods signature in a bug release. So only expose it for stable +//versions. +// +//6.8.2.8 - MagickStatisticImage ( MagickWand* p1, enum ChannelType const p2, enum StatisticType const p3, size_t const p4, size_t const p5 ) (6) +//6.8.2.9 - MagickStatisticImage ( MagickWand* p1, enum StatisticType const p2, size_t const p3, size_t const p4 ) + + +/* {{{ proto bool Imagick::statisticImage(int type, int width, int height[, int channel] ) + Replace each pixel with corresponding statistic from the neighborhood of the specified width and height. +*/ +PHP_METHOD(imagick, statisticimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + im_long type; + im_long width, height; + im_long channel = IM_DEFAULT_CHANNEL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll|l", &type, &width, &height, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickStatisticImageChannel(intern->magick_wand, channel, type, width, height); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to statisticImage" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +#endif + +#if MagickLibVersion >= 0x652 +/* {{{ proto Imagick Imagick::subimagematch(Imagick subimage[, array &$bestMatch[, float &similarity[, float similarity_threshold = 0[, int metric = ]]]]) + Searches for a subimage in the current image and returns a similarity image such that an exact match location is completely white and if none of the pixels match, black, otherwise some gray level in-between. + You can also pass in the optional parameters bestMatch and similarity. After calling the function similarity will be + set to the 'score' of the similarity between the subimage and the matching position in the larger image, bestMatch will + contain an associative array with elements x, y, width, height that describe the matching region. +*/ +PHP_METHOD(imagick, subimagematch) +{ + php_imagick_object *intern; + RectangleInfo best_match_offset; + double similarity; + double similarity_threshold = 0.0; + + zval *reference_obj; + php_imagick_object *reference_intern; + php_imagick_object *intern_return; + zval *z_similarity = NULL; + zval *z_best_match_offset = NULL; + + //http://devzone.zend.com/317/extension-writing-part-ii-parameters-arrays-and-zvals/ + MagickWand *new_wand; + + +#if MagickLibVersion >= 0x700 + im_long metric = RootMeanSquaredErrorMetric; +#else + im_long metric = 0; +#endif + +#ifdef ZEND_ENGINE_3 + char *param_string = "O|z/z/dl"; +#else + char *param_string = "O|zzdl"; + +#endif + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, param_string, &reference_obj, php_imagick_sc_entry, &z_best_match_offset, &z_similarity, &similarity_threshold, &metric) == FAILURE) { + return; + } + reference_intern = Z_IMAGICK_P(reference_obj); + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + +#if MagickLibVersion >= 0x700 + new_wand = MagickSimilarityImage(intern->magick_wand, reference_intern->magick_wand, + metric, similarity_threshold, + &best_match_offset, &similarity); +#else + new_wand = MagickSimilarityImage(intern->magick_wand, reference_intern->magick_wand, &best_match_offset, &similarity); +#endif + + if (new_wand == NULL) { + php_imagick_convert_imagick_exception(intern->magick_wand, "subimagematch failed" TSRMLS_CC); + return; + } + + if (z_similarity) { + ZVAL_DOUBLE(z_similarity, similarity); + } + + if (z_best_match_offset) { + array_init(z_best_match_offset); + add_assoc_long(z_best_match_offset, "x", best_match_offset.x); + add_assoc_long(z_best_match_offset, "y", best_match_offset.y); + add_assoc_long(z_best_match_offset, "width", best_match_offset.width); + add_assoc_long(z_best_match_offset, "height", best_match_offset.height); + } + + object_init_ex(return_value, php_imagick_sc_entry); + intern_return = Z_IMAGICK_P(return_value); + php_imagick_replace_magickwand(intern_return, new_wand); + + return; +} +/* }}} */ +#endif + + +/* {{{ proto bool Imagick::setRegistry(string key, string value) + Sets the ImageMagick registry entry named key to value. This is most + useful for setting "temporary-path" which controls where ImageMagick + creates temporary images e.g. while processing PDFs. +*/ +PHP_METHOD(imagick, setregistry) +{ + MagickBooleanType status; + char *key, *value; + IM_LEN_TYPE key_len, value_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &key, &key_len, &value, &value_len) == FAILURE) { + return; + } + + status = SetImageRegistry(StringRegistryType, key, value, NULL); + + /* No magick is going to happen */ + if (status == MagickFalse) { + RETURN_FALSE; + } + + RETURN_TRUE; +} +/* }}} */ + + +/* {{{ proto string|false Imagick::getRegistry(string key) + Get the StringRegistry entry for the named key or false if not set. +*/ +PHP_METHOD(imagick, getregistry) +{ + char *key, *value; + IM_LEN_TYPE key_len; + ExceptionInfo *ex_info; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &key, &key_len) == FAILURE) { + return; + } + + ex_info = AcquireExceptionInfo(); + + value = GetImageRegistry(StringRegistryType, key, ex_info); + + if (ex_info->severity != 0) { + zend_throw_exception_ex(php_imagick_exception_class_entry, 1 TSRMLS_CC, "Imagick::getRegistry exception (%s) ", ex_info->reason); + ex_info = DestroyExceptionInfo(ex_info); + return; + } + + ex_info = DestroyExceptionInfo(ex_info); + + if (value != NULL) { + IM_ZVAL_STRING(return_value, value); + IMAGICK_FREE_MAGICK_MEMORY(value); + return; + } + + RETURN_FALSE; +} +/* }}} */ + + +/* {{{ proto array Imagick::listRegistry() + List all the registry settings calls GetImageRegistry. returns an array of all the key/value pairs in the registry +*/ +PHP_METHOD(imagick, listregistry) +{ + char *registry = NULL; + char *value = NULL; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + array_init(return_value); + + ResetImageRegistryIterator(); + while ((registry = GetNextImageRegistry())) { + value = GetImageRegistry(StringRegistryType, registry, NULL); + //should this be add_assoc_string(return_value, estrdup(registry), value, 1); + IM_add_assoc_string(return_value, registry, value); + IMAGICK_FREE_MAGICK_MEMORY(value); + } + + return; +} +/* }}} */ + +#if MagickLibVersion >= 0x680 +/* {{{ proto bool Imagick::morphology(int morphologyMethod, int iterations, kernel, [int CHANNEL] ) + Applies a user supplied kernel to the image according to the given morphology method. + iterations - A value of -1 means loop until no change found. How this is applied may depend on the morphology method. Typically this is a value of 1. +*/ +PHP_METHOD(imagick, morphology) +{ + zval *objvar; + php_imagick_object *intern; + php_imagickkernel_object *kernel; + im_long morphologyMethod, iterations; + MagickBooleanType status; + im_long channel = IM_DEFAULT_CHANNEL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llO|l", &morphologyMethod, &iterations, &objvar, php_imagickkernel_sc_entry, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + kernel = Z_IMAGICKKERNEL_P(objvar); + IMAGICK_KERNEL_NOT_NULL_EMPTY(kernel); + + status = MagickMorphologyImageChannel(intern->magick_wand, + DefaultChannels, morphologyMethod, iterations, kernel->kernel_info); + + // No magick is going to happen + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to morphology image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +#if MagickLibVersion < 0x700 +/* {{{ proto bool Imagick::filter(ImagickKernel kernel, [int CHANNEL] ) + Applies a custom convolution kernel to the image. +*/ +PHP_METHOD(imagick, filter) +{ + zval *objvar; + php_imagick_object *intern; + php_imagickkernel_object *kernel; + MagickBooleanType status; + ChannelType channel = UndefinedChannel; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|l", &objvar, php_imagickkernel_sc_entry, &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + kernel = Z_IMAGICKKERNEL_P(objvar); + + if ((kernel->kernel_info->width % 2) != 1) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Only odd-sized, square kernels can be applied as a filter." TSRMLS_CC); + return; + } + + if (kernel->kernel_info->width != kernel->kernel_info->height) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Only odd-sized, square kernels can be applied as a filter." TSRMLS_CC); + return; + } + + if (channel == 0) { + status = MagickFilterImage(intern->magick_wand, kernel->kernel_info); + } + else { + status = MagickFilterImageChannel(intern->magick_wand, channel, kernel->kernel_info); + } + + // No magick is going to happen + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Failed to filter image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ +#endif //#if MagickLibVersion < 0x700 +#endif //#if MagickLibVersion >= 0x680 + + +/* {{{ proto int Imagick::setAntiAlias(bool antialias) + Set whether antialiasing should be used for operations. On by default. +*/ +PHP_METHOD(imagick, setantialias) +{ + php_imagick_object *intern; + zend_bool antialias; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &antialias) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + status = MagickSetAntialias(intern->magick_wand, antialias); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to setAntiAlias" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool Imagick::getAntiAlias() + get whether antialiasing would be used for operations. +*/ +PHP_METHOD(imagick, getantialias) +{ + php_imagick_object *intern; + MagickBooleanType antialias; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + antialias = MagickGetAntialias(intern->magick_wand); + + if (antialias == MagickTrue) { + RETURN_TRUE; + } else { + RETURN_FALSE; + } +} +/* }}} */ + +#if MagickLibVersion > 0x676 +/* {{{ proto bool Imagick::colorDecisionListImage(string color_correction_collection) + Set whether antialiasing should be used for operations. On by default. +*/ +PHP_METHOD(imagick, colordecisionlistimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + + char *color_correction_collection; + IM_LEN_TYPE ccc_len; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &color_correction_collection, &ccc_len) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + status = MagickColorDecisionListImage(intern->magick_wand, color_correction_collection); + + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to colorDecisionListImage" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ +#endif + +#if MagickLibVersion >= 0x687 +/* {{{ proto Imagick Imagick::optimizeimagetransparency() + Takes a frame optimized GIF animation, and compares the overlayed pixels against the disposal image resulting fr +*/ +PHP_METHOD(imagick, optimizeimagetransparency) +{ + php_imagick_object *intern; + MagickBooleanType status; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickOptimizeImageTransparency(intern->magick_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Optimize image transparency failed" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ +#endif + +#if MagickLibVersion >= 0x660 +/* {{{ proto bool Imagick::autoGammaImage([int channel = CHANNEL_ALL]) + Extracts the 'mean' from the image and adjust the image to try make set its gamma appropriately. +*/ +PHP_METHOD(imagick, autogammaimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + im_long channel = IM_DEFAULT_CHANNEL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &channel) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickAutoGammaImageChannel(intern->magick_wand, channel); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "autoGammaImage" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ +#endif //#if MagickLibVersion >= 0x660 + +#if MagickLibVersion >= 0x692 +/* {{{ proto bool Imagick::autoOrient() + Adjusts an image so that its orientation is suitable $ for viewing (i.e. top-left orientation). +*/ +PHP_METHOD(imagick, autoorient) +{ + php_imagick_object *intern; + MagickBooleanType status; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickAutoOrientImage(intern->magick_wand); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable autoOrient image" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ +#endif // #if MagickLibVersion >= 0x692 + +#if MagickLibVersion >= 0x692 +/* {{{ proto bool Imagick::compositeImageGravity(Imagick $image, int COMPOSITE_CONSTANT, int GRAVITY_CONSTANT) + Composite one image onto another using the specified gravity. +*/ +PHP_METHOD(imagick, compositeimagegravity) +{ + zval *objvar; + php_imagick_object *intern, *image_to_composite; + MagickBooleanType status; + im_long composite, gravity; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Oll", &objvar, php_imagick_sc_entry, &composite, &gravity) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + image_to_composite = Z_IMAGICK_P(objvar); + if (php_imagick_ensure_not_empty (image_to_composite->magick_wand) == 0) + return; + + status = MagickCompositeImageGravity(intern->magick_wand, image_to_composite->magick_wand, composite, gravity); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Unable to compositeImageGravity" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ +#endif + +#if MagickLibVersion >= 0x693 +/* {{{ proto bool Imagick::localContrastImage(float radius, float strength) +Attempts to increase the appearance of large-scale light-dark transitions. +Local contrast enhancement works similarly to sharpening with an unsharp mask, +however the mask is instead created using an image with a greater blur distance. +*/ +PHP_METHOD(imagick, localcontrastimage) +{ + php_imagick_object *intern; + MagickBooleanType status; + double radius, strength; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &radius, &strength) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + status = MagickLocalContrastImage(intern->magick_wand, radius, strength); + + /* No magick is going to happen */ + if (status == MagickFalse) { + php_imagick_convert_imagick_exception(intern->magick_wand, "Failed to localContrastImage" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ +#endif // #if MagickLibVersion >= 0x693 + + +#if MagickLibVersion >= 0x700 +/* {{{ proto int Imagick::identifyImageType() + Identifies the potential image type, returns one of the Imagick::IMGTYPE_* constants +*/ +PHP_METHOD(imagick, identifyimagetype) +{ + php_imagick_object *intern; + long imageType; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(getThis()); + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + imageType = MagickIdentifyImageType(intern->magick_wand); + + RETVAL_LONG(imageType); +} +/* }}} */ +#endif // #if MagickLibVersion >= 0x700 + +/* end of Imagick */ diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/imagickdraw_class.c php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/imagickdraw_class.c --- php-imagick-3.4.4/imagick-3.4.4+php8.0/imagickdraw_class.c 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/imagickdraw_class.c 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,3087 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 / Imagick | + +----------------------------------------------------------------------+ + | Copyright (c) 2006-2013 Mikko Koppanen, Scott MacVicar | + | ImageMagick (c) ImageMagick Studio LLC | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Mikko Kopppanen | + | Scott MacVicar | + +----------------------------------------------------------------------+ +*/ + +#include "php_imagick.h" +#include "php_imagick_defs.h" +#include "php_imagick_macros.h" +#include "php_imagick_helpers.h" + +#if MagickLibVersion > 0x628 +/* {{{ proto bool ImagickDraw::resetvectorgraphics() + Resets the vector graphics +*/ +PHP_METHOD(imagickdraw, resetvectorgraphics) +{ + php_imagickdraw_object *internd; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + DrawResetVectorGraphics(internd->drawing_wand); + RETURN_TRUE; +} +/* }}} */ +#endif + +#if MagickLibVersion > 0x649 +/* {{{ proto bool ImagickDraw::getTextKerning() + Gets the text kerning +*/ +PHP_METHOD(imagickdraw, gettextkerning) +{ + php_imagickdraw_object *internd; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + RETURN_DOUBLE(DrawGetTextKerning(internd->drawing_wand)); +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setTextKerning(float kerning) + Sets the text kerning +*/ +PHP_METHOD(imagickdraw, settextkerning) +{ + php_imagickdraw_object *internd; + double kerning; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &kerning) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + DrawSetTextKerning(internd->drawing_wand, kerning); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::getTextInterwordSpacing() + Gets the text interword spacing +*/ +PHP_METHOD(imagickdraw, gettextinterwordspacing) +{ + php_imagickdraw_object *internd; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + RETURN_DOUBLE(DrawGetTextInterwordSpacing(internd->drawing_wand)); +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setTextInterwordSpacing(float spacing) + Sets the text interword spacing +*/ +PHP_METHOD(imagickdraw, settextinterwordspacing) +{ + php_imagickdraw_object *internd; + double spacing; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &spacing) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + DrawSetTextInterwordSpacing(internd->drawing_wand, spacing); + RETURN_TRUE; +} +/* }}} */ +#endif + +#if MagickLibVersion > 0x655 +/* {{{ proto bool ImagickDraw::getTextInterlineSpacing() + Gets the text interword spacing +*/ +PHP_METHOD(imagickdraw, gettextinterlinespacing) +{ + php_imagickdraw_object *internd; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + RETURN_DOUBLE(DrawGetTextInterlineSpacing(internd->drawing_wand)); +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setTextInterlineSpacing(float spacing) + Sets the text interword spacing +*/ +PHP_METHOD(imagickdraw, settextinterlinespacing) +{ + php_imagickdraw_object *internd; + double spacing; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &spacing) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + DrawSetTextInterlineSpacing(internd->drawing_wand, spacing); + RETURN_TRUE; +} +/* }}} */ +#endif + +/* {{{ proto ImagickDraw ImagickDraw::__construct() + The ImagickDraw constructor +*/ +PHP_METHOD(imagickdraw, __construct) +{ + /* Empty constructor for possible future uses */ + +#ifdef ZEND_ENGINE_3 + // This suppresses an 'unused parameter' warning. + (void)execute_data; + (void)return_value; +#endif +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::circle(float ox, float oy, float px, float py) + Draws a circle on the image. +*/ +PHP_METHOD(imagickdraw, circle) +{ + double ox, oy, px, py; + php_imagickdraw_object *internd; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddd", &ox, &oy, &px, &py) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + DrawCircle(internd->drawing_wand, ox, oy, px, py); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::rectangle(float x1, float y1, float x2, float y2) + Draws a rectangle given two coordinates and using the current stroke, stroke width, and fill settings. +*/ +PHP_METHOD(imagickdraw, rectangle) +{ + double x1, y1, x2, y2; + php_imagickdraw_object *internd; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddd", &x1, &y1, &x2, &y2) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + DrawRectangle(internd->drawing_wand, x1, y1, x2, y2); + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::roundRectangle(float x1, float y1, float x2, float y2, float rx, float ry) + Draws a rounted rectangle given two coordinates, x & y corner radiuses and using the current stroke, stroke width, and fill settings. +*/ +PHP_METHOD(imagickdraw, roundrectangle) +{ + double x1, y1, x2, y2, rx, ry; + php_imagickdraw_object *internd; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddddd", &x1, &y1, &x2, &y2, &rx, &ry) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + DrawRoundRectangle(internd->drawing_wand, x1, y1, x2, y2, rx, ry); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::ellipse(float ox, float oy, float rx, float ry, float start, float end) + Draws an ellipse on the image. +*/ +PHP_METHOD(imagickdraw, ellipse) +{ + double ox, oy, rx, ry, start, end; + php_imagickdraw_object *internd; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddddd", &ox, &oy, &rx, &ry, &start, &end) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + DrawEllipse(internd->drawing_wand, ox, oy, rx, ry, start, end); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::skewX(float degrees) + Skews the current coordinate system in the horizontal direction. +*/ +PHP_METHOD(imagickdraw, skewx) +{ + double degrees; + php_imagickdraw_object *internd; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", °rees) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + DrawSkewX(internd->drawing_wand, degrees); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::skewY(float degrees) + Skews the current coordinate system in the vertical direction. +*/ +PHP_METHOD(imagickdraw, skewy) +{ + double degrees; + php_imagickdraw_object *internd; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", °rees) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + DrawSkewY(internd->drawing_wand, degrees); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::translate(float x, float y) + Applies a translation to the current coordinate system which moves the coordinate system origin to the specified coordinate. +*/ +PHP_METHOD(imagickdraw, translate) +{ + double x, y; + php_imagickdraw_object *internd; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + DrawTranslate(internd->drawing_wand, x, y); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setFillColor(PixelWand fill_wand) + Sets the fill color to be used for drawing filled objects. +*/ +PHP_METHOD(imagickdraw, setfillcolor) +{ + zval *param; + php_imagickdraw_object *internd; + PixelWand *color_wand; + zend_bool allocated; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶m) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + color_wand = php_imagick_zval_to_pixelwand(param, IMAGICKDRAW_CLASS, &allocated TSRMLS_CC); + if (!color_wand) + return; + + DrawSetFillColor(internd->drawing_wand, color_wand); + if (allocated) + color_wand = DestroyPixelWand (color_wand); + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setResolution(float x, float y) + Sets the resolution +*/ +PHP_METHOD(imagickdraw, setresolution) +{ + char *density, *buf = NULL; + double x, y; + php_imagickdraw_object *internd; + DrawInfo *draw_info; + DrawingWand *d_wand; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + spprintf(&buf, 512, "%fx%f", x, y); + density = AcquireString(buf); + efree (buf); + + if (!density) { + php_imagick_throw_exception(IMAGICKDRAW_CLASS, "Failed to allocate memory" TSRMLS_CC); + return; + } + + draw_info = PeekDrawingWand(internd->drawing_wand); + draw_info->density = density; + + +#if MagickLibVersion >= 0x693 + d_wand = AcquireDrawingWand(draw_info, NULL); +#else + d_wand = (DrawingWand *) DrawAllocateWand(draw_info, NULL); +#endif + + if (!d_wand) { + php_imagick_throw_exception(IMAGICKDRAW_CLASS, "Failed to allocate new DrawingWand structure" TSRMLS_CC); + return; + } + + php_imagick_replace_drawingwand(internd, d_wand); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setStrokeColor(PixelWand stroke_wand) + Sets the color used for stroking object outlines. +*/ +PHP_METHOD(imagickdraw, setstrokecolor) +{ + zval *param; + php_imagickdraw_object *internd; + PixelWand *color_wand; + zend_bool allocated; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶m) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + color_wand = php_imagick_zval_to_pixelwand (param, IMAGICKDRAW_CLASS, &allocated TSRMLS_CC); + if (!color_wand) + return; + + DrawSetStrokeColor(internd->drawing_wand, color_wand); + if (allocated) + color_wand = DestroyPixelWand (color_wand); + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setFillAlpha(float opacity) + Sets the opacity to use when drawing using the fill color or fill texture. Fully opaque is 1.0. +*/ +PHP_METHOD(imagickdraw, setfillalpha) +{ + php_imagickdraw_object *internd; + double opacity; + + IMAGICK_METHOD_DEPRECATED("ImagickDraw", "setFillAlpha"); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &opacity) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + +#if MagickLibVersion >= 0x635 + DrawSetFillOpacity(internd->drawing_wand, opacity); +#else + DrawSetFillAlpha(internd->drawing_wand, opacity); +#endif + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::getAntialias() + Returns the antialias property associated with the wand. +*/ +PHP_METHOD(imagickdraw, settextantialias) +{ + php_imagickdraw_object *internd; + zend_bool antialias; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &antialias) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + DrawSetTextAntialias(internd->drawing_wand, antialias); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setTextEncoding(string encoding) + Specifies specifies the code set to use for text annotations. + The only character encoding which may be specified at this time is "UTF-8" for representing Unicode as a sequence of bytes. + Specify an empty string to set text encoding to the system's default. + Successful text annotation using Unicode may require fonts designed to support Unicode. +*/ +PHP_METHOD(imagickdraw, settextencoding) +{ + php_imagickdraw_object *internd; + char *encoding; + IM_LEN_TYPE encoding_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &encoding, &encoding_len) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + DrawSetTextEncoding(internd->drawing_wand, encoding); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setStrokeAlpha(float opacity) + Specifies the opacity of stroked object outlines. +*/ +PHP_METHOD(imagickdraw, setstrokealpha) +{ + php_imagickdraw_object *internd; + double opacity; + + IMAGICK_METHOD_DEPRECATED("ImagickDraw", "setStrokeAlpha"); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &opacity) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + +#if MagickLibVersion >= 0x635 + DrawSetStrokeOpacity(internd->drawing_wand, opacity); +#else + DrawSetStrokeAlpha(internd->drawing_wand, opacity); +#endif + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setStrokeWidth(float stroke_width) + Sets the width of the stroke used to draw object outlines. +*/ +PHP_METHOD(imagickdraw, setstrokewidth) +{ + php_imagickdraw_object *internd; + double width; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &width) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + DrawSetStrokeWidth(internd->drawing_wand, width); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setFont(string font_name) + Sets the fully-sepecified font to use when annotating with text. +*/ +PHP_METHOD(imagickdraw, setfont) +{ + php_imagickdraw_object *internd; + char *font, *absolute; + IM_LEN_TYPE font_len; + MagickBooleanType status; + php_imagick_rw_result_t rc; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &font, &font_len) == FAILURE) { + return; + } + + /* Check that no empty string is passed */ + if (font_len == 0) { + php_imagick_throw_exception (IMAGICKDRAW_CLASS, "Can not set empty font" TSRMLS_CC); + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + /* And if it wasn't */ + if (!php_imagick_check_font(font, font_len TSRMLS_CC)) { + + if ((absolute = expand_filepath(font, NULL TSRMLS_CC)) == NULL) { + php_imagick_throw_exception (IMAGICKDRAW_CLASS, "Unable to set font, file path expansion failed" TSRMLS_CC); + return; + } + + /* Do an access check for the font */ + if ((rc = php_imagick_file_access_check (absolute TSRMLS_CC)) != IMAGICK_RW_OK) { + // Failed + php_imagick_imagickdraw_rw_fail_to_exception (internd->drawing_wand, rc, absolute TSRMLS_CC); + efree(absolute); + return; + } + status = DrawSetFont(internd->drawing_wand, absolute); + efree(absolute); + + } else { + status = DrawSetFont(internd->drawing_wand, font); + } + + if (status == MagickFalse) { + php_imagick_convert_imagickdraw_exception (internd->drawing_wand, "Unable to set font" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setFontFamily(string font_family) + Sets the font family to use when annotating with text. +*/ +PHP_METHOD(imagickdraw, setfontfamily) +{ + php_imagickdraw_object *internd; + char *font_family; + IM_LEN_TYPE font_family_len; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &font_family, &font_family_len) == FAILURE) { + return; + } + + /* Check that no empty string is passed */ + if (font_family_len == 0) { + php_imagick_throw_exception(IMAGICKDRAW_CLASS, "Can not set empty font family" TSRMLS_CC); + return; + } + + if (!php_imagick_check_font(font_family, font_family_len TSRMLS_CC )) { + php_imagick_throw_exception(IMAGICKDRAW_CLASS, "Unable to set font family; parameter not found in the list of configured fonts" TSRMLS_CC); + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + status = DrawSetFontFamily(internd->drawing_wand, font_family); + + if (status == MagickFalse) { + php_imagick_convert_imagickdraw_exception (internd->drawing_wand, "Unable to set font family" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setFontSize(float pointsize) + Sets the font pointsize to use when annotating with text. +*/ +PHP_METHOD(imagickdraw, setfontsize) +{ + php_imagickdraw_object *internd; + double font_size; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &font_size) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + DrawSetFontSize(internd->drawing_wand, font_size); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setFontStyle(int style) + Sets the font style to use when annotating with text. The AnyStyle enumeration acts as a wild-card "don't care" option. +*/ +PHP_METHOD(imagickdraw, setfontstyle) +{ + php_imagickdraw_object *internd; + im_long style_id = AnyStyle; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &style_id) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + DrawSetFontStyle(internd->drawing_wand, style_id); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setFontWeight(int font_weight) + Sets the font weight to use when annotating with text. +*/ +PHP_METHOD(imagickdraw, setfontweight) +{ + php_imagickdraw_object *internd; + im_long weight; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &weight) == FAILURE) { + return; + } + + if (weight >= 100 && weight <= 900) { + internd = Z_IMAGICKDRAW_P(getThis());; + DrawSetFontWeight(internd->drawing_wand, weight); + RETURN_TRUE; + } + php_imagick_throw_exception(IMAGICKDRAW_CLASS, "Font weight valid range is 100-900" TSRMLS_CC); + return; +} +/* }}} */ + +/* {{{ proto int ImagickDraw::getFontStretch(int fontStretch) + Gets the font stretch to use when annotating with text +*/ +PHP_METHOD(imagickdraw, getfontstretch) +{ + php_imagickdraw_object *internd; + + internd = Z_IMAGICKDRAW_P(getThis());; + RETVAL_LONG(DrawGetFontStretch(internd->drawing_wand)); +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setFontStretch(int fontStretch) + Sets the font stretch to use when annotating with text. The AnyStretch enumeration acts as a wild-card "don't care" option. +*/ +PHP_METHOD(imagickdraw, setfontstretch) +{ + php_imagickdraw_object *internd; + im_long stretch; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &stretch) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + DrawSetFontStretch(internd->drawing_wand, stretch); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setStrokeAntialias(bool stroke_antialias) + Controls whether stroked outlines are antialiased. Stroked outlines are antialiased by default. When antialiasing is disabled stroked pixels are thresholded to determine if the stroke color or underlying canvas color should be used. +*/ +PHP_METHOD(imagickdraw, setstrokeantialias) +{ + php_imagickdraw_object *internd; + zend_bool antialias; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &antialias) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + DrawSetStrokeAntialias(internd->drawing_wand, antialias); + RETURN_TRUE; + +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setTextAlignment(int alignment) + Specifies a text alignment to be applied when annotating with text. +*/ +PHP_METHOD(imagickdraw, settextalignment) +{ + php_imagickdraw_object *internd; + im_long align; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &align) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + DrawSetTextAlignment(internd->drawing_wand, align); + RETURN_TRUE; + +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setTextDecoration(int decoration) + Specifies a decoration to be applied when annotating with text. +*/ +PHP_METHOD(imagickdraw, settextdecoration) +{ + php_imagickdraw_object *internd; + im_long decoration; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &decoration) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + DrawSetTextDecoration(internd->drawing_wand, decoration); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setTextUnderColor(PixelWand under_wand) + Specifies the color of a background rectangle to place under text annotations. +*/ +PHP_METHOD(imagickdraw, settextundercolor) +{ + zval *param; + php_imagickdraw_object *internd; + PixelWand *color_wand; + zend_bool allocated; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶m) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + color_wand = php_imagick_zval_to_pixelwand (param, IMAGICKDRAW_CLASS, &allocated TSRMLS_CC); + if (!color_wand) + return; + + DrawSetTextUnderColor(internd->drawing_wand, color_wand); + if (allocated) + color_wand = DestroyPixelWand (color_wand); + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setViewbox(float x1, float y1, float x2, float y2 ) + Sets the overall canvas size to be recorded with the drawing vector data. Usually this will be specified using the same size as the canvas image. When the vector data is saved to SVG or MVG formats, the viewbox is use to specify the size of the canvas image that a viewer will render the vector data on. +*/ +PHP_METHOD(imagickdraw, setviewbox) +{ + php_imagickdraw_object *internd; + im_long x1, y1, x2, y2; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &x1, &y1, &x2, &y2) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + DrawSetViewbox(internd->drawing_wand, x1, y1, x2, y2); + RETURN_TRUE; +} + +/* {{{ proto string ImagickDraw::getFont() + Returns a string specifying the font used when annotating with text +*/ +PHP_METHOD(imagickdraw, getfont) +{ + php_imagickdraw_object *internd; + char *font; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + font = DrawGetFont(internd->drawing_wand); + + if (!font) { + RETURN_FALSE; + } else { + IM_ZVAL_STRING(return_value, font); + IMAGICK_FREE_MAGICK_MEMORY(font); + return; + } +} +/* }}} */ + +/* {{{ proto string ImagickDraw::getFontFamily() + Returns the font family to use when annotating with text. The value returned must be freed by the user when it is no longer needed. +*/ +PHP_METHOD(imagickdraw, getfontfamily) +{ + php_imagickdraw_object *internd; + char *font_family; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + font_family = DrawGetFontFamily(internd->drawing_wand); + if (!font_family) { + RETURN_FALSE; + } else { + IM_ZVAL_STRING(return_value, font_family); + IMAGICK_FREE_MAGICK_MEMORY(font_family); + return; + } +} +/* }}} */ + +/* {{{ proto float ImagickDraw::getFontSize() + Returns the font pointsize used when annotating with text. +*/ +PHP_METHOD(imagickdraw, getfontsize) +{ + php_imagickdraw_object *internd; + double font_size; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + font_size = DrawGetFontSize(internd->drawing_wand); + ZVAL_DOUBLE(return_value, font_size); + return; +} +/* }}} */ + +/* {{{ proto int ImagickDraw::getFontStyle() + Returns the font style used when annotating with text. +*/ +PHP_METHOD(imagickdraw, getfontstyle) +{ + php_imagickdraw_object *internd; + long font_style; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + font_style = DrawGetFontStyle(internd->drawing_wand); + ZVAL_LONG(return_value, font_style); + return; +} +/* }}} */ + +/* {{{ proto int ImagickDraw::getFontWeight() + Returns the font weight used when annotating with text. +*/ +PHP_METHOD(imagickdraw, getfontweight) +{ + php_imagickdraw_object *internd; + long weight; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + weight = DrawGetFontWeight(internd->drawing_wand); + ZVAL_LONG(return_value, weight); + return; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::clear() + Clears a DrawingWand resource of any accumulated commands, and resets the settings it contains to their defaults. +*/ +PHP_METHOD(imagickdraw, clear) +{ + php_imagickdraw_object *internd; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + ClearDrawingWand(internd->drawing_wand); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto int ImagickDraw::getTextDecoration() + Returns the decoration applied when annotating with text. +*/ +PHP_METHOD(imagickdraw, gettextdecoration) +{ + php_imagickdraw_object *internd; + long decoration; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + decoration = DrawGetTextDecoration(internd->drawing_wand); + ZVAL_LONG(return_value, decoration); + return; +} +/* }}} */ + +/* {{{ proto string ImagickDraw::getTextEncoding() + Returns a null-terminated string which specifies the code set used for text annotations. The string must be freed by the user once it is no longer required. +*/ +PHP_METHOD(imagickdraw, gettextencoding) +{ + php_imagickdraw_object *internd; + char *encoding; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + encoding = DrawGetTextEncoding(internd->drawing_wand); + + if (!encoding) { + RETURN_FALSE; + } else { + IM_ZVAL_STRING(return_value, encoding); + IMAGICK_FREE_MAGICK_MEMORY(encoding); + return; + } +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::annotation(float x, float y, string *text) + Draws text on the image. +*/ +PHP_METHOD(imagickdraw, annotation) +{ + php_imagickdraw_object *internd; + double x, y; + unsigned char *text; + IM_LEN_TYPE text_len; +#if MagickLibVersion < 0x632 + char *font; +#endif + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dds", &x, &y, &text, &text_len) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; +#if MagickLibVersion < 0x632 + font = DrawGetFont(internd->drawing_wand); + + /* Fixes PECL Bug #11328 */ + if (!font) { + php_imagick_throw_exception(IMAGICKDRAW_CLASS, "Font needs to be set before annotating an image" TSRMLS_CC); + return; + } +#endif + + DrawAnnotation(internd->drawing_wand, x, y, text); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::arc(float sx, float sy, float ex, float ey, float sd, float ed) + Draws an arc falling within a specified bounding rectangle on the image. +*/ +PHP_METHOD(imagickdraw, arc) +{ + double sx, sy, ex, ey, sd, ed; + php_imagickdraw_object *internd; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddddd", &sx, &sy, &ex, &ey, &sd, &ed) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + DrawArc(internd->drawing_wand, sx, sy, ex, ey, sd, ed); + RETURN_TRUE; +} +/* }}} */ + + +#if MagickLibVersion < 0x700 +/* {{{ proto bool ImagickDraw::matte(float x, float y, int paintMethod) + Paints on the image's opacity channel in order to set effected pixels to transparent. to influence the opacity of pixels. The available paint methods are: +*/ +PHP_METHOD(imagickdraw, matte) +{ + double x, y; + php_imagickdraw_object *internd; + im_long paint_method; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ddl", &x, &y, &paint_method) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + DrawMatte(internd->drawing_wand, x, y, paint_method); + RETURN_TRUE; +} +/* }}} */ + +#else + +/* {{{ proto bool ImagickDraw::matte(float x, float y, int paintMethod) + Paints on the image's alpha channel in order to set effected pixels to transparent. to influence the alpha of pixels. The available paint methods are: + PointMethod: Select the target pixel + ReplaceMethod: Select any pixel that matches the target pixel. + FloodfillMethod: Select the target pixel and matching neighbors. + FillToBorderMethod: Select the target pixel and neighbors not matching +border color. + ResetMethod: Select all pixels. +*/ +PHP_METHOD(imagickdraw, alpha) +{ + double x, y; + php_imagickdraw_object *internd; + im_long paint_method; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ddl", &x, &y, &paint_method) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + DrawAlpha(internd->drawing_wand, x, y, paint_method); + RETURN_TRUE; +} +/* }}} */ + +#endif + + +/* {{{ proto bool ImagickDraw::polygon(array coordinates) + Draws a polygon using the current stroke, stroke width, and fill color or texture, using the specified array of coordinates. +*/ +PHP_METHOD(imagickdraw, polygon) +{ + zval *coordinate_array; + php_imagickdraw_object *internd; + PointInfo *coordinates; + int num_elements = 0; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &coordinate_array) == FAILURE) { + return; + } + + coordinates = php_imagick_zval_to_pointinfo_array(coordinate_array, &num_elements TSRMLS_CC); + + if (!coordinates) { + php_imagick_throw_exception(IMAGICKDRAW_CLASS, "Unable to read coordinate array" TSRMLS_CC); + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + DrawPolygon(internd->drawing_wand, num_elements, coordinates); + + efree(coordinates); + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::bezier(array coordinates) + Draws a bezier curve through a set of points on the image. +*/ +PHP_METHOD(imagickdraw, bezier) +{ + zval *coordinate_array; + php_imagickdraw_object *internd; + PointInfo *coordinates; + int num_elements = 0; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &coordinate_array) == FAILURE) { + return; + } + + coordinates = php_imagick_zval_to_pointinfo_array(coordinate_array, &num_elements TSRMLS_CC); + + if (!coordinates) { + php_imagick_throw_exception(IMAGICKDRAW_CLASS, "Unable to read coordinate array" TSRMLS_CC); + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + DrawBezier(internd->drawing_wand, num_elements, coordinates); + + efree(coordinates); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::point(float x, float y) + Draws a point using the current stroke color and stroke thickness at the specified coordinates. +*/ +PHP_METHOD(imagickdraw, point) +{ + php_imagickdraw_object *internd; + double x, y; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + DrawPoint(internd->drawing_wand, x, y); + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::line(float sx, float sy, float ex, float ey) + Draws a line on the image using the current stroke color, stroke opacity, and stroke width. +*/ +PHP_METHOD(imagickdraw, line) +{ + php_imagickdraw_object *internd; + double sx, sy, ex, ey; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddd", &sx, &sy, &ex, &ey) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + DrawLine(internd->drawing_wand, sx, sy, ex, ey); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto ImagickDraw ImagickDraw::clone() + Makes an exact copy of the specified wand. +*/ +PHP_METHOD(imagickdraw, clone) +{ + php_imagickdraw_object *internd, *intern_return; + DrawingWand *tmp_wand; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + IMAGICK_METHOD_DEPRECATED("ImagickDraw", "clone"); + + internd = Z_IMAGICKDRAW_P(getThis());; + tmp_wand = CloneDrawingWand(internd->drawing_wand); + + if (!tmp_wand) { + php_imagick_throw_exception (IMAGICK_CLASS, "Failed to allocate DrawingWand structure" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagickdraw_sc_entry); + intern_return = Z_IMAGICKDRAW_P(return_value); + php_imagick_replace_drawingwand(intern_return, tmp_wand); + + return; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::affine(array affine) + Adjusts the current affine transformation matrix with the specified affine transformation matrix. Note that the current affine transform is adjusted rather than replaced. +*/ +PHP_METHOD(imagickdraw, affine) +{ + php_imagickdraw_object *internd; + zval *affine_matrix; + +#ifdef ZEND_ENGINE_3 + zval *pzval; +#else + HashTable *affine; + zval **ppzval; +#endif + char *matrix_elements[] = { "sx", "rx", "ry", + "sy", "tx", "ty" }; + int i; + double value; + AffineMatrix matrix; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &affine_matrix) == FAILURE) { + return; + } + +#ifndef ZEND_ENGINE_3 + affine = Z_ARRVAL_P(affine_matrix); + zend_hash_internal_pointer_reset_ex(affine, (HashPosition *) 0); +#endif + + + for (i = 0; i < 6 ; i++) { +#ifdef ZEND_ENGINE_3 + pzval = zend_hash_str_find(HASH_OF(affine_matrix), matrix_elements[i], 2); + ZVAL_DEREF(pzval); + if (pzval == NULL) { + php_imagick_throw_exception(IMAGICKDRAW_CLASS, "AffineMatrix must contain keys: sx, rx, ry, sy, tx and ty" TSRMLS_CC); + return; +#else + if (zend_hash_find(affine, matrix_elements[i], 3, (void**)&ppzval) == FAILURE) { + php_imagick_throw_exception(IMAGICKDRAW_CLASS, "AffineMatrix must contain keys: sx, rx, ry, sy, tx and ty" TSRMLS_CC); + return; +#endif + } else { + +#ifdef ZEND_ENGINE_3 + value = zval_get_double(pzval); +#else + zval tmp_zval, *tmp_pzval; + + tmp_zval = **ppzval; + zval_copy_ctor(&tmp_zval); + tmp_pzval = &tmp_zval; + convert_to_double(tmp_pzval); + value = Z_DVAL(tmp_zval); +#endif + if (strcmp(matrix_elements[i], "sx") == 0) { + matrix.sx = value; + } else if (strcmp(matrix_elements[i], "rx") == 0) { + matrix.rx = value; + } else if (strcmp(matrix_elements[i], "ry") == 0) { + matrix.ry = value; + } else if (strcmp(matrix_elements[i], "sy") == 0) { + matrix.sy = value; + } else if (strcmp(matrix_elements[i], "tx") == 0) { + matrix.tx = value; + } else if (strcmp(matrix_elements[i], "ty") == 0) { + matrix.ty = value; + } + } + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawAffine(internd->drawing_wand, &matrix); + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::composite(int compose, float x, float y, float width, float height, MagickWand magick_wand) + Composites an image onto the current image, using the specified composition operator, specified position, and at the specified size. +*/ +PHP_METHOD(imagickdraw, composite) +{ + php_imagickdraw_object *internd; + php_imagick_object *intern; + zval *magick_obj; + im_long compose; + double x, y, width, height; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lddddO", &compose, &x, &y, &width, &height, &magick_obj, php_imagick_sc_entry) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(magick_obj); + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + internd = Z_IMAGICKDRAW_P(getThis()); + status = DrawComposite(internd->drawing_wand, compose, x, y, width, height, intern->magick_wand); + + if (status == MagickFalse) { + php_imagick_convert_imagickdraw_exception (internd->drawing_wand, "Compositing image failed" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::color(float x, float y, int paintMethod) + Draws color on image using the current fill color, starting at specified position, and using specified paint method. The available paint methods are: +*/ +PHP_METHOD(imagickdraw, color) +{ + php_imagickdraw_object *internd; + double x, y; + im_long paint_method; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ddl", &x, &y, &paint_method) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawColor(internd->drawing_wand, x, y, paint_method); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::comment(string comment) + Adds a comment to a vector output stream. +*/ +PHP_METHOD(imagickdraw, comment) +{ + php_imagickdraw_object *internd; + char *comment; + IM_LEN_TYPE comment_len; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &comment, &comment_len) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawComment(internd->drawing_wand, comment); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto string ImagickDraw::getClipPath() + Obtains the current clipping path ID. The value returned must be deallocated by the user when it is no longer needed. +*/ +PHP_METHOD(imagickdraw, getclippath) +{ + php_imagickdraw_object *internd; + char *clip_path; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + clip_path = DrawGetClipPath(internd->drawing_wand); + + if (!clip_path) { + RETURN_FALSE; + } else { + IM_ZVAL_STRING(return_value, clip_path); + IMAGICK_FREE_MAGICK_MEMORY(clip_path); + return; + } +} +/* }}} */ + +/* {{{ proto int ImagickDraw::getClipRule() + Returns the current polygon fill rule to be used by the clipping path. +*/ +PHP_METHOD(imagickdraw, getcliprule) +{ + php_imagickdraw_object *internd; + long clip_rule; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + clip_rule = DrawGetClipRule(internd->drawing_wand); + + RETVAL_LONG(clip_rule); +} +/* }}} */ + +/* {{{ proto int ImagickDraw::getClipUnits() + Returns the interpretation of clip path units. +*/ +PHP_METHOD(imagickdraw, getclipunits) +{ + php_imagickdraw_object *internd; + long units; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + units = DrawGetClipUnits(internd->drawing_wand); + + RETVAL_LONG(units); +} +/* }}} */ + +/* {{{ proto ImagickPixel ImagickDraw::getFillColor() + Returns the fill color used for drawing filled objects. +*/ +PHP_METHOD(imagickdraw, getfillcolor) +{ + php_imagickpixel_object *internp; + php_imagickdraw_object *internd; + PixelWand *tmp_wand; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + tmp_wand = NewPixelWand(); + DrawGetFillColor(internd->drawing_wand, tmp_wand); + + object_init_ex(return_value, php_imagickpixel_sc_entry); + internp = Z_IMAGICKPIXEL_P(return_value); + php_imagick_replace_pixelwand(internp, tmp_wand); + + return; +} +/* }}} */ + +/* {{{ proto float ImagickDraw::getFillOpacity() + Returns the opacity used when drawing using the fill color or fill texture. Fully opaque is 1.0. +*/ +PHP_METHOD(imagickdraw, getfillopacity) +{ + php_imagickdraw_object *internd; + double opacity; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + opacity = DrawGetFillOpacity(internd->drawing_wand); + + RETVAL_DOUBLE(opacity); +} +/* }}} */ + +/* {{{ proto int ImagickDraw::getFillRule(const DrawingWand *wand) + Returns the fill rule used while drawing polygons. +*/ +PHP_METHOD(imagickdraw, getfillrule) +{ + php_imagickdraw_object *internd; + long fill_rule; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + fill_rule = DrawGetFillRule(internd->drawing_wand); + + RETVAL_LONG(fill_rule); +} +/* }}} */ + +/* {{{ proto int ImagickDraw::getGravity() + Returns the text placement gravity used when annotating with text. +*/ +PHP_METHOD(imagickdraw, getgravity) +{ + php_imagickdraw_object *internd; + long gravity; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + gravity = DrawGetGravity(internd->drawing_wand); + + RETVAL_LONG(gravity); +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::getStrokeAntialias() + Returns the current stroke antialias setting. Stroked outlines are antialiased by default. When antialiasing is disabled stroked pixels are thresholded to determine if the stroke color or underlying canvas color should be used. +*/ +PHP_METHOD(imagickdraw, getstrokeantialias) +{ + php_imagickdraw_object *internd; + MagickBooleanType status; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + status = DrawGetStrokeAntialias(internd->drawing_wand); + + if (status == MagickFalse) { + RETURN_FALSE; + } else { + RETURN_TRUE; + } +} +/* }}} */ + +/* {{{ proto ImagickPixel ImagickDraw::getStrokeColor(PixelWand stroke_color) + Returns the color used for stroking object outlines. +*/ +PHP_METHOD(imagickdraw, getstrokecolor) +{ + php_imagickpixel_object *internp; + php_imagickdraw_object *internd; + PixelWand *tmp_wand; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + tmp_wand = NewPixelWand(); + DrawGetStrokeColor(internd->drawing_wand, tmp_wand); + + object_init_ex(return_value, php_imagickpixel_sc_entry); + internp = Z_IMAGICKPIXEL_P(return_value); + php_imagick_replace_pixelwand(internp, tmp_wand); + + return; +} +/* }}} */ + +/* {{{ proto array ImagickDraw::getStrokeDashArray() + Returns an array representing the pattern of dashes and gaps used to stroke paths (see DrawSetStrokeDashArray). The array must be freed once it is no longer required by the user. +*/ +PHP_METHOD(imagickdraw, getstrokedasharray) +{ + php_imagickdraw_object *internd; + double *stroke_array; + unsigned long i; + size_t num_elements; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + stroke_array = DrawGetStrokeDashArray(internd->drawing_wand, &num_elements); + array_init(return_value); + + for (i = 0; i < num_elements ; i++) { + add_next_index_double(return_value, stroke_array[i]); + } + + IMAGICK_FREE_MAGICK_MEMORY(stroke_array); + return; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setStrokeDashArray(array dashArray) + Specifies the pattern of dashes and gaps used to stroke paths. The strokeDashArray represents an array of numbers that specify the lengths of alternating dashes and gaps in pixels. If an odd number of values is provided, then the list of values is repeated to yield an even number of values. To remove an existing dash array, pass a zero number_elements argument and null dash_array. A typical strokeDashArray_ array might contain the members 5 3 2. +*/ +PHP_METHOD(imagickdraw, setstrokedasharray) +{ + zval *param_array; + double *double_array; + im_long elements; + php_imagickdraw_object *internd; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", ¶m_array) == FAILURE) { + return; + } + + double_array = php_imagick_zval_to_double_array(param_array, &elements TSRMLS_CC); + + if (!double_array) { + php_imagick_throw_exception(IMAGICKDRAW_CLASS, "Cannot read stroke dash array parameter" TSRMLS_CC); + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawSetStrokeDashArray(internd->drawing_wand, elements, double_array); + efree(double_array); + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto float ImagickDraw::getStrokeDashOffset() + Returns the offset into the dash pattern to start the dash. +*/ +PHP_METHOD(imagickdraw, getstrokedashoffset) +{ + php_imagickdraw_object *internd; + double offset; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + offset = DrawGetStrokeDashOffset(internd->drawing_wand); + + RETVAL_DOUBLE(offset); +} +/* }}} */ + +/* {{{ proto int ImagickDraw::getStrokeLineCap() + Returns the shape to be used at the end of open subpaths when they are stroked. Values of LineCap are UndefinedCap, ButtCap, RoundCap, and SquareCap. +*/ +PHP_METHOD(imagickdraw, getstrokelinecap) +{ + php_imagickdraw_object *internd; + long line_cap; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + line_cap = DrawGetStrokeLineCap(internd->drawing_wand); + + RETVAL_LONG(line_cap); +} +/* }}} */ + +/* {{{ proto int ImagickDraw::getStrokeLineJoin() + Returns the shape to be used at the corners of paths (or other vector shapes) when they are stroked. Values of LineJoin are UndefinedJoin, MiterJoin, RoundJoin, and BevelJoin. +*/ +PHP_METHOD(imagickdraw, getstrokelinejoin) +{ + php_imagickdraw_object *internd; + long line_join; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + line_join = DrawGetStrokeLineJoin(internd->drawing_wand); + + RETVAL_LONG(line_join); +} +/* }}} */ + +/* {{{ proto int ImagickDraw::getStrokeMiterLimit() + Returns the miter limit. When two line segments meet at a sharp angle and miter joins have been specified for 'lineJoin', it is possible for the miter to extend far beyond the thickness of the line stroking the path. The miterLimit' imposes a limit on the ratio of the miter length to the 'lineWidth'. +*/ +PHP_METHOD(imagickdraw, getstrokemiterlimit) +{ + php_imagickdraw_object *internd; + unsigned long miter_limit; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + miter_limit = DrawGetStrokeMiterLimit(internd->drawing_wand); + + RETVAL_LONG(miter_limit); +} +/* }}} */ + +/* {{{ proto float ImagickDraw::getStrokeOpacity() + Returns the opacity of stroked object outlines. +*/ +PHP_METHOD(imagickdraw, getstrokeopacity) +{ + php_imagickdraw_object *internd; + double opacity; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + opacity = DrawGetStrokeOpacity(internd->drawing_wand); + + RETVAL_DOUBLE(opacity); +} +/* }}} */ + +/* {{{ proto float ImagickDraw::getStrokeWidth() + Returns the width of the stroke used to draw object outlines. +*/ +PHP_METHOD(imagickdraw, getstrokewidth) +{ + php_imagickdraw_object *internd; + double width; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + width = DrawGetStrokeWidth(internd->drawing_wand); + + RETVAL_DOUBLE(width); +} +/* }}} */ + +/* {{{ proto int ImagickDraw::getTextAlignment() + Returns the alignment applied when annotating with text. +*/ +PHP_METHOD(imagickdraw, gettextalignment) +{ + php_imagickdraw_object *internd; + long align_type; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + align_type = DrawGetTextAlignment(internd->drawing_wand); + + RETVAL_LONG(align_type); +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::getTextAntialias() + Returns the current text antialias setting, which determines whether text is antialiased. Text is antialiased by default. +*/ +PHP_METHOD(imagickdraw, gettextantialias) +{ + php_imagickdraw_object *internd; + MagickBooleanType status; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + status = DrawGetTextAntialias(internd->drawing_wand); + + if (status == MagickFalse) { + RETURN_FALSE; + } else { + RETURN_TRUE; + } +} +/* }}} */ + +/* {{{ proto string ImagickDraw::getVectorGraphics() + Returns a null-terminated string which specifies the vector graphics generated by any graphics calls made since the wand was instantiated. The string must be freed by the user once it is no longer required. +*/ +PHP_METHOD(imagickdraw, getvectorgraphics) +{ + php_imagickdraw_object *internd; + char *vector; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + vector = DrawGetVectorGraphics(internd->drawing_wand); + + IM_ZVAL_STRING(return_value, vector); + IMAGICK_FREE_MAGICK_MEMORY(vector); + + return; +} +/* }}} */ + +/* {{{ proto ImagickPixel ImagickDraw::getTextUnderColor(PixelWand under_color) + Returns the color of a background rectangle to place under text annotations. +*/ +PHP_METHOD(imagickdraw, gettextundercolor) +{ + php_imagickpixel_object *internp; + php_imagickdraw_object *internd; + PixelWand *tmp_wand; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + tmp_wand = NewPixelWand(); + + if (!tmp_wand) { + php_imagick_throw_exception(IMAGICKDRAW_CLASS, "Failed to allocate space for new PixelWand" TSRMLS_CC); + return; + } + + DrawGetTextUnderColor(internd->drawing_wand, tmp_wand); + + object_init_ex(return_value, php_imagickpixel_sc_entry); + internp = Z_IMAGICKPIXEL_P(return_value); + php_imagick_replace_pixelwand(internp, tmp_wand); + + return; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::pathClose() + Adds a path element to the current path which closes the current subpath by drawing a straight line from the current point to the current subpath's most recent starting point (usually, the most recent moveto point). +*/ +PHP_METHOD(imagickdraw, pathclose) +{ + php_imagickdraw_object *internd; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + DrawPathClose(internd->drawing_wand); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::pathCurveToAbsolute(float x1, float y1, float x2, float y2, float x, float y) + Draws a cubic Bezier curve from the current point to (x,y) using (x1,y1) as the control point at the beginning of the curve and (x2,y2) as the control point at the end of the curve using absolute coordinates. At the end of the command, the new current point becomes the final (x,y) coordinate pair used in the polybezier. +*/ +PHP_METHOD(imagickdraw, pathcurvetoabsolute) +{ + php_imagickdraw_object *internd; + double x1, y1, x2, y2, x, y; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddddd", &x1, &y1, &x2, &y2, &x, &y) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawPathCurveToAbsolute(internd->drawing_wand, x1, y1, x2, y2, x, y); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::pathCurveToRelative(float x1, float y1, float x2, float y2, float x, float y) + Draws a cubic Bezier curve from the current point to (x,y) using (x1,y1) as the control point at the beginning of the curve and (x2,y2) as the control point at the end of the curve using relative coordinates. At the end of the command, the new current point becomes the final (x,y) coordinate pair used in the polybezier. +*/ +PHP_METHOD(imagickdraw, pathcurvetorelative) +{ + php_imagickdraw_object *internd; + double x1, y1, x2, y2, x, y; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddddd", &x1, &y1, &x2, &y2, &x, &y) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawPathCurveToRelative(internd->drawing_wand, x1, y1, x2, y2, x, y); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::pathCurveToQuadraticBezierAbsolute(float x1, float y1, float x, float y) + Draws a quadratic Bezier curve from the current point to (x,y) using (x1,y1) as the control point using absolute coordinates. At the end of the command, the new current point becomes the final (x,y) coordinate pair used in the polybezier. +*/ +PHP_METHOD(imagickdraw, pathcurvetoquadraticbezierabsolute) +{ + php_imagickdraw_object *internd; + double x1, y1, x, y; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddd", &x1, &y1, &x, &y) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawPathCurveToQuadraticBezierAbsolute(internd->drawing_wand, x1, y1, x, y); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::pathCurveToQuadraticBezierRelative(float x1, float y1, float x, float y) + Draws a quadratic Bezier curve from the current point to (x,y) using (x1,y1) as the control point using relative coordinates. At the end of the command, the new current point becomes the final (x,y) coordinate pair used in the polybezier. +*/ +PHP_METHOD(imagickdraw, pathcurvetoquadraticbezierrelative) +{ + php_imagickdraw_object *internd; + double x1, y1, x, y; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddd", &x1, &y1, &x, &y) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawPathCurveToQuadraticBezierRelative(internd->drawing_wand, x1, y1, x, y); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::pathCurveToQuadraticBezierSmoothAbsolute(float x, float y) + Draws a quadratic Bezier curve (using relative coordinates) from the current point to (x,y). The control point is assumed to be the reflection of the control point on the previous command relative to the current point. (If there is no previous command or if the previous command was not a DrawPathCurveToQuadraticBezierAbsolute, DrawPathCurveToQuadraticBezierRelative, DrawPathCurveToQuadraticBezierSmoothAbsolut or DrawPathCurveToQuadraticBezierSmoothRelative, assume the control point is coincident with the current point.). At the end of the command, the new current point becomes the final (x,y) coordinate pair used in the polybezier. +*/ +PHP_METHOD(imagickdraw, pathcurvetoquadraticbeziersmoothabsolute) +{ + php_imagickdraw_object *internd; + double x, y; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawPathCurveToQuadraticBezierSmoothAbsolute(internd->drawing_wand, x, y); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::pathCurveToQuadraticBezierSmoothRelative(float x, float y) + Draws a quadratic Bezier curve (using relative coordinates) from the current point to (x, y). The control point is assumed to be the reflection of the control point on the previous command relative to the current point. (If there is no previous command or if the previous command was not a DrawPathCurveToQuadraticBezierAbsolute, DrawPathCurveToQuadraticBezierRelative, DrawPathCurveToQuadraticBezierSmoothAbsolut or DrawPathCurveToQuadraticBezierSmoothRelative, assume the control point is coincident with the current point). At the end of the command, the new current point becomes the final (x, y) coordinate pair used in the polybezier. +*/ +PHP_METHOD(imagickdraw, pathcurvetoquadraticbeziersmoothrelative) +{ + php_imagickdraw_object *internd; + double x, y; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawPathCurveToQuadraticBezierSmoothRelative(internd->drawing_wand, x, y); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::pathCurveToSmoothAbsolute(float x2, float y2, float x, float y) + Draws a cubic Bezier curve from the current point to (x,y) using absolute coordinates. The first control point is assumed to be the reflection of the second control point on the previous command relative to the current point. (If there is no previous command or if the previous command was not an DrawPathCurveToAbsolute, DrawPathCurveToRelative, DrawPathCurveToSmoothAbsolute or DrawPathCurveToSmoothRelative, assume the first control point is coincident with the current point.) (x2,y2) is the second control point (i.e., the control point at the end of the curve). At the end of the command, the new current point becomes the final (x,y) coordinate pair used in the polybezier. +*/ +PHP_METHOD(imagickdraw, pathcurvetosmoothabsolute) +{ + php_imagickdraw_object *internd; + double x1, y1, x, y; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddd", &x1, &y1, &x, &y) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawPathCurveToSmoothAbsolute(internd->drawing_wand, x1, y1, x, y); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::pathCurveToSmoothRelative(float x2, float y2, float x, float y) + Draws a cubic Bezier curve from the current point to (x,y) using relative coordinates. The first control point is assumed to be the reflection of the second control point on the previous command relative to the current point. (If there is no previous command or if the previous command was not an DrawPathCurveToAbsolute, DrawPathCurveToRelative, DrawPathCurveToSmoothAbsolute or DrawPathCurveToSmoothRelative, assume the first control point is coincident with the current point.) (x2,y2) is the second control point (i.e., the control point at the end of the curve). At the end of the command, the new current point becomes the final (x,y) coordinate pair used in the polybezier. +*/ +PHP_METHOD(imagickdraw, pathcurvetosmoothrelative) +{ + php_imagickdraw_object *internd; + double x1, y1, x, y; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddd", &x1, &y1, &x, &y) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawPathCurveToSmoothRelative(internd->drawing_wand, x1, y1, x, y); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::pathEllipticArcAbsolute(float rx, float ry, float x_axis_rotation, bool large_arc_flag, bool sweep_flag, float x, float y) + Draws an elliptical arc from the current point to (x, y) using absolute coordinates. The size and orientation of the ellipse are defined by two radii (rx, ry) and an xAxisRotation, which indicates how the ellipse as a whole is rotated relative to the current coordinate system. The center (cx, cy) of the ellipse is calculated automatically to satisfy the constraints imposed by the other parameters. largeArcFlag and sweepFlag contribute to the automatic calculations and help determine how the arc is drawn. If largeArcFlag is true then draw the larger of the available arcs. If sweepFlag is true, then draw the arc matching a clock-wise rotation. +*/ +PHP_METHOD(imagickdraw, pathellipticarcabsolute) +{ + php_imagickdraw_object *internd; + double rx, ry, x_axis_rotation, x, y; + zend_bool large_arc, sweep; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddbbdd", &rx, &ry, &x_axis_rotation, &large_arc, &sweep, &x, &y) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + DrawPathEllipticArcAbsolute(internd->drawing_wand, rx, ry, x_axis_rotation, large_arc, sweep, x, y); + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::pathEllipticArcRelative(float rx, float ry, float x_axis_rotation, bool large_arc_flag, bool sweep_flag, float x, float y) + Draws an elliptical arc from the current point to (x, y) using relative coordinates. The size and orientation of the ellipse are defined by two radii (rx, ry) and an xAxisRotation, which indicates how the ellipse as a whole is rotated relative to the current coordinate system. The center (cx, cy) of the ellipse is calculated automatically to satisfy the constraints imposed by the other parameters. largeArcFlag and sweepFlag contribute to the automatic calculations and help determine how the arc is drawn. If largeArcFlag is true then draw the larger of the available arcs. If sweepFlag is true, then draw the arc matching a clock-wise rotation. +*/ +PHP_METHOD(imagickdraw, pathellipticarcrelative) +{ + php_imagickdraw_object *internd; + double rx, ry, x_axis_rotation, x, y; + zend_bool large_arc, sweep; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddbbdd", &rx, &ry, &x_axis_rotation, &large_arc, &sweep, &x, &y) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + DrawPathEllipticArcRelative(internd->drawing_wand, rx, ry, x_axis_rotation, large_arc, sweep, x, y); + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::pathFinish() + Terminates the current path. +*/ +PHP_METHOD(imagickdraw, pathfinish) +{ + php_imagickdraw_object *internd; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + DrawPathFinish(internd->drawing_wand); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::pathLineToAbsolute(float x, float y) + Draws a line path from the current point to the given coordinate using absolute coordinates. The coordinate then becomes the new current point. +*/ +PHP_METHOD(imagickdraw, pathlinetoabsolute) +{ + php_imagickdraw_object *internd; + double x, y; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawPathLineToAbsolute(internd->drawing_wand, x, y); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::pathLineToRelative(float x, float y) + Draws a line path from the current point to the given coordinate using relative coordinates. The coordinate then becomes the new current point. +*/ +PHP_METHOD(imagickdraw, pathlinetorelative) +{ + php_imagickdraw_object *internd; + double x, y; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawPathLineToRelative(internd->drawing_wand, x, y); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::pathLineToHorizontalAbsolute(float x) + Draws a horizontal line path from the current point to the target point using absolute coordinates. The target point then becomes the new current point. +*/ +PHP_METHOD(imagickdraw, pathlinetohorizontalabsolute) +{ + php_imagickdraw_object *internd; + double y; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &y) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawPathLineToHorizontalAbsolute(internd->drawing_wand, y); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::pathLineToHorizontalRelative(float x) + Draws a horizontal line path from the current point to the target point using relative coordinates. The target point then becomes the new current point. +*/ +PHP_METHOD(imagickdraw, pathlinetohorizontalrelative) +{ + php_imagickdraw_object *internd; + double x; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &x) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawPathLineToHorizontalRelative(internd->drawing_wand, x); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::pathLineToVerticalAbsolute(float y) + Draws a vertical line path from the current point to the target point using absolute coordinates. The target point then becomes the new current point. +*/ +PHP_METHOD(imagickdraw, pathlinetoverticalabsolute) +{ + php_imagickdraw_object *internd; + double y; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &y) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawPathLineToVerticalAbsolute(internd->drawing_wand, y); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::pathLineToVerticalRelative(float y) + Draws a vertical line path from the current point to the target point using relative coordinates. The target point then becomes the new current point. +*/ +PHP_METHOD(imagickdraw, pathlinetoverticalrelative) +{ + php_imagickdraw_object *internd; + double y; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &y) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawPathLineToVerticalRelative(internd->drawing_wand, y); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::pathMoveToAbsolute(float x, float y) + Starts a new sub-path at the given coordinate using absolute coordinates. The current point then becomes the specified coordinate. +*/ +PHP_METHOD(imagickdraw, pathmovetoabsolute) +{ + php_imagickdraw_object *internd; + double x, y; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawPathMoveToAbsolute(internd->drawing_wand, x, y); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::pathMoveToRelative(float x, float y) + Starts a new sub-path at the given coordinate using relative coordinates. The current point then becomes the specified coordinate. +*/ +PHP_METHOD(imagickdraw, pathmovetorelative) +{ + php_imagickdraw_object *internd; + double x, y; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawPathMoveToRelative(internd->drawing_wand, x, y); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::pathStart() + Declares the start of a path drawing list which is terminated by a matching DrawPathFinish() command. All other DrawPath commands must be enclosed between a and a DrawPathFinish() command. This is because path drawing commands are subordinate commands and they do not function by themselves. +*/ +PHP_METHOD(imagickdraw, pathstart) +{ + php_imagickdraw_object *internd; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + DrawPathStart(internd->drawing_wand); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::polyline(array coordinates) + Draws a polyline using the current stroke, stroke width, and fill color or texture, using the specified array of coordinates. +*/ +PHP_METHOD(imagickdraw, polyline) +{ + zval *coordinate_array; + php_imagickdraw_object *internd; + PointInfo *coordinates; + int num_elements = 0; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &coordinate_array) == FAILURE) { + return; + } + + coordinates = php_imagick_zval_to_pointinfo_array(coordinate_array, &num_elements TSRMLS_CC); + + if (!coordinates) { + php_imagick_throw_exception(IMAGICKDRAW_CLASS, "Unable to read coordinate array" TSRMLS_CC); + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + DrawPolyline(internd->drawing_wand, num_elements, coordinates); + + efree(coordinates); + RETURN_TRUE; + +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::popClipPath() + Terminates a clip path definition. +*/ +PHP_METHOD(imagickdraw, popclippath) +{ + php_imagickdraw_object *internd; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + DrawPopClipPath(internd->drawing_wand); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::popDefs() + Terminates a definition list +*/ +PHP_METHOD(imagickdraw, popdefs) +{ + php_imagickdraw_object *internd; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + DrawPopDefs(internd->drawing_wand); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::popPattern() + Terminates a pattern definition. +*/ +PHP_METHOD(imagickdraw, poppattern) +{ + php_imagickdraw_object *internd; + MagickBooleanType status; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + internd = Z_IMAGICKDRAW_P(getThis());; + status = DrawPopPattern(internd->drawing_wand); + + if (status == MagickFalse) { + php_imagick_convert_imagickdraw_exception (internd->drawing_wand, "Unable to terminate the pattern definition" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::pushClipPath(string clip_mask_id) + Starts a clip path definition which is comprized of any number of drawing commands and terminated by a DrawPopClipPath() command. +*/ +PHP_METHOD(imagickdraw, pushclippath) +{ + php_imagickdraw_object *internd; + char *clip_mask; + IM_LEN_TYPE clip_mask_len; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &clip_mask, &clip_mask_len) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawPushClipPath(internd->drawing_wand, clip_mask); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::pushDefs() + Indicates that commands up to a terminating DrawPopDefs() command create named elements (e.g. clip-paths, textures, etc.) which may safely be processed earlier for the sake of efficiency. +*/ +PHP_METHOD(imagickdraw, pushdefs) +{ + php_imagickdraw_object *internd; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + DrawPushDefs(internd->drawing_wand); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::pushPattern(string pattern_id, float x, float y, float width, float height) + Indicates that subsequent commands up to a DrawPopPattern() command comprise the definition of a named pattern. The pattern space is assigned top left corner coordinates, a width and height, and becomes its own drawing space. Anything which can be drawn may be used in a pattern definition. Named patterns may be used as stroke or brush definitions. +*/ +PHP_METHOD(imagickdraw, pushpattern) +{ + php_imagickdraw_object *internd; + char *pattern_id; + IM_LEN_TYPE pattern_id_len; + double x, y, width, height; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sdddd", &pattern_id, &pattern_id_len, &x, &y, &width, &height) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawPushPattern(internd->drawing_wand, pattern_id, x, y, width, height); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::render() + Renders all preceding drawing commands. +*/ +PHP_METHOD(imagickdraw, render) +{ + php_imagickdraw_object *internd; + MagickBooleanType status; + char *old_locale; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + old_locale = php_imagick_set_locale (TSRMLS_C); + + status = DrawRender(internd->drawing_wand); + + php_imagick_restore_locale (old_locale); + + if (old_locale) + efree (old_locale); + + if (status == MagickFalse) { + php_imagick_convert_imagickdraw_exception (internd->drawing_wand, "Unable to render the drawing commands" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::rotate(float degrees) + Applies the specified rotation to the current coordinate space. +*/ +PHP_METHOD(imagickdraw, rotate) +{ + php_imagickdraw_object *internd; + double degrees; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", °rees) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawRotate(internd->drawing_wand, degrees); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::scale(float x, float y) + Adjusts the scaling factor to apply in the horizontal and vertical directions to the current coordinate space. +*/ +PHP_METHOD(imagickdraw, scale) +{ + php_imagickdraw_object *internd; + double x, y; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawScale(internd->drawing_wand, x, y); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setClipPath(string clip_mask) + Associates a named clipping path with the image. Only the areas drawn on by the clipping path will be modified as long as it remains in effect. +*/ +PHP_METHOD(imagickdraw, setclippath) +{ + php_imagickdraw_object *internd; + char *clip_mask; + IM_LEN_TYPE clip_mask_len; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &clip_mask, &clip_mask_len) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + status = DrawSetClipPath(internd->drawing_wand, clip_mask); + + if (status == MagickFalse) { + php_imagick_convert_imagickdraw_exception (internd->drawing_wand, "Unable to set clipping path" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setClipRule(int fill_rule) + Set the polygon fill rule to be used by the clipping path. +*/ +PHP_METHOD(imagickdraw, setcliprule) +{ + php_imagickdraw_object *internd; + im_long fill_rule; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &fill_rule) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawSetClipRule(internd->drawing_wand, fill_rule); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setClipUnits(int clip_units) + Sets the interpretation of clip path units. +*/ +PHP_METHOD(imagickdraw, setclipunits) +{ + php_imagickdraw_object *internd; + im_long units; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &units) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawSetClipUnits(internd->drawing_wand, units); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setFillOpacity(float fillOpacity) + Sets the opacity to use when drawing using the fill color or fill texture. Fully opaque is 1.0. +*/ +PHP_METHOD(imagickdraw, setfillopacity) +{ + php_imagickdraw_object *internd; + double fillOpacity; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &fillOpacity) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawSetFillOpacity(internd->drawing_wand, fillOpacity); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setFillPatternURL(string fill_url) + Sets the URL to use as a fill pattern for filling objects. Only local URLs ("#identifier") are supported at this time. + These local URLs are normally created by defining a named fill pattern with DrawPushPattern/DrawPopPattern. +*/ +PHP_METHOD(imagickdraw, setfillpatternurl) +{ + php_imagickdraw_object *internd; + char *url; + IM_LEN_TYPE url_len; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &url, &url_len) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + status = DrawSetFillPatternURL(internd->drawing_wand, url); + + if (status == MagickFalse) { + php_imagick_convert_imagickdraw_exception (internd->drawing_wand, "Unable to set fill pattern URL" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setFillRule(int fill_rule) + Sets the fill rule to use while drawing polygons. +*/ +PHP_METHOD(imagickdraw, setfillrule) +{ + php_imagickdraw_object *internd; + im_long fill_rule; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &fill_rule) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawSetFillRule(internd->drawing_wand, fill_rule); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setGravity(int gravity) + Sets the text placement gravity to use when annotating with text. +*/ +PHP_METHOD(imagickdraw, setgravity) +{ + php_imagickdraw_object *internd; + im_long gravity; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &gravity) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawSetGravity(internd->drawing_wand, gravity); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setStrokePatternURL(string stroke_url) + Sets the pattern used for stroking object outlines. +*/ +PHP_METHOD(imagickdraw, setstrokepatternurl) +{ + php_imagickdraw_object *internd; + char *url; + IM_LEN_TYPE url_len; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &url, &url_len) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + status = DrawSetStrokePatternURL(internd->drawing_wand, url); + + if (status == MagickFalse) { + php_imagick_convert_imagickdraw_exception (internd->drawing_wand, "Unable to set stroke pattern URL" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setStrokeDashOffset(float dash_offset) + Specifies the offset into the dash pattern to start the dash. +*/ +PHP_METHOD(imagickdraw, setstrokedashoffset) +{ + php_imagickdraw_object *internd; + double offset; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &offset) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawSetStrokeDashOffset(internd->drawing_wand, offset); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setStrokeLineCap(int linecap) + Specifies the shape to be used at the end of open subpaths when they are stroked. Values of LineCap are UndefinedCap, ButtCap, RoundCap, and SquareCap. +*/ +PHP_METHOD(imagickdraw, setstrokelinecap) +{ + php_imagickdraw_object *internd; + im_long line_cap; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &line_cap) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawSetStrokeLineCap(internd->drawing_wand, line_cap); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setStrokeLineJoin(int linejoin) + Specifies the shape to be used at the corners of paths (or other vector shapes) when they are stroked. Values of LineJoin are UndefinedJoin, MiterJoin, RoundJoin, and BevelJoin. +*/ +PHP_METHOD(imagickdraw, setstrokelinejoin) +{ + php_imagickdraw_object *internd; + im_long line_join; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &line_join) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawSetStrokeLineJoin(internd->drawing_wand, line_join); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setStrokeMiterLimit(int miterlimit) + Specifies the miter limit. When two line segments meet at a sharp angle and miter joins have been specified for 'lineJoin', it is possible for the miter to extend far beyond the thickness of the line stroking the path. The miterLimit' imposes a limit on the ratio of the miter length to the 'lineWidth'. +*/ +PHP_METHOD(imagickdraw, setstrokemiterlimit) +{ + php_imagickdraw_object *internd; + im_long miter_limit; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &miter_limit) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawSetStrokeMiterLimit(internd->drawing_wand, miter_limit); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setStrokeOpacity(float stroke_opacity) + Specifies the opacity of stroked object outlines. +*/ +PHP_METHOD(imagickdraw, setstrokeopacity) +{ + php_imagickdraw_object *internd; + double opacity; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &opacity) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawSetStrokeOpacity(internd->drawing_wand, opacity); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setVectorGraphics(string xml) + Sets the vector graphics associated with the specified wand. Use this method with DrawGetVectorGraphics() as a method to persist the vector graphics state. +*/ +PHP_METHOD(imagickdraw, setvectorgraphics) +{ + php_imagickdraw_object *internd; + char *vector; + IM_LEN_TYPE vector_len; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &vector, &vector_len) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + status = DrawSetVectorGraphics(internd->drawing_wand, vector); + + if (status == MagickFalse) { + php_imagick_convert_imagickdraw_exception (internd->drawing_wand, "Unable to set the vector graphics" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::pop() + Destroys the current DrawingWand in the stack, and returns to the previously pushed DrawingWand. Multiple DrawingWands may exist. It is an error to attempt to pop more DrawingWands than have been pushed, and it is proper form to pop all DrawingWands which have been pushed. +*/ +PHP_METHOD(imagickdraw, pop) +{ + php_imagickdraw_object *internd; + MagickBooleanType status; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + status = PopDrawingWand(internd->drawing_wand); + + if (status == MagickFalse) { + php_imagick_convert_imagickdraw_exception (internd->drawing_wand, "Unable to pop the current ImagickDraw object" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::push() + Clones the current DrawingWand to create a new DrawingWand, which is then added to the DrawingWand stack. The original drawing DrawingWand(s) may be returned to by invoking PopDrawingWand(). The DrawingWands are stored on a DrawingWand stack. For every Pop there must have already been an equivalent Push. +*/ +PHP_METHOD(imagickdraw, push) +{ + php_imagickdraw_object *internd; + MagickBooleanType status; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + status = PushDrawingWand(internd->drawing_wand); + + if (status == MagickFalse) { + php_imagick_convert_imagickdraw_exception (internd->drawing_wand, "Unable to push the current ImagickDraw object" TSRMLS_CC); + return; + } + RETURN_TRUE; +} +/* }}} */ + +#if MagickLibVersion >= 0x693 +/* {{{ proto float ImagickDraw::getOpacity() + Returns the opacity used when drawing with the fill or stroke color or texture. Fully opaque is 1.0. +*/ +PHP_METHOD(imagickdraw, getopacity) +{ + php_imagickdraw_object *internd; + double opacity; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + opacity = DrawGetOpacity(internd->drawing_wand); + + RETURN_DOUBLE(opacity); +} +/* }}} */ + +/* {{{ proto bool ImagickDraw::setOpacity(float opacity) + Sets the opacity to use when drawing using the fill or stroke color or texture. Fully opaque is 1.0. +*/ +PHP_METHOD(imagickdraw, setopacity) +{ + php_imagickdraw_object *internd; + double opacity; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &opacity) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + DrawSetOpacity(internd->drawing_wand, opacity); + + RETURN_TRUE; +} +/* }}} */ +#endif //#if MagickLibVersion >= 0x693 + +#if MagickLibVersion >= 0x675 +/* {{{ proto array ImagickDraw::getFontResolution() + Gets the image X and Y resolution. +*/ +PHP_METHOD(imagickdraw, getfontresolution) +{ + php_imagickdraw_object *internd; + double x, y; + MagickBooleanType status; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + status = DrawGetFontResolution(internd->drawing_wand, &x, &y); + + if (status == MagickFalse) { + php_imagick_convert_imagickdraw_exception (internd->drawing_wand, "Unable to push the current ImagickDraw object" TSRMLS_CC); + return; + } + + array_init(return_value); + add_assoc_double(return_value, "x", x); + add_assoc_double(return_value, "y", y); + + return; +} +/* }}} */ +#endif //#if MagickLibVersion >= 0x675 + + +#if MagickLibVersion >= 0x675 +/* {{{ proto bool ImagickDraw::setFontResolution(float x, float y) + Sets the image font resolution. +*/ +PHP_METHOD(imagickdraw, setfontresolution) +{ + php_imagickdraw_object *internd; + double x, y; + + MagickBooleanType status; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + status = DrawSetFontResolution(internd->drawing_wand, x, y); + if (status == MagickFalse) { + php_imagick_convert_imagickdraw_exception (internd->drawing_wand, "Unable to push the current ImagickDraw object" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ +#endif //#if MagickLibVersion >= 0x675 + + +#if MagickLibVersion >= 0x675 +/* {{{ proto ImagickPixel ImagickDraw::getBorderColor() + Returns the border color used for drawing bordered objects. +*/ +PHP_METHOD(imagickdraw, getbordercolor) +{ + php_imagickpixel_object *internp; + php_imagickdraw_object *internd; + PixelWand *tmp_wand; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + tmp_wand = NewPixelWand(); + DrawGetBorderColor(internd->drawing_wand, tmp_wand); + + object_init_ex(return_value, php_imagickpixel_sc_entry); + internp = Z_IMAGICKPIXEL_P(return_value); + php_imagick_replace_pixelwand(internp, tmp_wand); + return; +} +/* }}} */ +#endif //#if MagickLibVersion >= 0x675 + + + +#if MagickLibVersion >= 0x675 +/* {{{ proto bool ImagickDraw::setBorderColor(ImagickPixel color) + Sets the border color to be used for drawing bordered objects. +*/ +PHP_METHOD(imagickdraw, setbordercolor) +{ + zval *param; + php_imagickdraw_object *internd; + PixelWand *color_wand; + zend_bool allocated; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶m) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis());; + + color_wand = php_imagick_zval_to_pixelwand(param, IMAGICKDRAW_CLASS, &allocated TSRMLS_CC); + if (!color_wand) + return; + + DrawSetBorderColor(internd->drawing_wand, color_wand); + if (allocated) + color_wand = DestroyPixelWand (color_wand); + + RETURN_TRUE; +} +/* }}} */ +#endif //#if MagickLibVersion >= 0x675 + +#if MagickLibVersion >= 0x692 +/* {{{ proto integer ImagickDraw::getTextDirection() + Returns the direction that will be used when annotating with text. +*/ +PHP_METHOD(imagickdraw, gettextdirection) +{ + php_imagickdraw_object *internd; + im_long direction; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + direction = DrawGetTextDirection(internd->drawing_wand); + + RETURN_LONG(direction); +} + +/* }}} */ + + +/* {{{ proto bool ImagickDraw::setTextDirection(int direction) + Sets the font style to use when annotating with text. The AnyStyle enumeration acts as a wild-card "don't care" option. +*/ +PHP_METHOD(imagickdraw, settextdirection) +{ + php_imagickdraw_object *internd; + im_long direction; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &direction) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + + DrawSetTextDirection(internd->drawing_wand, direction); + RETURN_TRUE; +} +/* }}} */ +#endif //#if MagickLibVersion >= 0x692 + +#if MagickLibVersion >= 0x692 +/* {{{ proto bool ImagickDraw::setDensity(string density_string) + Sets the vertical and horizontal resolution. +*/ +PHP_METHOD(imagickdraw, setdensity) +{ + php_imagickdraw_object *internd; + char *density; + IM_LEN_TYPE density_len; + MagickBooleanType status; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &density, &density_len) == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + status = DrawSetDensity(internd->drawing_wand, density); + + if (status == MagickFalse) { + php_imagick_convert_imagickdraw_exception (internd->drawing_wand, "Unable to setdensity for ImagickDraw object" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + + +/* {{{ proto string|null ImagickDraw::getDensity() + Obtains the vertical and horizontal resolution. +*/ +PHP_METHOD(imagickdraw, getdensity) +{ + php_imagickdraw_object *internd; + char *density; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internd = Z_IMAGICKDRAW_P(getThis()); + density = DrawGetDensity(internd->drawing_wand); + + if (density == NULL) { + RETURN_NULL(); + } + else { + IM_RETURN_STRING(density); + } +} +/* }}} */ +#endif// #if MagickLibVersion >= 0x692 + + +/* END OF DRAWINGWAND METHODS */ diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/imagick_file.c php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/imagick_file.c --- php-imagick-3.4.4/imagick-3.4.4+php8.0/imagick_file.c 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/imagick_file.c 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,360 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 / Imagick | + +----------------------------------------------------------------------+ + | Copyright (c) 2006-2013 Mikko Koppanen, Scott MacVicar | + | ImageMagick (c) ImageMagick Studio LLC | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Mikko Kopppanen | + | Scott MacVicar | + +----------------------------------------------------------------------+ +*/ + +#include "php_imagick.h" +#include "php_imagick_file.h" +#include "php_imagick_macros.h" +#include "php_imagick_defs.h" + +#if ZEND_MODULE_API_NO > 20060613 +# define IMAGICK_INIT_ERROR_HANDLING zend_error_handling error_handling +# define IMAGICK_SET_ERROR_HANDLING_THROW zend_replace_error_handling(EH_THROW, php_imagick_exception_class_entry, &error_handling TSRMLS_CC) +# define IMAGICK_RESTORE_ERROR_HANDLING zend_restore_error_handling(&error_handling TSRMLS_CC) +#else +# define IMAGICK_INIT_ERROR_HANDLING +# define IMAGICK_SET_ERROR_HANDLING_THROW php_set_error_handling(EH_THROW, php_imagick_exception_class_entry TSRMLS_CC) +# define IMAGICK_RESTORE_ERROR_HANDLING php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC) +#endif + +#ifndef S_ISDIR +# define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR) +#endif + +static +zend_bool php_imagick_is_virtual_format(const char *format) +{ + int i, elements; + + const char *virtual_fmt[] = { + "CAPTION", + "CLIPBOARD", + "FRACTAL", + "GRADIENT", + "LABEL", + "MATTE", + "NULL", + "PLASMA", + "PRINT", + "SCAN", + "RADIAL-GRADIENT", + "SCANX", + "WIN", +#ifndef PHP_WIN32 + "X", +#endif + "XC", + "MAGICK", + "GRANITE", + "LOGO", + "NETSCAPE", + "ROSE" + }; + + elements = sizeof (virtual_fmt) / sizeof (virtual_fmt [0]); + + for (i = 0; i < elements; i++) { + if (strcasecmp(format, virtual_fmt[i]) == 0) { + return 1; + } + } + return 0; +} + +static +zend_bool php_imagick_is_url(const char *filename TSRMLS_DC) +{ + const char *path_for_open; + + if (php_stream_locate_url_wrapper(filename, &path_for_open, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC)) { + return 1; + } + return 0; +} + +zend_bool php_imagick_file_init(struct php_imagick_file_t *file, const char *filename, size_t filename_len TSRMLS_DC) +{ + char magick_path[MaxTextExtent], head_path[MaxTextExtent], tail_path[MaxTextExtent], buffer[MaxTextExtent]; + + if (!filename_len) { + return 0; + } + + /* Undefined for now */ + file->type = ImagickUndefinedType; + + if (filename_len >= MaxTextExtent) { + return 0; + } + + /* Take a copy of the original string */ + strlcpy(file->filename, filename, MaxTextExtent); + file->filename_len = filename_len; + + /* Break the path into pieces */ + memset(magick_path, 0, MaxTextExtent); + GetPathComponent(file->filename, MagickPath, magick_path); + + /* The path has a format identifier, check for url and virtual format */ + if (strlen(magick_path) > 0) { + /* Virtual format? */ + if (php_imagick_is_virtual_format(magick_path)) { + file->type = ImagickVirtualFormat; + file->absolute_path = estrdup(""); + return 1; + } + /* Is it an url? */ + else if (php_imagick_is_url(filename TSRMLS_CC)) { + file->type = ImagickUri; + file->absolute_path = estrdup(""); + return 1; + } + } + + /* This is a normal file path */ + file->type = ImagickFile; + + memset(head_path, 0, MaxTextExtent); + memset(tail_path, 0, MaxTextExtent); + + GetPathComponent(file->filename, HeadPath, head_path); + GetPathComponent(file->filename, TailPath, tail_path); + + (void) snprintf(buffer, MaxTextExtent, "%s/%s", head_path, tail_path); + + /* The full path to the file */ + file->absolute_path = expand_filepath(buffer, NULL TSRMLS_CC); + + /* Failed to resolve absolute path */ + if (!file->absolute_path) { + file->absolute_path = estrdup(""); + } + return 1; +} + +void php_imagick_file_deinit(struct php_imagick_file_t *file) +{ + if (file->absolute_path) { + efree(file->absolute_path); + file->absolute_path = NULL; + } +} + +static +int php_imagick_read_image_using_imagemagick(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type TSRMLS_DC) +{ + +#ifndef ZEND_ENGINE_3 +#if PHP_VERSION_ID >= 50600 +#ifdef ZTS + // This suppresses an 'unused parameter' warning. + (void)tsrm_ls; +#endif +#endif +#endif + + if (type == ImagickReadImage) { + if (MagickReadImage(intern->magick_wand, file->filename) == MagickFalse) { + +#ifdef ZEND_ENGINE_3 + zend_stat_t st; +#else + struct stat st; +#endif + + /* Resolved to a filename. Check that it's not a dir */ + if (php_sys_stat(file->absolute_path, &st) == 0 && S_ISDIR(st.st_mode)) { + return IMAGICK_RW_PATH_IS_DIR; + } + return IMAGICK_RW_UNDERLYING_LIBRARY; + } + } else if (type == ImagickPingImage){ + if (MagickPingImage(intern->magick_wand, file->filename) == MagickFalse) { + return IMAGICK_RW_UNDERLYING_LIBRARY; + } + } else { + return IMAGICK_RW_UNDERLYING_LIBRARY; + } + + MagickSetImageFilename(intern->magick_wand, file->absolute_path); + MagickSetLastIterator(intern->magick_wand); + return IMAGICK_RW_OK; +} + +static +int php_imagick_read_image_using_php_streams(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type TSRMLS_DC) +{ + php_stream *stream; + MagickBooleanType status; + FILE *fp; + IMAGICK_INIT_ERROR_HANDLING; + IMAGICK_SET_ERROR_HANDLING_THROW; + +#ifdef ZEND_ENGINE_3 + stream = php_stream_open_wrapper(file->filename, "rb", (IGNORE_PATH) & ~REPORT_ERRORS, NULL); +#else + stream = php_stream_open_wrapper(file->filename, "rb", (ENFORCE_SAFE_MODE|IGNORE_PATH) & ~REPORT_ERRORS, NULL); +#endif + + if (!stream) { + IMAGICK_RESTORE_ERROR_HANDLING; + return IMAGICK_RW_UNDERLYING_LIBRARY; + } + + if (php_stream_can_cast(stream, PHP_STREAM_AS_STDIO|PHP_STREAM_CAST_INTERNAL) == FAILURE || + php_stream_cast(stream, PHP_STREAM_AS_STDIO|PHP_STREAM_CAST_INTERNAL, (void*)&fp, 0) == FAILURE) { + + php_stream_close(stream); + IMAGICK_RESTORE_ERROR_HANDLING; + return IMAGICK_RW_UNDERLYING_LIBRARY; + } + + IMAGICK_RESTORE_ERROR_HANDLING; + + if (type == ImagickReadImage) { + status = MagickReadImageFile(intern->magick_wand, fp); + } else if (type == ImagickPingImage){ + status = MagickPingImageFile(intern->magick_wand, fp); + } else { + php_stream_close(stream); + return IMAGICK_RW_UNDERLYING_LIBRARY; + } + + if (status == MagickFalse) { + php_stream_close(stream); + return IMAGICK_RW_UNDERLYING_LIBRARY; + } + + MagickSetImageFilename(intern->magick_wand, file->absolute_path); + php_stream_close(stream); + + if (status == MagickFalse) { + return IMAGICK_RW_UNDERLYING_LIBRARY; + } + + MagickSetLastIterator(intern->magick_wand); + return IMAGICK_RW_OK; +} + +int php_imagick_safe_mode_check(const char *filename TSRMLS_DC) +{ +#if defined(CHECKUID_CHECK_FILE_AND_DIR) + if (PG(safe_mode) && (!php_checkuid_ex(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR, CHECKUID_NO_ERRORS))) { + return IMAGICK_RW_SAFE_MODE_ERROR; + } +#endif + if (PG(open_basedir) && php_check_open_basedir_ex(filename, 0 TSRMLS_CC)) { + return IMAGICK_RW_OPEN_BASEDIR_ERROR; + } + + return IMAGICK_RW_OK; +} + +php_imagick_rw_result_t php_imagick_read_file(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type TSRMLS_DC) +{ + php_imagick_rw_result_t rc; + + if (file->type == ImagickFile) { + rc = php_imagick_safe_mode_check(file->absolute_path TSRMLS_CC); + + if (rc != IMAGICK_RW_OK) { + return rc; + } + } + + if (file->type == ImagickUri) { + return php_imagick_read_image_using_php_streams(intern, file, type TSRMLS_CC); + } else { + return php_imagick_read_image_using_imagemagick(intern, file, type TSRMLS_CC); + } +} + +php_imagick_rw_result_t php_imagick_write_file(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type, zend_bool adjoin TSRMLS_DC) +{ + php_imagick_rw_result_t rc; + MagickBooleanType status = MagickFalse; + + if (file->type == ImagickFile) { + rc = php_imagick_safe_mode_check(file->absolute_path TSRMLS_CC); + if (rc != IMAGICK_RW_OK) { + return rc; + } + } + if (type == ImagickWriteImage) { + status = MagickWriteImage(intern->magick_wand, file->filename); + } else if (type == ImagickWriteImages) { + status = MagickWriteImages(intern->magick_wand, file->filename, adjoin); + } + + /* Write succeded ? */ + if (status == MagickFalse) { + return IMAGICK_RW_UNDERLYING_LIBRARY; + } + /* All went well it seems */ + return IMAGICK_RW_OK; +} + +zend_bool php_imagick_stream_handler(php_imagick_object *intern, php_stream *stream, ImagickOperationType type TSRMLS_DC) +{ + FILE *fp; + MagickBooleanType status = MagickFalse; + + IMAGICK_INIT_ERROR_HANDLING; + IMAGICK_SET_ERROR_HANDLING_THROW; + + if (php_stream_can_cast(stream, PHP_STREAM_AS_STDIO | PHP_STREAM_CAST_INTERNAL) == FAILURE || + php_stream_cast(stream, PHP_STREAM_AS_STDIO | PHP_STREAM_CAST_INTERNAL, (void*)&fp, 0) == FAILURE) { + IMAGICK_RESTORE_ERROR_HANDLING; + return 0; + } + + IMAGICK_RESTORE_ERROR_HANDLING; + + /* php_stream_cast returns warning on some streams but still does not return FAILURE */ + if (EG(exception)) { + return 0; + } + + switch (type) { + case ImagickWriteImageFile: + status = MagickWriteImageFile(intern->magick_wand, fp); + break; + + case ImagickWriteImagesFile: + status = MagickWriteImagesFile(intern->magick_wand, fp); + break; + + case ImagickReadImageFile: + status = MagickReadImageFile(intern->magick_wand, fp); + break; + + case ImagickPingImageFile: + status = MagickPingImageFile(intern->magick_wand, fp); + break; + + default: + return 0; + break; + } + if (status == MagickFalse) { + return 0; + } + return 1; +} + diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/imagick_helpers.c php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/imagick_helpers.c --- php-imagick-3.4.4/imagick-3.4.4+php8.0/imagick_helpers.c 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/imagick_helpers.c 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,1906 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 / Imagick | + +----------------------------------------------------------------------+ + | Copyright (c) 2006-2013 Mikko Koppanen, Scott MacVicar | + | ImageMagick (c) ImageMagick Studio LLC | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Mikko Kopppanen | + | Scott MacVicar | + +----------------------------------------------------------------------+ +*/ + +#include "php_imagick.h" +#include "php_imagick_defs.h" +#include "php_imagick_macros.h" +#include "php_imagick_helpers.h" + +MagickBooleanType php_imagick_progress_monitor(const char *text, const MagickOffsetType offset, const MagickSizeType span, void *client_data) +{ + FILE *fp; + php_imagick_object *intern = (php_imagick_object *)client_data; + + if (!intern) { + return MagickFalse; + } + + if (!intern->progress_monitor_name) { + return MagickFalse; + } + + fp = fopen(intern->progress_monitor_name, "a+"); + + if (!fp) { + return MagickFalse; + } + + fprintf(fp, "text: %s, offset: %lld, span: %lld\n", text, offset, span); + fclose(fp); + return MagickTrue; +} + +void php_imagick_cleanup_progress_callback(php_imagick_callback* progress_callback TSRMLS_DC) { + + if (progress_callback) { + if (progress_callback->previous_callback) { + php_imagick_cleanup_progress_callback(progress_callback->previous_callback TSRMLS_CC); + efree(progress_callback->previous_callback); + } + +#ifdef ZEND_ENGINE_3 + zval_ptr_dtor(&progress_callback->user_callback); +#else + zval_ptr_dtor(&progress_callback->user_callback); +#endif + } +} + +MagickBooleanType php_imagick_progress_monitor_callable(const char *text, const MagickOffsetType offset, const MagickSizeType span, void *userData) +{ + int error; + zend_fcall_info fci; + zend_fcall_info_cache fci_cache; + +#ifdef ZEND_ENGINE_3 + zval zargs[2]; + zval retval; +#else + zval **zargs[2]; + zval *retval_ptr; +#endif + + //We can get the data both via the passed param and via + //IMAGICK_G(progress_callback) - this should be quicker + php_imagick_callback *callback = (php_imagick_callback*)userData; + + // This suppresses an 'unused parameter' warning. + // We could maybe use text. + (void)text; + +#if defined(ZEND_ENGINE_3) && defined(ZTS) + if( NULL == tsrm_get_ls_cache() ) { + return MagickTrue; + } +#endif + +#ifndef ZEND_ENGINE_3 + TSRMLS_FETCH_FROM_CTX(callback->thread_ctx); +#endif + fci_cache = empty_fcall_info_cache; + + fci.size = sizeof(fci); +#if PHP_VERSION_ID < 70100 + fci.function_table = EG(function_table); +#endif +#ifdef ZEND_ENGINE_3 + fci.object = NULL; + //fci.function_name = *callback->user_callback; + ZVAL_COPY_VALUE(&fci.function_name, &callback->user_callback); + fci.retval = &retval; +#else + retval_ptr = NULL; + fci.object_ptr = NULL; + fci.function_name = callback->user_callback; + fci.retval_ptr_ptr = &retval_ptr; +#endif + fci.param_count = 2; + fci.params = zargs; + fci.no_separation = 0; +#if PHP_VERSION_ID < 70100 + fci.symbol_table = NULL; +#endif + +#ifdef ZEND_ENGINE_3 + ZVAL_LONG(&zargs[0], offset); + ZVAL_LONG(&zargs[1], span); +#else + zargs[0] = emalloc(sizeof(zval *)); + MAKE_STD_ZVAL(*zargs[0]); + ZVAL_LONG(*zargs[0], offset); + + zargs[1] = emalloc(sizeof(zval *)); + MAKE_STD_ZVAL(*zargs[1]); + ZVAL_LONG(*zargs[1], span); +#endif + + error = zend_call_function(&fci, &fci_cache TSRMLS_CC); + + if (error == FAILURE) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "An error occurred while invoking the callback"); + //Abort processing as user callback is no longer callable + return MagickFalse; + } +#ifdef ZEND_ENGINE_3 + if (Z_TYPE(retval) == IS_FALSE) { + //User returned false - tell Imagick to abort processing. + return MagickFalse; + } +#else + zval_ptr_dtor(zargs[0]); + zval_ptr_dtor(zargs[1]); + + if (retval_ptr) { + if (Z_TYPE_P(retval_ptr) == IS_BOOL) { + if (Z_LVAL_P(retval_ptr) == 0) { + //User returned false - tell Imagick to abort processing. + return MagickFalse; + } + } + } +#endif + + return MagickTrue; +} + +/* This is not universally safe to use, but is safe enough for values that will + be encountered for image dimensions. +*/ +static inline double im_round_helper(double value) { + if (value >= 0.0) { + // Prevent zero width/height images + if (value < 1) { + return 1; + } + return floor(value + 0.5); + } else { + return ceil(value - 0.5); + } +} + + +zend_bool php_imagick_thumbnail_dimensions(MagickWand *magick_wand, zend_bool bestfit, im_long desired_width, im_long desired_height, im_long *new_width, im_long *new_height, zend_bool legacy) +{ + im_long orig_width, orig_height; + + orig_width = MagickGetImageWidth(magick_wand); + orig_height = MagickGetImageHeight(magick_wand); + + if ((orig_width == desired_width) && (orig_height == desired_height)) { + *new_width = desired_width; + *new_height = desired_height; + return 1; + } + + if (bestfit) { + double ratio_x, ratio_y; + + if (desired_width <= 0 || desired_height <= 0) { + return 0; + } + + ratio_x = (double) desired_width / (double) orig_width; + ratio_y = (double) desired_height / (double) orig_height; + + //in the case of square images there should be no rounding error + if (ratio_x == ratio_y) { + *new_width = desired_width; + *new_height = desired_height; + } else if (ratio_x < ratio_y) { + *new_width = desired_width; + if (legacy) { + *new_height = ratio_x * ((double) orig_height); + } + else { + *new_height = im_round_helper(ratio_x * ((double) orig_height)); + } + } else { + *new_height = desired_height; + if (legacy) { + *new_width = ratio_y * ((double) orig_width); + } + else { + *new_width = im_round_helper(ratio_y * ((double) orig_width)); + } + } + *new_width = (*new_width < 1) ? 1 : *new_width; + *new_height = (*new_height < 1) ? 1 : *new_height; + + } else { + double ratio; + + if (desired_width <= 0 && desired_height <= 0) { + return 0; + } + + if (desired_width <= 0 || desired_height <= 0) { + if (desired_width <= 0) { + ratio = (double) orig_height / (double) desired_height; + if (legacy) { + *new_width = ((double) orig_width) / ratio; + } + else { + *new_width = im_round_helper(((double) orig_width) / ratio); + } + *new_height = desired_height; + } else { + ratio = (double) orig_width / (double) desired_width; + if (legacy) { + *new_height = ((double) orig_height) / ratio; + } + else { + *new_height = im_round_helper(((double) orig_height) / ratio); + } + *new_width = desired_width; + } + } else { + *new_width = desired_width; + *new_height = desired_height; + } + } + return 1; +} + +zend_bool php_imagick_validate_map(const char *map TSRMLS_DC) +{ + zend_bool match; + const char *p = map; + char allow_map[] = { 'R', 'G', 'B', + 'A', 'O', 'C', + 'Y', 'M', 'K', + 'I', 'P' }; + + while (*p != '\0') { + char *it = allow_map; + match = 0; + while(*it != '\0') { + if (*(it++) == *p) { + match = 1; + break; + } + } + if (!match) { + return 0; + } + p++; + } + return 1; +} + +double *php_imagick_zval_to_double_array(zval *param_array, im_long *num_elements TSRMLS_DC) +{ + double *double_array; + long i = 0; + +#ifdef ZEND_ENGINE_3 + zval *pzvalue; +#else + zval **ppzval; +#endif + + *num_elements = zend_hash_num_elements(Z_ARRVAL_P(param_array)); + + if (*num_elements == 0) { + return NULL; + } + + double_array = ecalloc(*num_elements, sizeof(double)); + +#ifdef ZEND_ENGINE_3 + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(param_array), pzvalue) { + ZVAL_DEREF(pzvalue); + double_array[i] = zval_get_double(pzvalue); + i++; + } ZEND_HASH_FOREACH_END(); +#else + for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(param_array)); + zend_hash_get_current_data(Z_ARRVAL_P(param_array), (void **) &ppzval) == SUCCESS; + zend_hash_move_forward(Z_ARRVAL_P(param_array)), i++) + { + zval tmp_zval, *tmp_pzval; + double value = 0.0; + + if (Z_TYPE_PP(ppzval) == IS_DOUBLE) { + value = Z_DVAL_PP(ppzval); + } + else { + tmp_zval = **ppzval; + zval_copy_ctor(&tmp_zval); + tmp_pzval = &tmp_zval; + convert_to_double(tmp_pzval); + + value = Z_DVAL_P(tmp_pzval); + zval_dtor (tmp_pzval); + } + double_array[i] = value; + } +#endif + return double_array; +} + +im_long *php_imagick_zval_to_long_array(zval *param_array, im_long *num_elements TSRMLS_DC) +{ + im_long *long_array; + im_long i = 0; + +#ifdef ZEND_ENGINE_3 + zval *pzvalue; +#else + zval **ppzval; +#endif + + *num_elements = zend_hash_num_elements(Z_ARRVAL_P(param_array)); + + if (*num_elements == 0) { + return NULL; + } + + long_array = ecalloc(*num_elements, sizeof(im_long)); + +#ifdef ZEND_ENGINE_3 + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(param_array), pzvalue) { + ZVAL_DEREF(pzvalue); + long_array[i] = zval_get_long(pzvalue); + i++; + } ZEND_HASH_FOREACH_END(); +#else + for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(param_array)); + zend_hash_get_current_data(Z_ARRVAL_P(param_array), (void **) &ppzval) == SUCCESS; + zend_hash_move_forward(Z_ARRVAL_P(param_array)), i++) + { + zval tmp_zval, *tmp_pzval; + im_long value = 0; + + if (Z_TYPE_PP(ppzval) == IS_DOUBLE) { + value = Z_LVAL_PP(ppzval); + } + else { + tmp_zval = **ppzval; + zval_copy_ctor(&tmp_zval); + tmp_pzval = &tmp_zval; + convert_to_long(tmp_pzval); + + value = Z_LVAL_P(tmp_pzval); + zval_dtor (tmp_pzval); + } + long_array[i] = value; + } +#endif + + return long_array; +} + +unsigned char *php_imagick_zval_to_char_array(zval *param_array, im_long *num_elements TSRMLS_DC) +{ + unsigned char *char_array; + im_long i = 0; + +#ifdef ZEND_ENGINE_3 + zval *pzvalue; +#else + zval **ppzval; +#endif + + *num_elements = zend_hash_num_elements(Z_ARRVAL_P(param_array)); + + if (*num_elements == 0) { + return NULL; + } + + char_array = ecalloc(*num_elements, sizeof(unsigned char)); + +#ifdef ZEND_ENGINE_3 + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(param_array), pzvalue) { + ZVAL_DEREF(pzvalue); + char_array[i] = zval_get_long(pzvalue); + i++; + } ZEND_HASH_FOREACH_END(); +#else + for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(param_array)); + zend_hash_get_current_data(Z_ARRVAL_P(param_array), (void **) &ppzval) == SUCCESS; + zend_hash_move_forward(Z_ARRVAL_P(param_array)), i++) + { + zval tmp_zval, *tmp_pzval; + im_long value = 0; + if (Z_TYPE_PP(ppzval) == IS_DOUBLE) { + value = Z_LVAL_PP(ppzval); + } + else { + tmp_zval = **ppzval; + zval_copy_ctor(&tmp_zval); + tmp_pzval = &tmp_zval; + convert_to_long(tmp_pzval); + + value = Z_LVAL_P(tmp_pzval); + zval_dtor (tmp_pzval); + } + char_array[i] = value; + } +#endif + + return char_array; +} + +zend_bool php_imagick_check_font(char *font, int font_len TSRMLS_DC) +{ + zend_bool retval = 0; + char **fonts; + unsigned long i = 0; + size_t num_fonts = 0; + + /* Check that user is only able to set a proper font */ + fonts = MagickQueryFonts("*", &num_fonts); + + for(i = 0 ; i < num_fonts ; i++) { + /* Let's see if the font is among configured fonts */ + if (strncasecmp(fonts[i], font, font_len) == 0) { + retval = 1; + break; + } + } + + IMAGICK_FREE_MAGICK_MEMORY(fonts); + return retval; +} + +php_imagick_rw_result_t php_imagick_file_access_check (const char *filename TSRMLS_DC) +{ + if (strlen(filename) >= MAXPATHLEN) + return IMAGICK_RW_FILENAME_TOO_LONG; + +#if defined(CHECKUID_CHECK_FILE_AND_DIR) + if (PG(safe_mode) && (!php_checkuid_ex(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR, CHECKUID_NO_ERRORS))) + return IMAGICK_RW_SAFE_MODE_ERROR; +#endif + + if (php_check_open_basedir_ex(filename, 0 TSRMLS_CC)) + return IMAGICK_RW_OPEN_BASEDIR_ERROR; + + if (VCWD_ACCESS(filename, F_OK) != 0) + return IMAGICK_RW_PATH_DOES_NOT_EXIST; + + if (VCWD_ACCESS(filename, R_OK) != 0) + return IMAGICK_RW_PERMISSION_DENIED; + + return IMAGICK_RW_OK; +} + +static +void s_rw_fail_to_exception (php_imagick_rw_result_t rc, const char *filename TSRMLS_DC) +{ + switch (rc) { + + case IMAGICK_RW_SAFE_MODE_ERROR: + zend_throw_exception_ex(php_imagick_exception_class_entry, 1 TSRMLS_CC, "Safe mode restricts user to read the file: %s", filename); + break; + + case IMAGICK_RW_OPEN_BASEDIR_ERROR: + zend_throw_exception_ex(php_imagick_exception_class_entry, 1 TSRMLS_CC, "open_basedir restriction in effect. File(%s) is not within the allowed path(s)", filename); + break; + + case IMAGICK_RW_PERMISSION_DENIED: + zend_throw_exception_ex(php_imagick_exception_class_entry, 1 TSRMLS_CC, "Permission denied to: %s", filename); + break; + + case IMAGICK_RW_FILENAME_TOO_LONG: + zend_throw_exception_ex(php_imagick_exception_class_entry, 1 TSRMLS_CC, "Filename too long: %s", filename); + break; + + case IMAGICK_RW_PATH_DOES_NOT_EXIST: + zend_throw_exception_ex(php_imagick_exception_class_entry, 1 TSRMLS_CC, "The path does not exist: %s", filename); + break; + + case IMAGICK_RW_PATH_IS_DIR: + zend_throw_exception_ex(php_imagick_exception_class_entry, 1 TSRMLS_CC, "The path is a directory: %s", filename); + break; + + default: + zend_throw_exception_ex(php_imagick_exception_class_entry, 1 TSRMLS_CC, "Unknown error"); + break; + } +} + +void php_imagick_rw_fail_to_exception (MagickWand *magick_wand, php_imagick_rw_result_t rc, const char *filename TSRMLS_DC) +{ + if (rc == IMAGICK_RW_UNDERLYING_LIBRARY) { + php_imagick_convert_imagick_exception (magick_wand, "Failed to read the file" TSRMLS_CC); + return; + } + s_rw_fail_to_exception (rc, filename TSRMLS_CC); +} + +void php_imagick_imagickdraw_rw_fail_to_exception (DrawingWand *drawing_wand, php_imagick_rw_result_t rc, const char *filename TSRMLS_DC) +{ + if (rc == IMAGICK_RW_UNDERLYING_LIBRARY) { + php_imagick_convert_imagickdraw_exception (drawing_wand, "Failed to read the file" TSRMLS_CC); + return; + } + s_rw_fail_to_exception (rc, filename TSRMLS_CC); +} + + +PointInfo *php_imagick_zval_to_pointinfo_array(zval *coordinate_array, int *num_elements TSRMLS_DC) +{ + PointInfo *coordinates; + long elements, sub_elements, i; + HashTable *sub_array; + +#ifdef ZEND_ENGINE_3 + zval *pzvalue; +#else + HashTable *coords; + zval **ppzval; +#endif + + i = 0; + + elements = zend_hash_num_elements(Z_ARRVAL_P(coordinate_array)); + + if (elements < 1) { + coordinates = (PointInfo *)NULL; + *num_elements = 0; + return coordinates; + } + + *num_elements = elements; + coordinates = emalloc(sizeof(PointInfo) * elements); + +#ifdef ZEND_ENGINE_3 + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(coordinate_array), pzvalue) { + zval *pz_x, *pz_y; + ZVAL_DEREF(pzvalue); + + /* If its something than array lets error here */ + if(Z_TYPE_P(pzvalue) != IS_ARRAY) { + efree(coordinates); + *num_elements = 0; + return NULL; + } + + /* Subarray should have two elements. X and Y */ + sub_elements = zend_hash_num_elements(Z_ARRVAL_P(pzvalue)); + + /* Exactly two elements */ + if (sub_elements != 2) { + efree(coordinates); + *num_elements = 0; + return NULL; + } + + /* Subarray values */ + sub_array = Z_ARRVAL_P(pzvalue); + + /* Get X */ + if ((pz_x = zend_hash_str_find(sub_array, "x", sizeof("x")-1)) == NULL) { + efree(coordinates); + *num_elements = 0; + return NULL; + } + + /* Get Y */ + if ((pz_y = zend_hash_str_find(sub_array, "y", sizeof("y")-1)) == NULL) { + efree(coordinates); + *num_elements = 0; + return NULL; + } + + /* Assign X and Y */ + coordinates[i].x = zval_get_double(pz_x); + coordinates[i].y = zval_get_double(pz_y); + i++; + } ZEND_HASH_FOREACH_END(); + +#else + coords = Z_ARRVAL_P(coordinate_array); + zend_hash_internal_pointer_reset_ex(coords, (HashPosition *) 0); + + for (i = 0, zend_hash_internal_pointer_reset(coords); + zend_hash_get_current_data(coords, (void **) &ppzval) == SUCCESS; + zend_hash_move_forward(coords), i++ + ) { + zval **ppz_x, **ppz_y; + zval tmp_zx, *tmp_pzx, tmp_zy, *tmp_pzy; + + /* If its something than array lets error here */ + if(Z_TYPE_PP(ppzval) != IS_ARRAY) { + efree(coordinates); + *num_elements = 0; + return NULL; + } + + /* Subarray should have two elements. X and Y */ + sub_elements = zend_hash_num_elements(Z_ARRVAL_PP(ppzval)); + + /* Exactly two elements */ + if (sub_elements != 2) { + efree(coordinates); + *num_elements = 0; + return NULL; + } + + /* Subarray values */ + sub_array = Z_ARRVAL_PP(ppzval); + + /* Get X */ + if (zend_hash_find(sub_array, "x", sizeof("x"), (void**)&ppz_x) == FAILURE) { + efree(coordinates); + *num_elements = 0; + return NULL; + } + + tmp_zx = **ppz_x; + zval_copy_ctor(&tmp_zx); + tmp_pzx = &tmp_zx; + convert_to_double(tmp_pzx); + + /* Get Y */ + if (zend_hash_find(sub_array, "y", sizeof("y"), (void**)&ppz_y) == FAILURE) { + efree(coordinates); + *num_elements = 0; + return NULL; + } + + tmp_zy = **ppz_y; + zval_copy_ctor(&tmp_zy); + tmp_pzy = &tmp_zy; + convert_to_double(tmp_pzy); + + /* Assign X and Y */ + coordinates[i].x = Z_DVAL(tmp_zx); + coordinates[i].y = Z_DVAL(tmp_zy); + } +#endif + + return coordinates; +} + +void php_imagick_throw_exception (php_imagick_class_type_t type, const char *description TSRMLS_DC) +{ + int code; + zend_class_entry *ce = NULL; + + switch (type) { + case IMAGICK_CLASS: + default: + ce = php_imagick_exception_class_entry; + code = 1; + break; + + case IMAGICKDRAW_CLASS: + ce = php_imagickdraw_exception_class_entry; + code = 2; + break; + + case IMAGICKPIXELITERATOR_CLASS: + ce = php_imagickpixeliterator_exception_class_entry; + code = 3; + break; + + case IMAGICKPIXEL_CLASS: + ce = php_imagickpixel_exception_class_entry; + code = 4; + break; +#ifdef IMAGICK_WITH_KERNEL + case IMAGICKKERNEL_CLASS: + ce = php_imagickkernel_exception_class_entry; + code = 5; + break; +#endif + } + zend_throw_exception(ce, description, code TSRMLS_CC); +} + +static +void s_convert_exception (char *description, const char *default_message, long severity, int code TSRMLS_DC) +{ + // No description provided or empty one + if (!description || (strlen (description) == 0)) { + if (description) { + description = MagickRelinquishMemory (description); + } + zend_throw_exception(php_imagick_exception_class_entry, default_message, code TSRMLS_CC); + return; + } + zend_throw_exception(php_imagick_exception_class_entry, description, severity TSRMLS_CC); + MagickRelinquishMemory (description); +} + +/** + Convert ImageMagick MagickWand exception to PHP exception +*/ +void php_imagick_convert_imagick_exception (MagickWand *magick_wand, const char *default_message TSRMLS_DC) +{ + ExceptionType severity; + char *description; + + description = MagickGetException(magick_wand, &severity); + MagickClearException (magick_wand); + + s_convert_exception (description, default_message, severity, 1 TSRMLS_CC); +} + +void php_imagick_convert_imagickdraw_exception (DrawingWand *drawing_wand, const char *default_message TSRMLS_DC) +{ + ExceptionType severity; + char *description; + + description = DrawGetException(drawing_wand, &severity); + DrawClearException (drawing_wand); + + s_convert_exception (description, default_message, severity, 2 TSRMLS_CC); +} + +void php_imagick_convert_imagickpixeliterator_exception (PixelIterator *pixel_iterator, const char *default_message TSRMLS_DC) +{ + ExceptionType severity; + char *description; + + description = PixelGetIteratorException(pixel_iterator, &severity); + PixelClearIteratorException (pixel_iterator); + + s_convert_exception (description, default_message, severity, 3 TSRMLS_CC); +} + +void php_imagick_convert_imagickpixel_exception (PixelWand *pixel_wand, const char *default_message TSRMLS_DC) +{ + ExceptionType severity; + char *description; + + description = PixelGetException(pixel_wand, &severity); + PixelClearException (pixel_wand); + + s_convert_exception (description, default_message, severity, 4 TSRMLS_CC); +} + +PixelWand *php_imagick_zval_to_pixelwand (zval *param, php_imagick_class_type_t caller, zend_bool *allocated TSRMLS_DC) +{ + PixelWand *pixel_wand = NULL; + *allocated = 0; + +#ifdef ZEND_ENGINE_3 + ZVAL_DEREF(param); +#endif + if (Z_TYPE_P (param) == IS_LONG || Z_TYPE_P (param) == IS_DOUBLE) { + zval var; + var = *param; + + zval_copy_ctor(&var); + convert_to_string(&var); + param = &var; + } + + switch (Z_TYPE_P(param)) { + case IS_STRING: + { + pixel_wand = NewPixelWand(); + if (!pixel_wand) { + zend_error(E_ERROR, "Failed to allocate PixelWand structure"); + } + *allocated = 1; + + if (PixelSetColor (pixel_wand, Z_STRVAL_P(param)) == MagickFalse) { + pixel_wand = DestroyPixelWand(pixel_wand); + php_imagick_throw_exception (caller, "Unrecognized color string" TSRMLS_CC); + return NULL; + } + } + break; + + case IS_OBJECT: + if (instanceof_function_ex(Z_OBJCE_P(param), php_imagickpixel_sc_entry, 0 TSRMLS_CC)) { + php_imagickpixel_object *intern = Z_IMAGICKPIXEL_P(param); + pixel_wand = intern->pixel_wand; + } else + php_imagick_throw_exception(caller, "The parameter must be an instance of ImagickPixel or a string" TSRMLS_CC); + break; + + default: + php_imagick_throw_exception(caller, "Invalid color parameter provided" TSRMLS_CC); + } + return pixel_wand; +} + +PixelWand *php_imagick_zval_to_opacity (zval *param, php_imagick_class_type_t caller, zend_bool *allocated TSRMLS_DC) +{ + PixelWand *pixel_wand = NULL; + *allocated = 0; + +#ifdef ZEND_ENGINE_3 + ZVAL_DEREF(param); +#endif + if (Z_TYPE_P (param) == IS_STRING) { + zval var; + var = *param; + + zval_copy_ctor(&var); + convert_to_double(&var); + param = &var; + } + + switch (Z_TYPE_P(param)) { + case IS_LONG: + case IS_DOUBLE: + { + pixel_wand = NewPixelWand(); + if (!pixel_wand) { + zend_error(E_ERROR, "Failed to allocate PixelWand structure"); + } +#if MagickLibVersion >= 0x700 + //TOOD - this should be one minus? Or should we just make a BC break + // and make users do it in user land? + PixelSetAlpha(pixel_wand, Z_DVAL_P(param)); +#else + PixelSetOpacity(pixel_wand, Z_DVAL_P(param)); +#endif + *allocated = 1; + } + break; + + case IS_OBJECT: + if (instanceof_function_ex(Z_OBJCE_P(param), php_imagickpixel_sc_entry, 0 TSRMLS_CC)) { + php_imagickpixel_object *intern = Z_IMAGICKPIXEL_P(param); + pixel_wand = intern->pixel_wand; + } else + php_imagick_throw_exception(caller, "The parameter must be an instance of ImagickPixel or a string" TSRMLS_CC); + break; + + default: + php_imagick_throw_exception(caller, "Invalid color parameter provided" TSRMLS_CC); + } + return pixel_wand; +} + +/** + * Changes the locale to IMAGICK_LC_NUMERIC_LOCALE if imagick.locale_fix is on + * and returns the locale set before calling this function. + * If locale is not changed, NULL is returned + * + */ +char *php_imagick_set_locale (TSRMLS_D) +{ + char *current_locale; + + if (!IMAGICK_G(locale_fix)) + return NULL; + + current_locale = setlocale(LC_NUMERIC, NULL); + if (current_locale != NULL) { + if (strcmp (current_locale, IMAGICK_LC_NUMERIC_LOCALE) != 0) { + setlocale (LC_NUMERIC, IMAGICK_LC_NUMERIC_LOCALE); + return estrdup (current_locale); + } + } + return NULL; +} + +void php_imagick_restore_locale (const char *old_locale) +{ + if (!old_locale) + return; + + if (strcmp (old_locale, IMAGICK_LC_NUMERIC_LOCALE) != 0) + setlocale (LC_NUMERIC, old_locale); +} + +PixelWand *php_imagick_clone_pixelwand (PixelWand *source) +{ +#if MagickLibVersion >= 0x635 + return ClonePixelWand(source); +#else + PixelWand *target = NewPixelWand (); + if (!target) + return NULL; + + PixelSetColorCount (target, PixelGetColorCount (source)); + PixelSetRed (target, PixelGetRed (source)); + PixelSetGreen (target, PixelGetGreen (source)); + PixelSetBlue (target, PixelGetBlue (source)); + PixelSetOpacity (target, PixelGetOpacity (source)); + PixelSetAlpha (target, PixelGetAlpha (source)); + + return target; +#endif +} + +void php_imagick_replace_magickwand (php_imagick_object *obj, MagickWand *new_wand) +{ + if (!obj->magick_wand) + obj->magick_wand = new_wand; + else { + obj->magick_wand = DestroyMagickWand(obj->magick_wand); + obj->magick_wand = new_wand; + } +} + +void php_imagick_replace_drawingwand (php_imagickdraw_object *obj, DrawingWand *new_wand) +{ + if (!obj->drawing_wand) + obj->drawing_wand = new_wand; + else { + obj->drawing_wand = DestroyDrawingWand(obj->drawing_wand); + obj->drawing_wand = new_wand; + } +} + +void php_imagick_replace_pixelwand (php_imagickpixel_object *obj, PixelWand *new_wand) +{ + if (obj->pixel_wand && obj->initialized_via_iterator != 1) { + obj->pixel_wand = DestroyPixelWand(obj->pixel_wand); + obj->pixel_wand = new_wand; + } else + obj->pixel_wand = new_wand; +} + +zend_bool php_imagick_ensure_not_empty (MagickWand *magick_wand) +{ + if (MagickGetNumberImages(magick_wand) == 0) { + TSRMLS_FETCH (); + php_imagick_throw_exception (IMAGICK_CLASS, "Can not process empty Imagick object" TSRMLS_CC); + return 0; + } + return 1; +} + +zend_bool php_imagickpixel_ensure_not_null(PixelWand *pixel_wand) +{ + if (pixel_wand == NULL) { + TSRMLS_FETCH (); + php_imagick_throw_exception (IMAGICKPIXEL_CLASS, "Can not process empty ImagickPixel object" TSRMLS_CC); + return 0; + } + return 1; +} + +void php_imagick_initialize_constants(TSRMLS_D) +{ +#define IMAGICK_REGISTER_CONST_LONG(const_name, value)\ + zend_declare_class_constant_long(php_imagick_sc_entry, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); + +#define IMAGICK_REGISTER_CONST_STRING(const_name, value)\ + zend_declare_class_constant_string(php_imagick_sc_entry, const_name, sizeof(const_name)-1, value TSRMLS_CC); + + /* Constants defined in php_imagick.h */ + IMAGICK_REGISTER_CONST_LONG("COLOR_BLACK", PHP_IMAGICK_COLOR_BLACK); + IMAGICK_REGISTER_CONST_LONG("COLOR_BLUE", PHP_IMAGICK_COLOR_BLUE); + IMAGICK_REGISTER_CONST_LONG("COLOR_CYAN", PHP_IMAGICK_COLOR_CYAN); + IMAGICK_REGISTER_CONST_LONG("COLOR_GREEN", PHP_IMAGICK_COLOR_GREEN); + IMAGICK_REGISTER_CONST_LONG("COLOR_RED", PHP_IMAGICK_COLOR_RED); + IMAGICK_REGISTER_CONST_LONG("COLOR_YELLOW", PHP_IMAGICK_COLOR_YELLOW); + IMAGICK_REGISTER_CONST_LONG("COLOR_MAGENTA", PHP_IMAGICK_COLOR_MAGENTA); +#if MagickLibVersion < 0x700 + IMAGICK_REGISTER_CONST_LONG("COLOR_OPACITY", PHP_IMAGICK_COLOR_OPACITY); +#endif + IMAGICK_REGISTER_CONST_LONG("COLOR_ALPHA", PHP_IMAGICK_COLOR_ALPHA); + IMAGICK_REGISTER_CONST_LONG("COLOR_FUZZ", PHP_IMAGICK_COLOR_FUZZ); + + /* Returning the version as a constant string */ + IMAGICK_REGISTER_CONST_LONG("IMAGICK_EXTNUM", PHP_IMAGICK_EXTNUM); + IMAGICK_REGISTER_CONST_STRING("IMAGICK_EXTVER", PHP_IMAGICK_VERSION); + +#if defined(MagickQuantumRange) + IMAGICK_REGISTER_CONST_LONG("QUANTUM_RANGE", atoi (MagickQuantumRange)); +#endif + + /* Are we using PHP allocations */ +#ifdef PHP_IMAGICK_ZEND_MM + IMAGICK_REGISTER_CONST_LONG("USE_ZEND_MM", 1); +#else + IMAGICK_REGISTER_CONST_LONG("USE_ZEND_MM", 0); +#endif + + /* ImageMagick defined constants */ + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_DEFAULT", OverCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_UNDEFINED", UndefinedCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_NO", NoCompositeOp); +#if MagickLibVersion < 0x700 + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_ADD", AddCompositeOp); +#endif + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_ATOP", AtopCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_BLEND", BlendCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_BUMPMAP", BumpmapCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_CLEAR", ClearCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_COLORBURN", ColorBurnCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_COLORDODGE", ColorDodgeCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_COLORIZE", ColorizeCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_COPYBLACK", CopyBlackCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_COPYBLUE", CopyBlueCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_COPY", CopyCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_COPYCYAN", CopyCyanCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_COPYGREEN", CopyGreenCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_COPYMAGENTA", CopyMagentaCompositeOp); +#if MagickLibVersion >= 0x700 + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_COPYALPHA", CopyAlphaCompositeOp); + //TOOD - is this semantically correct? + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_COPYOPACITY", CopyAlphaCompositeOp); +#else + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_COPYOPACITY", CopyOpacityCompositeOp); +#endif + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_COPYRED", CopyRedCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_COPYYELLOW", CopyYellowCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_DARKEN", DarkenCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_DSTATOP", DstAtopCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_DST", DstCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_DSTIN", DstInCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_DSTOUT", DstOutCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_DSTOVER", DstOverCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_DIFFERENCE", DifferenceCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_DISPLACE", DisplaceCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_DISSOLVE", DissolveCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_EXCLUSION", ExclusionCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_HARDLIGHT", HardLightCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_HUE", HueCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_IN", InCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_LIGHTEN", LightenCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_LUMINIZE", LuminizeCompositeOp); +#if MagickLibVersion < 0x700 + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_MINUS", MinusCompositeOp); +#endif + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_MODULATE", ModulateCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_MULTIPLY", MultiplyCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_OUT", OutCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_OVER", OverCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_OVERLAY", OverlayCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_PLUS", PlusCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_REPLACE", ReplaceCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_SATURATE", SaturateCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_SCREEN", ScreenCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_SOFTLIGHT", SoftLightCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_SRCATOP", SrcAtopCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_SRC", SrcCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_SRCIN", SrcInCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_SRCOUT", SrcOutCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_SRCOVER", SrcOverCompositeOp); +#if MagickLibVersion < 0x700 + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_SUBTRACT", SubtractCompositeOp); +#endif + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_THRESHOLD", ThresholdCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_XOR", XorCompositeOp); +#if MagickLibVersion >= 0x634 + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_CHANGEMASK", ChangeMaskCompositeOp); +#endif +#if MagickLibVersion >= 0x636 + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_LINEARLIGHT", LinearLightCompositeOp); +#if MagickLibVersion < 0x700 + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_DIVIDE", DivideCompositeOp); +#endif +#endif +#if MagickLibVersion >= 0x654 + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_DISTORT", DistortCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_BLUR", BlurCompositeOp); +#endif +#if MagickLibVersion >= 0x655 + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_PEGTOPLIGHT", PegtopLightCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_VIVIDLIGHT", VividLightCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_PINLIGHT", PinLightCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_LINEARDODGE", LinearDodgeCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_LINEARBURN", LinearBurnCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_MATHEMATICS", MathematicsCompositeOp); +#endif +#if MagickLibVersion >= 0x662 + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_MODULUSADD", ModulusAddCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_MODULUSSUBTRACT", ModulusSubtractCompositeOp); +#endif +#if MagickLibVersion >= 0x670 + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_MINUSDST", MinusDstCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_DIVIDEDST", DivideDstCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_DIVIDESRC", DivideSrcCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_MINUSSRC", MinusSrcCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_DARKENINTENSITY", DarkenIntensityCompositeOp); + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_LIGHTENINTENSITY", LightenIntensityCompositeOp); +#endif +#if MagickLibVersion >= 0x690 + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_HARDMIX", HardMixCompositeOp); +#endif + +#if (MagickLibVersion >= 0x700 && MagickLibVersion >= 0x708) || (MagickLibVersion < 0x700 && MagickLibVersion >= 0x69A) + IMAGICK_REGISTER_CONST_LONG("COMPOSITE_STEREO", StereoCompositeOp); +#endif + + IMAGICK_REGISTER_CONST_LONG("MONTAGEMODE_FRAME", FrameMode); + IMAGICK_REGISTER_CONST_LONG("MONTAGEMODE_UNFRAME", UnframeMode); + IMAGICK_REGISTER_CONST_LONG("MONTAGEMODE_CONCATENATE", ConcatenateMode); + IMAGICK_REGISTER_CONST_LONG("STYLE_NORMAL", NormalStyle); + IMAGICK_REGISTER_CONST_LONG("STYLE_ITALIC", ItalicStyle); + IMAGICK_REGISTER_CONST_LONG("STYLE_OBLIQUE", ObliqueStyle); + IMAGICK_REGISTER_CONST_LONG("STYLE_ANY", AnyStyle); +#if (MagickLibVersion >= 0x700 && MagickLibVersion >= 0x709) || (MagickLibVersion < 0x700 && MagickLibVersion >= 0x69B) + IMAGICK_REGISTER_CONST_LONG("STYLE_BOLD", BoldStyle); +#endif + + IMAGICK_REGISTER_CONST_LONG("FILTER_UNDEFINED", UndefinedFilter); + IMAGICK_REGISTER_CONST_LONG("FILTER_POINT", PointFilter); + IMAGICK_REGISTER_CONST_LONG("FILTER_BOX", BoxFilter); + IMAGICK_REGISTER_CONST_LONG("FILTER_TRIANGLE", TriangleFilter); + IMAGICK_REGISTER_CONST_LONG("FILTER_HERMITE", HermiteFilter); +#if MagickLibVersion >= 0x701 + IMAGICK_REGISTER_CONST_LONG("FILTER_HANNING", HannFilter); + IMAGICK_REGISTER_CONST_LONG("FILTER_HANN", HannFilter); +#else + IMAGICK_REGISTER_CONST_LONG("FILTER_HANNING", HanningFilter); +#endif + IMAGICK_REGISTER_CONST_LONG("FILTER_HAMMING", HammingFilter); + IMAGICK_REGISTER_CONST_LONG("FILTER_BLACKMAN", BlackmanFilter); + IMAGICK_REGISTER_CONST_LONG("FILTER_GAUSSIAN", GaussianFilter); + IMAGICK_REGISTER_CONST_LONG("FILTER_QUADRATIC", QuadraticFilter); + IMAGICK_REGISTER_CONST_LONG("FILTER_CUBIC", CubicFilter); + IMAGICK_REGISTER_CONST_LONG("FILTER_CATROM", CatromFilter); + IMAGICK_REGISTER_CONST_LONG("FILTER_MITCHELL", MitchellFilter); + IMAGICK_REGISTER_CONST_LONG("FILTER_LANCZOS", LanczosFilter); + IMAGICK_REGISTER_CONST_LONG("FILTER_BESSEL", BesselFilter); + IMAGICK_REGISTER_CONST_LONG("FILTER_SINC", SincFilter); +#if MagickLibVersion >= 0x637 + IMAGICK_REGISTER_CONST_LONG("FILTER_KAISER", KaiserFilter); +#if MagickLibVersion >= 0x701 + IMAGICK_REGISTER_CONST_LONG("FILTER_WELSH", WelshFilter); + IMAGICK_REGISTER_CONST_LONG("FILTER_WELCH", WelchFilter); +#else + IMAGICK_REGISTER_CONST_LONG("FILTER_WELSH", WelshFilter); +#endif + IMAGICK_REGISTER_CONST_LONG("FILTER_PARZEN", ParzenFilter); + IMAGICK_REGISTER_CONST_LONG("FILTER_LAGRANGE", LagrangeFilter); + IMAGICK_REGISTER_CONST_LONG("FILTER_SENTINEL", SentinelFilter); +#endif +#if MagickLibVersion >= 0x638 + IMAGICK_REGISTER_CONST_LONG("FILTER_BOHMAN", BohmanFilter); + IMAGICK_REGISTER_CONST_LONG("FILTER_BARTLETT", BartlettFilter); +#endif +#if MagickLibVersion >= 0x666 + IMAGICK_REGISTER_CONST_LONG("FILTER_JINC", JincFilter); + IMAGICK_REGISTER_CONST_LONG("FILTER_SINCFAST", SincFastFilter); + IMAGICK_REGISTER_CONST_LONG("FILTER_ROBIDOUX", RobidouxFilter); + IMAGICK_REGISTER_CONST_LONG("FILTER_LANCZOSSHARP", LanczosSharpFilter); + IMAGICK_REGISTER_CONST_LONG("FILTER_LANCZOS2", Lanczos2Filter); + IMAGICK_REGISTER_CONST_LONG("FILTER_LANCZOS2SHARP", Lanczos2SharpFilter); +#endif +#if MagickLibVersion >= 0x677 + IMAGICK_REGISTER_CONST_LONG("FILTER_ROBIDOUXSHARP", RobidouxSharpFilter); + IMAGICK_REGISTER_CONST_LONG("FILTER_COSINE", CosineFilter); +#endif +#if MagickLibVersion >= 0x678 + IMAGICK_REGISTER_CONST_LONG("FILTER_SPLINE", SplineFilter); +#endif +#if MagickLibVersion >= 0x681 + IMAGICK_REGISTER_CONST_LONG("FILTER_LANCZOSRADIUS", LanczosRadiusFilter); +#endif +#if MagickLibVersion >= 0x707 + IMAGICK_REGISTER_CONST_LONG("FILTER_CUBIC_SPLINE", CubicSplineFilter); +#endif + IMAGICK_REGISTER_CONST_LONG("IMGTYPE_UNDEFINED", UndefinedType); + IMAGICK_REGISTER_CONST_LONG("IMGTYPE_BILEVEL", BilevelType); + IMAGICK_REGISTER_CONST_LONG("IMGTYPE_GRAYSCALE", GrayscaleType); +#if MagickLibVersion < 0x700 + IMAGICK_REGISTER_CONST_LONG("IMGTYPE_GRAYSCALEMATTE", GrayscaleMatteType); +#else + IMAGICK_REGISTER_CONST_LONG("IMGTYPE_GRAYSCALEALPHA", GrayscaleAlphaType); + //@TODO - this is only here for legacy support + IMAGICK_REGISTER_CONST_LONG("IMGTYPE_GRAYSCALEMATTE", GrayscaleAlphaType); +#endif + IMAGICK_REGISTER_CONST_LONG("IMGTYPE_PALETTE", PaletteType); +#if MagickLibVersion < 0x700 + IMAGICK_REGISTER_CONST_LONG("IMGTYPE_PALETTEMATTE", PaletteMatteType); +#else + IMAGICK_REGISTER_CONST_LONG("IMGTYPE_PALETTEMATTE", PaletteAlphaType); + //@TODO - this is only here for legacy support + IMAGICK_REGISTER_CONST_LONG("IMGTYPE_PALETTEALPHA", PaletteAlphaType); +#endif + IMAGICK_REGISTER_CONST_LONG("IMGTYPE_TRUECOLOR", TrueColorType); +#if MagickLibVersion < 0x700 + IMAGICK_REGISTER_CONST_LONG("IMGTYPE_TRUECOLORMATTE", TrueColorMatteType); +#else + IMAGICK_REGISTER_CONST_LONG("IMGTYPE_TRUECOLORALPHA", TrueColorAlphaType); + //@TODO - this is only here for legacy support + IMAGICK_REGISTER_CONST_LONG("IMGTYPE_TRUECOLORMATTE", TrueColorAlphaType); + +#endif + IMAGICK_REGISTER_CONST_LONG("IMGTYPE_COLORSEPARATION", ColorSeparationType); +#if MagickLibVersion < 0x700 + IMAGICK_REGISTER_CONST_LONG("IMGTYPE_COLORSEPARATIONMATTE", ColorSeparationMatteType); +#else + IMAGICK_REGISTER_CONST_LONG("IMGTYPE_COLORSEPARATIONALPHA", ColorSeparationAlphaType); + //@TODO - this is only here for legacy support + IMAGICK_REGISTER_CONST_LONG("IMGTYPE_COLORSEPARATIONMATTE", ColorSeparationAlphaType); +#endif + IMAGICK_REGISTER_CONST_LONG("IMGTYPE_OPTIMIZE", OptimizeType); +#if MagickLibVersion < 0x700 + IMAGICK_REGISTER_CONST_LONG("IMGTYPE_PALETTEBILEVELMATTE", PaletteBilevelMatteType); +#else + IMAGICK_REGISTER_CONST_LONG("IMGTYPE_PALETTEBILEVELALPHA", PaletteBilevelAlphaType); + //@TODO - this is only here for legacy support + IMAGICK_REGISTER_CONST_LONG("IMGTYPE_PALETTEBILEVELMATTE", PaletteBilevelAlphaType); +#endif + IMAGICK_REGISTER_CONST_LONG("RESOLUTION_UNDEFINED", UndefinedResolution); + IMAGICK_REGISTER_CONST_LONG("RESOLUTION_PIXELSPERINCH", PixelsPerInchResolution); + IMAGICK_REGISTER_CONST_LONG("RESOLUTION_PIXELSPERCENTIMETER", PixelsPerCentimeterResolution); + IMAGICK_REGISTER_CONST_LONG("COMPRESSION_UNDEFINED", UndefinedCompression); + IMAGICK_REGISTER_CONST_LONG("COMPRESSION_NO", NoCompression); + IMAGICK_REGISTER_CONST_LONG("COMPRESSION_BZIP", BZipCompression); + IMAGICK_REGISTER_CONST_LONG("COMPRESSION_FAX", FaxCompression); + IMAGICK_REGISTER_CONST_LONG("COMPRESSION_GROUP4", Group4Compression); + IMAGICK_REGISTER_CONST_LONG("COMPRESSION_JPEG", JPEGCompression); + IMAGICK_REGISTER_CONST_LONG("COMPRESSION_JPEG2000", JPEG2000Compression); + IMAGICK_REGISTER_CONST_LONG("COMPRESSION_LOSSLESSJPEG", LosslessJPEGCompression); + IMAGICK_REGISTER_CONST_LONG("COMPRESSION_LZW", LZWCompression); + IMAGICK_REGISTER_CONST_LONG("COMPRESSION_RLE", RLECompression); + IMAGICK_REGISTER_CONST_LONG("COMPRESSION_ZIP", ZipCompression); +#if MagickLibVersion > 0x639 + IMAGICK_REGISTER_CONST_LONG("COMPRESSION_DXT1", DXT1Compression); + IMAGICK_REGISTER_CONST_LONG("COMPRESSION_DXT3", DXT3Compression); + IMAGICK_REGISTER_CONST_LONG("COMPRESSION_DXT5", DXT5Compression); +#endif +#if MagickLibVersion >= 0x656 + IMAGICK_REGISTER_CONST_LONG("COMPRESSION_ZIPS", ZipSCompression); + IMAGICK_REGISTER_CONST_LONG("COMPRESSION_PIZ", PizCompression); + IMAGICK_REGISTER_CONST_LONG("COMPRESSION_PXR24", Pxr24Compression); + IMAGICK_REGISTER_CONST_LONG("COMPRESSION_B44", B44Compression); + IMAGICK_REGISTER_CONST_LONG("COMPRESSION_B44A", B44ACompression); +#endif +#if MagickLibVersion >= 0x667 + IMAGICK_REGISTER_CONST_LONG("COMPRESSION_LZMA", LZMACompression); +#endif +#if MagickLibVersion >= 0x670 + IMAGICK_REGISTER_CONST_LONG("COMPRESSION_JBIG1", JBIG1Compression); + IMAGICK_REGISTER_CONST_LONG("COMPRESSION_JBIG2", JBIG2Compression); +#endif + +#if MagickLibVersion >= 0x709 + IMAGICK_REGISTER_CONST_LONG("COMPRESSION_ZSTD", ZstdCompression); + IMAGICK_REGISTER_CONST_LONG("COMPRESSION_WEBP", WebPCompression); +#endif + + IMAGICK_REGISTER_CONST_LONG("PAINT_POINT", PointMethod); + IMAGICK_REGISTER_CONST_LONG("PAINT_REPLACE", ReplaceMethod); + IMAGICK_REGISTER_CONST_LONG("PAINT_FLOODFILL", FloodfillMethod); + IMAGICK_REGISTER_CONST_LONG("PAINT_FILLTOBORDER", FillToBorderMethod); + IMAGICK_REGISTER_CONST_LONG("PAINT_RESET", ResetMethod); + IMAGICK_REGISTER_CONST_LONG("GRAVITY_NORTHWEST", NorthWestGravity); + IMAGICK_REGISTER_CONST_LONG("GRAVITY_NORTH", NorthGravity); + IMAGICK_REGISTER_CONST_LONG("GRAVITY_NORTHEAST", NorthEastGravity); + IMAGICK_REGISTER_CONST_LONG("GRAVITY_WEST", WestGravity); + IMAGICK_REGISTER_CONST_LONG("GRAVITY_CENTER", CenterGravity); + IMAGICK_REGISTER_CONST_LONG("GRAVITY_EAST", EastGravity); + IMAGICK_REGISTER_CONST_LONG("GRAVITY_SOUTHWEST", SouthWestGravity); + IMAGICK_REGISTER_CONST_LONG("GRAVITY_SOUTH", SouthGravity); + IMAGICK_REGISTER_CONST_LONG("GRAVITY_SOUTHEAST", SouthEastGravity); + IMAGICK_REGISTER_CONST_LONG("GRAVITY_FORGET", ForgetGravity); +#if MagickLibVersion < 0x700 + IMAGICK_REGISTER_CONST_LONG("GRAVITY_STATIC", StaticGravity); +#endif + + IMAGICK_REGISTER_CONST_LONG("STRETCH_NORMAL", NormalStretch); + IMAGICK_REGISTER_CONST_LONG("STRETCH_ULTRACONDENSED", UltraCondensedStretch); + IMAGICK_REGISTER_CONST_LONG("STRETCH_EXTRACONDENSED", ExtraCondensedStretch); + IMAGICK_REGISTER_CONST_LONG("STRETCH_CONDENSED", CondensedStretch); + IMAGICK_REGISTER_CONST_LONG("STRETCH_SEMICONDENSED", SemiCondensedStretch); + IMAGICK_REGISTER_CONST_LONG("STRETCH_SEMIEXPANDED", SemiExpandedStretch); + IMAGICK_REGISTER_CONST_LONG("STRETCH_EXPANDED", ExpandedStretch); + IMAGICK_REGISTER_CONST_LONG("STRETCH_EXTRAEXPANDED", ExtraExpandedStretch); + IMAGICK_REGISTER_CONST_LONG("STRETCH_ULTRAEXPANDED", UltraExpandedStretch); + IMAGICK_REGISTER_CONST_LONG("STRETCH_ANY", AnyStretch); + IMAGICK_REGISTER_CONST_LONG("ALIGN_UNDEFINED", UndefinedAlign); + IMAGICK_REGISTER_CONST_LONG("ALIGN_LEFT", LeftAlign); + IMAGICK_REGISTER_CONST_LONG("ALIGN_CENTER", CenterAlign); + IMAGICK_REGISTER_CONST_LONG("ALIGN_RIGHT", RightAlign); + IMAGICK_REGISTER_CONST_LONG("DECORATION_NO", NoDecoration); + IMAGICK_REGISTER_CONST_LONG("DECORATION_UNDERLINE", UnderlineDecoration); + IMAGICK_REGISTER_CONST_LONG("DECORATION_OVERLINE", OverlineDecoration); + IMAGICK_REGISTER_CONST_LONG("DECORATION_LINETROUGH", LineThroughDecoration); //TODO remove? + IMAGICK_REGISTER_CONST_LONG("DECORATION_LINETHROUGH", LineThroughDecoration); + IMAGICK_REGISTER_CONST_LONG("NOISE_UNIFORM", UniformNoise); + IMAGICK_REGISTER_CONST_LONG("NOISE_GAUSSIAN", GaussianNoise); + IMAGICK_REGISTER_CONST_LONG("NOISE_MULTIPLICATIVEGAUSSIAN", MultiplicativeGaussianNoise); + IMAGICK_REGISTER_CONST_LONG("NOISE_IMPULSE", ImpulseNoise); + IMAGICK_REGISTER_CONST_LONG("NOISE_LAPLACIAN", LaplacianNoise); + IMAGICK_REGISTER_CONST_LONG("NOISE_POISSON", PoissonNoise); +#if MagickLibVersion > 0x635 + IMAGICK_REGISTER_CONST_LONG("NOISE_RANDOM", RandomNoise); +#endif + IMAGICK_REGISTER_CONST_LONG("CHANNEL_UNDEFINED", UndefinedChannel); + IMAGICK_REGISTER_CONST_LONG("CHANNEL_RED", RedChannel); + IMAGICK_REGISTER_CONST_LONG("CHANNEL_GRAY", GrayChannel); + IMAGICK_REGISTER_CONST_LONG("CHANNEL_CYAN", CyanChannel); + IMAGICK_REGISTER_CONST_LONG("CHANNEL_GREEN", GreenChannel); + IMAGICK_REGISTER_CONST_LONG("CHANNEL_MAGENTA", MagentaChannel); + IMAGICK_REGISTER_CONST_LONG("CHANNEL_BLUE", BlueChannel); + IMAGICK_REGISTER_CONST_LONG("CHANNEL_YELLOW", YellowChannel); + IMAGICK_REGISTER_CONST_LONG("CHANNEL_ALPHA", AlphaChannel); + IMAGICK_REGISTER_CONST_LONG("CHANNEL_OPACITY", OpacityChannel); +#if MagickLibVersion < 0x700 + IMAGICK_REGISTER_CONST_LONG("CHANNEL_MATTE", MatteChannel); /* deprecated, needs to throw E_STRICT if used */ +#endif + IMAGICK_REGISTER_CONST_LONG("CHANNEL_BLACK", BlackChannel); + IMAGICK_REGISTER_CONST_LONG("CHANNEL_INDEX", IndexChannel); + IMAGICK_REGISTER_CONST_LONG("CHANNEL_ALL", AllChannels); + IMAGICK_REGISTER_CONST_LONG("CHANNEL_DEFAULT", DefaultChannels); + IMAGICK_REGISTER_CONST_LONG("CHANNEL_RGBA", RedChannel | GreenChannel | BlueChannel | AlphaChannel); +#if MagickLibVersion >= 0x644 + IMAGICK_REGISTER_CONST_LONG("CHANNEL_TRUEALPHA", TrueAlphaChannel); + IMAGICK_REGISTER_CONST_LONG("CHANNEL_RGBS", RGBChannels); +#endif +#if MagickLibVersion >= 0x655 + IMAGICK_REGISTER_CONST_LONG("CHANNEL_GRAY_CHANNELS", GrayChannels); +#endif +#if MagickLibVersion >= 0x656 + IMAGICK_REGISTER_CONST_LONG("CHANNEL_SYNC", SyncChannels); +#endif + +#if MagickLibVersion >= 0x700 + IMAGICK_REGISTER_CONST_LONG("CHANNEL_READ_MASK", ReadMaskChannel); /* Pixel is Not Readable? */ + IMAGICK_REGISTER_CONST_LONG("CHANNEL_WRITE_MASK", WriteMaskChannel); /* Pixel is Write Protected? */ + IMAGICK_REGISTER_CONST_LONG("CHANNEL_META", MetaChannel); /* ???? */ +#endif + +#if MagickLibVersion >= 0x708 + IMAGICK_REGISTER_CONST_LONG("CHANNEL_COMPOSITE_MASK", CompositeMaskChannel); /* SVG mask */ +#endif + +#if MagickLibVersion >= 0x670 + IMAGICK_REGISTER_CONST_LONG("CHANNEL_COMPOSITES", CompositeChannels); +#endif +#if MagickLibVersion < 0x700 + IMAGICK_REGISTER_CONST_LONG("METRIC_UNDEFINED", UndefinedMetric); +#endif + IMAGICK_REGISTER_CONST_LONG("METRIC_ABSOLUTEERRORMETRIC", AbsoluteErrorMetric); + IMAGICK_REGISTER_CONST_LONG("METRIC_MEANABSOLUTEERROR", MeanAbsoluteErrorMetric); +#if MagickLibVersion < 0x700 + IMAGICK_REGISTER_CONST_LONG("METRIC_MEANERRORPERPIXELMETRIC", MeanErrorPerPixelMetric); +#else + IMAGICK_REGISTER_CONST_LONG("METRIC_MEANERRORPERPIXELMETRIC", MeanErrorPerPixelErrorMetric); +#endif + + IMAGICK_REGISTER_CONST_LONG("METRIC_MEANSQUAREERROR", MeanSquaredErrorMetric); + IMAGICK_REGISTER_CONST_LONG("METRIC_PEAKABSOLUTEERROR", PeakAbsoluteErrorMetric); +#if MagickLibVersion < 0x700 + IMAGICK_REGISTER_CONST_LONG("METRIC_PEAKSIGNALTONOISERATIO", PeakSignalToNoiseRatioMetric); +#else + IMAGICK_REGISTER_CONST_LONG("METRIC_PEAKSIGNALTONOISERATIO", PeakSignalToNoiseRatioErrorMetric); +#endif + IMAGICK_REGISTER_CONST_LONG("METRIC_ROOTMEANSQUAREDERROR", RootMeanSquaredErrorMetric); +#if MagickLibVersion >= 0x687 + IMAGICK_REGISTER_CONST_LONG("METRIC_NORMALIZEDCROSSCORRELATIONERRORMETRIC", NormalizedCrossCorrelationErrorMetric); + IMAGICK_REGISTER_CONST_LONG("METRIC_FUZZERROR", FuzzErrorMetric); +#endif +#if MagickLibVersion >= 0x690 + IMAGICK_REGISTER_CONST_LONG("METRIC_PERCEPTUALHASH_ERROR", PerceptualHashErrorMetric); +#endif + +#if MagickLibVersion >= 0x707 + IMAGICK_REGISTER_CONST_LONG("METRIC_STRUCTURAL_SIMILARITY_ERROR", StructuralSimilarityErrorMetric); + IMAGICK_REGISTER_CONST_LONG("METRIC_STRUCTURAL_DISSIMILARITY_ERROR", StructuralDissimilarityErrorMetric); +#endif + + IMAGICK_REGISTER_CONST_LONG("PIXEL_CHAR", CharPixel); + IMAGICK_REGISTER_CONST_LONG("PIXEL_DOUBLE", DoublePixel); + IMAGICK_REGISTER_CONST_LONG("PIXEL_FLOAT", FloatPixel); +#if MagickLibVersion < 0x700 + IMAGICK_REGISTER_CONST_LONG("PIXEL_INTEGER", IntegerPixel); +#endif + IMAGICK_REGISTER_CONST_LONG("PIXEL_LONG", LongPixel); + IMAGICK_REGISTER_CONST_LONG("PIXEL_QUANTUM", QuantumPixel); + IMAGICK_REGISTER_CONST_LONG("PIXEL_SHORT", ShortPixel); + //For now we deliberately DO NOT support the longlong pixel type. + //64 bit integers and PHP do not play nicely. + //IMAGICK_REGISTER_CONST_LONG("PIXEL_LONGLONG", ..); + IMAGICK_REGISTER_CONST_LONG("EVALUATE_UNDEFINED", UndefinedEvaluateOperator); + IMAGICK_REGISTER_CONST_LONG("EVALUATE_ADD", AddEvaluateOperator); + IMAGICK_REGISTER_CONST_LONG("EVALUATE_AND", AndEvaluateOperator); + IMAGICK_REGISTER_CONST_LONG("EVALUATE_DIVIDE", DivideEvaluateOperator); + IMAGICK_REGISTER_CONST_LONG("EVALUATE_LEFTSHIFT", LeftShiftEvaluateOperator); + IMAGICK_REGISTER_CONST_LONG("EVALUATE_MAX", MaxEvaluateOperator); + IMAGICK_REGISTER_CONST_LONG("EVALUATE_MIN", MinEvaluateOperator); + IMAGICK_REGISTER_CONST_LONG("EVALUATE_MULTIPLY", MultiplyEvaluateOperator); + IMAGICK_REGISTER_CONST_LONG("EVALUATE_OR", OrEvaluateOperator); + IMAGICK_REGISTER_CONST_LONG("EVALUATE_RIGHTSHIFT", RightShiftEvaluateOperator); + IMAGICK_REGISTER_CONST_LONG("EVALUATE_SET", SetEvaluateOperator); + IMAGICK_REGISTER_CONST_LONG("EVALUATE_SUBTRACT", SubtractEvaluateOperator); + IMAGICK_REGISTER_CONST_LONG("EVALUATE_XOR", XorEvaluateOperator); +#if MagickLibVersion > 0x643 + IMAGICK_REGISTER_CONST_LONG("EVALUATE_POW", PowEvaluateOperator); + IMAGICK_REGISTER_CONST_LONG("EVALUATE_LOG", LogEvaluateOperator); + IMAGICK_REGISTER_CONST_LONG("EVALUATE_THRESHOLD", ThresholdEvaluateOperator); + IMAGICK_REGISTER_CONST_LONG("EVALUATE_THRESHOLDBLACK", ThresholdBlackEvaluateOperator); + IMAGICK_REGISTER_CONST_LONG("EVALUATE_THRESHOLDWHITE", ThresholdWhiteEvaluateOperator); + IMAGICK_REGISTER_CONST_LONG("EVALUATE_GAUSSIANNOISE", GaussianNoiseEvaluateOperator); + IMAGICK_REGISTER_CONST_LONG("EVALUATE_IMPULSENOISE", ImpulseNoiseEvaluateOperator); + IMAGICK_REGISTER_CONST_LONG("EVALUATE_LAPLACIANNOISE", LaplacianNoiseEvaluateOperator); + IMAGICK_REGISTER_CONST_LONG("EVALUATE_MULTIPLICATIVENOISE", MultiplicativeNoiseEvaluateOperator); + IMAGICK_REGISTER_CONST_LONG("EVALUATE_POISSONNOISE", PoissonNoiseEvaluateOperator); + IMAGICK_REGISTER_CONST_LONG("EVALUATE_UNIFORMNOISE", UniformNoiseEvaluateOperator); +#endif +#if MagickLibVersion > 0x648 + IMAGICK_REGISTER_CONST_LONG("EVALUATE_COSINE", CosineEvaluateOperator); + IMAGICK_REGISTER_CONST_LONG("EVALUATE_SINE", SineEvaluateOperator); + IMAGICK_REGISTER_CONST_LONG("EVALUATE_ADDMODULUS", AddModulusEvaluateOperator); +#endif +#if MagickLibVersion >= 0x661 + IMAGICK_REGISTER_CONST_LONG("EVALUATE_MEAN", MeanEvaluateOperator); +#endif +#if MagickLibVersion >= 0x664 + IMAGICK_REGISTER_CONST_LONG("EVALUATE_ABS", AbsEvaluateOperator); +#endif +#if MagickLibVersion >= 0x666 + IMAGICK_REGISTER_CONST_LONG("EVALUATE_EXPONENTIAL", ExponentialEvaluateOperator); + IMAGICK_REGISTER_CONST_LONG("EVALUATE_MEDIAN", MedianEvaluateOperator); +#endif +#if MagickLibVersion >= 0x676 + IMAGICK_REGISTER_CONST_LONG("EVALUATE_SUM", SumEvaluateOperator); +#endif +#if MagickLibVersion >= 0x690 + IMAGICK_REGISTER_CONST_LONG("EVALUATE_ROOT_MEAN_SQUARE", RootMeanSquareEvaluateOperator); +#endif + + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_UNDEFINED", UndefinedColorspace); + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_RGB", RGBColorspace); + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_GRAY", GRAYColorspace); + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_TRANSPARENT", TransparentColorspace); + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_OHTA", OHTAColorspace); +#if MagickLibVersion < 0x700 +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_LAB", LABColorspace); +#endif +#endif + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_XYZ", XYZColorspace); + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_YCBCR", YCbCrColorspace); + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_YCC", YCCColorspace); + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_YIQ", YIQColorspace); + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_YPBPR", YPbPrColorspace); + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_YUV", YUVColorspace); + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_CMYK", CMYKColorspace); + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_SRGB", sRGBColorspace); + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_HSB", HSBColorspace); + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_HSL", HSLColorspace); + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_HWB", HWBColorspace); +#if MagickLibVersion < 0x700 + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_REC601LUMA", Rec601LumaColorspace); + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_REC709LUMA", Rec709LumaColorspace); +#endif + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_LOG", LogColorspace); +#if MagickLibVersion >= 0x642 + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_CMY", CMYColorspace); +#endif +#if MagickLibVersion >= 0X679 + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_LUV", LuvColorspace); + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_HCL", HCLColorspace); +#endif +#if MagickLibVersion >= 0x680 + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_LCH", LCHColorspace); + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_LMS", LMSColorspace); +#endif +#if MagickLibVersion >= 0x686 + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_LCHAB", LCHabColorspace); + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_LCHUV", LCHuvColorspace); + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_SCRGB", scRGBColorspace); + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_HSI", HSIColorspace); + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_HSV", HSVColorspace); + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_HCLP", HCLpColorspace); + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_YDBDR", YDbDrColorspace); +#endif + + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_REC601YCBCR", Rec601YCbCrColorspace); + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_REC709YCBCR", Rec709YCbCrColorspace); +#if MagickLibVersion >= 0x690 + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_XYY", xyYColorspace); +#endif + + +#if (MagickLibVersion >= 0x700 && MagickLibVersion >= 0x708) || (MagickLibVersion < 0x700 && MagickLibVersion >= 0x699) + IMAGICK_REGISTER_CONST_LONG("COLORSPACE_LINEARGRAY", LinearGRAYColorspace); +#endif + + IMAGICK_REGISTER_CONST_LONG("VIRTUALPIXELMETHOD_UNDEFINED", UndefinedVirtualPixelMethod); + IMAGICK_REGISTER_CONST_LONG("VIRTUALPIXELMETHOD_BACKGROUND", BackgroundVirtualPixelMethod); +#if MagickLibVersion < 0x700 + IMAGICK_REGISTER_CONST_LONG("VIRTUALPIXELMETHOD_CONSTANT", ConstantVirtualPixelMethod); /* deprecated */ +#endif + IMAGICK_REGISTER_CONST_LONG("VIRTUALPIXELMETHOD_EDGE", EdgeVirtualPixelMethod); + IMAGICK_REGISTER_CONST_LONG("VIRTUALPIXELMETHOD_MIRROR", MirrorVirtualPixelMethod); + IMAGICK_REGISTER_CONST_LONG("VIRTUALPIXELMETHOD_TILE", TileVirtualPixelMethod); + IMAGICK_REGISTER_CONST_LONG("VIRTUALPIXELMETHOD_TRANSPARENT", TransparentVirtualPixelMethod); +#if MagickLibVersion > 0x641 + IMAGICK_REGISTER_CONST_LONG("VIRTUALPIXELMETHOD_MASK", MaskVirtualPixelMethod); + IMAGICK_REGISTER_CONST_LONG("VIRTUALPIXELMETHOD_BLACK", BlackVirtualPixelMethod); + IMAGICK_REGISTER_CONST_LONG("VIRTUALPIXELMETHOD_GRAY", GrayVirtualPixelMethod); + IMAGICK_REGISTER_CONST_LONG("VIRTUALPIXELMETHOD_WHITE", WhiteVirtualPixelMethod); +#endif +#if MagickLibVersion > 0x642 + IMAGICK_REGISTER_CONST_LONG("VIRTUALPIXELMETHOD_HORIZONTALTILE", HorizontalTileVirtualPixelMethod); + IMAGICK_REGISTER_CONST_LONG("VIRTUALPIXELMETHOD_VERTICALTILE", VerticalTileVirtualPixelMethod); +#endif +#if MagickLibVersion >= 0x651 + IMAGICK_REGISTER_CONST_LONG("VIRTUALPIXELMETHOD_HORIZONTALTILEEDGE", HorizontalTileEdgeVirtualPixelMethod); + IMAGICK_REGISTER_CONST_LONG("VIRTUALPIXELMETHOD_VERTICALTILEEDGE", VerticalTileEdgeVirtualPixelMethod); + IMAGICK_REGISTER_CONST_LONG("VIRTUALPIXELMETHOD_CHECKERTILE", CheckerTileVirtualPixelMethod); +#endif + IMAGICK_REGISTER_CONST_LONG("PREVIEW_UNDEFINED", UndefinedPreview); + IMAGICK_REGISTER_CONST_LONG("PREVIEW_ROTATE", RotatePreview); + IMAGICK_REGISTER_CONST_LONG("PREVIEW_SHEAR", ShearPreview); + IMAGICK_REGISTER_CONST_LONG("PREVIEW_ROLL", RollPreview); + IMAGICK_REGISTER_CONST_LONG("PREVIEW_HUE", HuePreview); + IMAGICK_REGISTER_CONST_LONG("PREVIEW_SATURATION", SaturationPreview); + IMAGICK_REGISTER_CONST_LONG("PREVIEW_BRIGHTNESS", BrightnessPreview); + IMAGICK_REGISTER_CONST_LONG("PREVIEW_GAMMA", GammaPreview); + IMAGICK_REGISTER_CONST_LONG("PREVIEW_SPIFF", SpiffPreview); + IMAGICK_REGISTER_CONST_LONG("PREVIEW_DULL", DullPreview); + IMAGICK_REGISTER_CONST_LONG("PREVIEW_GRAYSCALE", GrayscalePreview); + IMAGICK_REGISTER_CONST_LONG("PREVIEW_QUANTIZE", QuantizePreview); + IMAGICK_REGISTER_CONST_LONG("PREVIEW_DESPECKLE", DespecklePreview); + IMAGICK_REGISTER_CONST_LONG("PREVIEW_REDUCENOISE", ReduceNoisePreview); + IMAGICK_REGISTER_CONST_LONG("PREVIEW_ADDNOISE", AddNoisePreview); + IMAGICK_REGISTER_CONST_LONG("PREVIEW_SHARPEN", SharpenPreview); + IMAGICK_REGISTER_CONST_LONG("PREVIEW_BLUR", BlurPreview); + IMAGICK_REGISTER_CONST_LONG("PREVIEW_THRESHOLD", ThresholdPreview); + IMAGICK_REGISTER_CONST_LONG("PREVIEW_EDGEDETECT", EdgeDetectPreview); + IMAGICK_REGISTER_CONST_LONG("PREVIEW_SPREAD", SpreadPreview); + IMAGICK_REGISTER_CONST_LONG("PREVIEW_SOLARIZE", SolarizePreview); + IMAGICK_REGISTER_CONST_LONG("PREVIEW_SHADE", ShadePreview); + IMAGICK_REGISTER_CONST_LONG("PREVIEW_RAISE", RaisePreview); + IMAGICK_REGISTER_CONST_LONG("PREVIEW_SEGMENT", SegmentPreview); + IMAGICK_REGISTER_CONST_LONG("PREVIEW_SWIRL", SwirlPreview); + IMAGICK_REGISTER_CONST_LONG("PREVIEW_IMPLODE", ImplodePreview); + IMAGICK_REGISTER_CONST_LONG("PREVIEW_WAVE", WavePreview); + IMAGICK_REGISTER_CONST_LONG("PREVIEW_OILPAINT", OilPaintPreview); + IMAGICK_REGISTER_CONST_LONG("PREVIEW_CHARCOALDRAWING", CharcoalDrawingPreview); + IMAGICK_REGISTER_CONST_LONG("PREVIEW_JPEG", JPEGPreview); + IMAGICK_REGISTER_CONST_LONG("RENDERINGINTENT_UNDEFINED", UndefinedIntent); + IMAGICK_REGISTER_CONST_LONG("RENDERINGINTENT_SATURATION", SaturationIntent); + IMAGICK_REGISTER_CONST_LONG("RENDERINGINTENT_PERCEPTUAL", PerceptualIntent); + IMAGICK_REGISTER_CONST_LONG("RENDERINGINTENT_ABSOLUTE", AbsoluteIntent); + IMAGICK_REGISTER_CONST_LONG("RENDERINGINTENT_RELATIVE", RelativeIntent); + IMAGICK_REGISTER_CONST_LONG("INTERLACE_UNDEFINED", UndefinedInterlace); + IMAGICK_REGISTER_CONST_LONG("INTERLACE_NO", NoInterlace); + IMAGICK_REGISTER_CONST_LONG("INTERLACE_LINE", LineInterlace); + IMAGICK_REGISTER_CONST_LONG("INTERLACE_PLANE", PlaneInterlace); + IMAGICK_REGISTER_CONST_LONG("INTERLACE_PARTITION", PartitionInterlace); +#if MagickLibVersion > 0x633 + IMAGICK_REGISTER_CONST_LONG("INTERLACE_GIF", GIFInterlace); + IMAGICK_REGISTER_CONST_LONG("INTERLACE_JPEG", JPEGInterlace); + IMAGICK_REGISTER_CONST_LONG("INTERLACE_PNG", PNGInterlace); +#endif + IMAGICK_REGISTER_CONST_LONG("FILLRULE_UNDEFINED", UndefinedRule); + IMAGICK_REGISTER_CONST_LONG("FILLRULE_EVENODD", EvenOddRule); + IMAGICK_REGISTER_CONST_LONG("FILLRULE_NONZERO", NonZeroRule); + IMAGICK_REGISTER_CONST_LONG("PATHUNITS_UNDEFINED", UndefinedPathUnits); + IMAGICK_REGISTER_CONST_LONG("PATHUNITS_USERSPACE", UserSpace); + IMAGICK_REGISTER_CONST_LONG("PATHUNITS_USERSPACEONUSE", UserSpaceOnUse); + IMAGICK_REGISTER_CONST_LONG("PATHUNITS_OBJECTBOUNDINGBOX", ObjectBoundingBox); + IMAGICK_REGISTER_CONST_LONG("LINECAP_UNDEFINED", UndefinedCap); + IMAGICK_REGISTER_CONST_LONG("LINECAP_BUTT", ButtCap); + IMAGICK_REGISTER_CONST_LONG("LINECAP_ROUND", RoundCap); + IMAGICK_REGISTER_CONST_LONG("LINECAP_SQUARE", SquareCap); + IMAGICK_REGISTER_CONST_LONG("LINEJOIN_UNDEFINED", UndefinedJoin); + IMAGICK_REGISTER_CONST_LONG("LINEJOIN_MITER", MiterJoin); + IMAGICK_REGISTER_CONST_LONG("LINEJOIN_ROUND", RoundJoin); + IMAGICK_REGISTER_CONST_LONG("LINEJOIN_BEVEL", BevelJoin); + IMAGICK_REGISTER_CONST_LONG("RESOURCETYPE_UNDEFINED", UndefinedResource); + IMAGICK_REGISTER_CONST_LONG("RESOURCETYPE_AREA", AreaResource); + IMAGICK_REGISTER_CONST_LONG("RESOURCETYPE_DISK", DiskResource); + IMAGICK_REGISTER_CONST_LONG("RESOURCETYPE_FILE", FileResource); + IMAGICK_REGISTER_CONST_LONG("RESOURCETYPE_MAP", MapResource); + IMAGICK_REGISTER_CONST_LONG("RESOURCETYPE_MEMORY", MemoryResource); +#if MagickLibVersion >= 0x675 + IMAGICK_REGISTER_CONST_LONG("RESOURCETYPE_TIME", TimeResource); + IMAGICK_REGISTER_CONST_LONG("RESOURCETYPE_THROTTLE", ThrottleResource); +#endif +#if MagickLibVersion > 0x678 + IMAGICK_REGISTER_CONST_LONG("RESOURCETYPE_THREAD", ThreadResource); +#endif +#if MagickLibVersion > 0x691 + IMAGICK_REGISTER_CONST_LONG("RESOURCETYPE_WIDTH", WidthResource); + IMAGICK_REGISTER_CONST_LONG("RESOURCETYPE_HEIGHT", HeightResource); +#endif + +#if (MagickLibVersion >= 0x700 && MagickLibVersion >= 0x708) || (MagickLibVersion < 0x700 && MagickLibVersion >= 0x69A) + IMAGICK_REGISTER_CONST_LONG("RESOURCETYPE_LISTLENGTH", ListLengthResource); +#endif + + IMAGICK_REGISTER_CONST_LONG("DISPOSE_UNRECOGNIZED", UnrecognizedDispose); + IMAGICK_REGISTER_CONST_LONG("DISPOSE_UNDEFINED", UndefinedDispose); + IMAGICK_REGISTER_CONST_LONG("DISPOSE_NONE", NoneDispose); + IMAGICK_REGISTER_CONST_LONG("DISPOSE_BACKGROUND", BackgroundDispose); + IMAGICK_REGISTER_CONST_LONG("DISPOSE_PREVIOUS", PreviousDispose); +#if MagickLibVersion > 0x631 + IMAGICK_REGISTER_CONST_LONG("INTERPOLATE_UNDEFINED", UndefinedInterpolatePixel); + + IMAGICK_REGISTER_CONST_LONG("INTERPOLATE_AVERAGE", AverageInterpolatePixel); /* Average 4 nearest neighbours */ +#if MagickLibVersion < 0x700 + IMAGICK_REGISTER_CONST_LONG("INTERPOLATE_BICUBIC", BicubicInterpolatePixel); /* Catmull-Rom interpolation */ +#endif + IMAGICK_REGISTER_CONST_LONG("INTERPOLATE_BILINEAR", BilinearInterpolatePixel); /* Triangular filter interpolation */ +#if MagickLibVersion < 0x700 + IMAGICK_REGISTER_CONST_LONG("INTERPOLATE_FILTER", FilterInterpolatePixel); /* Use resize filter - (very slow) */ +#endif + IMAGICK_REGISTER_CONST_LONG("INTERPOLATE_INTEGER", IntegerInterpolatePixel); /* Integer (floor) interpolation */ + IMAGICK_REGISTER_CONST_LONG("INTERPOLATE_MESH", MeshInterpolatePixel); /* Triangular mesh interpolation */ +#if MagickLibVersion < 0x700 + IMAGICK_REGISTER_CONST_LONG("INTERPOLATE_NEARESTNEIGHBOR", NearestNeighborInterpolatePixel); +#endif +#endif +#if MagickLibVersion > 0x634 + IMAGICK_REGISTER_CONST_LONG("INTERPOLATE_SPLINE", SplineInterpolatePixel); /* Cubic Spline (blurred) interpolation */ +#endif +#if MagickLibVersion > 0x690 + IMAGICK_REGISTER_CONST_LONG("INTERPOLATE_AVERAGE_9", Average9InterpolatePixel); /* Average 9 nearest neighbours */ + IMAGICK_REGISTER_CONST_LONG("INTERPOLATE_AVERAGE_16", Average16InterpolatePixel); /* Average 16 nearest neighbours */ + IMAGICK_REGISTER_CONST_LONG("INTERPOLATE_BLEND", BlendInterpolatePixel); /* blend of nearest 1, 2 or 4 pixels */ + IMAGICK_REGISTER_CONST_LONG("INTERPOLATE_BACKGROUND_COLOR", BackgroundInterpolatePixel); /* just return background color */ +#if MagickLibVersion >= 0x687 + IMAGICK_REGISTER_CONST_LONG("INTERPOLATE_CATROM", CatromInterpolatePixel); /* Catmull-Rom interpolation */ +#endif +#endif + +#if MagickLibVersion >= 0x701 + IMAGICK_REGISTER_CONST_LONG("INTERPOLATE_NEAREST_PIXEL", NearestInterpolatePixel); /* NearestInterpolatePixel */ +#endif + +#if MagickLibVersion > 0x628 + IMAGICK_REGISTER_CONST_LONG("LAYERMETHOD_UNDEFINED", UndefinedLayer); + IMAGICK_REGISTER_CONST_LONG("LAYERMETHOD_COALESCE", CoalesceLayer); + IMAGICK_REGISTER_CONST_LONG("LAYERMETHOD_COMPAREANY", CompareAnyLayer); + IMAGICK_REGISTER_CONST_LONG("LAYERMETHOD_COMPARECLEAR", CompareClearLayer); + IMAGICK_REGISTER_CONST_LONG("LAYERMETHOD_COMPAREOVERLAY", CompareOverlayLayer); + IMAGICK_REGISTER_CONST_LONG("LAYERMETHOD_DISPOSE", DisposeLayer); + IMAGICK_REGISTER_CONST_LONG("LAYERMETHOD_OPTIMIZE", OptimizeLayer); + IMAGICK_REGISTER_CONST_LONG("LAYERMETHOD_OPTIMIZEPLUS", OptimizePlusLayer); +#endif +#if MagickLibVersion > 0x632 + IMAGICK_REGISTER_CONST_LONG("LAYERMETHOD_OPTIMIZETRANS", OptimizeTransLayer); + IMAGICK_REGISTER_CONST_LONG("LAYERMETHOD_COMPOSITE", CompositeLayer); + IMAGICK_REGISTER_CONST_LONG("LAYERMETHOD_OPTIMIZEIMAGE", OptimizeImageLayer); + IMAGICK_REGISTER_CONST_LONG("LAYERMETHOD_REMOVEDUPS", RemoveDupsLayer); + IMAGICK_REGISTER_CONST_LONG("LAYERMETHOD_REMOVEZERO", RemoveZeroLayer); +#endif +#if MagickLibVersion >= 0x644 + IMAGICK_REGISTER_CONST_LONG("LAYERMETHOD_TRIMBOUNDS", TrimBoundsLayer); +#endif +#if MagickLibVersion > 0x629 + IMAGICK_REGISTER_CONST_LONG("ORIENTATION_UNDEFINED", UndefinedOrientation); + IMAGICK_REGISTER_CONST_LONG("ORIENTATION_TOPLEFT", TopLeftOrientation); + IMAGICK_REGISTER_CONST_LONG("ORIENTATION_TOPRIGHT", TopRightOrientation); + IMAGICK_REGISTER_CONST_LONG("ORIENTATION_BOTTOMRIGHT", BottomRightOrientation); + IMAGICK_REGISTER_CONST_LONG("ORIENTATION_BOTTOMLEFT", BottomLeftOrientation); + IMAGICK_REGISTER_CONST_LONG("ORIENTATION_LEFTTOP", LeftTopOrientation); + IMAGICK_REGISTER_CONST_LONG("ORIENTATION_RIGHTTOP", RightTopOrientation); + IMAGICK_REGISTER_CONST_LONG("ORIENTATION_RIGHTBOTTOM", RightBottomOrientation); + IMAGICK_REGISTER_CONST_LONG("ORIENTATION_LEFTBOTTOM", LeftBottomOrientation); +#endif +#if MagickLibVersion > 0x635 + IMAGICK_REGISTER_CONST_LONG("DISTORTION_UNDEFINED", UndefinedDistortion); + IMAGICK_REGISTER_CONST_LONG("DISTORTION_AFFINE", AffineDistortion); + IMAGICK_REGISTER_CONST_LONG("DISTORTION_AFFINEPROJECTION", AffineProjectionDistortion); + IMAGICK_REGISTER_CONST_LONG("DISTORTION_ARC", ArcDistortion); + IMAGICK_REGISTER_CONST_LONG("DISTORTION_BILINEAR", BilinearDistortion); + IMAGICK_REGISTER_CONST_LONG("DISTORTION_PERSPECTIVE", PerspectiveDistortion); + IMAGICK_REGISTER_CONST_LONG("DISTORTION_PERSPECTIVEPROJECTION", PerspectiveProjectionDistortion); + IMAGICK_REGISTER_CONST_LONG("DISTORTION_SCALEROTATETRANSLATE", ScaleRotateTranslateDistortion); +#endif +#if MagickLibVersion > 0x645 + IMAGICK_REGISTER_CONST_LONG("DISTORTION_POLYNOMIAL", PolynomialDistortion); + IMAGICK_REGISTER_CONST_LONG("DISTORTION_POLAR", PolarDistortion); + IMAGICK_REGISTER_CONST_LONG("DISTORTION_DEPOLAR", DePolarDistortion); + IMAGICK_REGISTER_CONST_LONG("DISTORTION_BARREL", BarrelDistortion); + IMAGICK_REGISTER_CONST_LONG("DISTORTION_SHEPARDS", ShepardsDistortion); + + // SentinelDistortion is not a real distortion type. It is a guard value + // that shouldn't have been exposed in Imagick. TODO remove at next + // minor version. + IMAGICK_REGISTER_CONST_LONG("DISTORTION_SENTINEL", SentinelDistortion); +#endif +#if MagickLibVersion >= 0x644 + IMAGICK_REGISTER_CONST_LONG("DISTORTION_BARRELINVERSE", BarrelInverseDistortion); +#endif +#if MagickLibVersion >= 0x654 + IMAGICK_REGISTER_CONST_LONG("DISTORTION_BILINEARFORWARD", BilinearForwardDistortion); + IMAGICK_REGISTER_CONST_LONG("DISTORTION_BILINEARREVERSE", BilinearReverseDistortion); +#endif +#if MagickLibVersion >= 0x670 + IMAGICK_REGISTER_CONST_LONG("DISTORTION_RESIZE", ResizeDistortion); +#endif +#if MagickLibVersion >= 0x671 + IMAGICK_REGISTER_CONST_LONG("DISTORTION_CYLINDER2PLANE", Cylinder2PlaneDistortion); + IMAGICK_REGISTER_CONST_LONG("DISTORTION_PLANE2CYLINDER", Plane2CylinderDistortion); +#endif +#if MagickLibVersion > 0x636 + IMAGICK_REGISTER_CONST_LONG("LAYERMETHOD_MERGE", MergeLayer); + IMAGICK_REGISTER_CONST_LONG("LAYERMETHOD_FLATTEN", FlattenLayer); + IMAGICK_REGISTER_CONST_LONG("LAYERMETHOD_MOSAIC", MosaicLayer); +#endif +#if MagickLibVersion > 0x637 + IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_ACTIVATE", ActivateAlphaChannel); +#if MagickLibVersion >= 0x700 + IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_ON", OnAlphaChannel); +#else + IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_RESET", ResetAlphaChannel); +#endif + IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_SET", SetAlphaChannel); +#endif +#if MagickLibVersion > 0x645 + IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_UNDEFINED", UndefinedAlphaChannel); +#if MagickLibVersion >= 0x700 + IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_DISCRETE", DiscreteAlphaChannel); +#else + IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_COPY", CopyAlphaChannel); +#endif + IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_DEACTIVATE", DeactivateAlphaChannel); + IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_EXTRACT", ExtractAlphaChannel); +#if MagickLibVersion >= 0x700 + IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_OFF", OffAlphaChannel); +#else + IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_OPAQUE", OpaqueAlphaChannel); +#endif + IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_SHAPE", ShapeAlphaChannel); + IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_TRANSPARENT", TransparentAlphaChannel); +#if MagickLibVersion >= 0x690 + IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_ASSOCIATE", AssociateAlphaChannel); + IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_DISSOCIATE", DisassociateAlphaChannel); +#endif + /* + DiscreteAlphaChannel, CopyAlphaChannel, + DisassociateAlphaChannel, DeactivateAlphaChannel, + ExtractAlphaChannel, ExtractAlphaChannel, + OffAlphaChannel, OpaqueAlphaChannel, + OnAlphaChannel, ResetAlphaChannel, // deprecated + */ + + IMAGICK_REGISTER_CONST_LONG("SPARSECOLORMETHOD_UNDEFINED", UndefinedColorInterpolate); + IMAGICK_REGISTER_CONST_LONG("SPARSECOLORMETHOD_BARYCENTRIC", BarycentricColorInterpolate); + IMAGICK_REGISTER_CONST_LONG("SPARSECOLORMETHOD_BILINEAR", BilinearColorInterpolate); + IMAGICK_REGISTER_CONST_LONG("SPARSECOLORMETHOD_POLYNOMIAL", PolynomialColorInterpolate); + IMAGICK_REGISTER_CONST_LONG("SPARSECOLORMETHOD_SPEPARDS", ShepardsColorInterpolate); + IMAGICK_REGISTER_CONST_LONG("SPARSECOLORMETHOD_VORONOI", VoronoiColorInterpolate); +#if MagickLibVersion >= 0x687 + IMAGICK_REGISTER_CONST_LONG("SPARSECOLORMETHOD_INVERSE", InverseColorInterpolate); +#endif +#if MagickLibVersion >= 0x693 + IMAGICK_REGISTER_CONST_LONG("SPARSECOLORMETHOD_MANHATTAN", ManhattanColorInterpolate); +#endif + IMAGICK_REGISTER_CONST_LONG("DITHERMETHOD_UNDEFINED", UndefinedDitherMethod); + IMAGICK_REGISTER_CONST_LONG("DITHERMETHOD_NO", NoDitherMethod); + IMAGICK_REGISTER_CONST_LONG("DITHERMETHOD_RIEMERSMA", RiemersmaDitherMethod); + IMAGICK_REGISTER_CONST_LONG("DITHERMETHOD_FLOYDSTEINBERG", FloydSteinbergDitherMethod); +#endif +#if MagickLibVersion > 0x648 + IMAGICK_REGISTER_CONST_LONG("FUNCTION_UNDEFINED", UndefinedFunction); + IMAGICK_REGISTER_CONST_LONG("FUNCTION_POLYNOMIAL", PolynomialFunction); + IMAGICK_REGISTER_CONST_LONG("FUNCTION_SINUSOID", SinusoidFunction); +#endif +#if MagickLibVersion >= 0x653 + IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_BACKGROUND", BackgroundAlphaChannel); + IMAGICK_REGISTER_CONST_LONG("FUNCTION_ARCSIN", ArcsinFunction); + IMAGICK_REGISTER_CONST_LONG("FUNCTION_ARCTAN", ArctanFunction); +#endif +#if MagickLibVersion >= 0x678 +#if MagickLibVersion < 0x700 + IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_FLATTEN", FlattenAlphaChannel); +#endif + IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_REMOVE", RemoveAlphaChannel); +#endif + +#if MagickLibVersion > 0x683 + IMAGICK_REGISTER_CONST_LONG("STATISTIC_GRADIENT", GradientStatistic); + IMAGICK_REGISTER_CONST_LONG("STATISTIC_MAXIMUM", MaximumStatistic); + IMAGICK_REGISTER_CONST_LONG("STATISTIC_MEAN", MeanStatistic); + IMAGICK_REGISTER_CONST_LONG("STATISTIC_MEDIAN", MedianStatistic); + IMAGICK_REGISTER_CONST_LONG("STATISTIC_MINIMUM", MinimumStatistic); + IMAGICK_REGISTER_CONST_LONG("STATISTIC_MODE", ModeStatistic); + IMAGICK_REGISTER_CONST_LONG("STATISTIC_NONPEAK", NonpeakStatistic); + IMAGICK_REGISTER_CONST_LONG("STATISTIC_STANDARD_DEVIATION", StandardDeviationStatistic); +#if MagickLibVersion >= 0x690 + IMAGICK_REGISTER_CONST_LONG("STATISTIC_ROOT_MEAN_SQUARE", RootMeanSquareStatistic); +#endif +#endif + +#ifdef IMAGICK_WITH_KERNEL +/* Convolve / Correlate weighted sums */ +IMAGICK_REGISTER_CONST_LONG("MORPHOLOGY_CONVOLVE", ConvolveMorphology); /* Weighted Sum with reflected kernel */ +IMAGICK_REGISTER_CONST_LONG("MORPHOLOGY_CORRELATE", CorrelateMorphology); /* Weighted Sum using a sliding window */ +/* Low-level Morphology methods */ +IMAGICK_REGISTER_CONST_LONG("MORPHOLOGY_ERODE", ErodeMorphology); /* Minimum Value in Neighbourhood */ +IMAGICK_REGISTER_CONST_LONG("MORPHOLOGY_DILATE", DilateMorphology); /* Maximum Value in Neighbourhood */ +IMAGICK_REGISTER_CONST_LONG("MORPHOLOGY_ERODE_INTENSITY", ErodeIntensityMorphology); /* Pixel Pick using GreyScale Erode */ +IMAGICK_REGISTER_CONST_LONG("MORPHOLOGY_DILATE_INTENSITY", DilateIntensityMorphology); /* Pixel Pick using GreyScale Dialate */ +IMAGICK_REGISTER_CONST_LONG("MORPHOLOGY_DISTANCE", DistanceMorphology); /* Add Kernel Value, take Minimum */ +/* Second-level Morphology methods */ +IMAGICK_REGISTER_CONST_LONG("MORPHOLOGY_OPEN", OpenMorphology); /* Dilate then Erode */ +IMAGICK_REGISTER_CONST_LONG("MORPHOLOGY_CLOSE", CloseMorphology); /* Erode then Dilate */ +IMAGICK_REGISTER_CONST_LONG("MORPHOLOGY_OPEN_INTENSITY", OpenIntensityMorphology); /* Pixel Pick using GreyScale Open */ +IMAGICK_REGISTER_CONST_LONG("MORPHOLOGY_CLOSE_INTENSITY", CloseIntensityMorphology); /* Pixel Pick using GreyScale Close */ +IMAGICK_REGISTER_CONST_LONG("MORPHOLOGY_SMOOTH", SmoothMorphology); /* Open then Close */ +/* Difference Morphology methods */ +IMAGICK_REGISTER_CONST_LONG("MORPHOLOGY_EDGE_IN", EdgeInMorphology); /* Dilate difference from Original */ +IMAGICK_REGISTER_CONST_LONG("MORPHOLOGY_EDGE_OUT", EdgeOutMorphology); /* Erode difference from Original */ +IMAGICK_REGISTER_CONST_LONG("MORPHOLOGY_EDGE", EdgeMorphology); /* Dilate difference with Erode */ +IMAGICK_REGISTER_CONST_LONG("MORPHOLOGY_TOP_HAT", TopHatMorphology); /* Close difference from Original */ +IMAGICK_REGISTER_CONST_LONG("MORPHOLOGY_BOTTOM_HAT", BottomHatMorphology); /* Open difference from Original */ +/* Recursive Morphology methods */ +IMAGICK_REGISTER_CONST_LONG("MORPHOLOGY_HIT_AND_MISS", HitAndMissMorphology); /* Foreground/Background pattern matching */ +IMAGICK_REGISTER_CONST_LONG("MORPHOLOGY_THINNING", ThinningMorphology); /* Remove matching pixels from image */ +IMAGICK_REGISTER_CONST_LONG("MORPHOLOGY_THICKEN", ThickenMorphology); /* Add matching pixels from image */ +/* Experimental Morphology methods */ +IMAGICK_REGISTER_CONST_LONG("MORPHOLOGY_VORONOI", VoronoiMorphology); /* distance matte channel copy nearest color */ +IMAGICK_REGISTER_CONST_LONG("MORPHOLOGY_ITERATIVE", IterativeDistanceMorphology); /* Add Kernel Value, take Minimum */ + + +/* The no-op or 'original image' kernel */ +IMAGICK_REGISTER_CONST_LONG("KERNEL_UNITY", UnityKernel); +/* Convolution Kernels, Gaussian Based */ +IMAGICK_REGISTER_CONST_LONG("KERNEL_GAUSSIAN", GaussianKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_DIFFERENCE_OF_GAUSSIANS", DoGKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_LAPLACIAN_OF_GAUSSIANS", LoGKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_BLUR", BlurKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_COMET", CometKernel); +/* Convolution Kernels, by Name */ +IMAGICK_REGISTER_CONST_LONG("KERNEL_LAPLACIAN", LaplacianKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_SOBEL", SobelKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_FREI_CHEN", FreiChenKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_ROBERTS", RobertsKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_PREWITT", PrewittKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_COMPASS", CompassKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_KIRSCH", KirschKernel); +/* Shape Kernels */ +IMAGICK_REGISTER_CONST_LONG("KERNEL_DIAMOND", DiamondKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_SQUARE", SquareKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_RECTANGLE", RectangleKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_OCTAGON", OctagonKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_DISK", DiskKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_PLUS", PlusKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_CROSS", CrossKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_RING", RingKernel); +/* Hit And Miss Kernels */ +IMAGICK_REGISTER_CONST_LONG("KERNEL_PEAKS", PeaksKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_EDGES", EdgesKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_CORNERS", CornersKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_DIAGONALS", DiagonalsKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_LINE_ENDS", LineEndsKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_LINE_JUNCTIONS", LineJunctionsKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_RIDGES", RidgesKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_CONVEX_HULL", ConvexHullKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_THIN_SE", ThinSEKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_SKELETON", SkeletonKernel); +/* Distance Measuring Kernels */ +IMAGICK_REGISTER_CONST_LONG("KERNEL_CHEBYSHEV", ChebyshevKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_MANHATTAN", ManhattanKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_OCTAGONAL", OctagonalKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_EUCLIDEAN", EuclideanKernel); +/* User Specified Kernel Array */ +IMAGICK_REGISTER_CONST_LONG("KERNEL_USER_DEFINED", UserDefinedKernel); +IMAGICK_REGISTER_CONST_LONG("KERNEL_BINOMIAL", BinomialKernel); + +/* Draw directions */ +IMAGICK_REGISTER_CONST_LONG("DIRECTION_LEFT_TO_RIGHT", LeftToRightDirection); +IMAGICK_REGISTER_CONST_LONG("DIRECTION_RIGHT_TO_LEFT", RightToLeftDirection); + +// The kernel is scaled directly using given scaling factor without change. +IMAGICK_REGISTER_CONST_LONG("NORMALIZE_KERNEL_NONE", 0); +// Kernel normalization ('normalize_flags' given) is designed to ensure +// that any use of the kernel scaling factor with 'Convolve' or 'Correlate' +// morphology methods will fall into -1.0 to +1.0 range. +IMAGICK_REGISTER_CONST_LONG("NORMALIZE_KERNEL_VALUE", NormalizeValue); +// For special kernels designed for locating shapes using 'Correlate', (often +// only containing +1 and -1 values, representing foreground/brackground +// matching) a special normalization method is provided to scale the positive +// values separately to those of the negative values, so the kernel will be +// forced to become a zero-sum kernel better suited to such searches. +IMAGICK_REGISTER_CONST_LONG("NORMALIZE_KERNEL_CORRELATE", CorrelateNormalizeValue); +// Scale the kernel by a percent. +IMAGICK_REGISTER_CONST_LONG("NORMALIZE_KERNEL_PERCENT", PercentValue); +#endif + +#undef IMAGICK_REGISTER_CONST_LONG +#undef IMAGICK_REGISTER_CONST_STRING +} diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/imagickkernel_class.c php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/imagickkernel_class.c --- php-imagick-3.4.4/imagick-3.4.4+php8.0/imagickkernel_class.c 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/imagickkernel_class.c 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,855 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 / Imagick | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Dan Ackroyd | + +----------------------------------------------------------------------+ +*/ + +#include "php_imagick.h" +#include "php_imagick_defs.h" +#include "php_imagick_macros.h" +#include "php_imagick_helpers.h" + +#ifdef IMAGICK_WITH_KERNEL + +#if MagickLibVersion < 0x691 +// These function defines are required currently as the functions are +// currently not available in the public ImageMagick header files +// This is being fixed for the next version of ImageMagick. +Image + *MorphologyApply(const Image *,const ChannelType,const MorphologyMethod, + const ssize_t,const KernelInfo *,const CompositeOperator,const double, + ExceptionInfo *); + +void + ScaleKernelInfo(KernelInfo *,const double,const GeometryFlags), + UnityAddKernelInfo(KernelInfo *,const double), + ZeroKernelNans(KernelInfo *); +#endif + + +static void php_imagickkernelvalues_to_zval(zval *zv, KernelInfo *kernel_info) { + int count; + double value; + unsigned int x, y; +#ifdef ZEND_ENGINE_3 + zval row; +#else + zval *row; +#endif + + zval *p_row; + + count = 0; + + for (y=0; yheight ; y++) { +#ifdef ZEND_ENGINE_3 + p_row = &row; +#else + MAKE_STD_ZVAL(row); + p_row = row; +#endif + + array_init(p_row); + for (x=0; xwidth ; x++) { + value = kernel_info->values[count]; + count++; + + //nan is not equal to itself + if (value != value) { + //this will be broken by some compilers - need to investigate more... + add_next_index_bool(p_row, 0); + } + else { + add_next_index_double(p_row, value); + } + } + + add_next_index_zval(zv, p_row); + } +} + + +HashTable* php_imagickkernel_get_debug_info(zval *obj, int *is_temp TSRMLS_DC) /* {{{ */ +{ + php_imagickkernel_object *internp; + HashTable *debug_info; + KernelInfo *kernel_info; +#ifdef ZEND_ENGINE_3 + zval matrix; +#else + zval *matrix; +#endif + + *is_temp = 1; //var_dump will destroy the hashtable + + internp = Z_IMAGICKKERNEL_P(obj); + kernel_info = internp->kernel_info; + + ALLOC_HASHTABLE(debug_info); + ZEND_INIT_SYMTABLE_EX(debug_info, 1, 0); + + while (kernel_info != NULL) { +#ifdef ZEND_ENGINE_3 + array_init(&matrix); + php_imagickkernelvalues_to_zval(&matrix, kernel_info); + zend_hash_next_index_insert(debug_info, &matrix); +#else + MAKE_STD_ZVAL(matrix); + array_init(matrix); + php_imagickkernelvalues_to_zval(matrix, kernel_info); + zend_hash_next_index_insert(debug_info, &matrix, sizeof(zval *), NULL); +#endif + kernel_info = kernel_info->next; + } + + return debug_info; +} + + +static void im_CalcKernelMetaData(KernelInfo *kernel) { + size_t i; + + kernel->minimum = kernel->maximum = 0.0; + kernel->negative_range = kernel->positive_range = 0.0; + + for (i=0; i < (kernel->width*kernel->height); i++) { + if (fabs(kernel->values[i]) < MagickEpsilon) { + kernel->values[i] = 0.0; + } + if (kernel->values[i] < 0) { + kernel->negative_range += kernel->values[i]; + } + else { + kernel->positive_range += kernel->values[i]; + } + if (kernel->values[i] < kernel->minimum) { + kernel->minimum = kernel->values[i]; + } + + if (kernel->values[i] > kernel->maximum) { + kernel->maximum = kernel->values[i]; + } + } + + return; +} + + +#if MagickLibVersion > 0x661 +static KernelInfo *imagick_createKernel(KernelValueType *values, size_t width, size_t height, size_t origin_x, size_t origin_y) +{ + KernelInfo *kernel_info; + +#if MagickLibVersion >= 0x700 + unsigned int i; + ExceptionInfo *_exception_info = (ExceptionInfo *) NULL; + //TODO - inspect exception info + kernel_info=AcquireKernelInfo(NULL, _exception_info); +#else + kernel_info=AcquireKernelInfo(NULL); +#endif + if (kernel_info == (KernelInfo *) NULL) { + return NULL; + } + + kernel_info->width = width; + kernel_info->height = height; + + kernel_info->x = origin_x; + kernel_info->y = origin_y; + + //Need to free old values? + if (kernel_info->values != NULL) { + RelinquishAlignedMemory(kernel_info->values); + } + +#if MagickLibVersion >= 0x700 + kernel_info->values = (MagickRealType *)AcquireAlignedMemory(width*height, sizeof(MagickRealType)); + + for (i=0; ivalues[i] = (MagickRealType)values[i]; + } + +#else + kernel_info->values = values; +#endif + + im_CalcKernelMetaData(kernel_info); + + return kernel_info; +} +#endif + +static void createKernelZval(zval *pzval, KernelInfo *kernel_info TSRMLS_DC) { + php_imagickkernel_object *intern_return; + + object_init_ex(pzval, php_imagickkernel_sc_entry); + intern_return = Z_IMAGICKKERNEL_P(pzval); + intern_return->kernel_info = kernel_info; +} + + +/* {{{ proto ImagickKernel ImagickKernel::__construct() + The ImagickKernel constructor +*/ +PHP_METHOD(imagickkernel, __construct) +{ + // This suppresses an 'unused parameter' warning. + (void)return_value; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + // this method is private. +} +/* }}} */ + +#define MATRIX_ERROR_EMPTY "Cannot create kernel, matrix is empty." +#define MATRIX_ERROR_UNEVEN "Values must be matrix, with the same number of columns in each row." +#define MATRIX_ERROR_BAD_VALUE "Only numbers or false are valid values in a kernel matrix." +#define MATRIX_ORIGIN_REQUIRED "For kernels with even numbered rows or columns, the origin position must be specified." + +/* {{{ proto ImagickKernel ImagickKernel::fromMatrix(array matrix, [array origin]) + Create a kernel from an 2d matrix of values. Each value should either be a float + (if the element should be used) or 'false' if the element should be skipped. For + matrixes that are odd sizes in both dimensions the the origin pixel will default + to the centre of the kernel. For all other kernel sizes the origin pixel must be specified. +*/ +#ifdef ZEND_ENGINE_3 +PHP_METHOD(imagickkernel, frommatrix) +{ + zval *kernel_array; + zval *origin_array; + HashTable *inner_array; + KernelInfo *kernel_info; + unsigned long num_rows, num_columns = 0; + unsigned int previous_num_columns = (unsigned int)-1; + unsigned int row, column; + + zval *pzval_outer; + zval *pzval_inner; + + int count = 0; + size_t origin_x, origin_y; + zval *tmp; + + KernelValueType *values = NULL; + double notanumber = sqrt((double)-1.0); /* Special Value : Not A Number */ + + count = 0; + row = 0; + origin_array = NULL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|a", &kernel_array, &origin_array) == FAILURE) { + return; + } + + num_rows = zend_hash_num_elements(Z_ARRVAL_P(kernel_array)); + + if (num_rows == 0) { + //error - array has zero elements. + php_imagick_throw_exception(IMAGICKKERNEL_CLASS, MATRIX_ERROR_EMPTY TSRMLS_CC); + return; + } + + + for (row=0 ; row> 1; + origin_y = (num_rows - 1) >> 1; + } + else { + HashTable *origin_array_ht; + origin_array_ht = Z_ARRVAL_P(origin_array); + + // parse the origin_x + tmp = zend_hash_index_find(origin_array_ht, 0); + if (tmp != NULL) { + ZVAL_DEREF(tmp); + origin_x = Z_LVAL_P(tmp); + } + else { + php_imagick_throw_exception(IMAGICKKERNEL_CLASS, MATRIX_ORIGIN_REQUIRED TSRMLS_CC); + goto cleanup; + } + // origin_x is unsigned, so checking for > num_columns, also + // checks for < 0 + if (origin_x>=num_columns) { + zend_throw_exception_ex( + php_imagickkernel_exception_class_entry, + 5 TSRMLS_CC, + "origin_x for matrix is outside bounds of columns: " ZEND_LONG_FMT, + origin_x + ); + goto cleanup; + } + + // parse the origin_y + tmp = zend_hash_index_find(origin_array_ht, 1); + if (tmp != NULL) { + ZVAL_DEREF(tmp); + origin_y = Z_LVAL_P(tmp); + } + else { + php_imagick_throw_exception(IMAGICKKERNEL_CLASS, MATRIX_ORIGIN_REQUIRED TSRMLS_CC); + goto cleanup; + } + // origin_y is unsigned, so checking for > num_rows, also + // checks for < 0 + if (origin_y>=num_rows) { + zend_throw_exception_ex( + php_imagickkernel_exception_class_entry, + 5 TSRMLS_CC, + "origin_y for matrix is outside bounds of rows: " ZEND_LONG_FMT, + origin_x + ); + goto cleanup; + } + } + + kernel_info = imagick_createKernel(values, num_columns, num_rows, origin_x, origin_y); + createKernelZval(return_value, kernel_info TSRMLS_CC); + + return; + +cleanup: + if (values != NULL) { + RelinquishAlignedMemory(values); + } +} + +#else //not ZEND_ENGINE_3 + + +PHP_METHOD(imagickkernel, frommatrix) +{ + zval *kernel_array; + zval *origin_array; + HashTable *inner_array; + KernelInfo *kernel_info; + unsigned long num_rows, num_columns = 0; + unsigned int previous_num_columns = (unsigned int)-1; + unsigned int row, column; + + HashTable *origin_array_ht; + zval **ppzval_outer; + zval **ppzval_inner; + + int count = 0; + size_t origin_x, origin_y; + zval **tmp; + + KernelValueType *values = NULL; + double notanumber = sqrt((double)-1.0); /* Special Value : Not A Number */ + + previous_num_columns = -1; + count = 0; + row = 0; + origin_array = NULL; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|a", &kernel_array, &origin_array) == FAILURE) { + return; + } + + num_rows = zend_hash_num_elements(Z_ARRVAL_P(kernel_array)); + + if (num_rows == 0) { + //error - array has zero elements. + php_imagick_throw_exception(IMAGICKKERNEL_CLASS, MATRIX_ERROR_EMPTY TSRMLS_CC); + return; + } + + for (row=0 ; row> 1; + origin_y = (num_rows - 1) >> 1; + } + else { + origin_array_ht = Z_ARRVAL_P(origin_array); + + // parse and check the origin_x + if (zend_hash_index_find(origin_array_ht, 0, (void**)&tmp) == SUCCESS) { + origin_x = Z_LVAL_PP(tmp); + } + else { + php_imagick_throw_exception(IMAGICKKERNEL_CLASS, MATRIX_ORIGIN_REQUIRED TSRMLS_CC); + goto cleanup; + } + + // origin_x is unsigned, so checking for > num_columns, also + // checks for < 0 + if (origin_x>=num_columns) { + zend_throw_exception_ex( + php_imagickkernel_exception_class_entry, + 5 TSRMLS_CC, + "origin_x for matrix is outside bounds of columns: %d", + origin_x + ); + goto cleanup; + } + + // parse and check the origin_y + if (zend_hash_index_find(origin_array_ht, 1, (void**)&tmp) == SUCCESS) { + origin_y = Z_LVAL_PP(tmp); + } + else { + php_imagick_throw_exception(IMAGICKKERNEL_CLASS, MATRIX_ORIGIN_REQUIRED TSRMLS_CC); + goto cleanup; + } + + // origin_y is unsigned, so checking for > num_rows, also + // checks for < 0 + if (origin_y>=num_rows) { + zend_throw_exception_ex( + php_imagickkernel_exception_class_entry, + 5 TSRMLS_CC, + "origin_y for matrix is outside bounds of rows: %d", + origin_y + ); + goto cleanup; + } + } + + kernel_info = imagick_createKernel(values, num_columns, num_rows, origin_x, origin_y); + createKernelZval(return_value, kernel_info TSRMLS_CC); + + return; + +cleanup: + if (values != NULL) { + RelinquishAlignedMemory(values); + } +} +#endif //end of zend_engine_3 +/* }}} */ + +static void imagick_fiddle_with_geometry_info(ssize_t type, GeometryFlags flags, GeometryInfo *geometry_info) { + + /* special handling of missing values in input string */ + switch( type ) { + /* Shape Kernel Defaults */ + case UnityKernel: { + if ((flags & WidthValue) == 0) + geometry_info->rho = 1.0; /* Default scale = 1.0, zero is valid */ + break; + } + case SquareKernel: + case DiamondKernel: + case OctagonKernel: + case DiskKernel: + case PlusKernel: + case CrossKernel: { + if ( (flags & HeightValue) == 0 ) { + geometry_info->sigma = 1.0; /* Default scale = 1.0, zero is valid */ + } + break; + } + case RingKernel: { + if ((flags & XValue) == 0) { + geometry_info->xi = 1.0; /* Default scale = 1.0, zero is valid */ + } + break; + } + case RectangleKernel: { /* Rectangle - set size defaults */ + if ((flags & WidthValue) == 0) { /* if no width then */ + geometry_info->rho = geometry_info->sigma; /* then width = height */ + } + if (geometry_info->rho < 1.0) { /* if width too small */ + geometry_info->rho = 3; /* then width = 3 */ + } + if (geometry_info->sigma < 1.0) { /* if height too small */ + geometry_info->sigma = geometry_info->rho; /* then height = width */ + } + if ((flags & XValue) == 0) { /* center offset if not defined */ + geometry_info->xi = (double)(((ssize_t)geometry_info->rho-1)/2); + } + if ((flags & YValue) == 0) { + geometry_info->psi = (double)(((ssize_t)geometry_info->sigma-1)/2); + } + break; + } + /* Distance Kernel Defaults */ + case ChebyshevKernel: + case ManhattanKernel: + case OctagonalKernel: + case EuclideanKernel: { + if ((flags & HeightValue) == 0) { /* no distance scale */ + geometry_info->sigma = 100.0; /* default distance scaling */ + } + else if ((flags & AspectValue ) != 0) { /* '!' flag */ + geometry_info->sigma = QuantumRange/(geometry_info->sigma+1); /* maximum pixel distance */ + } + else if ((flags & PercentValue ) != 0) { /* '%' flag */ + geometry_info->sigma *= QuantumRange/100.0; /* percentage of color range */ + } + break; + } + default: { + break; + } + } +} + +/* {{{ proto ImagickKernel ImagickKernel::fromBuiltin(type, string) + Create a kernel from a builtin in kernel. See http://www.imagemagick.org/Usage/morphology/#kernel for examples. Currently the 'rotation' symbols are not supported. Example: + $diamondKernel = ImagickKernel::fromBuiltIn(\Imagick::KERNEL_DIAMOND, "2"); +*/ +PHP_METHOD(imagickkernel, frombuiltin) +{ + im_long kernel_type; + GeometryInfo geometry_info = { + 0, //rho, + 0, //sigma, + 0, //xi, + 0, //psi, + 0, //chi; + }; + KernelInfo *kernel_info; + char *string; + IM_LEN_TYPE string_len; + GeometryFlags flags; +#if MagickLibVersion >= 0x700 + ExceptionInfo *_exception_info = NULL; +#endif + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &kernel_type, &string, &string_len) == FAILURE) { + return; + } + + flags = ParseGeometry(string, &geometry_info); + imagick_fiddle_with_geometry_info(kernel_type, flags, &geometry_info); + +#if MagickLibVersion >= 0x700 + //TODO - inspect exception info + kernel_info = AcquireKernelBuiltIn(kernel_type, &geometry_info, _exception_info); +#else + kernel_info = AcquireKernelBuiltIn(kernel_type, &geometry_info); +#endif + createKernelZval(return_value, kernel_info TSRMLS_CC); + + return; +} + +/* }}} */ + + +/* {{{ proto void ImagickKernel::addKernel(ImagickKernel kernel) + Attach another kernel to this kernel to allow them to both be applied in a single morphology or filter function. Returns the new combined kernel. +*/ +PHP_METHOD(imagickkernel, addkernel) +{ + zval *objvar; + KernelInfo *kernel_info_add_clone; + + KernelInfo *kernel_info; + KernelInfo *kernel_info_target; + + php_imagickkernel_object *kernel; + php_imagickkernel_object *internp; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &objvar, php_imagickkernel_sc_entry) == FAILURE) { + return; + } + + kernel = Z_IMAGICKKERNEL_P(objvar); + internp = Z_IMAGICKKERNEL_P(getThis()); + + if (kernel->kernel_info == NULL) { + zend_throw_exception(php_imagickkernel_exception_class_entry, "ImagickKernel is empty, cannot be used", (long)0 TSRMLS_CC); + RETURN_NULL(); + } + + kernel_info = internp->kernel_info; + do { + kernel_info_target = kernel_info; + kernel_info = kernel_info->next; + } while (kernel_info != NULL); + + kernel_info_add_clone = CloneKernelInfo(kernel->kernel_info); + kernel_info_target->next = kernel_info_add_clone; + + return; +} +/* }}} */ + + +/* {{{ proto ImagickKernel[] ImagickKernel::separate(void) + Separates a linked set of kernels and returns an array of ImagickKernels. +*/ +PHP_METHOD(imagickkernel, separate) +{ + php_imagickkernel_object *internp; + KernelInfo *kernel_info; + KernelInfo *kernel_info_copy; + int number_values; + KernelValueType * values_copy; + +#ifdef ZEND_ENGINE_3 + zval separate_object; +#else + zval *separate_object; +#endif + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internp = Z_IMAGICKKERNEL_P(getThis()); + IMAGICK_KERNEL_NOT_NULL_EMPTY(internp); + kernel_info = internp->kernel_info; + + array_init(return_value); + + while (kernel_info != NULL) { + number_values = kernel_info->width * kernel_info->height; + values_copy = (KernelValueType *)AcquireAlignedMemory(kernel_info->width, kernel_info->height*sizeof(KernelValueType)); + memcpy(values_copy, kernel_info->values, number_values * sizeof(KernelValueType)); + + kernel_info_copy = imagick_createKernel( + values_copy, + kernel_info->width, + kernel_info->height, + kernel_info->x, + kernel_info->y + ); + +#ifdef ZEND_ENGINE_3 + createKernelZval(&separate_object, kernel_info_copy TSRMLS_CC); + add_next_index_zval(return_value, &separate_object); +#else + MAKE_STD_ZVAL(separate_object); + createKernelZval(separate_object, kernel_info_copy TSRMLS_CC); + add_next_index_zval(return_value, separate_object); +#endif + kernel_info = kernel_info->next; + } + + return; +} +/* }}} */ + + +/* {{{ proto [] ImagickKernel::getMatrix(void) + Get the 2d matrix of values used in this kernel. The elements are either + float for elements that are used or 'false' if the element should be skipped. +*/ +PHP_METHOD(imagickkernel, getmatrix) +{ + php_imagickkernel_object *internp; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internp = Z_IMAGICKKERNEL_P(getThis()); + IMAGICK_KERNEL_NOT_NULL_EMPTY(internp); + + array_init(return_value); + php_imagickkernelvalues_to_zval(return_value, internp->kernel_info); + + return; +} +/* }}} */ + + + + + +/* {{{ proto [] ImagickKernel::scale(float scaling_factor[, int NORMALIZE_KERNEL_FLAG]) + ScaleKernelInfo() scales the given kernel list by the given amount, with or without + normalization of the sum of the kernel values (as per given flags). + + The exact behaviour of this function depends on the normalization type being used + please see http://www.imagemagick.org/api/morphology.php#ScaleKernelInfo for details. + + Flag should be one of NORMALIZE_KERNEL_VALUE, NORMALIZE_KERNEL_CORRELATE, + NORMALIZE_KERNEL_PERCENT or not set. +*/ +PHP_METHOD(imagickkernel, scale) +{ + php_imagickkernel_object *internp; + double scale; + im_long normalize_flag; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|l", &scale, &normalize_flag) == FAILURE) { + return; + } + + internp = Z_IMAGICKKERNEL_P(getThis()); + IMAGICK_KERNEL_NOT_NULL_EMPTY(internp); + ScaleKernelInfo(internp->kernel_info, scale, normalize_flag); + + return; +} +/* }}} */ + + + + +/* {{{ proto [] ImagickKernel::addUnityKernel(float scale) + Adds a given amount of the 'Unity' Convolution Kernel to the given pre-scaled + and normalized Kernel. This in effect adds that amount of the original image + into the resulting convolution kernel. The resulting effect is to convert the + defined kernels into blended soft-blurs, unsharp kernels or into sharpening kernels. +*/ +PHP_METHOD(imagickkernel, addunitykernel) +{ + php_imagickkernel_object *internp; + double scale; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &scale) == FAILURE) { + return; + } + + internp = Z_IMAGICKKERNEL_P(getThis()); + IMAGICK_KERNEL_NOT_NULL_EMPTY(internp); + UnityAddKernelInfo(internp->kernel_info, scale); + + return; +} +/* }}} */ + +#endif diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/imagickpixel_class.c php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/imagickpixel_class.c --- php-imagick-3.4.4/imagick-3.4.4+php8.0/imagickpixel_class.c 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/imagickpixel_class.c 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,834 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 / Imagick | + +----------------------------------------------------------------------+ + | Copyright (c) 2006-2013 Mikko Koppanen, Scott MacVicar | + | ImageMagick (c) ImageMagick Studio LLC | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Mikko Kopppanen | + | Scott MacVicar | + +----------------------------------------------------------------------+ +*/ + +#include "php_imagick.h" +#include "php_imagick_defs.h" +#include "php_imagick_macros.h" +#include "php_imagick_helpers.h" + +#if MagickLibVersion > 0x628 +/* {{{ proto array ImagickPixel::getHSL() + Returns the normalized HSL color of the pixel wand in an array with the keys "hue", "saturation", and "luminosity". +*/ +PHP_METHOD(imagickpixel, gethsl) +{ + php_imagickpixel_object *internp; + double hue, saturation, luminosity; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internp = Z_IMAGICKPIXEL_P(getThis()); + if (php_imagickpixel_ensure_not_null(internp->pixel_wand) == 0) { + return; + } + + PixelGetHSL(internp->pixel_wand, &hue, &saturation, &luminosity); + + array_init(return_value); + add_assoc_double(return_value, "hue", hue); + add_assoc_double(return_value, "saturation", saturation); + add_assoc_double(return_value, "luminosity", luminosity); + return; +} +/* }}} */ + +/* {{{ proto bool ImagickPixel::setHSL(float hue, float saturation, float luminosity) + Sets the normalized HSL color of the pixel wand. +*/ +PHP_METHOD(imagickpixel, sethsl) +{ + php_imagickpixel_object *internp; + double hue, saturation, luminosity; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ddd", &hue, &saturation, &luminosity) == FAILURE) { + return; + } + + internp = Z_IMAGICKPIXEL_P(getThis()); + if (php_imagickpixel_ensure_not_null(internp->pixel_wand) == 0) { + return; + } + + PixelSetHSL(internp->pixel_wand, hue, saturation, luminosity); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto Quantum ImagickPixel::getColorValueQuantum(int color) + Gets the quantum value of a color in the ImagickPixel. Quantum is a float if ImageMagick was compiled with HDRI + otherwise an integer. +*/ +PHP_METHOD(imagickpixel, getcolorvaluequantum) +{ + php_imagickpixel_object *internp; + im_long color; + Quantum color_value; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &color) == FAILURE) { + return; + } + + internp = Z_IMAGICKPIXEL_P(getThis()); + if (php_imagickpixel_ensure_not_null(internp->pixel_wand) == 0) { + return; + } + + switch (color) { + + case PHP_IMAGICK_COLOR_BLACK: + color_value = PixelGetBlackQuantum(internp->pixel_wand); + break; + + case PHP_IMAGICK_COLOR_BLUE: + color_value = PixelGetBlueQuantum(internp->pixel_wand); + break; + + case PHP_IMAGICK_COLOR_CYAN: + color_value = PixelGetCyanQuantum(internp->pixel_wand); + break; + + case PHP_IMAGICK_COLOR_GREEN: + color_value = PixelGetGreenQuantum(internp->pixel_wand); + break; + + case PHP_IMAGICK_COLOR_RED: + color_value = PixelGetRedQuantum(internp->pixel_wand); + break; + + case PHP_IMAGICK_COLOR_YELLOW: + color_value = PixelGetYellowQuantum(internp->pixel_wand); + break; + + case PHP_IMAGICK_COLOR_MAGENTA: + color_value = PixelGetMagentaQuantum(internp->pixel_wand); + break; + +#if MagickLibVersion < 0x700 + case PHP_IMAGICK_COLOR_OPACITY: + color_value = PixelGetOpacityQuantum(internp->pixel_wand); + break; +#endif + + case PHP_IMAGICK_COLOR_ALPHA: + color_value = PixelGetAlphaQuantum(internp->pixel_wand); + break; + + default: + php_imagick_throw_exception (IMAGICKPIXEL_CLASS, "Unknown color type" TSRMLS_CC); + return; + break; + } + +#if MAGICKCORE_HDRI_ENABLE + RETVAL_DOUBLE(color_value); +#else + RETVAL_LONG(color_value); +#endif +} +/* }}} */ + +/* {{{ proto bool ImagickPixel::setColorValueQuantum(int color, float value) + Sets the quantum color of the ImagickPixel. +*/ +PHP_METHOD(imagickpixel, setcolorvaluequantum) +{ + php_imagickpixel_object *internp; + im_long color; + +#if MAGICKCORE_HDRI_ENABLE + double color_value; + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ld", &color, &color_value) == FAILURE) { + return; + } +#else + im_long color_value; + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &color, &color_value) == FAILURE) { + return; + } +#endif + + internp = Z_IMAGICKPIXEL_P(getThis()); + if (php_imagickpixel_ensure_not_null(internp->pixel_wand) == 0) { + return; + } + + switch (color) { + + case PHP_IMAGICK_COLOR_BLACK: + PixelSetBlackQuantum(internp->pixel_wand, color_value); + break; + + case PHP_IMAGICK_COLOR_BLUE: + PixelSetBlueQuantum(internp->pixel_wand, color_value); + break; + + case PHP_IMAGICK_COLOR_CYAN: + PixelSetCyanQuantum(internp->pixel_wand, color_value); + break; + + case PHP_IMAGICK_COLOR_GREEN: + PixelSetGreenQuantum(internp->pixel_wand, color_value); + break; + + case PHP_IMAGICK_COLOR_RED: + PixelSetRedQuantum(internp->pixel_wand, color_value); + break; + + case PHP_IMAGICK_COLOR_YELLOW: + PixelSetYellowQuantum(internp->pixel_wand, color_value); + break; + + case PHP_IMAGICK_COLOR_MAGENTA: + PixelSetMagentaQuantum(internp->pixel_wand, color_value); + break; + +#if MagickLibVersion < 0x700 + case PHP_IMAGICK_COLOR_OPACITY: + PixelSetOpacityQuantum(internp->pixel_wand, color_value); + break; +#endif + + case PHP_IMAGICK_COLOR_ALPHA: + PixelSetAlphaQuantum(internp->pixel_wand, color_value); + break; + + default: + php_imagick_throw_exception (IMAGICKPIXEL_CLASS, "Unknown color type" TSRMLS_CC); + return; + break; + } + RETVAL_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickPixel::getIndex() + Gets the colormap index of the pixel wand +*/ +PHP_METHOD(imagickpixel, getindex) +{ + php_imagickpixel_object *internp; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internp = Z_IMAGICKPIXEL_P(getThis()); + if (php_imagickpixel_ensure_not_null(internp->pixel_wand) == 0) { + return; + } + + RETVAL_LONG(PixelGetIndex(internp->pixel_wand)); +} +/* }}} */ + +/* {{{ proto bool ImagickPixel::setIndex(int pixel_packet) + Sets the colormap index of the pixel wand +*/ +PHP_METHOD(imagickpixel, setindex) +{ + php_imagickpixel_object *internp; + im_long index; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &index) == FAILURE) { + return; + } + + internp = Z_IMAGICKPIXEL_P(getThis()); + if (php_imagickpixel_ensure_not_null(internp->pixel_wand) == 0) { + return; + } + + PixelSetIndex(internp->pixel_wand, index); + RETURN_TRUE; +} +/* }}} */ +#endif + +/* {{{ proto ImagickPixel ImagickPixel::__construct([string color] ) + The ImagickPixel constructor +*/ +PHP_METHOD(imagickpixel, __construct) +{ + php_imagickpixel_object *internp; + char *color_name = NULL; + IM_LEN_TYPE color_name_len = 0; + + // This suppresses an 'unused parameter' warning. + (void)return_value; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &color_name, &color_name_len) == FAILURE) { + return; + } + + internp = Z_IMAGICKPIXEL_P(getThis()); + + if (internp->pixel_wand != NULL) { + DestroyPixelWand(internp->pixel_wand); + } + + internp->pixel_wand = NewPixelWand(); + + if (!internp->pixel_wand) { + php_imagick_throw_exception (IMAGICKPIXEL_CLASS, "Failed to allocate PixelWand structure" TSRMLS_CC); + return; + } + + /* If color was given as parameter, set it here.*/ + if (color_name && color_name_len) { + if (PixelSetColor(internp->pixel_wand, color_name) == MagickFalse) { + php_imagick_throw_exception (IMAGICKPIXEL_CLASS, "Unable to construct ImagickPixel" TSRMLS_CC); + return; + } + } +} +/* }}} */ + +/* {{{ proto bool ImagickPixel::setColor(string color) + Sets the color of the pixel wand with a string (e.g. "blue", "#0000ff", "rgb(0,0,255)", "cmyk(100,100,100,10)", etc.). +*/ +PHP_METHOD(imagickpixel, setcolor) +{ + char *color_name; + IM_LEN_TYPE color_name_len; + + php_imagickpixel_object *internp; + MagickBooleanType status; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &color_name, &color_name_len) == FAILURE) { + return; + } + + internp = Z_IMAGICKPIXEL_P(getThis()); + if (php_imagickpixel_ensure_not_null(internp->pixel_wand) == 0) { + return; + } + + status = PixelSetColor(internp->pixel_wand, color_name); + + if (status == MagickFalse) { + php_imagick_convert_imagickpixel_exception (internp->pixel_wand, "Unable to set ImagickPixel color" TSRMLS_CC); + return; + } + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickPixel::clear() + Clears resources associated with the wand. +*/ +PHP_METHOD(imagickpixel, clear) +{ + php_imagickpixel_object *internp; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internp = Z_IMAGICKPIXEL_P(getThis()); + if (php_imagickpixel_ensure_not_null(internp->pixel_wand) == 0) { + return; + } + + ClearPixelWand(internp->pixel_wand); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickPixel::isSimilar(float fuzz) + Returns true if the distance between two colors is less than the specified distance. +*/ +static +void s_is_pixelwand_similar(INTERNAL_FUNCTION_PARAMETERS, zend_bool use_quantum) +{ + zval *param; + double fuzz; + php_imagickpixel_object *internp; + MagickBooleanType status; + PixelWand *color_wand; + zend_bool allocated; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zd", ¶m, &fuzz) == FAILURE) { + return; + } + + internp = Z_IMAGICKPIXEL_P(getThis()); + if (php_imagickpixel_ensure_not_null(internp->pixel_wand) == 0) { + return; + } + + color_wand = php_imagick_zval_to_pixelwand (param, IMAGICKPIXEL_CLASS, &allocated TSRMLS_CC); + if (!color_wand) + return; + + status = IsPixelWandSimilar(internp->pixel_wand, color_wand, (use_quantum ? (QuantumRange * fuzz) : fuzz)); + if (allocated) + color_wand = DestroyPixelWand (color_wand); + + if (status == MagickFalse) { + RETURN_FALSE; + } + + RETURN_TRUE; +} + + +/* {{{ proto bool ImagickPixel::isPixelSimilarQuantum(ImagickPixel pixel, float fuzz) + Returns true if the distance between two colors is less than the specified distance. + The fuzz value should be in the range 0-QuantumRange. + The maximum value represents the longest possible distance in the colorspace. + e.g. from RGB(0, 0, 0) to RGB(255, 255, 255) for the RGB colorspace +*/ +PHP_METHOD(imagickpixel, ispixelsimilarquantum) +{ + s_is_pixelwand_similar (INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); +} +/* }}} */ + +/* {{{ proto bool ImagickPixel::isPixelSimilar(ImagickPixel pixel, float fuzz) + Returns true if the distance between two colors is less than the specified distance. + The fuzz value should be in the range 0-1. + The maximum value represents the longest possible distance in the colorspace. + e.g. from RGB(0, 0, 0) to RGB(255, 255, 255) for the RGB colorspace +*/ +PHP_METHOD(imagickpixel, ispixelsimilar) +{ + s_is_pixelwand_similar (INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); +} +/* }}} */ + +/* {{{ proto float ImagickPixel::getColorValue(int color) + Gets the normalized value of a color in the ImagickPixel. +*/ +PHP_METHOD(imagickpixel, getcolorvalue) +{ + php_imagick_color_t color_enum; + php_imagickpixel_object *internp; + im_long color; + double color_value = 0; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &color) == FAILURE) { + return; + } + + internp = Z_IMAGICKPIXEL_P(getThis()); + if (php_imagickpixel_ensure_not_null(internp->pixel_wand) == 0) { + return; + } + + if (color <= PHP_IMAGICK_COLOR_MIN || color >= PHP_IMAGICK_COLOR_MAX) { + php_imagick_throw_exception (IMAGICKPIXEL_CLASS, "Unknown color type" TSRMLS_CC); + return; + } + + color_enum = color; + + switch (color_enum) { + + case PHP_IMAGICK_COLOR_BLACK: + color_value = PixelGetBlack(internp->pixel_wand); + break; + + case PHP_IMAGICK_COLOR_BLUE: + color_value = PixelGetBlue(internp->pixel_wand); + break; + + case PHP_IMAGICK_COLOR_CYAN: + color_value = PixelGetCyan(internp->pixel_wand); + break; + + case PHP_IMAGICK_COLOR_GREEN: + color_value = PixelGetGreen(internp->pixel_wand); + break; + + case PHP_IMAGICK_COLOR_RED: + color_value = PixelGetRed(internp->pixel_wand); + break; + + case PHP_IMAGICK_COLOR_YELLOW: + color_value = PixelGetYellow(internp->pixel_wand); + break; + + case PHP_IMAGICK_COLOR_MAGENTA: + color_value = PixelGetMagenta(internp->pixel_wand); + break; + +#if MagickLibVersion < 0x700 + case PHP_IMAGICK_COLOR_OPACITY: + color_value = PixelGetOpacity(internp->pixel_wand); + break; +#endif + + case PHP_IMAGICK_COLOR_ALPHA: + color_value = PixelGetAlpha(internp->pixel_wand); + break; + +#if MagickLibVersion > 0x628 + case PHP_IMAGICK_COLOR_FUZZ: + color_value = PixelGetFuzz(internp->pixel_wand); + break; +#endif + + default: + php_imagick_throw_exception (IMAGICKPIXEL_CLASS, "Unknown color type" TSRMLS_CC); + return; + break; + } + RETVAL_DOUBLE(color_value); +} +/* }}} */ + +/* {{{ proto float ImagickPixel::setColorValue(int color, float value ) + Sets the normalized color of the ImagickPixel. +*/ +PHP_METHOD(imagickpixel, setcolorvalue) +{ + php_imagick_color_t color_enum; + php_imagickpixel_object *internp; + im_long color; + double color_value; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ld", &color, &color_value) == FAILURE) { + return; + } + + internp = Z_IMAGICKPIXEL_P(getThis()); + if (php_imagickpixel_ensure_not_null(internp->pixel_wand) == 0) { + return; + } + + if (color <= PHP_IMAGICK_COLOR_MIN || color >= PHP_IMAGICK_COLOR_MAX) { + php_imagick_throw_exception (IMAGICKPIXEL_CLASS, "Unknown color type" TSRMLS_CC); + return; + } + + color_enum = color; + + switch (color_enum) { + + case PHP_IMAGICK_COLOR_BLACK: + PixelSetBlack(internp->pixel_wand, color_value); + break; + + case PHP_IMAGICK_COLOR_BLUE: + PixelSetBlue(internp->pixel_wand, color_value); + break; + + case PHP_IMAGICK_COLOR_CYAN: + PixelSetCyan(internp->pixel_wand, color_value); + break; + + case PHP_IMAGICK_COLOR_GREEN: + PixelSetGreen(internp->pixel_wand, color_value); + break; + + case PHP_IMAGICK_COLOR_RED: + PixelSetRed(internp->pixel_wand, color_value); + break; + + case PHP_IMAGICK_COLOR_YELLOW: + PixelSetYellow(internp->pixel_wand, color_value); + break; + + case PHP_IMAGICK_COLOR_MAGENTA: + PixelSetMagenta(internp->pixel_wand, color_value); + break; + +#if MagickLibVersion < 0x700 + case PHP_IMAGICK_COLOR_OPACITY: + PixelSetOpacity(internp->pixel_wand, color_value); + break; +#endif + + case PHP_IMAGICK_COLOR_ALPHA: + PixelSetAlpha(internp->pixel_wand, color_value); + break; + +#if MagickLibVersion > 0x628 + case PHP_IMAGICK_COLOR_FUZZ: + PixelSetFuzz(internp->pixel_wand, color_value); + break; +#endif + + default: + php_imagick_throw_exception (IMAGICKPIXEL_CLASS, "Unknown color type" TSRMLS_CC); + return; + break; + } + RETVAL_TRUE; +} +/* }}} */ + +/* {{{ proto array ImagickPixel::getColor([int normalization]) + Returns the color of the pixel in an array + normalization - 0 - values returned in the range 0,255 and will be ints, except + for legacy reasons alpha which is 0-1 + normalization - 1 - values returned in the range 0,1 and will be floats + normalization - 2 - values returned in the range 0,255 and will be ints including alpha + values i.e. float if ImageMagick was compiled with HDRI, or integers normally. +*/ +PHP_METHOD(imagickpixel, getcolor) +{ + php_imagickpixel_object *internp; + im_long normalization = 0; + double red, green, blue, alpha; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &normalization) == FAILURE) { + return; + } + + internp = Z_IMAGICKPIXEL_P(getThis()); + if (php_imagickpixel_ensure_not_null(internp->pixel_wand) == 0) { + return; + } + array_init(return_value); + + red = PixelGetRed(internp->pixel_wand); + green = PixelGetGreen(internp->pixel_wand); + blue = PixelGetBlue(internp->pixel_wand); + alpha = PixelGetAlpha(internp->pixel_wand); + + switch (normalization){ + //values returned in the range 0,255 and will be ints + case(0): { + //Leave like this for legacy code + //TODO fix the alpha not being normalised at next major/minor verysion + red *= 255; + green *= 255; + blue *= 255; + + //values are always >=0, so the rounding below may not be necessary + add_assoc_long(return_value, "r", (long) (red > 0.0 ? red + 0.5 : red - 0.5)); + add_assoc_long(return_value, "g", (long) (green > 0.0 ? green + 0.5 : green - 0.5)); + add_assoc_long(return_value, "b", (long) (blue > 0.0 ? blue + 0.5 : blue - 0.5)); + add_assoc_long(return_value, "a", alpha); + break; + } + + //values returned in the range 0,1 and will be floats + case(1): { + add_assoc_double(return_value, "r", red); + add_assoc_double(return_value, "g", green); + add_assoc_double(return_value, "b", blue); + add_assoc_double(return_value, "a", alpha); + break; + } + + case(2): { + red *= 255; + green *= 255; + blue *= 255; + alpha *= 255; + + //values are always >=0, so the rounding below may not be necessary + add_assoc_long(return_value, "r", (long) (red > 0.0 ? red + 0.5 : red - 0.5)); + add_assoc_long(return_value, "g", (long) (green > 0.0 ? green + 0.5 : green - 0.5)); + add_assoc_long(return_value, "b", (long) (blue > 0.0 ? blue + 0.5 : blue - 0.5)); + add_assoc_long(return_value, "a", (long) (alpha > 0.0 ? alpha + 0.5 : alpha - 0.5)); + break; + } + } + + return; +} +/* }}} */ + + +/* {{{ proto array ImagickPixel::getColorQuantum() + Returns the color of the pixel in an array as Quantum values. If ImageMagick was compiled + as HDRI these will be floats, otherwise they will be integers +*/ +PHP_METHOD(imagickpixel, getcolorquantum) +{ + php_imagickpixel_object *internp; + Quantum red, green, blue, alpha; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internp = Z_IMAGICKPIXEL_P(getThis()); + if (php_imagickpixel_ensure_not_null(internp->pixel_wand) == 0) { + return; + } + array_init(return_value); + + red = PixelGetRedQuantum(internp->pixel_wand); + green = PixelGetGreenQuantum(internp->pixel_wand); + blue = PixelGetBlueQuantum(internp->pixel_wand) ; + alpha = PixelGetAlphaQuantum(internp->pixel_wand); + + +#if MAGICKCORE_HDRI_ENABLE + add_assoc_double(return_value, "r", red); + add_assoc_double(return_value, "g", green); + add_assoc_double(return_value, "b", blue); + add_assoc_double(return_value, "a", alpha); +#else + add_assoc_long(return_value, "r", (long)red); + add_assoc_long(return_value, "g", (long)green); + add_assoc_long(return_value, "b", (long)blue); + add_assoc_long(return_value, "a", (long)alpha); +#endif + + return; +} +/* }}} */ + +/* {{{ proto array ImagickPixel::getColorAsString(void ) + Returns the color as a string +*/ +PHP_METHOD(imagickpixel, getcolorasstring) +{ + php_imagickpixel_object *internp; + char *color_string; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internp = Z_IMAGICKPIXEL_P(getThis()); + if (php_imagickpixel_ensure_not_null(internp->pixel_wand) == 0) { + return; + } + + color_string = PixelGetColorAsString(internp->pixel_wand); + IM_ZVAL_STRING(return_value, color_string); + + IMAGICK_FREE_MAGICK_MEMORY(color_string); + return; +} +/* }}} */ + +/* {{{ proto ImagickPixel ImagickPixel::clone(void) + Clones the ImagickPixel +*/ +PHP_METHOD(imagickpixel, clone) +{ + php_imagickpixel_object *internp; + php_imagickpixel_object *intern_return; + PixelWand *pixel_wand; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + IMAGICK_METHOD_DEPRECATED("ImagickPixel", "clone"); + + internp = Z_IMAGICKPIXEL_P(getThis()); + + pixel_wand = php_imagick_clone_pixelwand (internp->pixel_wand); + if (!pixel_wand) { + php_imagick_throw_exception (IMAGICKPIXEL_CLASS, "Failed to allocate" TSRMLS_CC); + return; + } + + object_init_ex(return_value, php_imagickpixel_sc_entry); + intern_return = Z_IMAGICKPIXEL_P(return_value); + + php_imagick_replace_pixelwand(intern_return, pixel_wand); + return; +} +/* }}} */ + +/* {{{ proto int ImagickPixel::getColorCount() + Returns the color count associated with this color. +*/ +PHP_METHOD(imagickpixel, getcolorcount) +{ + php_imagickpixel_object *internp; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internp = Z_IMAGICKPIXEL_P(getThis()); + if (php_imagickpixel_ensure_not_null(internp->pixel_wand) == 0) { + return; + } + + RETVAL_LONG(PixelGetColorCount(internp->pixel_wand)); +} +/* }}} */ + +/* {{{ proto int ImagickPixel::setColorCount(int colorCount) + Sets the color count associated with this color. +*/ +PHP_METHOD(imagickpixel, setcolorcount) +{ + php_imagickpixel_object *internp; + im_long color_count; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &color_count) == FAILURE) { + return; + } + + internp = Z_IMAGICKPIXEL_P(getThis()); + if (php_imagickpixel_ensure_not_null(internp->pixel_wand) == 0) { + return; + } + + PixelSetColorCount(internp->pixel_wand, color_count); + RETVAL_TRUE; +} +/* }}} */ + +#if MagickLibVersion >= 0x693 +/* {{{ proto bool ImagickPixel::setColorFromPixel(ImagickPixel $srcPixel) + Sets the color count associated with this color from another ImagickPixel object. +*/ +PHP_METHOD(imagickpixel, setcolorfrompixel) +{ + php_imagickpixel_object *internp, *src_pixel; + zval *objvar; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &objvar, php_imagickpixel_sc_entry) == FAILURE) { + return; + } + + internp = Z_IMAGICKPIXEL_P(getThis()); + if (php_imagickpixel_ensure_not_null(internp->pixel_wand) == 0) { + return; + } + src_pixel = Z_IMAGICKPIXEL_P(objvar); + if (php_imagickpixel_ensure_not_null(src_pixel->pixel_wand) == 0) { + return; + } + + PixelSetColorFromWand(internp->pixel_wand, src_pixel->pixel_wand); + + RETVAL_TRUE; +} +/* }}} */ + +#endif //#if MagickLibVersion >= 0x693 \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/imagickpixeliterator_class.c php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/imagickpixeliterator_class.c --- php-imagick-3.4.4/imagick-3.4.4+php8.0/imagickpixeliterator_class.c 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/imagickpixeliterator_class.c 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,635 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 / Imagick | + +----------------------------------------------------------------------+ + | Copyright (c) 2006-2013 Mikko Koppanen, Scott MacVicar | + | ImageMagick (c) ImageMagick Studio LLC | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Mikko Kopppanen | + | Scott MacVicar | + +----------------------------------------------------------------------+ +*/ + +#include "php_imagick.h" +#include "php_imagick_defs.h" +#include "php_imagick_macros.h" +#include "php_imagick_helpers.h" + +#if MagickLibVersion <= 0x628 +static +long s_count_pixeliterator_rows(php_imagickpixeliterator_object *internpix) +{ + long rows = 0, tmp; + PixelWand **row; + PixelResetIterator(internpix->pixel_iterator); + + while ((row = PixelGetNextIteratorRow(internpix->pixel_iterator, &tmp)) != NULL) + rows++; + + return rows; +} +#endif + +void php_imagick_pixel_iterator_new (PixelIterator *pixel_it, zval *return_value TSRMLS_DC) +{ + php_imagickpixeliterator_object *internpix; + + object_init_ex(return_value, php_imagickpixeliterator_sc_entry); + internpix = Z_IMAGICKPIXELITERATOR_P(return_value); + + internpix->pixel_iterator = pixel_it; + internpix->initialized = 1; + +#if MagickLibVersion <= 0x628 + internpix->rows = s_count_pixeliterator_rows (internpix); +#endif +} + +/* {{{ proto ImagickPixelIterator ImagickPixelIterator::__construct(Imagick source) + The ImagickPixelIterator constructor +*/ +PHP_METHOD(imagickpixeliterator, __construct) +{ + zval *magick_object; + php_imagickpixeliterator_object *internpix; + php_imagick_object *intern; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|llll", &magick_object, php_imagick_sc_entry) == FAILURE) { + return; + } + + internpix = Z_IMAGICKPIXELITERATOR_P(getThis()); + intern = Z_IMAGICK_P(magick_object); + + if (!intern->magick_wand) { + php_imagick_throw_exception (IMAGICKPIXELITERATOR_CLASS, "Invalid Imagick object passed" TSRMLS_CC); + return; + } + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + internpix->pixel_iterator = NewPixelIterator(intern->magick_wand); + + if (!internpix->pixel_iterator) { + php_imagick_throw_exception (IMAGICKPIXELITERATOR_CLASS, "Can not allocate ImagickPixelIterator" TSRMLS_CC); + return; + } + +#if MagickLibVersion <= 0x628 + internpix->rows = s_count_pixeliterator_rows (internpix); +#endif + + internpix->initialized = 1; + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickPixelIterator::resetIterator() + Resets the pixel iterator. Use it in conjunction with PixelGetNextIteratorRow() to iterate over all the pixels in a pixel container. +*/ +PHP_METHOD(imagickpixeliterator, resetiterator) +{ + php_imagickpixeliterator_object *internpix; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internpix = Z_IMAGICKPIXELITERATOR_P(getThis()); + + if (!internpix->initialized) { + php_imagick_throw_exception (IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly" TSRMLS_CC); + return; + } + + PixelResetIterator(internpix->pixel_iterator); +#if MagickLibVersion <= 0x628 + internpix->iterator_position = 0; +#endif + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickPixelIterator::syncIterator() + Syncs the pixel iterator. +*/ +PHP_METHOD(imagickpixeliterator, synciterator) +{ + php_imagickpixeliterator_object *internpix; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internpix = Z_IMAGICKPIXELITERATOR_P(getThis()); + + if (!internpix->initialized) { + php_imagick_throw_exception (IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly" TSRMLS_CC); + return; + } + + PixelSyncIterator(internpix->pixel_iterator); + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickPixelIterator::setIteratorFirstRow() + Sets the pixel iterator to the first pixel row. +*/ +PHP_METHOD(imagickpixeliterator, setiteratorfirstrow) +{ + php_imagickpixeliterator_object *internpix; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internpix = Z_IMAGICKPIXELITERATOR_P(getThis()); + + if (!internpix->initialized) { + php_imagick_throw_exception (IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly" TSRMLS_CC); + return; + } + + PixelSetFirstIteratorRow(internpix->pixel_iterator); +#if MagickLibVersion <= 0x628 + internpix->iterator_position = 0; +#endif + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool ImagickPixelIterator::setIteratorLastRow() + Sets the pixel iterator to the last pixel row. +*/ +PHP_METHOD(imagickpixeliterator, setiteratorlastrow) +{ + php_imagickpixeliterator_object *internpix; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internpix = Z_IMAGICKPIXELITERATOR_P(getThis()); + + if (!internpix->initialized) { + php_imagick_throw_exception (IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly" TSRMLS_CC); + return; + } + + PixelSetLastIteratorRow(internpix->pixel_iterator); +#if MagickLibVersion <= 0x628 + internpix->iterator_position = (internpix->rows - 1); +#endif + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto ImagickPixelIterator ImagickPixelIterator::getPixelIterator(Imagick source) + Returns a new pixel iterator, static method. This is equivalent to Imagick::getPixelIterator + which probably ought to be used in preference to this method. +*/ +PHP_METHOD(imagickpixeliterator, getpixeliterator) +{ + PixelIterator *pixel_it; + zval *magick_object; + php_imagick_object *intern; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &magick_object, php_imagick_sc_entry) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(magick_object); + + if (!intern->magick_wand) { + php_imagick_throw_exception (IMAGICKPIXELITERATOR_CLASS, "Invalid Imagick object passed" TSRMLS_CC); + return; + } + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + pixel_it = NewPixelIterator (intern->magick_wand); + if (!pixel_it) { + php_imagick_throw_exception (IMAGICKPIXELITERATOR_CLASS, "Can not allocate ImagickPixelIterator" TSRMLS_CC); + return; + } + + php_imagick_pixel_iterator_new (pixel_it, return_value TSRMLS_CC); + return; +} +/* }}} */ + +/* {{{ proto ImagickPixelIterator ImagickPixelIterator::newPixelIterator(Imagick source) + Returns a new pixel iterator. +*/ +PHP_METHOD(imagickpixeliterator, newpixeliterator) +{ + PixelIterator *pixel_it; + zval *magick_object; + php_imagickpixeliterator_object *internpix; + php_imagick_object *intern; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &magick_object, php_imagick_sc_entry) == FAILURE) { + return; + } + + IMAGICK_METHOD_DEPRECATED_USE_INSTEAD("ImagickPixelIterator", "newPixelIterator", "ImagickPixelIterator", "getPixelIterator"); + + internpix = Z_IMAGICKPIXELITERATOR_P(getThis() ); + intern = Z_IMAGICK_P(magick_object); + + if (!intern->magick_wand) { + php_imagick_throw_exception (IMAGICKPIXELITERATOR_CLASS, "Invalid Imagick object passed" TSRMLS_CC); + return; + } + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + pixel_it = NewPixelIterator(intern->magick_wand); + + if (!pixel_it) { + php_imagick_throw_exception (IMAGICKPIXELITERATOR_CLASS, "Can not allocate ImagickPixelIterator" TSRMLS_CC); + return; + } + + if (internpix->initialized && internpix->pixel_iterator) + DestroyPixelIterator (internpix->pixel_iterator); + + internpix->pixel_iterator = pixel_it; +#if MagickLibVersion <= 0x628 + internpix->rows = s_count_pixeliterator_rows (internpix); +#endif + + internpix->initialized = 1; + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto ImagickPixelIterator ImagickPixelIterator::getPixelRegionIterator(Imagick source, int x, int y, int columns, int rows) + Returns a new pixel region iterator, static method. This is equivalent to the non-static + Imagick::getPixelRegionIterator which ought to be used in preference to this method. +*/ +PHP_METHOD(imagickpixeliterator, getpixelregioniterator) +{ + PixelIterator *pixel_it; + zval *magick_object; + php_imagick_object *intern; + long x, y, columns, rows; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ollll", &magick_object, php_imagick_sc_entry, &x, &y, &columns, &rows) == FAILURE) { + return; + } + + intern = Z_IMAGICK_P(magick_object); + + if (!intern->magick_wand) { + php_imagick_throw_exception (IMAGICKPIXELITERATOR_CLASS, "Invalid Imagick object passed" TSRMLS_CC); + return; + } + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + pixel_it = NewPixelRegionIterator(intern->magick_wand, x, y, columns, rows); + if (!pixel_it) { + php_imagick_throw_exception (IMAGICKPIXELITERATOR_CLASS, "Can not allocate ImagickPixelIterator" TSRMLS_CC); + return; + } + + php_imagick_pixel_iterator_new (pixel_it, return_value TSRMLS_CC); + return; +} +/* }}} */ + +/* {{{ proto bool ImagickPixelIterator::newPixelRegionIterator(Imagick source, int x, int y, int columns, int rows) + Returns a new pixel iterator. +*/ +PHP_METHOD(imagickpixeliterator, newpixelregioniterator) +{ + PixelIterator *pixel_it; + zval *magick_object; + php_imagickpixeliterator_object *internpix; + php_imagick_object *intern; + long x, y, columns, rows; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ollll", &magick_object, php_imagick_sc_entry, &x, &y, &columns, &rows) == FAILURE) { + return; + } + + IMAGICK_METHOD_DEPRECATED_USE_INSTEAD("ImagickPixelIterator", "newPixelRegionIterator", "ImagickPixelIterator", "getPixelRegionIterator"); + + internpix = Z_IMAGICKPIXELITERATOR_P(getThis()); + intern = Z_IMAGICK_P(magick_object); + + if (!intern->magick_wand) { + php_imagick_throw_exception (IMAGICKPIXELITERATOR_CLASS, "Invalid Imagick object passed" TSRMLS_CC); + return; + } + + if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) + return; + + pixel_it = NewPixelRegionIterator(intern->magick_wand, x, y, columns, rows); + + if (!pixel_it) { + php_imagick_throw_exception (IMAGICKPIXELITERATOR_CLASS, "Can not allocate ImagickPixelIterator" TSRMLS_CC); + return; + } + + if (internpix->initialized && internpix->pixel_iterator) + DestroyPixelIterator (internpix->pixel_iterator); + + internpix->pixel_iterator = pixel_it; + +#if MagickLibVersion <= 0x628 + internpix->rows = s_count_pixeliterator_rows (internpix); +#endif + internpix->initialized = 1; + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto int ImagickPixelIterator::getIteratorRow() + Returns the crurent pixel iterator row. +*/ +PHP_METHOD(imagickpixeliterator, getiteratorrow) +{ + php_imagickpixeliterator_object *internpix; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + internpix = Z_IMAGICKPIXELITERATOR_P(getThis()); + + if (!internpix->initialized) { + php_imagick_throw_exception (IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly" TSRMLS_CC); + return; + } + +#if MagickLibVersion <= 0x628 + ZVAL_LONG(return_value, internpix->iterator_position); +#else + ZVAL_LONG(return_value, (long) PixelGetIteratorRow(internpix->pixel_iterator)); +#endif + return; +} +/* }}} */ + +/* {{{ proto bool ImagickPixelIterator::setIteratorRow(int row) + Set the pixel iterator row. +*/ +PHP_METHOD(imagickpixeliterator, setiteratorrow) +{ + php_imagickpixeliterator_object *internpix; + MagickBooleanType status; + long row; + + /* Parse parameters given to function */ + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &row) == FAILURE) { + return; + } + + internpix = Z_IMAGICKPIXELITERATOR_P(getThis()); + + if (!internpix->initialized) { + php_imagick_throw_exception (IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly" TSRMLS_CC); + return; + } + + status = PixelSetIteratorRow(internpix->pixel_iterator, row); + + if (status == MagickFalse) { + php_imagick_convert_imagickpixeliterator_exception(internpix->pixel_iterator, "Unable to set iterator row" TSRMLS_CC); + return; + } +#if MagickLibVersion <= 0x628 + internpix->iterator_position = row; +#endif + RETURN_TRUE; +} +/* }}} */ + +static +void s_pixelwands_to_zval (PixelWand **wand_array, unsigned long num_wands, zval *return_value TSRMLS_DC) +{ + php_imagickpixel_object *internp; +#ifdef ZEND_ENGINE_3 + zval obj; +#else + zval *obj; +#endif + + unsigned long i; + + array_init(return_value); + + for (i = 0; i < num_wands; i++) { +#ifdef ZEND_ENGINE_3 + object_init_ex(&obj, php_imagickpixel_sc_entry); + internp = Z_IMAGICKPIXEL_P(&obj); +#else + MAKE_STD_ZVAL(obj); + object_init_ex(obj, php_imagickpixel_sc_entry); + internp = Z_IMAGICKPIXEL_P(obj); +#endif + + internp->initialized_via_iterator = 1; + + php_imagick_replace_pixelwand(internp, wand_array[i]); +#ifdef ZEND_ENGINE_3 + add_next_index_zval(return_value, &obj); +#else + add_next_index_zval(return_value, obj); +#endif + } + +} + +/* {{{ proto array ImagickPixelIterator::getPreviousIteratorRow() + Returns the previous row as an array of pixel wands from the pixel iterator. +*/ +PHP_METHOD(imagickpixeliterator, getpreviousiteratorrow) +{ + php_imagickpixeliterator_object *internpix; + PixelWand **wand_array; + size_t num_wands; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internpix = Z_IMAGICKPIXELITERATOR_P(getThis()); + + if (!internpix->initialized) { + php_imagick_throw_exception (IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly" TSRMLS_CC); + return; + } + + wand_array = PixelGetPreviousIteratorRow(internpix->pixel_iterator, &num_wands); + +#if MagickLibVersion <= 0x628 + if (internpix->iterator_position > 0) { + internpix->iterator_position--; + } +#endif + + if (!wand_array) { + RETURN_NULL(); + } + + s_pixelwands_to_zval (wand_array, num_wands, return_value TSRMLS_CC); + return; +} +/* }}} */ + + +/* {{{ proto array ImagickPixelIterator::getCurrentIteratorRow() + Returns the current row as an array of pixel wands from the pixel iterator. +*/ +PHP_METHOD(imagickpixeliterator, getcurrentiteratorrow) +{ + php_imagickpixeliterator_object *internpix; + PixelWand **wand_array; + size_t num_wands; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internpix = Z_IMAGICKPIXELITERATOR_P(getThis()); + + if (!internpix->initialized) { + php_imagick_throw_exception (IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly" TSRMLS_CC); + return; + } + +#if MagickLibVersion <= 0x628 + if (internpix->iterator_position >= internpix->rows) { + RETURN_NULL(); + } else if (internpix->iterator_position != 0) { + long tmp; + (void)PixelGetPreviousIteratorRow(internpix->pixel_iterator, &tmp); + } + wand_array = PixelGetNextIteratorRow(internpix->pixel_iterator, &num_wands); +#else + wand_array = PixelGetCurrentIteratorRow(internpix->pixel_iterator, &num_wands); +#endif + + if (!wand_array) { + RETURN_NULL(); + } + + s_pixelwands_to_zval (wand_array, num_wands, return_value TSRMLS_CC); + return; +} +/* }}} */ + +/* {{{ proto array ImagickPixelIterator::getNextIteratorRow() + Returns the next row as an array of pixel wands from the pixel iterator. +*/ +PHP_METHOD(imagickpixeliterator, getnextiteratorrow) +{ + php_imagickpixeliterator_object *internpix; + PixelWand **wand_array; + size_t num_wands; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internpix = Z_IMAGICKPIXELITERATOR_P(getThis()); + + if (!internpix->initialized) { + php_imagick_throw_exception (IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly" TSRMLS_CC); + return; + } + + wand_array = PixelGetNextIteratorRow(internpix->pixel_iterator, &num_wands); + +#if MagickLibVersion <= 0x628 + internpix->iterator_position++; +#endif + + if (!wand_array) { + RETURN_NULL(); + } + + s_pixelwands_to_zval (wand_array, num_wands, return_value TSRMLS_CC); + return; +} +/* }}} */ + +/* {{{ proto bool ImagickPixelIterator::clear() + Clear resources associated with a PixelIterator. +*/ +PHP_METHOD(imagickpixeliterator, clear) +{ + php_imagickpixeliterator_object *internpix; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + internpix = Z_IMAGICKPIXELITERATOR_P(getThis()); + + if (!internpix->initialized) { + php_imagick_throw_exception (IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly" TSRMLS_CC); + return; + } +/* Assertion failure with earlier versions */ +#if MagickLibVersion <= 0x628 + RETURN_TRUE; +#else + ClearPixelIterator(internpix->pixel_iterator); + RETURN_TRUE; +#endif +} +/* }}} */ + +/* {{{ proto bool ImagickPixelIterator::valid() + The if the current iterator row is valid +*/ +PHP_METHOD(imagickpixeliterator, valid) +{ + php_imagickpixeliterator_object *internpix; + + if (zend_parse_parameters_none() == FAILURE) { + return; + } + + internpix = Z_IMAGICKPIXELITERATOR_P(getThis()); + + if (!internpix->initialized) { + php_imagick_throw_exception (IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly" TSRMLS_CC); + return; + } +#if MagickLibVersion <= 0x628 + if (internpix->iterator_position < internpix->rows) { + RETURN_TRUE; + } +#else + /* Test if the current row is valid */ + if (PixelSetIteratorRow(internpix->pixel_iterator, PixelGetIteratorRow(internpix->pixel_iterator))) { + RETURN_TRUE; + } +#endif + RETURN_FALSE; +} +/* }}} */ + +/* END OF PIXELITERATOR */ diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/LICENSE php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/LICENSE --- php-imagick-3.4.4/imagick-3.4.4+php8.0/LICENSE 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/LICENSE 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,68 @@ +-------------------------------------------------------------------- + The PHP License, version 3.01 +Copyright (c) 1999 - 2011 The PHP Group. All rights reserved. +-------------------------------------------------------------------- + +Redistribution and use in source and binary forms, with or without +modification, is permitted provided that the following conditions +are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + 3. The name "PHP" must not be used to endorse or promote products + derived from this software without prior written permission. For + written permission, please contact group@php.net. + + 4. Products derived from this software may not be called "PHP", nor + may "PHP" appear in their name, without prior written permission + from group@php.net. You may indicate that your software works in + conjunction with PHP by saying "Foo for PHP" instead of calling + it "PHP Foo" or "phpfoo" + + 5. The PHP Group may publish revised and/or new versions of the + license from time to time. Each version will be given a + distinguishing version number. + Once covered code has been published under a particular version + of the license, you may always continue to use it under the terms + of that version. You may also choose to use such covered code + under the terms of any subsequent version of the license + published by the PHP Group. No one other than the PHP Group has + the right to modify the terms applicable to covered code created + under this License. + + 6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes PHP software, freely available from + ". + +THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND +ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP +DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. + +-------------------------------------------------------------------- + +This software consists of voluntary contributions made by many +individuals on behalf of the PHP Group. + +The PHP Group can be contacted via Email at group@php.net. + +For more information on the PHP Group and the PHP project, +please see . + +PHP includes the Zend Engine, freely available at +. diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/php_imagick_defs.h php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/php_imagick_defs.h --- php-imagick-3.4.4/imagick-3.4.4+php8.0/php_imagick_defs.h 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/php_imagick_defs.h 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,1154 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 / Imagick | + +----------------------------------------------------------------------+ + | Copyright (c) 2006-2013 Mikko Koppanen, Scott MacVicar | + | ImageMagick (c) ImageMagick Studio LLC | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Mikko Kopppanen | + | Scott MacVicar | + +----------------------------------------------------------------------+ +*/ +#ifndef PHP_IMAGICK_DEFS_H /* PHP_IMAGICK_DEFS_H */ +# define PHP_IMAGICK_DEFS_H + +/* Include magic wand header */ +#if defined (IM_MAGICKWAND_HEADER_STYLE_SEVEN) +# include +#elif defined (IM_MAGICKWAND_HEADER_STYLE_OLD) +# include +#else +# include +#endif + +#if MagickLibVersion >= 0x700 +#include "shim_im6_to_im7.h" +#endif + +/* Some extra headers */ +#include "Zend/zend_exceptions.h" +#include "Zend/zend_interfaces.h" +#include "ext/standard/php_string.h" +#include "ext/standard/info.h" +#include "ext/standard/php_filestat.h" +#include "php_ini.h" +#include "Zend/zend.h" + +/* Include locale header */ +#ifdef HAVE_LOCALE_H +# include +#endif + +#if MagickLibVersion >= 0x680 + #define IMAGICK_WITH_KERNEL +#endif + + + +#if MagickLibVersion >= 0x700 +#if !defined(MaxTextExtent) +# define MaxTextExtent 4096 /* always >= 4096 */ +#endif + +#endif + + +#ifdef ZEND_ENGINE_3 + #define im_long zend_long +#else + #define im_long long +#endif + + +typedef struct _php_imagick_callback { + void ***thread_ctx; +#ifdef ZEND_ENGINE_3 + zval user_callback; +#else + zval *user_callback; +#endif + struct _php_imagick_callback *previous_callback; +} php_imagick_callback; + +/* Globals, needed for the ini settings */ +ZEND_BEGIN_MODULE_GLOBALS(imagick) + zend_bool locale_fix; + zend_bool progress_monitor; + zend_bool skip_version_check; + php_imagick_callback *progress_callback; +#ifdef PHP_IMAGICK_ZEND_MM + MagickWand *keep_alive; +#endif +ZEND_END_MODULE_GLOBALS(imagick) + +#ifdef ZTS +# define IMAGICK_G(v) TSRMG(imagick_globals_id, zend_imagick_globals *, v) +#else +# define IMAGICK_G(v) (imagick_globals.v) +#endif + +ZEND_EXTERN_MODULE_GLOBALS(imagick) + +#ifdef HAVE_LOCALE_H +# if defined(PHP_WIN32) +# define IMAGICK_LC_NUMERIC_LOCALE "English" +# else +# define IMAGICK_LC_NUMERIC_LOCALE "C" +# endif +#endif + +#if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 3 +#define zend_parse_parameters_none() zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") +#endif + + +/* Class names */ +#define PHP_IMAGICK_SC_NAME "Imagick" +#define PHP_IMAGICK_EXCEPTION_SC_NAME "ImagickException" + +#define PHP_IMAGICKDRAW_SC_NAME "ImagickDraw" +#define PHP_IMAGICKDRAW_EXCEPTION_SC_NAME "ImagickDrawException" + +#define PHP_IMAGICKPIXEL_SC_NAME "ImagickPixel" +#define PHP_IMAGICKPIXEL_EXCEPTION_SC_NAME "ImagickPixelException" + +#define PHP_IMAGICKPIXELITERATOR_SC_NAME "ImagickPixelIterator" +#define PHP_IMAGICKPIXELITERATOR_EXCEPTION_SC_NAME "ImagickPixelIteratorException" + +#ifdef IMAGICK_WITH_KERNEL +#define PHP_IMAGICKKERNEL_SC_NAME "ImagickKernel" +#define PHP_IMAGICKKERNEL_EXCEPTION_SC_NAME "ImagickKernelException" +#endif + + +#ifdef ZEND_ENGINE_3 + +/* Structure for Imagick object. */ +typedef struct _php_imagick_object { + MagickWand *magick_wand; + char *progress_monitor_name; + zend_bool next_out_of_bound; + zend_object zo; +} php_imagick_object; + +#else + +/* Structure for Imagick object. */ +typedef struct _php_imagick_object { + zend_object zo; + MagickWand *magick_wand; + char *progress_monitor_name; + zend_bool next_out_of_bound; +} php_imagick_object; + +#endif + + +#ifdef ZEND_ENGINE_3 + +/* Structure for ImagickDraw object. */ +typedef struct _php_imagickdraw_object { + DrawingWand *drawing_wand; + zend_object zo; +} php_imagickdraw_object; + + +#else + + +/* Structure for ImagickDraw object. */ +typedef struct _php_imagickdraw_object { + zend_object zo; + DrawingWand *drawing_wand; +} php_imagickdraw_object; + + +#endif + +#ifdef ZEND_ENGINE_3 + +/* Structure for ImagickPixelIterator object. */ +typedef struct _php_imagickpixeliterator_object { + + PixelIterator *pixel_iterator; + zend_bool initialized; + +#if MagickLibVersion <= 0x628 + long rows; + long iterator_position; +#endif + + zend_object zo; +} php_imagickpixeliterator_object; + +#else + +/* Structure for ImagickPixelIterator object. */ +typedef struct _php_imagickpixeliterator_object { + zend_object zo; + PixelIterator *pixel_iterator; + zend_bool initialized; + +#if MagickLibVersion <= 0x628 + long rows; + long iterator_position; +#endif + +} php_imagickpixeliterator_object; + +#endif + + +#ifdef ZEND_ENGINE_3 + +/* Structure for ImagickPixel object. */ +typedef struct _php_imagickpixel_object { + PixelWand *pixel_wand; + zend_bool initialized_via_iterator; + zend_object zo; +} php_imagickpixel_object; + + +#else + + +/* Structure for ImagickPixel object. */ +typedef struct _php_imagickpixel_object { + zend_object zo; + PixelWand *pixel_wand; + zend_bool initialized_via_iterator; +} php_imagickpixel_object; + +#endif + + +#ifdef IMAGICK_WITH_KERNEL +#ifdef ZEND_ENGINE_3 +/* Structure for ImagickKernel object. */ +typedef struct _php_imagickkernel_object { + KernelInfo *kernel_info; + zend_object zo; +} php_imagickkernel_object; +#else + +/* Structure for ImagickKernel object. */ +typedef struct _php_imagickkernel_object { + zend_object zo; + KernelInfo *kernel_info; +} php_imagickkernel_object; +#endif +#endif + +//Object fetching. +#ifdef ZEND_ENGINE_3 + +static inline php_imagick_object *php_imagick_fetch_object(zend_object *obj) { + return (php_imagick_object *)((char*)(obj) - XtOffsetOf(php_imagick_object, zo)); +} + +static inline php_imagickdraw_object *php_imagickdraw_fetch_object(zend_object *obj) { + return (php_imagickdraw_object *)((char*)(obj) - XtOffsetOf(php_imagickdraw_object, zo)); +} + +static inline php_imagickpixel_object *php_imagickpixel_fetch_object(zend_object *obj) { + return (php_imagickpixel_object *)((char*)(obj) - XtOffsetOf(php_imagickpixel_object, zo)); +} + +static inline php_imagickpixeliterator_object *php_imagickpixeliterator_fetch_object(zend_object *obj) { + return (php_imagickpixeliterator_object *)((char*)(obj) - XtOffsetOf(php_imagickpixeliterator_object, zo)); +} + +#ifdef IMAGICK_WITH_KERNEL +static inline php_imagickkernel_object *php_imagickkernel_fetch_object(zend_object *obj) { + return (php_imagickkernel_object *)((char*)(obj) - XtOffsetOf(php_imagickkernel_object, zo)); +} +#endif + +#else + #define php_imagick_fetch_object(object) ((php_imagick_object *)object) + #define php_imagickdraw_fetch_object(object) ((php_imagickdraw_object *)object) + #define php_imagickpixel_fetch_object(object) ((php_imagickpixel_object *)object) + #define php_imagickpixeliterator_fetch_object(object) ((php_imagickpixeliterator_object *)object) + #define php_imagickkernel_fetch_object(object) ((php_imagickkernel_object *)object) +#endif + +// Object access +#ifdef ZEND_ENGINE_3 + #define Z_IMAGICK_P(zv) php_imagick_fetch_object(Z_OBJ_P((zv))) + #define Z_IMAGICKDRAW_P(zv) php_imagickdraw_fetch_object(Z_OBJ_P((zv))) + #define Z_IMAGICKPIXEL_P(zv) php_imagickpixel_fetch_object(Z_OBJ_P((zv))) + #define Z_IMAGICKPIXELITERATOR_P(zv) php_imagickpixeliterator_fetch_object(Z_OBJ_P((zv))) +#ifdef IMAGICK_WITH_KERNEL + #define Z_IMAGICKKERNEL_P(zv) php_imagickkernel_fetch_object(Z_OBJ_P((zv))) +#endif +#else + #define Z_IMAGICK_P(zv) (php_imagick_object *)zend_object_store_get_object(zv TSRMLS_CC) + #define Z_IMAGICKDRAW_P(zv) (php_imagickdraw_object *)zend_object_store_get_object(zv TSRMLS_CC) + #define Z_IMAGICKPIXEL_P(zv) (php_imagickpixel_object *) zend_object_store_get_object(zv TSRMLS_CC) + #define Z_IMAGICKPIXELITERATOR_P(zv) (php_imagickpixeliterator_object *)zend_object_store_get_object(zv TSRMLS_CC) + #define Z_IMAGICKKERNEL_P(zv) (php_imagickkernel_object *)zend_object_store_get_object(zv TSRMLS_CC) +#endif + +// String access +#ifdef ZEND_ENGINE_3 + #define IM_ZVAL_STRING(zv, charstar) ZVAL_STRING(zv, charstar); + #define IM_RETURN_STRING(s) RETURN_STRING(s) +#else + #define IM_ZVAL_STRING(zv, charstar) ZVAL_STRING(zv, charstar, 1); + //RETURN_STRING(s, duplicate) + #define IM_RETURN_STRING(s) RETURN_STRING(s, 0) +#endif + +#ifdef ZEND_ENGINE_3 + #define IM_add_assoc_string(zv, key, charstr) add_assoc_string(zv, key, charstr) + #define IM_ZVAL_STRINGL(zv, charstr, length) ZVAL_STRINGL(zv, charstr, length) + #define IM_add_next_index_string(zv, charstr) add_next_index_string(zv, charstr) + #define IM_LEN_TYPE size_t +#else + #define IM_add_assoc_string(zv, key, charstr) add_assoc_string(zv, key, charstr, 1) + #define IM_add_assoc_string(zv, key, charstr) add_assoc_string(zv, key, charstr, 1) + #define IM_ZVAL_STRINGL(zv, charstr, length) ZVAL_STRINGL(zv, charstr, length, 1) + #define IM_add_next_index_string(zv, charstr) add_next_index_string(zv, charstr, 1) + #define IM_add_next_index_zval(zv1, zv2) + #define IM_LEN_TYPE int +#endif + +#ifdef ZEND_ENGINE_3 + #define IM_ZEND_OBJECT zend_object +#else + #define IM_ZEND_OBJECT void +#endif + + + + + +/* Define some color constants */ +typedef enum _php_imagick_color_t { + PHP_IMAGICK_COLOR_MIN = 10, + PHP_IMAGICK_COLOR_BLACK, + PHP_IMAGICK_COLOR_BLUE, + PHP_IMAGICK_COLOR_CYAN, + PHP_IMAGICK_COLOR_GREEN, + PHP_IMAGICK_COLOR_RED, + PHP_IMAGICK_COLOR_YELLOW, + PHP_IMAGICK_COLOR_MAGENTA, +#if MagickLibVersion < 0x700 + PHP_IMAGICK_COLOR_OPACITY, +#endif + PHP_IMAGICK_COLOR_ALPHA, + PHP_IMAGICK_COLOR_FUZZ, + PHP_IMAGICK_COLOR_MAX, +} php_imagick_color_t; + +/* Class enum */ +typedef enum _php_imagick_class_type_t { + IMAGICK_CLASS, + IMAGICKDRAW_CLASS, + IMAGICKPIXELITERATOR_CLASS, + IMAGICKPIXEL_CLASS, +#ifdef IMAGICK_WITH_KERNEL + IMAGICKKERNEL_CLASS +#endif +} php_imagick_class_type_t; + +/* Read / write constants */ +typedef enum _php_imagick_rw_result_t { + IMAGICK_RW_OK, + IMAGICK_RW_SAFE_MODE_ERROR, + IMAGICK_RW_OPEN_BASEDIR_ERROR, + IMAGICK_RW_UNDERLYING_LIBRARY, + IMAGICK_RW_PERMISSION_DENIED, + IMAGICK_RW_FILENAME_TOO_LONG, + IMAGICK_RW_PATH_DOES_NOT_EXIST, + IMAGICK_RW_PATH_IS_DIR, +} php_imagick_rw_result_t; + +/* Class entries */ +extern zend_class_entry *php_imagick_sc_entry; +extern zend_class_entry *php_imagick_exception_class_entry; +extern zend_class_entry *php_imagickdraw_sc_entry; +extern zend_class_entry *php_imagickdraw_exception_class_entry; +extern zend_class_entry *php_imagickpixel_sc_entry; +extern zend_class_entry *php_imagickpixel_exception_class_entry; +extern zend_class_entry *php_imagickpixeliterator_sc_entry; +extern zend_class_entry *php_imagickpixeliterator_exception_class_entry; +#ifdef IMAGICK_WITH_KERNEL +extern zend_class_entry *php_imagickkernel_sc_entry; +extern zend_class_entry *php_imagickkernel_exception_class_entry; +#endif + +/* Forward declarations (Imagick) */ + +/* The conditional methods */ +#if MagickLibVersion > 0x628 +PHP_METHOD(imagick, pingimageblob); +PHP_METHOD(imagick, pingimagefile); +PHP_METHOD(imagick, transposeimage); +PHP_METHOD(imagick, transverseimage); +PHP_METHOD(imagick, trimimage); +PHP_METHOD(imagick, waveimage); +PHP_METHOD(imagick, vignetteimage); +PHP_METHOD(imagick, compareimagelayers); +PHP_METHOD(imagick, optimizeimagelayers); +PHP_METHOD(imagick, uniqueimagecolors); +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 +PHP_METHOD(imagick, getimagematte); +#endif //#if MagickLibVersion < 0x700 +#endif +PHP_METHOD(imagick, setimagematte); +PHP_METHOD(imagick, adaptiveresizeimage); +PHP_METHOD(imagick, sketchimage); +PHP_METHOD(imagick, shadeimage); +PHP_METHOD(imagick, getsizeoffset); +PHP_METHOD(imagick, setsizeoffset); +PHP_METHOD(imagick, adaptiveblurimage); +PHP_METHOD(imagick, contraststretchimage); +PHP_METHOD(imagick, adaptivesharpenimage); +PHP_METHOD(imagick, randomthresholdimage); +#if MagickLibVersion < 0x700 +PHP_METHOD(imagick, roundcornersimage); +#endif +PHP_METHOD(imagick, setiteratorindex); +PHP_METHOD(imagick, getiteratorindex); +#if MagickLibVersion < 0x700 +PHP_METHOD(imagick, transformimage); +#endif // #if MagickLibVersion < 0x700 +#endif +#if MagickLibVersion > 0x630 +#if MagickLibVersion < 0x700 +PHP_METHOD(imagick, setimageopacity); +#endif +#if MagickLibVersion >= 0x700 +PHP_METHOD(imagick, setimagealpha); +#endif +#if MagickLibVersion < 0x700 +PHP_METHOD(imagick, orderedposterizeimage); +#endif //#if MagickLibVersion < 0x700 +#endif +#if MagickLibVersion > 0x631 +PHP_METHOD(imagick, polaroidimage); +PHP_METHOD(imagick, getimageproperty); +PHP_METHOD(imagick, setimageproperty); +PHP_METHOD(imagick, deleteimageproperty); +PHP_METHOD(imagick, identifyformat); +PHP_METHOD(imagick, setimageinterpolatemethod); +PHP_METHOD(imagick, getimageinterpolatemethod); +PHP_METHOD(imagick, linearstretchimage); +PHP_METHOD(imagick, getimagelength); +PHP_METHOD(imagick, extentimage); +#endif +#if MagickLibVersion > 0x633 +PHP_METHOD(imagick, getimageorientation); +PHP_METHOD(imagick, setimageorientation); +#endif +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion > 0x634 +PHP_METHOD(imagick, paintfloodfillimage); +#endif +#endif +#if MagickLibVersion > 0x635 +PHP_METHOD(imagick, clutimage); +PHP_METHOD(imagick, getimageproperties); +PHP_METHOD(imagick, getimageprofiles); +PHP_METHOD(imagick, distortimage); +PHP_METHOD(imagick, writeimagefile); +PHP_METHOD(imagick, writeimagesfile); +PHP_METHOD(imagick, resetimagepage); + +#if MagickLibVersion < 0x700 +PHP_METHOD(imagick, setimageclipmask); +PHP_METHOD(imagick, getimageclipmask); +#endif +PHP_METHOD(imagick, animateimages); +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 +PHP_METHOD(imagick, recolorimage); +#endif +#endif +#endif +#if MagickLibVersion > 0x636 +PHP_METHOD(imagick, setfont); +PHP_METHOD(imagick, getfont); +PHP_METHOD(imagick, setpointsize); +PHP_METHOD(imagick, getpointsize); +PHP_METHOD(imagick, mergeimagelayers); +#endif +#if MagickLibVersion > 0x637 +PHP_METHOD(imagick, floodfillpaintimage); +PHP_METHOD(imagick, opaquepaintimage); +PHP_METHOD(imagick, transparentpaintimage); +PHP_METHOD(imagick, setimagealphachannel); +#endif +#if MagickLibVersion > 0x638 +PHP_METHOD(imagick, liquidrescaleimage); +PHP_METHOD(imagick, decipherimage); +PHP_METHOD(imagick, encipherimage); +#endif +#if MagickLibVersion > 0x639 +PHP_METHOD(imagick, setgravity); +PHP_METHOD(imagick, getgravity); +PHP_METHOD(imagick, getimagechannelrange); +PHP_METHOD(imagick, getimagealphachannel); +#endif +#if MagickLibVersion > 0x642 +PHP_METHOD(imagick, getimagechanneldistortions); +#endif +#if MagickLibVersion > 0x643 +PHP_METHOD(imagick, getimagegravity); +PHP_METHOD(imagick, setimagegravity); +#endif +#if MagickLibVersion > 0x645 +PHP_METHOD(imagick, importimagepixels); +PHP_METHOD(imagick, deskewimage); +PHP_METHOD(imagick, segmentimage); +PHP_METHOD(imagick, sparsecolorimage); +PHP_METHOD(imagick, remapimage); +#endif +#if MagickLibVersion > 0x646 +PHP_METHOD(imagick, exportimagepixels); +#endif +#if MagickLibVersion > 0x648 +PHP_METHOD(imagick, getimagechannelkurtosis); +PHP_METHOD(imagick, functionimage); +#endif +#if MagickLibVersion > 0x651 +PHP_METHOD(imagick, transformimagecolorspace); +#endif +#if MagickLibVersion > 0x652 +PHP_METHOD(imagick, haldclutimage); +#endif +#if MagickLibVersion > 0x655 +PHP_METHOD(imagick, autolevelimage); +PHP_METHOD(imagick, blueshiftimage); +#endif +#if MagickLibVersion > 0x656 +PHP_METHOD(imagick, setimageartifact); +PHP_METHOD(imagick, getimageartifact); +PHP_METHOD(imagick, deleteimageartifact); +PHP_METHOD(imagick, setcolorspace); +PHP_METHOD(imagick, getcolorspace); +PHP_METHOD(imagick, clampimage); +#endif +#if MagickLibVersion > 0x667 +PHP_METHOD(imagick, smushimages); +#endif + +PHP_METHOD(imagick, __construct); +PHP_METHOD(imagick, __tostring); +PHP_METHOD(imagick, count); +PHP_METHOD(imagick, getpixeliterator); +PHP_METHOD(imagick, getpixelregioniterator); +PHP_METHOD(imagick, readimage); +PHP_METHOD(imagick, readimages); +PHP_METHOD(imagick, pingimage); +PHP_METHOD(imagick, readimageblob); +PHP_METHOD(imagick, readimagefile); +PHP_METHOD(imagick, displayimage); +PHP_METHOD(imagick, displayimages); +PHP_METHOD(imagick, destroy); +PHP_METHOD(imagick, clear); +PHP_METHOD(imagick, clone); +PHP_METHOD(imagick, removeimage); +PHP_METHOD(imagick, writeimage); +PHP_METHOD(imagick, writeimages); +PHP_METHOD(imagick, resetiterator); +PHP_METHOD(imagick, setfirstiterator); +PHP_METHOD(imagick, setlastiterator); +PHP_METHOD(imagick, previousimage); +PHP_METHOD(imagick, nextimage); +PHP_METHOD(imagick, haspreviousimage); +PHP_METHOD(imagick, hasnextimage); +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 +PHP_METHOD(imagick, setimageindex); +PHP_METHOD(imagick, getimageindex); +#endif // #if MagickLibVersion < 0x700 +#endif +PHP_METHOD(imagick, setimageformat); +PHP_METHOD(imagick, setimagefilename); +PHP_METHOD(imagick, getimagefilename); +PHP_METHOD(imagick, getimageformat); +PHP_METHOD(imagick, getimagemimetype); +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 +PHP_METHOD(imagick, getimagesize); +#endif +#endif +PHP_METHOD(imagick, getimagegeometry); +PHP_METHOD(imagick, getimagecolors); +PHP_METHOD(imagick, scaleimage); +PHP_METHOD(imagick, blurimage); +PHP_METHOD(imagick, thumbnailimage); +PHP_METHOD(imagick, cropthumbnailimage); +PHP_METHOD(imagick, commentimage); +PHP_METHOD(imagick, cropimage); +PHP_METHOD(imagick, labelimage); +PHP_METHOD(imagick, valid); +PHP_METHOD(imagick, current); +PHP_METHOD(imagick, drawimage); +PHP_METHOD(imagick, getimageblob); +PHP_METHOD(imagick, getimagesblob); +PHP_METHOD(imagick, setimagecompressionquality); +PHP_METHOD(imagick, getimagecompressionquality); +PHP_METHOD(imagick, setimagecompression); +PHP_METHOD(imagick, getimagecompression); +PHP_METHOD(imagick, annotateimage); +PHP_METHOD(imagick, compositeimage); +PHP_METHOD(imagick, modulateimage); +PHP_METHOD(imagick, montageimage); +PHP_METHOD(imagick, morphology); +PHP_METHOD(imagick, identifyimage); +PHP_METHOD(imagick, thresholdimage); +PHP_METHOD(imagick, adaptivethresholdimage); +PHP_METHOD(imagick, blackthresholdimage); +PHP_METHOD(imagick, whitethresholdimage); +PHP_METHOD(imagick, appendimages); +PHP_METHOD(imagick, charcoalimage); +PHP_METHOD(imagick, normalizeimage); +PHP_METHOD(imagick, oilpaintimage); +PHP_METHOD(imagick, posterizeimage); +#if MagickLibVersion < 0x700 +PHP_METHOD(imagick, radialblurimage); +#endif +PHP_METHOD(imagick, raiseimage); +PHP_METHOD(imagick, resampleimage); +PHP_METHOD(imagick, resizeimage); +PHP_METHOD(imagick, rollimage); +PHP_METHOD(imagick, rotateimage); +PHP_METHOD(imagick, sampleimage); +PHP_METHOD(imagick, solarizeimage); +PHP_METHOD(imagick, shadowimage); +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 +PHP_METHOD(imagick, setimageattribute); +#endif // #if MagickLibVersion < 0x700 +#endif +PHP_METHOD(imagick, setimagebackgroundcolor); +#if MagickLibVersion >= 0x700 +PHP_METHOD(imagick, setimagechannelmask); +#endif +PHP_METHOD(imagick, setimagecompose); +PHP_METHOD(imagick, setimagecompression); +PHP_METHOD(imagick, setimagedelay); +PHP_METHOD(imagick, setimagedepth); +PHP_METHOD(imagick, setimagegamma); +PHP_METHOD(imagick, setimageiterations); +#if MagickLibVersion < 0x700 +PHP_METHOD(imagick, setimagemattecolor); +#endif // #if MagickLibVersion < 0x700 +PHP_METHOD(imagick, setimagepage); +PHP_METHOD(imagick, setimageprogressmonitor); +#if MagickLibVersion > 0x653 +PHP_METHOD(imagick, setprogressmonitor); +#endif +PHP_METHOD(imagick, setimageresolution); +PHP_METHOD(imagick, setimagescene); +PHP_METHOD(imagick, setimagetickspersecond); +PHP_METHOD(imagick, setimagetype); +PHP_METHOD(imagick, setimageunits); +PHP_METHOD(imagick, sharpenimage); +PHP_METHOD(imagick, shaveimage); +PHP_METHOD(imagick, shearimage); +PHP_METHOD(imagick, spliceimage); +PHP_METHOD(imagick, spreadimage); +PHP_METHOD(imagick, swirlimage); +PHP_METHOD(imagick, stripimage); +PHP_METHOD(imagick, queryformats); +PHP_METHOD(imagick, queryfonts); +PHP_METHOD(imagick, queryfontmetrics); +PHP_METHOD(imagick, steganoimage); +PHP_METHOD(imagick, motionblurimage); +#if MagickLibVersion < 0x700 +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +PHP_METHOD(imagick, mosaicimages); +#endif +#endif +PHP_METHOD(imagick, morphimages); +PHP_METHOD(imagick, minifyimage); +PHP_METHOD(imagick, addnoiseimage); +PHP_METHOD(imagick, affinetransformimage); +#if MagickLibVersion < 0x700 +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +PHP_METHOD(imagick, averageimages); +#endif +#endif +PHP_METHOD(imagick, borderimage); +PHP_METHOD(imagick, calculatecrop); +PHP_METHOD(imagick, chopimage); +PHP_METHOD(imagick, clipimage); +PHP_METHOD(imagick, clippathimage); +PHP_METHOD(imagick, coalesceimages); +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 +PHP_METHOD(imagick, colorfloodfillimage); +#endif //#if MagickLibVersion < 0x700 +#endif +PHP_METHOD(imagick, colorizeimage); +PHP_METHOD(imagick, compareimagechannels); +PHP_METHOD(imagick, compareimages); +PHP_METHOD(imagick, contrastimage); +PHP_METHOD(imagick, combineimages); +PHP_METHOD(imagick, convolveimage); +PHP_METHOD(imagick, cyclecolormapimage); +PHP_METHOD(imagick, deconstructimages); +PHP_METHOD(imagick, despeckleimage); +PHP_METHOD(imagick, edgeimage); +PHP_METHOD(imagick, embossimage); +PHP_METHOD(imagick, enhanceimage); +PHP_METHOD(imagick, equalizeimage); +PHP_METHOD(imagick, evaluateimage); +#if MagickLibVersion >= 0x687 +PHP_METHOD(imagick, evaluateimages); +#endif +#if MagickLibVersion < 0x700 +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +PHP_METHOD(imagick, flattenimages); +#endif +#endif +PHP_METHOD(imagick, flipimage); +PHP_METHOD(imagick, flopimage); +#if MagickLibVersion >= 0x655 +PHP_METHOD(imagick, forwardfouriertransformimage); +#endif +PHP_METHOD(imagick, frameimage); +PHP_METHOD(imagick, fximage); +PHP_METHOD(imagick, gammaimage); +PHP_METHOD(imagick, gaussianblurimage); +#if MagickLibVersion < 0x700 +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +PHP_METHOD(imagick, getimageattribute); +#endif +#endif +PHP_METHOD(imagick, getimagebackgroundcolor); +PHP_METHOD(imagick, getimageblueprimary); +PHP_METHOD(imagick, getimagebordercolor); +PHP_METHOD(imagick, getimagechanneldepth); +PHP_METHOD(imagick, getimagechanneldistortion); +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 +PHP_METHOD(imagick, getimagechannelextrema); +#endif // #if MagickLibVersion < 0x700 +#endif +PHP_METHOD(imagick, getimagechannelmean); +PHP_METHOD(imagick, getimagechannelstatistics); +PHP_METHOD(imagick, getimagecolormapcolor); +PHP_METHOD(imagick, getimagecolorspace); +PHP_METHOD(imagick, getimagecompose); +PHP_METHOD(imagick, getimagedelay); +PHP_METHOD(imagick, getimagedepth); +PHP_METHOD(imagick, getimagedistortion); +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 +PHP_METHOD(imagick, getimageextrema); +#endif // #if MagickLibVersion < 0x700 +#endif +PHP_METHOD(imagick, getimagedispose); +PHP_METHOD(imagick, getimagegamma); +PHP_METHOD(imagick, getimagegreenprimary); +PHP_METHOD(imagick, getimageheight); +PHP_METHOD(imagick, getimagehistogram); +PHP_METHOD(imagick, getimageinterlacescheme); +PHP_METHOD(imagick, getimageiterations); +#if MagickLibVersion < 0x700 +PHP_METHOD(imagick, getimagemattecolor); +#endif //#if MagickLibVersion < 0x700 +PHP_METHOD(imagick, getimagepage); +PHP_METHOD(imagick, getimagepixelcolor); +PHP_METHOD(imagick, getimageprofile); +PHP_METHOD(imagick, getimageredprimary); +PHP_METHOD(imagick, getimagerenderingintent); +PHP_METHOD(imagick, getimageresolution); +PHP_METHOD(imagick, getimagescene); +PHP_METHOD(imagick, getimagesignature); +PHP_METHOD(imagick, getimagetickspersecond); +PHP_METHOD(imagick, getimagetype); +PHP_METHOD(imagick, getimageunits); +PHP_METHOD(imagick, getimagevirtualpixelmethod); +PHP_METHOD(imagick, getimagewhitepoint); +PHP_METHOD(imagick, getimagewidth); +PHP_METHOD(imagick, getnumberimages); +PHP_METHOD(imagick, getimagetotalinkdensity); +PHP_METHOD(imagick, getimageregion); +PHP_METHOD(imagick, implodeimage); +#if MagickLibVersion >= 0x658 +PHP_METHOD(imagick, inversefouriertransformimage); +#endif +PHP_METHOD(imagick, levelimage); +PHP_METHOD(imagick, magnifyimage); +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 +PHP_METHOD(imagick, mapimage); +PHP_METHOD(imagick, mattefloodfillimage); +#endif // #if MagickLibVersion < 0x700 +#endif +#if MagickLibVersion < 0x700 +PHP_METHOD(imagick, medianfilterimage); +#endif +PHP_METHOD(imagick, negateimage); +#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) +#if MagickLibVersion < 0x700 +PHP_METHOD(imagick, paintopaqueimage); +PHP_METHOD(imagick, painttransparentimage); +#endif //#if MagickLibVersion < 0x700 +#endif +PHP_METHOD(imagick, previewimages); +PHP_METHOD(imagick, profileimage); +PHP_METHOD(imagick, quantizeimage); +PHP_METHOD(imagick, quantizeimages); +#if MagickLibVersion < 0x700 +PHP_METHOD(imagick, reducenoiseimage); +#endif +PHP_METHOD(imagick, removeimageprofile); +PHP_METHOD(imagick, separateimagechannel); +PHP_METHOD(imagick, sepiatoneimage); + +#if MagickLibVersion < 0x700 +PHP_METHOD(imagick, setimagebias); +PHP_METHOD(imagick, setimagebiasquantum); +#endif + +PHP_METHOD(imagick, setimageblueprimary); +PHP_METHOD(imagick, setimagebordercolor); +PHP_METHOD(imagick, setimagechanneldepth); +PHP_METHOD(imagick, setimagecolormapcolor); +PHP_METHOD(imagick, setimagecolorspace); +PHP_METHOD(imagick, setimagedispose); +PHP_METHOD(imagick, setimageextent); +PHP_METHOD(imagick, setimagegreenprimary); +PHP_METHOD(imagick, setimageinterlacescheme); +PHP_METHOD(imagick, setimageprofile); +PHP_METHOD(imagick, setimageredprimary); +PHP_METHOD(imagick, setimagerenderingintent); +PHP_METHOD(imagick, setimagevirtualpixelmethod); +PHP_METHOD(imagick, setimagewhitepoint); +PHP_METHOD(imagick, sigmoidalcontrastimage); +PHP_METHOD(imagick, stereoimage); +PHP_METHOD(imagick, textureimage); +PHP_METHOD(imagick, tintimage); +PHP_METHOD(imagick, unsharpmaskimage); +PHP_METHOD(imagick, getimage); +PHP_METHOD(imagick, setimage); +PHP_METHOD(imagick, addimage); +PHP_METHOD(imagick, newimage); +PHP_METHOD(imagick, newpseudoimage); +PHP_METHOD(imagick, getcompression); +PHP_METHOD(imagick, getcompressionquality); +PHP_METHOD(imagick, getcopyright); +PHP_METHOD(imagick, getconfigureoptions); +#if MagickLibVersion > 0x660 +PHP_METHOD(imagick, getfeatures); +#endif +PHP_METHOD(imagick, getfilename); +PHP_METHOD(imagick, getformat); +PHP_METHOD(imagick, gethomeurl); +PHP_METHOD(imagick, getinterlacescheme); +PHP_METHOD(imagick, getoption); +PHP_METHOD(imagick, getpackagename); +PHP_METHOD(imagick, getpage); +PHP_METHOD(imagick, gethdrienabled); +PHP_METHOD(imagick, getquantum); +PHP_METHOD(imagick, getquantumdepth); +PHP_METHOD(imagick, getquantumrange); +PHP_METHOD(imagick, getreleasedate); +PHP_METHOD(imagick, getresource); +PHP_METHOD(imagick, getresourcelimit); +PHP_METHOD(imagick, getsamplingfactors); +PHP_METHOD(imagick, getsize); +PHP_METHOD(imagick, getversion); +PHP_METHOD(imagick, setbackgroundcolor); +PHP_METHOD(imagick, setcompression); +PHP_METHOD(imagick, setcompressionquality); +PHP_METHOD(imagick, setfilename); +PHP_METHOD(imagick, setformat); +PHP_METHOD(imagick, setinterlacescheme); +PHP_METHOD(imagick, setoption); +PHP_METHOD(imagick, setpage); +PHP_METHOD(imagick, setresourcelimit); +PHP_METHOD(imagick, setresolution); +PHP_METHOD(imagick, setsamplingfactors); +PHP_METHOD(imagick, setsize); +PHP_METHOD(imagick, settype); +PHP_METHOD(imagick, brightnesscontrastimage); +#if MagickLibVersion > 0x661 +PHP_METHOD(imagick, colormatriximage); +#endif +PHP_METHOD(imagick, selectiveblurimage); +#if MagickLibVersion >= 0x689 +PHP_METHOD(imagick, rotationalblurimage); +#endif +#if MagickLibVersion >= 0x687 +PHP_METHOD(imagick, optimizeimagetransparency); +#endif +#if MagickLibVersion >= 0x683 +PHP_METHOD(imagick, statisticimage); +#endif +#if MagickLibVersion >= 0x652 +PHP_METHOD(imagick, subimagematch); +#endif + +PHP_METHOD(imagick, setregistry); +PHP_METHOD(imagick, getregistry); +PHP_METHOD(imagick, listregistry); +PHP_METHOD(imagick, morphology); +#if MagickLibVersion < 0x700 +PHP_METHOD(imagick, filter); +#endif // #if MagickLibVersion < 0x700 +PHP_METHOD(imagick, setantialias); +PHP_METHOD(imagick, getantialias); +#if MagickLibVersion > 0x676 +PHP_METHOD(imagick, colordecisionlistimage); +#endif + +#if MagickLibVersion >= 0x660 +PHP_METHOD(imagick, autogammaimage); +#endif //#if MagickLibVersion >= 0x660 +#if MagickLibVersion >= 0x692 +PHP_METHOD(imagick, autoorient); +PHP_METHOD(imagick, compositeimagegravity); +#endif // #if MagickLibVersion >= 0x692 +#if MagickLibVersion >= 0x692 +PHP_METHOD(imagick, localcontrastimage); +#endif // #if MagickLibVersion >= 0x692 +#if MagickLibVersion >= 0x700 +PHP_METHOD(imagick, identifyimagetype); +#endif // #if MagickLibVersion >= 0x700 + +/* Forward declarations (ImagickDraw) */ +#if MagickLibVersion > 0x628 +PHP_METHOD(imagickdraw, resetvectorgraphics); +#endif +#if MagickLibVersion > 0x649 +PHP_METHOD(imagickdraw, gettextkerning); +PHP_METHOD(imagickdraw, settextkerning); +PHP_METHOD(imagickdraw, gettextinterwordspacing); +PHP_METHOD(imagickdraw, settextinterwordspacing); +#endif +#if MagickLibVersion > 0x655 +PHP_METHOD(imagickdraw, gettextinterlinespacing); +PHP_METHOD(imagickdraw, settextinterlinespacing); +#endif +PHP_METHOD(imagickdraw, __construct); +PHP_METHOD(imagickdraw, setfillcolor); +PHP_METHOD(imagickdraw, setfillalpha); +PHP_METHOD(imagickdraw, setresolution); +PHP_METHOD(imagickdraw, setstrokecolor); +PHP_METHOD(imagickdraw, setstrokealpha); +PHP_METHOD(imagickdraw, setstrokewidth); +PHP_METHOD(imagickdraw, setfont); +PHP_METHOD(imagickdraw, setfontfamily); +PHP_METHOD(imagickdraw, setfontsize); +PHP_METHOD(imagickdraw, setfontstyle); +PHP_METHOD(imagickdraw, setfontweight); +PHP_METHOD(imagickdraw, getfont); +PHP_METHOD(imagickdraw, getfontfamily); +PHP_METHOD(imagickdraw, getfontsize); +PHP_METHOD(imagickdraw, getfontstyle); +PHP_METHOD(imagickdraw, getfontweight); +PHP_METHOD(imagickdraw, clear); +PHP_METHOD(imagickdraw, destroy); +PHP_METHOD(imagickdraw, annotation); +PHP_METHOD(imagickdraw, settextantialias); +PHP_METHOD(imagickdraw, settextencoding); +PHP_METHOD(imagickdraw, rectangle); +PHP_METHOD(imagickdraw, roundrectangle); +PHP_METHOD(imagickdraw, ellipse); +PHP_METHOD(imagickdraw, circle); +PHP_METHOD(imagickdraw, skewx); +PHP_METHOD(imagickdraw, skewy); +PHP_METHOD(imagickdraw, translate); +PHP_METHOD(imagickdraw, line); +PHP_METHOD(imagickdraw, polygon); +PHP_METHOD(imagickdraw, arc); + +#if MagickLibVersion >= 0x700 +PHP_METHOD(imagickdraw, alpha); +#else +PHP_METHOD(imagickdraw, matte); +#endif + +PHP_METHOD(imagickdraw, point); +PHP_METHOD(imagickdraw, getfontstretch); +PHP_METHOD(imagickdraw, setfontstretch); +PHP_METHOD(imagickdraw, settextalignment); +PHP_METHOD(imagickdraw, settextdecoration); +PHP_METHOD(imagickdraw, settextundercolor); +PHP_METHOD(imagickdraw, setviewbox); +PHP_METHOD(imagickdraw, gettextdecoration); +PHP_METHOD(imagickdraw, gettextencoding); +PHP_METHOD(imagickdraw, clone); +PHP_METHOD(imagickdraw, affine); +PHP_METHOD(imagickdraw, bezier); +PHP_METHOD(imagickdraw, composite); +PHP_METHOD(imagickdraw, color); +PHP_METHOD(imagickdraw, comment); +PHP_METHOD(imagickdraw, getclippath); +PHP_METHOD(imagickdraw, getcliprule); +PHP_METHOD(imagickdraw, getclipunits); +PHP_METHOD(imagickdraw, getfillcolor); +PHP_METHOD(imagickdraw, getfillopacity); +PHP_METHOD(imagickdraw, getfillrule); +PHP_METHOD(imagickdraw, getgravity); +PHP_METHOD(imagickdraw, getstrokeantialias); +PHP_METHOD(imagickdraw, getstrokecolor); +PHP_METHOD(imagickdraw, getstrokedasharray); +PHP_METHOD(imagickdraw, getstrokedashoffset); +PHP_METHOD(imagickdraw, getstrokelinecap); +PHP_METHOD(imagickdraw, getstrokelinejoin); +PHP_METHOD(imagickdraw, getstrokemiterlimit); +PHP_METHOD(imagickdraw, getstrokeopacity); +PHP_METHOD(imagickdraw, getstrokewidth); +PHP_METHOD(imagickdraw, gettextalignment); +PHP_METHOD(imagickdraw, gettextantialias); +PHP_METHOD(imagickdraw, getvectorgraphics); +PHP_METHOD(imagickdraw, gettextundercolor); +PHP_METHOD(imagickdraw, pathclose); +PHP_METHOD(imagickdraw, pathcurvetoabsolute); +PHP_METHOD(imagickdraw, pathcurvetorelative); +PHP_METHOD(imagickdraw, pathcurvetoquadraticbezierabsolute); +PHP_METHOD(imagickdraw, pathcurvetoquadraticbezierrelative); +PHP_METHOD(imagickdraw, pathcurvetoquadraticbeziersmoothabsolute); +PHP_METHOD(imagickdraw, pathcurvetoquadraticbeziersmoothrelative); +PHP_METHOD(imagickdraw, pathcurvetosmoothabsolute); +PHP_METHOD(imagickdraw, pathcurvetosmoothrelative); +PHP_METHOD(imagickdraw, pathellipticarcabsolute); +PHP_METHOD(imagickdraw, pathellipticarcrelative); +PHP_METHOD(imagickdraw, pathfinish); +PHP_METHOD(imagickdraw, pathlinetoabsolute); +PHP_METHOD(imagickdraw, pathlinetorelative); +PHP_METHOD(imagickdraw, pathlinetohorizontalabsolute); +PHP_METHOD(imagickdraw, pathlinetohorizontalrelative); +PHP_METHOD(imagickdraw, pathlinetoverticalabsolute); +PHP_METHOD(imagickdraw, pathlinetoverticalrelative); +PHP_METHOD(imagickdraw, pathmovetoabsolute); +PHP_METHOD(imagickdraw, pathmovetorelative); +PHP_METHOD(imagickdraw, pathstart); +PHP_METHOD(imagickdraw, polyline); +PHP_METHOD(imagickdraw, popclippath); +PHP_METHOD(imagickdraw, popdefs); +PHP_METHOD(imagickdraw, poppattern); +PHP_METHOD(imagickdraw, pushclippath); +PHP_METHOD(imagickdraw, pushdefs); +PHP_METHOD(imagickdraw, pushpattern); +PHP_METHOD(imagickdraw, render); +PHP_METHOD(imagickdraw, rotate); +PHP_METHOD(imagickdraw, scale); +PHP_METHOD(imagickdraw, setclippath); +PHP_METHOD(imagickdraw, setcliprule); +PHP_METHOD(imagickdraw, setclipunits); +PHP_METHOD(imagickdraw, setfillopacity); +PHP_METHOD(imagickdraw, setfillpatternurl); +PHP_METHOD(imagickdraw, setfillrule); +PHP_METHOD(imagickdraw, setgravity); +PHP_METHOD(imagickdraw, setstrokepatternurl); +PHP_METHOD(imagickdraw, setstrokeantialias); +PHP_METHOD(imagickdraw, setstrokedasharray); +PHP_METHOD(imagickdraw, setstrokedashoffset); +PHP_METHOD(imagickdraw, setstrokelinecap); +PHP_METHOD(imagickdraw, setstrokelinejoin); +PHP_METHOD(imagickdraw, setstrokemiterlimit); +PHP_METHOD(imagickdraw, setstrokeopacity); +PHP_METHOD(imagickdraw, setvectorgraphics); +PHP_METHOD(imagickdraw, pop); +PHP_METHOD(imagickdraw, push); +#if MagickLibVersion >= 0x693 +PHP_METHOD(imagickdraw, getopacity); +PHP_METHOD(imagickdraw, setopacity); +#endif //MagickLibVersion >= 0x693 + +#if MagickLibVersion >= 0x675 +PHP_METHOD(imagickdraw, getfontresolution); +PHP_METHOD(imagickdraw, setfontresolution); +PHP_METHOD(imagickdraw, getbordercolor); +PHP_METHOD(imagickdraw, setbordercolor); +#endif //#if MagickLibVersion >= 0x675 + +#if MagickLibVersion >= 0x693 +PHP_METHOD(imagickdraw, setdensity); +PHP_METHOD(imagickdraw, getdensity); +#endif// #if MagickLibVersion >= 0x693 + +#if MagickLibVersion >= 0x692 +PHP_METHOD(imagickdraw, gettextdirection); +PHP_METHOD(imagickdraw, settextdirection); +#endif //#if MagickLibVersion >= 0x692 + +/* Imagick Pixel iterator */ +PHP_METHOD(imagickpixeliterator, __construct); +PHP_METHOD(imagickpixeliterator, newpixeliterator); +PHP_METHOD(imagickpixeliterator, newpixelregioniterator); +PHP_METHOD(imagickpixeliterator, getpixeliterator); +PHP_METHOD(imagickpixeliterator, getpixelregioniterator); +PHP_METHOD(imagickpixeliterator, getiteratorrow); +PHP_METHOD(imagickpixeliterator, setiteratorrow); +PHP_METHOD(imagickpixeliterator, getpreviousiteratorrow); +PHP_METHOD(imagickpixeliterator, getcurrentiteratorrow); +PHP_METHOD(imagickpixeliterator, getnextiteratorrow); +PHP_METHOD(imagickpixeliterator, setiteratorfirstrow); +PHP_METHOD(imagickpixeliterator, setiteratorlastrow); +PHP_METHOD(imagickpixeliterator, resetiterator); +PHP_METHOD(imagickpixeliterator, synciterator); +PHP_METHOD(imagickpixeliterator, destroy); +PHP_METHOD(imagickpixeliterator, clear); +PHP_METHOD(imagickpixeliterator, valid); + +/* ImagickPixel */ +#if MagickLibVersion > 0x628 +PHP_METHOD(imagickpixel, gethsl); +PHP_METHOD(imagickpixel, sethsl); +PHP_METHOD(imagickpixel, getcolorvaluequantum); +PHP_METHOD(imagickpixel, setcolorvaluequantum); +PHP_METHOD(imagickpixel, getindex); +PHP_METHOD(imagickpixel, setindex); +#endif +PHP_METHOD(imagickpixel, __construct); +PHP_METHOD(imagickpixel, setcolor); +PHP_METHOD(imagickpixel, clear); +PHP_METHOD(imagickpixel, destroy); +PHP_METHOD(imagickpixel, ispixelsimilarquantum); +PHP_METHOD(imagickpixel, ispixelsimilar); +PHP_METHOD(imagickpixel, getcolorvalue); +PHP_METHOD(imagickpixel, setcolorvalue); +PHP_METHOD(imagickpixel, getcolor); +PHP_METHOD(imagickpixel, getcolorquantum); +PHP_METHOD(imagickpixel, getcolorasstring); +PHP_METHOD(imagickpixel, getcolorcount); +PHP_METHOD(imagickpixel, setcolorcount); +PHP_METHOD(imagickpixel, clone); +#if MagickLibVersion >= 0x693 +PHP_METHOD(imagickpixel, setcolorfrompixel); +#endif //#if MagickLibVersion >= 0x693 + +#ifdef IMAGICK_WITH_KERNEL +PHP_METHOD(imagickkernel, __construct); +PHP_METHOD(imagickkernel, frommatrix); +PHP_METHOD(imagickkernel, frombuiltin); +PHP_METHOD(imagickkernel, addkernel); +PHP_METHOD(imagickkernel, getmatrix); +PHP_METHOD(imagickkernel, separate); +PHP_METHOD(imagickkernel, scale); +PHP_METHOD(imagickkernel, addunitykernel); +#endif + +#if MagickLibVersion < 0x700 +#define KernelValueType double +#else +#define KernelValueType MagickRealType +#endif + +#if MagickLibVersion >= 0x700 +#define IM_DEFAULT_CHANNEL UndefinedChannel +#else +#define IM_DEFAULT_CHANNEL DefaultChannels +#endif + +#endif /* PHP_IMAGICK_DEFS_H */ diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/php_imagick_file.h php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/php_imagick_file.h --- php-imagick-3.4.4/imagick-3.4.4+php8.0/php_imagick_file.h 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/php_imagick_file.h 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,76 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 / Imagick | + +----------------------------------------------------------------------+ + | Copyright (c) 2006-2013 Mikko Koppanen, Scott MacVicar | + | ImageMagick (c) ImageMagick Studio LLC | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Mikko Kopppanen | + | Scott MacVicar | + +----------------------------------------------------------------------+ +*/ +#ifndef PHP_IMAGICK_FILE_H +# define PHP_IMAGICK_FILE_H + +#include "php_imagick.h" +#include "php_imagick_defs.h" + +typedef enum { + ImagickUndefinedType, /* Don't know */ + ImagickFile, /* Use ImageMagick to read the file */ + ImagickUri, /* Use PHP streams to read the file */ + ImagickVirtualFormat, /* The file is a virtual, use ImageMagick */ +} ImagickFileType; + +struct php_imagick_file_t { + /* The file type */ + ImagickFileType type; + + /* Absolute path to the file, emalloced */ + char *absolute_path; + size_t absolute_path_len; + + /* Original filename */ + char filename[MaxTextExtent]; + size_t filename_len; +}; + +typedef enum { + ImagickUndefinedOperation, + ImagickReadImage, + ImagickPingImage, + ImagickWriteImage, + ImagickWriteImages, + + ImagickWriteImageFile, + ImagickWriteImagesFile, + + ImagickReadImageFile, + ImagickPingImageFile, +} ImagickOperationType; + + +zend_bool php_imagick_file_init(struct php_imagick_file_t *file, const char *filename, size_t filename_len TSRMLS_DC); + +void php_imagick_file_deinit(struct php_imagick_file_t *file); + +int php_imagick_safe_mode_check(const char *filename TSRMLS_DC); + +/* Read operations */ +php_imagick_rw_result_t php_imagick_read_file(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type TSRMLS_DC); + +/* Write operations */ +php_imagick_rw_result_t php_imagick_write_file(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type, zend_bool adjoin TSRMLS_DC); + +/* Handle streams */ +zend_bool php_imagick_stream_handler(php_imagick_object *intern, php_stream *stream, ImagickOperationType type TSRMLS_DC); + +#endif /* PHP_IMAGICK_FILE_H */ \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/php_imagick.h php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/php_imagick.h --- php-imagick-3.4.4/imagick-3.4.4+php8.0/php_imagick.h 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/php_imagick.h 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,51 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 / Imagick | + +----------------------------------------------------------------------+ + | Copyright (c) 2006-2013 Mikko Koppanen, Scott MacVicar | + | ImageMagick (c) ImageMagick Studio LLC | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Mikko Kopppanen | + | Scott MacVicar | + +----------------------------------------------------------------------+ +*/ +#ifndef PHP_IMAGICK_H +/* Prevent double inclusion */ +#define PHP_IMAGICK_H + +/* Define Extension Properties */ +#define PHP_IMAGICK_EXTNAME "imagick" +// The version is deliberately left as 'PACKAGE_VERSION' in source code. +// It is only replaced with the actual version number that packaged through pecl.php.net +#define PHP_IMAGICK_VERSION "3.4.4" +#define PHP_IMAGICK_EXTNUM 30404 + +/* Import configure options when building + outside of the PHP source tree */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#ifdef ZTS +# include "TSRM.h" +#endif + +/* Include PHP Standard Headers */ +#include "php.h" + +/* Define the entry point symbol + * ZE will use when loading this module + */ +extern zend_module_entry imagick_module_entry; +#define phpext_imagick_ptr &imagick_module_entry + +#endif /* PHP_IMAGICK_H */ + diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/php_imagick_helpers.h php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/php_imagick_helpers.h --- php-imagick-3.4.4/imagick-3.4.4+php8.0/php_imagick_helpers.h 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/php_imagick_helpers.h 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,88 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 / Imagick | + +----------------------------------------------------------------------+ + | Copyright (c) 2006-2013 Mikko Koppanen, Scott MacVicar | + | ImageMagick (c) ImageMagick Studio LLC | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Mikko Kopppanen | + | Scott MacVicar | + +----------------------------------------------------------------------+ +*/ +#ifndef PHP_IMAGICK_HELPERS_H +# define PHP_IMAGICK_HELPERS_H + +void php_imagick_initialize_constants(TSRMLS_D); + +zend_bool php_imagick_check_font(char *font, int font_len TSRMLS_DC); + +zend_bool php_imagick_thumbnail_dimensions(MagickWand *magick_wand, zend_bool bestfit, im_long desired_width, im_long desired_height, im_long *new_width, im_long *new_height, zend_bool legacy); + +PointInfo *php_imagick_zval_to_pointinfo_array(zval *coordinate_array, int *num_elements TSRMLS_DC); + +double *php_imagick_zval_to_double_array(zval *param_array, im_long *num_elements TSRMLS_DC); + +im_long *php_imagick_zval_to_long_array(zval *param_array, im_long *num_elements TSRMLS_DC); + +unsigned char *php_imagick_zval_to_char_array(zval *param_array, im_long *num_elements TSRMLS_DC); + +MagickBooleanType php_imagick_progress_monitor(const char *text, const MagickOffsetType offset, const MagickSizeType span, void *client_data); + +void php_imagick_cleanup_progress_callback(php_imagick_callback* progress_callback TSRMLS_DC); + +MagickBooleanType php_imagick_progress_monitor_callable(const char *text, const MagickOffsetType offset, const MagickSizeType span, void *client_data); + +zend_bool php_imagick_validate_map(const char *map TSRMLS_DC); + +php_imagick_rw_result_t php_imagick_file_access_check (const char *filename TSRMLS_DC); + + +PixelWand *php_imagick_zval_to_pixelwand (zval *param, php_imagick_class_type_t caller, zend_bool *allocated TSRMLS_DC); +PixelWand *php_imagick_zval_to_opacity (zval *param, php_imagick_class_type_t caller, zend_bool *allocated TSRMLS_DC); + + +char *php_imagick_set_locale (TSRMLS_D); +void php_imagick_restore_locale (const char *old_locale); + +PixelWand *php_imagick_clone_pixelwand (PixelWand *source); + +void php_imagick_replace_magickwand (php_imagick_object *obj, MagickWand *new_wand); + +void php_imagick_replace_drawingwand (php_imagickdraw_object *obj, DrawingWand *new_wand); + +void php_imagick_replace_pixelwand (php_imagickpixel_object *obj, PixelWand *new_wand); + +zend_bool php_imagick_ensure_not_empty (MagickWand *magick_wand); +zend_bool php_imagickpixel_ensure_not_null(PixelWand *pixel_wand); + +/* Defined in imagickpixeliterator_class.c */ +void php_imagick_pixel_iterator_new (PixelIterator *pixel_it, zval *return_value TSRMLS_DC); + +/* + Convert ImageMagick exception types to PHP exceptions +*/ +void php_imagick_convert_imagick_exception (MagickWand *magick_wand, const char *default_message TSRMLS_DC); +void php_imagick_convert_imagickdraw_exception (DrawingWand *drawing_wand, const char *default_message TSRMLS_DC); +void php_imagick_convert_imagickpixeliterator_exception (PixelIterator *pixel_iterator, const char *default_message TSRMLS_DC); +void php_imagick_convert_imagickpixel_exception (PixelWand *pixel_wand, const char *default_message TSRMLS_DC); + +/* + Convert read or write failure to PHP exception +*/ +void php_imagick_rw_fail_to_exception (MagickWand *magick_wand, php_imagick_rw_result_t rc, const char *filename TSRMLS_DC); +void php_imagick_imagickdraw_rw_fail_to_exception (DrawingWand *drawing_wand, php_imagick_rw_result_t rc, const char *filename TSRMLS_DC); + +/* + Throw an exception with message +*/ +void php_imagick_throw_exception (php_imagick_class_type_t type, const char *description TSRMLS_DC); + +#endif /* PHP_IMAGICK_HELPERS_H */ diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/php_imagick_macros.h php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/php_imagick_macros.h --- php-imagick-3.4.4/imagick-3.4.4+php8.0/php_imagick_macros.h 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/php_imagick_macros.h 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,49 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 / Imagick | + +----------------------------------------------------------------------+ + | Copyright (c) 2006-2013 Mikko Koppanen, Scott MacVicar | + | ImageMagick (c) ImageMagick Studio LLC | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Mikko Kopppanen | + | Scott MacVicar | + +----------------------------------------------------------------------+ +*/ + +#ifndef PHP_IMAGICK_MACROS_H +# define PHP_IMAGICK_MACROS_H + +#define IMAGICK_FREE_MAGICK_MEMORY(value) \ + do { \ + if (value) { \ + MagickRelinquishMemory(value); \ + value = NULL; \ + } \ + } while (0) + +#if !defined(E_DEPRECATED) +# define E_DEPRECATED E_STRICT +#endif + +#define IMAGICK_METHOD_DEPRECATED(class_name, method_name) \ + php_error(E_DEPRECATED, "%s::%s method is deprecated and it's use should be avoided", class_name, method_name); + +#define IMAGICK_METHOD_DEPRECATED_USE_INSTEAD(class_name, method_name, new_class, new_method) \ + php_error(E_DEPRECATED, "%s::%s is deprecated. %s::%s should be used instead", class_name, method_name, new_class, new_method); + + +#define IMAGICK_KERNEL_NOT_NULL_EMPTY(kernel) \ + if (kernel->kernel_info == NULL) { \ + zend_throw_exception(php_imagickkernel_exception_class_entry, "ImagickKernel is empty, cannot be used", (long)0 TSRMLS_CC); \ + RETURN_NULL(); \ + } + +#endif /* PHP_IMAGICK_MACROS_H */ diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/php_imagick_shared.h php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/php_imagick_shared.h --- php-imagick-3.4.4/imagick-3.4.4+php8.0/php_imagick_shared.h 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/php_imagick_shared.h 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,40 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 / Imagick | + +----------------------------------------------------------------------+ + | Copyright (c) 2006-2013 Mikko Koppanen, Scott MacVicar | + | ImageMagick (c) ImageMagick Studio LLC | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Mikko Kopppanen | + | Scott MacVicar | + +----------------------------------------------------------------------+ +*/ + +#ifndef _PHP_IMAGICK_SHARED_H_ +# define _PHP_IMAGICK_SHARED_H_ + +/* Should work with ImageMagick 6.x for now */ +#include "php.h" + +#if defined(PHP_WIN32) && defined(IMAGICK_EXPORTS) +#define PHP_IMAGICK_API __declspec(dllexport) +#else +#define PHP_IMAGICK_API PHPAPI +#endif + +/* + Allow extensions to use the class entries +*/ +PHP_IMAGICK_API zend_class_entry *php_imagick_get_class_entry(); +PHP_IMAGICK_API zend_class_entry *php_imagickdraw_get_class_entry(); +PHP_IMAGICK_API zend_class_entry *php_imagickpixel_get_class_entry(); + +#endif diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/shim_im6_to_im7.c php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/shim_im6_to_im7.c --- php-imagick-3.4.4/imagick-3.4.4+php8.0/shim_im6_to_im7.c 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/shim_im6_to_im7.c 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,880 @@ + +/* + +----------------------------------------------------------------------+ + | Imagick | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ +*/ + +#include "php_imagick.h" +#include "php_imagick_defs.h" +#include "php_imagick_macros.h" +#include "php_imagick_helpers.h" +#include "php_imagick_file.h" + +//derprecated + +//MagickReduceNoiseImage +//MagickMedianFilterImage +//MagickRecolorImage + +//Mising +//MagickSetImageBias +//MagickSetImageClipMask + + +#if MagickLibVersion >= 0x700 + + +// Functions that have been replaced by channel aware versions +MagickBooleanType MagickAdaptiveBlurImageChannel(MagickWand *wand,const ChannelType channel,const double radius, const double sigma) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickAdaptiveBlurImage(wand, radius, sigma); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + +MagickBooleanType MagickAdaptiveSharpenImageChannel(MagickWand *wand, const ChannelType channel, const double radius, const double sigma) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickAdaptiveSharpenImage(wand, radius, sigma); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + +MagickBooleanType MagickAddNoiseImageChannel(MagickWand *wand,const ChannelType channel,const NoiseType noise_type) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + //TODO - what is the value meant to be? + status = MagickAddNoiseImage(wand, noise_type, 1.0); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + +MagickBooleanType MagickAutoGammaImageChannel(MagickWand *wand, const ChannelType channel) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickAutoGammaImage(wand); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + +MagickBooleanType MagickAutoLevelImageChannel(MagickWand *wand, + const ChannelType channel) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickAutoLevelImage(wand); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + +MagickBooleanType MagickBlurImageChannel(MagickWand *wand, + const ChannelType channel,const double radius,const double sigma) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickBlurImage(wand, radius,sigma); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + +MagickBooleanType MagickBrightnessContrastImageChannel(MagickWand *wand,const ChannelType channel,const double brightness, const double contrast) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickBrightnessContrastImage(wand, brightness, contrast); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + +MagickBooleanType MagickClampImageChannel(MagickWand *wand, const ChannelType channel) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickClampImage(wand); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; + +} + +MagickBooleanType MagickClutImageChannel(MagickWand *wand, const ChannelType channel, const MagickWand *clut_wand) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + //TODO - need to take parameter + status = MagickClutImage(wand, clut_wand, AverageInterpolatePixel); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + +MagickBooleanType MagickCompositeImageChannel(MagickWand *wand, + const ChannelType channel,const MagickWand *source_wand, + const CompositeOperator compose,const ssize_t x,const ssize_t y) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + long clip_to_self = 1; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickCompositeImage(wand, source_wand, compose, clip_to_self, x,y); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + + +MagickWand *MagickCompareImageChannels(MagickWand *wand, const MagickWand *reference, const ChannelType channel, const MetricType metric, double *distortion) { + + MagickWand *tmp_wand; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + tmp_wand = MagickCompareImages(wand, reference, metric, distortion); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + return tmp_wand; +} + + +MagickBooleanType MagickContrastStretchImageChannel(MagickWand *wand, + const ChannelType channel,const double black_point, + const double white_point) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickContrastStretchImage(wand, black_point, white_point); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + +MagickBooleanType MagickConvolveImageChannel(MagickWand *wand, + const ChannelType channel, const KernelInfo *kernel){ + + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickConvolveImage(wand, kernel); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + + +MagickBooleanType MagickEqualizeImageChannel(MagickWand *wand, + const ChannelType channel) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickEqualizeImage(wand); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + + +MagickBooleanType MagickEvaluateImageChannel(MagickWand *wand, + const ChannelType channel,const MagickEvaluateOperator op,const double value) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickEvaluateImage(wand,op,value); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + +//MagickBooleanType MagickFilterImageChannel(MagickWand *wand, +// const ChannelType channel,const KernelInfo *kernel) { +// MagickBooleanType status; +// ChannelType previous_channel_mask; +// +// if (channel != UndefinedChannel) { +// previous_channel_mask = MagickSetImageChannelMask(wand, channel); +// } +// +// status = MagickFilterImage(wand, kernel); +// +// if (channel != UndefinedChannel) { +// (void) MagickSetImageChannelMask(wand, previous_channel_mask); +// } +// +// return status; +//} + +MagickBooleanType MagickFloodfillPaintImageChannel(MagickWand *wand, + const ChannelType channel,const PixelWand *fill,const double fuzz, + const PixelWand *bordercolor,const ssize_t x,const ssize_t y, + const MagickBooleanType invert) { + + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickFloodfillPaintImage(wand, fill, fuzz, bordercolor, x, y, invert); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + +MagickBooleanType MagickFunctionImageChannel(MagickWand *wand, + const ChannelType channel,const MagickFunction function, + const size_t number_arguments,const double *arguments) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickFunctionImage(wand,function,number_arguments,arguments); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + + +MagickWand *MagickFxImageChannel(MagickWand *wand, const ChannelType channel,const char *expression) { + + MagickWand *result_wand; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + result_wand = MagickFxImage(wand, expression); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return result_wand; +} + + +MagickBooleanType MagickGammaImageChannel(MagickWand *wand, + const ChannelType channel,const double gamma) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickGammaImage(wand,gamma); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + +MagickBooleanType MagickGaussianBlurImageChannel(MagickWand *wand, + const ChannelType channel,const double radius,const double sigma) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickGaussianBlurImage(wand,radius,sigma); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + +size_t MagickGetImageChannelDepth(MagickWand *wand, const ChannelType channel) { + size_t depth; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + depth = MagickGetImageDepth(wand); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return depth; +} + +MagickBooleanType MagickGetImageChannelMean(MagickWand *wand, const ChannelType channel,double *mean, + double *standard_deviation) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickGetImageMean(wand, mean, standard_deviation); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + + +MagickBooleanType MagickSetImageChannelDepth(MagickWand *wand, const ChannelType channel, + const size_t depth) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickSetImageDepth(wand, depth); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + +MagickBooleanType MagickGetImageChannelDistortion(MagickWand *wand, + const MagickWand *reference,const ChannelType channel,const MetricType metric, + double *distortion) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickGetImageDistortion(wand, reference, metric, distortion); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + +MagickBooleanType MagickGetImageChannelKurtosis(MagickWand *wand,const ChannelType channel, + double *kurtosis,double *skewness) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickGetImageKurtosis(wand,kurtosis,skewness); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + +MagickBooleanType MagickGetImageChannelRange(MagickWand *wand,const ChannelType channel,double *minima, + double *maxima) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickGetImageRange(wand, minima, maxima); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + +MagickBooleanType MagickOrderedPosterizeImageChannel(MagickWand *wand,const ChannelType channel, + const char *threshold_map) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickOrderedDitherImage(wand, threshold_map); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + +ChannelStatistics *MagickGetImageChannelStatistics(MagickWand *wand) { + return MagickGetImageStatistics(wand); +} + +MagickBooleanType MagickHaldClutImageChannel(MagickWand *wand, const ChannelType channel,const MagickWand *hald_wand) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickHaldClutImage(wand, hald_wand); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + +MagickBooleanType MagickLevelImageChannel(MagickWand *wand, + const ChannelType channel,const double black_point,const double gamma, + const double white_point) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickLevelImage(wand,black_point,gamma, white_point); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + +MagickBooleanType MagickMorphologyImageChannel(MagickWand *wand, + ChannelType channel,MorphologyMethod method,const ssize_t iterations, + KernelInfo *kernel) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickMorphologyImage(wand, method, iterations, kernel); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + +MagickBooleanType MagickMotionBlurImageChannel(MagickWand *wand, + const ChannelType channel,const double radius,const double sigma, + const double angle) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickMotionBlurImage(wand, radius, sigma,angle); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + + +MagickBooleanType MagickNegateImageChannel(MagickWand *wand,const ChannelType channel,const MagickBooleanType gray) { + + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickNegateImage(wand, gray); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + +MagickBooleanType MagickNormalizeImageChannel(MagickWand *wand, + const ChannelType channel) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickNormalizeImage(wand); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + +MagickBooleanType MagickOpaquePaintImageChannel(MagickWand *wand, + const ChannelType channel,const PixelWand *target, + const PixelWand *fill,const double fuzz,const MagickBooleanType invert) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickOpaquePaintImage(wand, target, fill, fuzz, invert); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + + +MagickBooleanType MagickRandomThresholdImageChannel(MagickWand *wand, + const ChannelType channel,const double low,const double high) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickRandomThresholdImage(wand, low, high); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + +MagickBooleanType MagickRotationalBlurImageChannel(MagickWand *wand, + const ChannelType channel,const double angle) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickRotationalBlurImage(wand, angle); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + +MagickBooleanType MagickSelectiveBlurImageChannel(MagickWand *wand, + const ChannelType channel,const double radius,const double sigma, + const double threshold) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickSelectiveBlurImage(wand, radius, sigma, threshold); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + +MagickBooleanType MagickSeparateImageChannel(MagickWand *wand,const ChannelType channel) { + return MagickSeparateImage(wand, channel); +} + +MagickBooleanType MagickSharpenImageChannel(MagickWand *wand, + const ChannelType channel,const double radius,const double sigma) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickSharpenImage(wand, radius, sigma); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + +MagickBooleanType MagickSigmoidalContrastImageChannel( + MagickWand *wand,const ChannelType channel,const MagickBooleanType sharpen, + const double alpha,const double beta) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickSigmoidalContrastImage(wand, sharpen, alpha, beta); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + +MagickBooleanType MagickSolarizeImageChannel(MagickWand *wand, const ChannelType channel,const double threshold) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickSolarizeImage(wand, threshold); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + + + +MagickBooleanType MagickSparseColorImageChannel(MagickWand *wand, const ChannelType channel,const SparseColorMethod method, const size_t number_arguments,const double *arguments) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickSparseColorImage(wand, method, number_arguments, arguments); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + + + +MagickBooleanType MagickStatisticImageChannel(MagickWand *wand, + const ChannelType channel,const StatisticType type,const size_t width, + const size_t height) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickStatisticImage(wand, type, width, height); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + +//MagickBooleanType MagickThresholdImageChannel(MagickWand *wand, +// const ChannelType channel,const double threshold) { +// MagickBooleanType status; +// ChannelType previous_channel_mask; +// +// if (channel != UndefinedChannel) { +// previous_channel_mask = MagickSetImageChannelMask(wand, channel); +// } +// +// status = MagickThresholdImage(wand, threshold); +// +// if (channel != UndefinedChannel) { +// (void) MagickSetImageChannelMask(wand, previous_channel_mask); +// } +// +// return status; +//} + + +MagickBooleanType MagickUnsharpMaskImageChannel(MagickWand *wand, + const ChannelType channel,const double radius,const double sigma, + const double amount,const double threshold) { + MagickBooleanType status; + ChannelType previous_channel_mask; + + if (channel != UndefinedChannel) { + previous_channel_mask = MagickSetImageChannelMask(wand, channel); + } + + status = MagickUnsharpMaskImage(wand, radius, sigma, amount, threshold); + + if (channel != UndefinedChannel) { + (void) MagickSetImageChannelMask(wand, previous_channel_mask); + } + + return status; +} + + + + +#endif \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/shim_im6_to_im7.h php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/shim_im6_to_im7.h --- php-imagick-3.4.4/imagick-3.4.4+php8.0/shim_im6_to_im7.h 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/shim_im6_to_im7.h 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,156 @@ + + +#if MagickLibVersion >= 0x700 + + +// Functions that have been renamed +ChannelStatistics *MagickGetImageChannelStatistics(MagickWand *wand); +MagickWand *MagickCompareImageChannels( + MagickWand *wand, + const MagickWand *reference, + const ChannelType channel, + const MetricType metric, + double *distortion +); + +MagickBooleanType MagickConvolveImageChannel(MagickWand *wand, + const ChannelType channel, const KernelInfo *kernel); + +//Function that used to be channel only +MagickBooleanType MagickFloodfillPaintImageChannel(MagickWand *wand, + const ChannelType channel,const PixelWand *fill,const double fuzz, + const PixelWand *bordercolor,const ssize_t x,const ssize_t y, + const MagickBooleanType invert +); + +MagickBooleanType MagickSparseColorImageChannel(MagickWand *wand, const ChannelType channel,const SparseColorMethod method, const size_t number_arguments,const double *arguments); + +// Functions that have been replaced by channel aware versions +MagickBooleanType MagickAdaptiveBlurImageChannel( + MagickWand *magick_wand, + const ChannelType channel, + const double radius, + const double sigma +); +MagickBooleanType MagickAdaptiveSharpenImageChannel( + MagickWand *wand, + const ChannelType channel, + const double radius, + const double sigma +); +MagickBooleanType MagickAddNoiseImageChannel( + MagickWand *wand, + const ChannelType channel, + const NoiseType noise_type +); +MagickBooleanType MagickAutoGammaImageChannel(MagickWand *wand, + const ChannelType channel); +MagickBooleanType MagickAutoLevelImageChannel(MagickWand *wand, + const ChannelType channel); +MagickBooleanType MagickBlurImageChannel(MagickWand *wand, + const ChannelType channel,const double radius,const double sigma); +MagickBooleanType MagickBrightnessContrastImageChannel(MagickWand *wand, + const ChannelType channel,const double brightness, + const double contrast); +MagickBooleanType MagickClampImageChannel(MagickWand *wand, + const ChannelType channel); +MagickBooleanType MagickClutImageChannel(MagickWand *wand, + const ChannelType channel,const MagickWand *clut_wand); +MagickBooleanType MagickCompositeImageChannel(MagickWand *wand, + const ChannelType channel,const MagickWand *composite_wand, + const CompositeOperator compose,const ssize_t x,const ssize_t y); +MagickBooleanType MagickContrastStretchImageChannel(MagickWand *wand, + const ChannelType channel,const double black_point, + const double white_point); +MagickBooleanType MagickEqualizeImageChannel(MagickWand *wand, + const ChannelType channel); +MagickBooleanType MagickEvaluateImageChannel(MagickWand *wand, + const ChannelType channel,const MagickEvaluateOperator op, + const double value); +MagickBooleanType MagickGetImageChannelDistortion(MagickWand *wand, + const MagickWand *reference,const ChannelType channel,const MetricType metric, + double *distortion); +MagickBooleanType MagickGetImageChannelKurtosis(MagickWand *wand,const ChannelType channel, + double *kurtosis,double *skewness); +MagickBooleanType MagickGetImageChannelRange(MagickWand *wand,const ChannelType channel,double *minima, + double *maxima); +size_t MagickGetImageChannelDepth(MagickWand *wand, const ChannelType channel); +MagickBooleanType MagickSetImageChannelDepth(MagickWand *wand, const ChannelType channel, + const size_t depth); +MagickBooleanType MagickGetImageChannelMean(MagickWand *wand, const ChannelType channel,double *mean, + double *standard_deviation); +//MagickBooleanType MagickFilterImageChannel(MagickWand *wand, +// const ChannelType channel,const KernelInfo *kernel); +MagickBooleanType MagickOrderedPosterizeImageChannel(MagickWand *wand,const ChannelType channel, + const char *threshold_map); + +MagickBooleanType MagickFloodfillPaintImageChannel( + MagickWand *wand, + const ChannelType channel, const PixelWand *fill,const double fuzz, + const PixelWand *bordercolor,const ssize_t x,const ssize_t y, + const MagickBooleanType invert +); +MagickBooleanType MagickFunctionImageChannel(MagickWand *wand, + const ChannelType channel,const MagickFunction function, + const size_t number_arguments,const double *arguments); + +MagickWand *MagickFxImageChannel( + MagickWand *wand, + const ChannelType channel, + const char *expression +); + +MagickBooleanType MagickGammaImageChannel(MagickWand *wand, + const ChannelType channel,const double gamma); +MagickBooleanType MagickGaussianBlurImageChannel(MagickWand *wand, + const ChannelType channel,const double radius,const double sigma); +MagickBooleanType MagickHaldClutImageChannel(MagickWand *wand, + const ChannelType channel,const MagickWand *hald_wand); +MagickBooleanType MagickLevelImageChannel(MagickWand *wand, + const ChannelType channel,const double black_point,const double gamma, + const double white_point); +MagickBooleanType MagickMorphologyImageChannel(MagickWand *wand, + ChannelType channel,MorphologyMethod method,const ssize_t iterations, + KernelInfo *kernel); +MagickBooleanType MagickMotionBlurImageChannel(MagickWand *wand, + const ChannelType channel,const double radius,const double sigma, + const double angle); +MagickBooleanType MagickNegateImageChannel(MagickWand *wand, + const ChannelType channel,const MagickBooleanType gray); +MagickBooleanType MagickNormalizeImageChannel(MagickWand *wand, + const ChannelType channel); +MagickBooleanType MagickOpaquePaintImageChannel(MagickWand *wand, + const ChannelType channel,const PixelWand *target, + const PixelWand *fill,const double fuzz,const MagickBooleanType invert); +MagickBooleanType MagickOrderedPosterizeImageChannel(MagickWand *wand, + const ChannelType channel,const char *threshold_map); +MagickBooleanType MagickRandomThresholdImageChannel(MagickWand *wand, + const ChannelType channel,const double low,const double high); +MagickBooleanType MagickRotationalBlurImageChannel(MagickWand *wand, + const ChannelType channel,const double angle); +MagickBooleanType MagickSelectiveBlurImageChannel(MagickWand *wand, + const ChannelType channel,const double radius,const double sigma, + const double threshold); +MagickBooleanType MagickSharpenImageChannel(MagickWand *wand, + const ChannelType channel,const double radius,const double sigma); +MagickBooleanType MagickSigmoidalContrastImageChannel(MagickWand *wand, + const ChannelType channel,const MagickBooleanType sharpen, + const double alpha,const double beta); +MagickBooleanType MagickSolarizeImageChannel(MagickWand *wand, + const ChannelType channel,const double threshold); +MagickBooleanType MagickStatisticImageChannel(MagickWand *wand, + const ChannelType channel,const StatisticType type,const size_t width, + const size_t height); +MagickBooleanType MagickThresholdImageChannel(MagickWand *wand, + const ChannelType channel,const double threshold); +MagickBooleanType MagickUnsharpMaskImageChannel(MagickWand *wand, + const ChannelType channel,const double radius,const double sigma, + const double amount,const double threshold); + +PixelInterpolateMethod MagickGetImageInterpolateMethod(MagickWand *); + +MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand, + const PixelInterpolateMethod method); +double DrawGetStrokeOpacity(const DrawingWand *wand); + +#endif \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/001_imagick_readimage.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/001_imagick_readimage.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/001_imagick_readimage.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/001_imagick_readimage.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,18 @@ +--TEST-- +Imagick::readImage test +--SKIPIF-- + +--FILE-- +readImage('foo.jpg'); +} catch (ImagickException $e) { + echo "got exception"; +} + +?> +--EXPECTF-- +--- Catch exception with try/catch +got exception \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/002_thumbnail.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/002_thumbnail.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/002_thumbnail.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/002_thumbnail.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,128 @@ +--TEST-- +Different types of thumbnailing +--SKIPIF-- + +--FILE-- +newImage( 400, 200, "white" ); +$imagick->thumbnailImage( 100, null, false ); +$g = $imagick->getImageGeometry(); +echo "{$g['width']}x{$g['height']}\n"; + +echo "--- Source Image: 400x200, Imagick::thumbnailImage( null, 100, false )\n"; +$imagick = new Imagick(); +$imagick->newImage( 400, 200, "white" ); +$imagick->thumbnailImage( null, 100, false ); +$g = $imagick->getImageGeometry(); +echo "{$g['width']}x{$g['height']}\n"; + +echo "--- Source Image: 400x200, Imagick::thumbnailImage( 100, 100, false )\n"; +$imagick = new Imagick(); +$imagick->newImage( 400, 200, "white" ); +$imagick->thumbnailImage( 100, 100, false); +$g = $imagick->getImageGeometry(); +echo "{$g['width']}x{$g['height']}\n"; + +echo "--- Source Image: 400x200, Imagick::thumbnailImage( null, null, false )\n"; +$imagick = new Imagick(); +$imagick->newImage( 400, 200, "white" ); +try +{ + $imagick->thumbnailImage( null, null, false ); + echo "FAILED TEST\n"; +} +catch ( ImagickException $e ) +{ + echo $e->getMessage() . "\n"; +} + +echo "--- Source Image: 400x200, Imagick::thumbnailImage( 100, 100, true )\n"; +$imagick = new Imagick(); +$imagick->newImage( 400, 200, "white" ); +$imagick->thumbnailImage( 100, 100, true ); +$g = $imagick->getImageGeometry(); +echo "{$g['width']}x{$g['height']}\n"; + +echo "--- Source Image: 400x200, Imagick::thumbnailImage( 100, null, true )\n"; +$imagick = new Imagick(); +$imagick->newImage( 400, 200, "white" ); +try +{ + $imagick->thumbnailImage( 100, null, true ); + echo "FAILED TEST\n"; +} +catch ( ImagickException $e ) +{ + echo $e->getMessage() . "\n"; +} + +echo "--- Source Image: 400x200, Imagick::thumbnailImage( null, 100, true )\n"; +$imagick = new Imagick(); +$imagick->newImage( 400, 200, "white" ); +try +{ + $imagick->thumbnailImage( null, 100, true ); + echo "FAILED TEST\n"; +} +catch ( ImagickException $e ) +{ + echo $e->getMessage() . "\n"; +} + +echo "--- Source Image: 400x200, Imagick::thumbnailImage( null, null, true )\n"; +$imagick = new Imagick(); +$imagick->newImage( 400, 200, "white" ); +try +{ + $imagick->thumbnailImage( null, null, true ); + echo "FAILED TEST\n"; +} +catch ( ImagickException $e ) +{ + echo $e->getMessage() . "\n"; +} + +// Legacy version +$imagick = new Imagick(); +$imagick->newImage(2961, 2592, "white" ); +$imagick->thumbnailImage(300, 0, false, false, true); + +if ($imagick->getImageWidth() != 300) { + echo "Error in height for 2961, 2592: actual is ".$image->getImageWidth()." not 300.".PHP_EOL; +} +if ($imagick->getImageHeight() != 262) { + echo "Error in height for 2961, 2592: actual is ".$image->getImageHeight()." not 262.".PHP_EOL; +} + +// Correct version +$imagick = new Imagick(); +$imagick->newImage(2961, 2592, "white" ); +$imagick->thumbnailImage(300, 0); + +if ($imagick->getImageWidth() != 300) { + echo "Error in height for 2961, 2592: actual is ".$image->getImageWidth()." not 300.".PHP_EOL; +} +if ($imagick->getImageHeight() != 263) { + echo "Error in height for 2961, 2592: actual is ".$image->getImageHeight()." not 263.".PHP_EOL; +} + +?> +--EXPECTF-- +--- Source Image: 400x200, Imagick::thumbnailImage( 100, null, false ) +100x50 +--- Source Image: 400x200, Imagick::thumbnailImage( null, 100, false ) +200x100 +--- Source Image: 400x200, Imagick::thumbnailImage( 100, 100, false ) +100x100 +--- Source Image: 400x200, Imagick::thumbnailImage( null, null, false ) +Invalid image geometry +--- Source Image: 400x200, Imagick::thumbnailImage( 100, 100, true ) +100x50 +--- Source Image: 400x200, Imagick::thumbnailImage( 100, null, true ) +Invalid image geometry +--- Source Image: 400x200, Imagick::thumbnailImage( null, 100, true ) +Invalid image geometry +--- Source Image: 400x200, Imagick::thumbnailImage( null, null, true ) +Invalid image geometry diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/003_cast_color_opacity.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/003_cast_color_opacity.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/003_cast_color_opacity.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/003_cast_color_opacity.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,33 @@ +--TEST-- +Casting color and opacity to pixel +--SKIPIF-- + +--FILE-- +newImage(100, 100, "red"); + $im->tintImage("red", "gray(50%)"); + echo "Casting color and opacity succeeded\n"; +} catch (Exception $e) { + echo "Casting color and opacity failed: " , $e->getMessage() . PHP_EOL; +} + +try { + $im = new Imagick(); + $pixel = new ImagickPixel("red"); + $strengthPixel = new ImagickPixel("gray"); + $im->newImage(100, 100, $pixel); + $im->tintImage($pixel, $strengthPixel); + echo "Setting color and opacity without cast succeeded\n"; +} catch (Exception $e) { + echo "Setting color and opacity without cast failed: " , $e->getMessage() . PHP_EOL; +} + +?> +--EXPECTF-- +--- Testing casts +Casting color and opacity succeeded +Setting color and opacity without cast succeeded \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/004_clone.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/004_clone.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/004_clone.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/004_clone.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,25 @@ +--TEST-- +Testing clone keyword +--SKIPIF-- + +--FILE-- +newImage(100, 100, new ImagickPixel("white")); + $new = clone $im; + + if ($new->getImageWidth() == 100 && $new->getImageHeight() == 100) { + echo "Cloning succeeded\n"; + } else { + echo "Cloning failed\n"; + } +} catch (Exception $e) { + echo "Cloning failed\n"; +} +?> +--EXPECTF-- +--- Testing clone keyword +Cloning succeeded \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/005_bestfit.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/005_bestfit.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/005_bestfit.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/005_bestfit.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,21 @@ +--TEST-- +Test thumbnail bestfit +--SKIPIF-- + +--FILE-- +newImage(50, 100, 'white'); + +$im->thumbnailImage(100, 50, true); +var_dump($im->getImageGeometry()); + +?> +--EXPECTF-- +array(2) { + ["width"]=> + int(25) + ["height"]=> + int(50) +} \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/006_cropthumbnail.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/006_cropthumbnail.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/006_cropthumbnail.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/006_cropthumbnail.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,69 @@ +--TEST-- +Test cropthumbnail +--SKIPIF-- + +--FILE-- +cropThumbnailImage(200, 200); +var_dump($im->getImageGeometry()); + +$im = new Imagick("magick:rose"); +$im->cropThumbnailImage(170, 120); +var_dump($im->getImageGeometry()); + +$im = new Imagick("magick:rose"); +$im->cropThumbnailImage(50, 50); +var_dump($im->getImageGeometry()); + +$im = new Imagick("magick:rose"); +$im->cropThumbnailImage(60, 120); +var_dump($im->getImageGeometry()); + +$im = new Imagick("magick:logo"); +$im->cropThumbnailImage(100, 100); +var_dump($im->getImageGeometry()); + +$im = new Imagick("magick:rose"); +$im->cropThumbnailImage(200, 10); +var_dump($im->getImageGeometry()); + +?> +--EXPECTF-- +array(2) { + ["width"]=> + int(200) + ["height"]=> + int(200) +} +array(2) { + ["width"]=> + int(170) + ["height"]=> + int(120) +} +array(2) { + ["width"]=> + int(50) + ["height"]=> + int(50) +} +array(2) { + ["width"]=> + int(60) + ["height"]=> + int(120) +} +array(2) { + ["width"]=> + int(100) + ["height"]=> + int(100) +} +array(2) { + ["width"]=> + int(200) + ["height"]=> + int(10) +} \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/007_thumbnail_fill.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/007_thumbnail_fill.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/007_thumbnail_fill.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/007_thumbnail_fill.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,34 @@ +--TEST-- +Test filling thumbnail with color +--SKIPIF-- += 0x660 && $v ['versionNumber'] < 0x670) + die ('skip seems to be broken in this version of ImageMagick'); +?> +--FILE-- +setImageBackgroundColor("pink"); +$im->thumbnailImage(200, 200, true, true); + +$color = $im->getImagePixelColor(5, 5); +if ($color->isPixelSimilar("pink", 0)) + echo "Similar" . PHP_EOL; +else + var_dump ($color->getColorAsString()); + +$color = $im->getImagePixelColor(199, 5); +if ($color->isPixelSimilar("pink", 0)) + echo "Similar" . PHP_EOL; +else + var_dump ($color->getColorAsString()); +?> +--EXPECT-- +Similar +Similar \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/008_newpseudoimage.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/008_newpseudoimage.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/008_newpseudoimage.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/008_newpseudoimage.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,54 @@ +--TEST-- +Test pseudo formats +--SKIPIF-- + +--FILE-- +newPseudoImage(100, 100, "XC:red"); +var_dump($im->getImageGeometry()); + +$im->newPseudoImage(0, 0, "magick:logo"); +var_dump($im->getImageGeometry()); + +$im->readImage("magick:logo"); +var_dump($im->getImageGeometry()); + +$im->newPseudoImage(0, 0, "rose:"); +var_dump($im->getImageGeometry()); + +try { +$im->newPseudoImage(0, 0, "png:"); +var_dump($im->getImageGeometry()); +} catch (Exception $e) { + echo "fail\n"; +} + +?> +--EXPECTF-- +array(2) { + ["width"]=> + int(%d) + ["height"]=> + int(%d) +} +array(2) { + ["width"]=> + int(%d) + ["height"]=> + int(%d) +} +array(2) { + ["width"]=> + int(%d) + ["height"]=> + int(%d) +} +array(2) { + ["width"]=> + int(%d) + ["height"]=> + int(%d) +} +fail \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/009_properties.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/009_properties.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/009_properties.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/009_properties.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,21 @@ +--TEST-- +Test reading properties +--SKIPIF-- + +--FILE-- +newPseudoImage(100, 100, "XC:red"); +$im->setImageFormat("png"); + +echo $im->width . "x" . $im->height . "\n"; +echo $im->format; + +?> +--EXPECTF-- +100x100 +png \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/010_importimagepixels.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/010_importimagepixels.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/010_importimagepixels.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/010_importimagepixels.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,48 @@ +--TEST-- +Test importimagepixels +--SKIPIF-- + +--FILE-- +newImage($width, $height, 'gray'); + +/* Import the pixels into image. + width * height * strlen("RGB") must match count($pixels) */ +$im->importImagePixels(0, 0, $width, $height, "RGB", Imagick::PIXEL_CHAR, $pixels); + +var_dump($width, $height); +var_dump($im->getImageGeometry()); + +?> +--EXPECTF-- +int(100) +int(100) +array(2) { + ["width"]=> + int(100) + ["height"]=> + int(100) +} \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/011_polygon.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/011_polygon.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/011_polygon.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/011_polygon.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,33 @@ +--TEST-- +Test polygon method arguments +--SKIPIF-- + +--FILE-- +polygon(array( + array('x' => 1, 'y' => 2), + array('x' => 'hello', 'y' => array()) + )); + + echo "pass\n"; + +} catch (Exception $e) { + echo "fail\n"; +} + +try { + $draw->polygon(array(array())); + echo "fail\n"; +} catch (ImagickDrawException $e) { + echo "pass\n"; +} + +?> +--EXPECTF-- +pass +pass \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/012-clone-separation.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/012-clone-separation.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/012-clone-separation.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/012-clone-separation.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,25 @@ +--TEST-- +Testing that cloned object does not affect the original +--SKIPIF-- + +--FILE-- +newImage(100, 100, new ImagickPixel("white")); + +$new = clone $im; +$new->thumbnailImage(200, null); +var_dump($im->width, $new->width); + +$new2 = $im->clone(); +$new2->thumbnailImage(200, null); +var_dump($im->width, $new2->width); + +?> +--EXPECTF-- +int(100) +int(200) + +%s: Imagick::clone method is deprecated and it's use should be avoided in %s on line %d +int(100) +int(200) \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/013-read-filehandle.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/013-read-filehandle.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/013-read-filehandle.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/013-read-filehandle.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,28 @@ +--TEST-- +Imagick::readImageFile test +--SKIPIF-- + +--FILE-- +setImageFormat('jpg'); +$imagick->writeImage($file); + +$imagick->clear(); + +$handle = fopen($file, 'rb'); +$imagick->readImageFile($handle); + +unlink($file); + +echo 'success'; + +?> +--EXPECT-- +success \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/014-setresourcelimit.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/014-setresourcelimit.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/014-setresourcelimit.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/014-setresourcelimit.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,68 @@ +--TEST-- +Imagick::setResourceLimit test +--SKIPIF-- + +--FILE-- + 100000000, + + // Set maximum amount of disk space in bytes permitted for use by the pixel cache. When this limit is exceeded, the pixel cache is not be created and an error message is returned. + Imagick::RESOURCETYPE_DISK => 100, + + + //Set maximum number of open pixel cache files. When this limit is exceeded, any subsequent pixels cached to disk are closed and reopened on demand. This behavior permits a large number of images to be accessed simultaneously on disk, but with a speed penalty due to repeated open/close calls. + Imagick::RESOURCETYPE_FILE => 100, + + // Set maximum amount of memory map in bytes to allocate for the pixel cache. When this limit is exceeded, the image pixels are cached to disk + Imagick::RESOURCETYPE_MAP => 10 * $g, + + // Set maximum amount of memory in bytes to allocate for the pixel cache from the heap. When this limit is exceeded, the image pixels are cached to memory-mapped disk + Imagick::RESOURCETYPE_MEMORY => 10 * $g, +); + +if (defined('Imagick::RESOURCETYPE_TIME')) { + $tests[Imagick::RESOURCETYPE_TIME] = 30; +} + +if (defined('Imagick::RESOURCETYPE_THROTTLE')) { + $tests[Imagick::RESOURCETYPE_THROTTLE] = 1; +} +if (defined('Imagick::RESOURCETYPE_THREAD')) { + $tests[Imagick::RESOURCETYPE_THREAD] = 1; +} +if (defined('Imagick::RESOURCETYPE_WIDTH')) { + $tests[Imagick::RESOURCETYPE_WIDTH] = $g; +} +if (defined('Imagick::RESOURCETYPE_HEIGHT')) { + $tests[Imagick::RESOURCETYPE_HEIGHT] = $g; +} + +foreach ($tests as $resourceType => $value) { + Imagick::setResourceLimit($resourceType, $value); + $actualValue = Imagick::getResourceLimit($resourceType); + + if ($actualValue != $value) { + echo "Error testing $resourceType, value returned $actualValue is not $value \n"; + } +} + +echo 'success'; + +?> +--EXPECTF-- +success \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/015-imagickdrawsetresolution.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/015-imagickdrawsetresolution.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/015-imagickdrawsetresolution.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/015-imagickdrawsetresolution.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,57 @@ +--TEST-- +Test ImagickDraw->setResolution +--SKIPIF-- + +--FILE-- +newImage(1000,1000, "white","png"); + +$draw = new ImagickDraw(); +$draw->setFont (dirname (__FILE__) . '/anonymous_pro_minus.ttf'); +$draw->setFontSize(72); + +$draw->setResolution(10, 10); +$small = $im->queryFontMetrics($draw, "Hello World"); + +$draw->setResolution(300, 300); +$large = $im->queryFontMetrics($draw, "Hello World"); + +if ($small['textWidth'] < $large['textWidth']) { + echo "Small font _is_ smaller than big font.".PHP_EOL; +} + +//These will both be one line. +$oneLine = $im->queryFontMetrics($draw, "Hello Hello"); +$forceOneLine = $im->queryFontMetrics($draw, "Hello \nHello", false); + +//These will both be multiline +$forceMultiLine = $im->queryFontMetrics($draw, "Hello \nHello", true); +$guessLine = $im->queryFontMetrics($draw, "Hello\nHello"); + +if (abs($oneLine["textHeight"] - $forceOneLine["textHeight"]) > 0.1) { + //Reaching this is bad + echo "One line and forced one line are not the same height.".PHP_EOL; + echo $oneLine["textHeight"]." ".$forceOneLine["textHeight"].PHP_EOL; +} + +if ($forceMultiLine["textHeight"] - (2 * $forceOneLine["textHeight"]) + 2 > 0) { + echo "Two lines are 2 times one line.".PHP_EOL; +} + +if ($guessLine["textHeight"] - (2 * $forceOneLine["textHeight"]) + 2 > 0) { + echo "Two lines are 2 times one line.".PHP_EOL; +} + +echo "OK\n"; + +?> +--EXPECT-- +Small font _is_ smaller than big font. +Two lines are 2 times one line. +Two lines are 2 times one line. +OK diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/016-static-methods.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/016-static-methods.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/016-static-methods.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/016-static-methods.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,24 @@ +--TEST-- +Test static methods +--SKIPIF-- + +--FILE-- +queryFormats ()) . PHP_EOL; + +echo gettype (Imagick::queryFonts ()) . PHP_EOL; +echo gettype ($im->queryFonts ()) . PHP_EOL; + +echo 'success'; + +?> +--EXPECT-- +array +array +array +array +success \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/017-clear-destroy.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/017-clear-destroy.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/017-clear-destroy.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/017-clear-destroy.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,30 @@ +--TEST-- +Clear and destroy aliases +--SKIPIF-- + +--FILE-- +clear (); +$im->destroy (); + +$im = new ImagickDraw (); +$im->clear (); +$im->destroy (); + +$im = new ImagickPixel (); +$im->clear (); +$im->destroy (); + +$magick = new Imagick ('magick:rose'); + +$im = new ImagickPixelIterator ($magick); +$im->clear (); +$im->destroy (); + +echo 'success'; + +?> +--EXPECT-- +success \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/018-clone-length.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/018-clone-length.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/018-clone-length.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/018-clone-length.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,34 @@ +--TEST-- +Test clone length, this is expected upstream behaviour +--SKIPIF-- += 0x640 && $v ['versionNumber'] < 0x650) + die ('skip seems to be different in this version of ImageMagick'); +?> +--FILE-- +setImageFormat ('png'); +if ($im->getImageLength()) { + echo "Image created has length" . PHP_EOL; +} +else { + echo "Image created has zero length" . PHP_EOL; +} + +$cloned = clone $im; +$cloned->setImageFormat ('png'); + +var_dump ($cloned->getImageLength ()); + +?> +--EXPECT-- +Image created has length +int(0) diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/019-readimages.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/019-readimages.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/019-readimages.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/019-readimages.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,48 @@ +--TEST-- +Imagick::readImages +--SKIPIF-- + +--FILE-- +readImages (array ( + 'magick:rose', + 'magick:rose', + 'magick:rose', +)); +echo 'OK readImages' . PHP_EOL; +try{ + $imagick->readImages (array ( + 'magick:rose', + 'fail_this_does_not_exist.jpg', + )); + echo 'Fail' . PHP_EOL; +} catch (ImagickException $e) { + echo 'OK readImages exception'. PHP_EOL; +} + +?> +--EXPECT-- +OK construct exception +OK construct +OK readImages +OK readImages exception \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/020-pixeliterator.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/020-pixeliterator.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/020-pixeliterator.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/020-pixeliterator.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,103 @@ +--TEST-- +Pixel Iterator tests +--SKIPIF-- + +--FILE-- +rewind(); + $pixelRegion->resetIterator(); + + while($pixelRow = $pixelRegion->current()) { + $row++; + foreach ($pixelRow as $pixel) { + $objects++; + } + + $pixelRegion->syncIterator(); + $pixelRegion->next(); + if (!$pixelRegion->valid()) { + break; + } + } + + return $objects; +} + +$im = new Imagick ('magick:rose'); +$it1 = new ImagickPixelIterator ($im); +$it2 = ImagickPixelIterator::getPixelIterator ($im); +$it3 = $im->getPixelIterator(); + + +$count1 = count_rows ($it1); +$count2 = count_rows ($it2); +$count3 = count_rows ($it3); + +if ($count1 != $count2 || + $count1 != $count3) { + printf( + "Row counts do not match %d %d %d", + $count1, + $count2, + $count3 + ); +} + +if ($count1 != $count2 || + $count1 != $count3) { + printf( + "Object counts do not match %d %d %d", + $count1, + $count2, + $count3 + ); +} + +$objects = array($it1, $it2, $it3); + +foreach ($objects as $object) { + $loop = 0; + $count = count_objects($object); + $countIterator = count_objects_with_iterator($object); + if ($countIterator != $count) { + echo "Counting with iterator doesn't match counting with foreach $loop, $count != $countIterator."; + $loop++; + } +} + + +$it1->newPixelIterator (new Imagick ('magick:rose')); + +echo 'done' . PHP_EOL; +?> +--EXPECTF-- + +%s: ImagickPixelIterator::newPixelIterator is deprecated. ImagickPixelIterator::getPixelIterator should be used instead in %s on line %d +done \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/021-countable.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/021-countable.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/021-countable.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/021-countable.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,24 @@ +--TEST-- +Test countable interface +--SKIPIF-- + +--FILE-- + +--EXPECT-- +3 +done \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/022-writeimagefileformat.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/022-writeimagefileformat.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/022-writeimagefileformat.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/022-writeimagefileformat.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,67 @@ +--TEST-- +Test format support in writeImageFile +--SKIPIF-- + +--FILE-- +writeImage (JPEG_FILE); +$im->clear (); + +// This is the problematic case, setImageFormat doesn't really +// affect writeImageFile. +// So in this case we want to write PNG but file should come out +// as JPEG +$fp = fopen (PNG_FILE, "w+"); +$im->readImage (JPEG_FILE); +$im->setImageFormat ('png'); +$im->writeImageFile ($fp); +$im->clear (); +fclose ($fp); + +// Output the format +$identify = new Imagick (PNG_FILE); +echo $identify->getImageFormat () . PHP_EOL; + +// Lets try again, setting the filename rather than format +// This should cause PNG image to be written +$fp = fopen (PNG_FILE, "w+"); +$im->readImage (JPEG_FILE); +$im->setImageFilename ('png:'); +$im->writeImageFile ($fp); +$im->clear (); +fclose ($fp); + +// If all goes according to plan, on second time we should get PNG +$identify = new Imagick (PNG_FILE); +echo $identify->getImageFormat () . PHP_EOL; + +// Lastly, test the newly added format parameter +$fp = fopen (PNG_FILE, "w+"); +$im->readImage (JPEG_FILE); +$im->writeImageFile ($fp, 'png'); +$im->clear (); +fclose ($fp); + +// If all goes according to plan, on second time we should get PNG +$identify = new Imagick (PNG_FILE); +echo $identify->getImageFormat () . PHP_EOL; + +unlink (PNG_FILE); +unlink (JPEG_FILE); + +echo 'done' . PHP_EOL; +?> +--EXPECT-- +JPEG +PNG +PNG +done \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/024-ispixelsimilar.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/024-ispixelsimilar.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/024-ispixelsimilar.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/024-ispixelsimilar.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,57 @@ +--TEST-- +Test ImagickPixel::isPixelSimilar +--SKIPIF-- +isPixelSimilarQuantum($color2Pixel, $testDistance * \Imagick::getquantum()); + if ($isSimilar !== $expectation) { + echo "isSimilar failed. Color [$color1] compared to color [$color2] distance $testDistance doesn't meet expected result [$expectation].". PHP_EOL; + } + + $isPixelSimilar = $color1Pixel->isPixelSimilar($color2Pixel, $testDistance); + if ($isPixelSimilar !== $expectation) { + echo "isPixelSimilar failed. Color [$color1] compared to color [$color2] distance $testDistance doesn't meet expected result [$expectation].". PHP_EOL; + } + } + echo "success"; +} catch (\Exception $e) { + echo "Exception caught in ImagickPixel::isPixelSimilar test: ".$e->getMessage() . PHP_EOL; +} + +?> +--EXPECT-- +success \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/025-function-image.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/025-function-image.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/025-function-image.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/025-function-image.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,17 @@ +--TEST-- +Test functionimage +--SKIPIF-- + +--FILE-- +convolveimage (array (1, 'a', 1)); + +echo "OK" . PHP_EOL; +?> +--EXPECT-- +OK \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/025-get-color.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/025-get-color.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/025-get-color.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/025-get-color.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,170 @@ +--TEST-- +Test getColor and getColorQuantum +--SKIPIF-- + +--FILE-- + 1 + ); + $v = Imagick::getVersion(); + $versionNumber = $v['versionNumber']; + + if (array_key_exists($versionNumber, $troubledVersions)) { + $variance = $troubledVersions[$versionNumber]; + } + + if (Imagick::getHDRIEnabled()) { + return abs($expectedValue - $actualValue) < (0.01 + $variance); + } + + if ($hasVariance) { + $difference = abs($expectedValue - $actualValue); + if ($difference < 1 + $variance) { + return true; + } + echo "difference $difference not < 1 + variance $variance\n"; + return false; + } + else if($expectedValue == $actualValue) { + return true; + } + + return false; +} + +function getExpectedValue($someValue) { + if (Imagick::getHDRIEnabled()) { + return $someValue; + } + + $v = Imagick::getVersion(); + if ($v['versionNumber'] >= 0x692) { + //this is the new correct behaviour + return (intval(round($someValue, 0, PHP_ROUND_HALF_UP))); + } + else { + //old behaviour had wrong rounding. + return (intval(round($someValue, 0, PHP_ROUND_HALF_DOWN))); + } +} + + +$tests = array( + array( + 'red', + ORIGINAL, + array( + array('r', getExpectedValue(255), 0), + array('a', getExpectedValue(1.0), 0) + ), + ), + array( + 'red', + QUANTUM, + array( + array('r', getExpectedValue(\Imagick::getQuantum()), 0), + array('a', getExpectedValue(\Imagick::getQuantum()), 0) + ), + ), + array( + 'rgb(25%, 25%, 25%)', + QUANTUM, + array( + array('r', getExpectedValue(\Imagick::getQuantum() / 4), 0), + array('a', getExpectedValue(\Imagick::getQuantum()), 0), + ) + ) +); + +$version = Imagick::getVersion(); +// The following don't seem stable in lesser versions. +if ($version['versionNumber'] >= 0x687) { + $tests[] = array( + 'green', + QUANTUM, + array( + array('g', getExpectedValue(\Imagick::getQuantum() * (128 / 255)), 1), + array('a', getExpectedValue(\Imagick::getQuantum()), 1) + ), + ); + + $tests[] = array( + 'rgb(0, 50%, 0)', + QUANTUM, + array( + array('g', getExpectedValue(\Imagick::getQuantum() / 2), 1), + array('a', getExpectedValue(\Imagick::getQuantum()), 0) + ), + ); +} + + +foreach ($tests as $test) { + + list($colorString, $type, $expectations) = $test; + $pixel = new ImagickPixel($colorString); + + switch ($type) { + + case(ORIGINAL): { + $color = $pixel->getColor(); + break; + } + + case(NORMALISED): { + $color = $pixel->getColor(true); + break; + } + + case(NORMALISED_INCLUDING_ALPHA): { + $color = $pixel->getColor(2); + break; + } + + case(QUANTUM): { + $color = $pixel->getColorQuantum(); + break; + } + + default:{ + echo "Unknown test type $type" . PHP_EOL; + break; + } + } + + foreach ($expectations as $test) { + list($key, $expectedValue, $hasVariance) = $test; + if (!checkExpectedValue($expectedValue, $color[$key], $hasVariance)) { + printf( + "%s %s is wrong for colorString '%s': actual %s != expected %s" . PHP_EOL, + $type, + $key, $colorString, + $color[$key], $expectedValue + ); + } + } +} + +echo "OK" . PHP_EOL; +?> +--EXPECT-- +OK \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/026_phpinfo.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/026_phpinfo.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/026_phpinfo.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/026_phpinfo.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,23 @@ +--TEST-- +Test Imagick module hasn't broken phpinfo +--SKIPIF-- + +--FILE-- + enabled') !== false) { + echo "Ok"; +} +else { + echo "Imagick was not reported as enabled?"; + var_dump($contents); +} + +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/027_Imagick_adaptiveResizeImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/027_Imagick_adaptiveResizeImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/027_Imagick_adaptiveResizeImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/027_Imagick_adaptiveResizeImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,27 @@ +--TEST-- +Test Imagick, adaptiveResizeImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->adaptiveResizeImage($width, $height, $bestFit); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +adaptiveResizeImage($width, $height, $bestFit) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/028_Imagick_adaptiveSharpenImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/028_Imagick_adaptiveSharpenImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/028_Imagick_adaptiveSharpenImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/028_Imagick_adaptiveSharpenImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,27 @@ +--TEST-- +Test Imagick, adaptiveSharpenImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->adaptiveSharpenImage($radius, $sigma, $channel); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +adaptiveSharpenImage($radius, $sigma, $channel) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/029_Imagick_adaptiveBlurImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/029_Imagick_adaptiveBlurImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/029_Imagick_adaptiveBlurImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/029_Imagick_adaptiveBlurImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,27 @@ +--TEST-- +Test Imagick, adaptiveBlurImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->adaptiveBlurImage($radius, $sigma, $channel); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +adaptiveBlurImage($radius, $sigma, $channel) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/030_Imagick_adaptiveThresholdImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/030_Imagick_adaptiveThresholdImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/030_Imagick_adaptiveThresholdImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/030_Imagick_adaptiveThresholdImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,28 @@ +--TEST-- +Test Imagick, adaptiveThresholdImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $adaptiveOffsetQuantum = intval($adaptiveOffset * \Imagick::getQuantum()); + $imagick->adaptiveThresholdImage($width, $height, $adaptiveOffsetQuantum); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +adaptiveThresholdImage($width, $height, $adaptiveOffset) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/031_Imagick_affineTransformImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/031_Imagick_affineTransformImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/031_Imagick_affineTransformImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/031_Imagick_affineTransformImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,37 @@ +--TEST-- +Test Imagick, affineTransformImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $draw = new \ImagickDraw(); + + $angle = 40 ; + + $affineRotate = array( + "sx" => cos($angle), "sy" => cos($angle), + "rx" => sin($angle), "ry" => -sin($angle), + "tx" => 0, "ty" => 0, + ); + + $draw->affine($affineRotate); + + $imagick->affineTransformImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +affineTransformImage() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/032_Imagick_addNoiseImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/032_Imagick_addNoiseImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/032_Imagick_addNoiseImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/032_Imagick_addNoiseImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,26 @@ +--TEST-- +Test Imagick, addNoiseImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->addNoiseImage($noiseType, $channel); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +addNoiseImage($noiseType, $channel) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/033_Imagick_autoLevelImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/033_Imagick_autoLevelImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/033_Imagick_autoLevelImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/033_Imagick_autoLevelImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,25 @@ +--TEST-- +Test Imagick, autoLevelImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->autoLevelImage(); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +autoLevelImage() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/034_Imagick_annotateImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/034_Imagick_annotateImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/034_Imagick_annotateImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/034_Imagick_annotateImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,37 @@ +--TEST-- +Test Imagick, annotateImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + + $draw = new \ImagickDraw(); + $draw->setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + + $draw->setStrokeWidth(1); + $draw->setFontSize(36); + + $text = "Imagick is a native php \nextension to create and \nmodify images using the\nImageMagick API."; + + $imagick->annotateimage($draw, 40, 40, 0, $text); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +annotateImage($strokeColor, $fillColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/035_Imagick_blackThresholdImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/035_Imagick_blackThresholdImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/035_Imagick_blackThresholdImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/035_Imagick_blackThresholdImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,25 @@ +--TEST-- +Test Imagick, blackThresholdImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->blackthresholdimage($thresholdColor); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +blackThresholdImage($thresholdColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/036_Imagick_blueShiftImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/036_Imagick_blueShiftImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/036_Imagick_blueShiftImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/036_Imagick_blueShiftImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,25 @@ +--TEST-- +Test Imagick, blueShiftImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->blueShiftImage($blueShift); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +blueShiftImage($blueShift) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/037_Imagick_blurImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/037_Imagick_blurImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/037_Imagick_blurImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/037_Imagick_blurImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,27 @@ +--TEST-- +Test Imagick, blurImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->blurImage($radius, $sigma, $channel); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +blurImage($radius, $sigma, $channel) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/038_Imagick_brightnessContrastImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/038_Imagick_brightnessContrastImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/038_Imagick_brightnessContrastImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/038_Imagick_brightnessContrastImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,27 @@ +--TEST-- +Test Imagick, brightnessContrastImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->brightnessContrastImage($brightness, $contrast, $channel); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +brightnessContrastImage($brightness, $contrast, $channel) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/039_Imagick_borderImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/039_Imagick_borderImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/039_Imagick_borderImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/039_Imagick_borderImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,27 @@ +--TEST-- +Test Imagick, borderImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->borderImage($color, $width, $height); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +borderImage($color, $width, $height) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/040_Imagick_charcoalImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/040_Imagick_charcoalImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/040_Imagick_charcoalImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/040_Imagick_charcoalImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,26 @@ +--TEST-- +Test Imagick, charcoalImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->charcoalImage($radius, $sigma); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +charcoalImage($radius, $sigma) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/041_Imagick_chopImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/041_Imagick_chopImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/041_Imagick_chopImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/041_Imagick_chopImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,28 @@ +--TEST-- +Test Imagick, chopImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->chopImage($width, $height, $startX, $startY); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +chopImage($startX, $startY, $width, $height) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/042_Imagick_clutImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/042_Imagick_clutImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/042_Imagick_clutImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/042_Imagick_clutImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,28 @@ +--TEST-- +Test Imagick, clutImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + //$imagick->quantizeImage(16, \Imagick::COLORSPACE_YIQ, 8, true, false); + + $clutImagick = new \Imagick(); + $clutImagick->newPseudoImage(640, 480, "magick:NETSCAPE"); + $imagick->clutImage($clutImagick); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +clutImage() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/043_Imagick_colorizeImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/043_Imagick_colorizeImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/043_Imagick_colorizeImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/043_Imagick_colorizeImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,28 @@ +--TEST-- +Test Imagick, colorizeImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $opacity = $opacity / 255.0; + $opacityColor = new \ImagickPixel("rgba(0, 0, 0, $opacity)"); + $imagick->colorizeImage($color, $opacityColor); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +colorizeImage($color, $opacity) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/044_Imagick_colorMatrixImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/044_Imagick_colorMatrixImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/044_Imagick_colorMatrixImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/044_Imagick_colorMatrixImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,73 @@ +--TEST-- +Test Imagick, colorMatrixImage +--SKIPIF-- + +--FILE-- + 1.5, + 1 => 0, + 2 => 0, + 3 => 0, + 4 => -0.157, + 5 => 0, + 6 => 1, + 7 => 0.5, + 8 => 0, + 9 => -0.157, + 10 => 0, + 11 => 0, + 12 => 0.5, + 13 => 0, + 14 => 0.5, + 15 => 0, + 16 => 0, + 17 => 0, + 18 => 1, + 19 => 0, + 20 => 0, + 21 => 0, + 22 => 0, + 23 => 0, + 24 => 1, +); + +function colorMatrixImage($colorMatrix) { + $imagick = new \Imagick(); + $imagick->newPseudoImage(640, 480, "magick:logo"); + //$imagick->setImageOpacity(1); + + //A color matrix should look like: + // $colorMatrix = [ + // 1.5, 0.0, 0.0, 0.0, 0.0, -0.157, + // 0.0, 1.0, 0.5, 0.0, 0.0, -0.157, + // 0.0, 0.0, 1.5, 0.0, 0.0, -0.157, + // 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, + // 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, + // 0.0, 0.0, 0.0, 0.0, 0.0, 1.0 + // ]; + + $background = new \Imagick(); + $background->newPseudoImage($imagick->getImageWidth(), $imagick->getImageHeight(), "pattern:checkerboard"); + + $background->setImageFormat('png'); + + $imagick->setImageFormat('png'); + $imagick->colorMatrixImage($colorMatrix); + + $background->compositeImage($imagick, \Imagick::COMPOSITE_ATOP, 0, 0); + + $bytes = $background->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +colorMatrixImage($colorMatrix) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/045_Imagick_compositeImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/045_Imagick_compositeImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/045_Imagick_compositeImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/045_Imagick_compositeImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,49 @@ +--TEST-- +Test Imagick, compositeImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + + $img2 = new \Imagick(); + $img2->newPseudoImage(640, 480, "magick:logo"); + $img2->negateImage(false); + $img2->blurimage(10, 5); + + + $img1->resizeimage( + $img2->getImageWidth(), + $img2->getImageHeight(), + \Imagick::FILTER_LANCZOS, + 1 + ); + + $opacity = new \Imagick(); + $opacity->newPseudoImage( + $img1->getImageHeight(), + $img1->getImageWidth(), + "gradient:gray(10%)-gray(90%)" + ); + $opacity->rotateimage('black', 90); + + $img2->compositeImage($opacity, \Imagick::COMPOSITE_COPYOPACITY, 0, 0); + $img1->compositeImage($img2, \Imagick::COMPOSITE_ATOP, 0, 0); + + $bytes = $img1->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +compositeImage() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/046_Imagick_contrastImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/046_Imagick_contrastImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/046_Imagick_contrastImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/046_Imagick_contrastImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,28 @@ +--TEST-- +Test Imagick, contrastImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + if ($contrastType != 2) { + $imagick->contrastImage($contrastType); + } + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +contrastImage($contrastType) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/047_Imagick_convolveImage_6.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/047_Imagick_convolveImage_6.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/047_Imagick_convolveImage_6.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/047_Imagick_convolveImage_6.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,42 @@ +--TEST-- +Test Imagick, convolveImage +--SKIPIF-- + +--FILE-- + -1, + 1 => -1, + 2 => -1, + 3 => -1, + 4 => 8, + 5 => -1, + 6 => -1, + 7 => -1, + 8 => -1, +); + +function convolveImage($bias, $kernelMatrix) { + $imagick = new \Imagick(); + $imagick->newPseudoImage(640, 480, "magick:logo"); + + //$edgeFindingKernel = [-1, -1, -1, -1, 8, -1, -1, -1, -1,]; + + $imagick->setImageBias($bias * \Imagick::getQuantum()); + $imagick->convolveImage($kernelMatrix); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +convolveImage($bias, $kernelMatrix) ; +echo "Ok"; +?> +--EXPECTF-- +Deprecated: Function Imagick::setimagebias() is deprecated in %s +Ok diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/047_Imagick_convolveImage_7.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/047_Imagick_convolveImage_7.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/047_Imagick_convolveImage_7.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/047_Imagick_convolveImage_7.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,31 @@ +--TEST-- +Test Imagick, convolveImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $kernel = ImagickKernel::fromMatrix($kernelMatrix); + $imagick->convolveImage($kernel); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +convolveImage($bias, $kernelMatrix) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/048_Imagick_cropImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/048_Imagick_cropImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/048_Imagick_cropImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/048_Imagick_cropImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,28 @@ +--TEST-- +Test Imagick, cropImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->cropImage($width, $height, $startX, $startY); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +cropImage($startX, $startY, $width, $height) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/049_Imagick_deskewImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/049_Imagick_deskewImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/049_Imagick_deskewImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/049_Imagick_deskewImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,43 @@ +--TEST-- +Test Imagick, deskewImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $deskewImagick = clone $imagick; + + //This is the only thing required for deskewing. + $deskewImagick->deskewImage($threshold); + + //The rest of this example is to make the result obvious - because + //otherwise the result is not obvious. + $trim = 9; + + $deskewImagick->cropImage($deskewImagick->getImageWidth() - $trim, $deskewImagick->getImageHeight(), $trim, 0); + $imagick->cropImage($imagick->getImageWidth() - $trim, $imagick->getImageHeight(), $trim, 0); + $deskewImagick->resizeimage($deskewImagick->getImageWidth() / 2, $deskewImagick->getImageHeight() / 2, \Imagick::FILTER_LANCZOS, 1); + $imagick->resizeimage($imagick->getImageWidth() / 2, $imagick->getImageHeight() / 2, \Imagick::FILTER_LANCZOS, 1); + $newCanvas = new \Imagick(); + $newCanvas->newimage($imagick->getImageWidth() + $deskewImagick->getImageWidth() + 20, $imagick->getImageHeight(), 'red', 'jpg'); + $newCanvas->compositeimage($imagick, \Imagick::COMPOSITE_COPY, 5, 0); + $newCanvas->compositeimage($deskewImagick, \Imagick::COMPOSITE_COPY, $imagick->getImageWidth() + 10, 0); + + $bytes = $newCanvas->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +deskewImage($threshold) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/050_Imagick_distortImage_Affine.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/050_Imagick_distortImage_Affine.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/050_Imagick_distortImage_Affine.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/050_Imagick_distortImage_Affine.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,32 @@ +--TEST-- +Test Imagick, distortImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $points = array( + 0, 0, + 25, 25, + 100, 0, + 100, 50 + ); + + $imagick->setimagebackgroundcolor("#fad888"); + $imagick->setImageVirtualPixelMethod( \Imagick::VIRTUALPIXELMETHOD_BACKGROUND ); + $imagick->distortImage( \Imagick::DISTORTION_AFFINE, $points, TRUE ); + header( "Content-Type: image/jpeg" ); + $bytes = $imagick; + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/051_Imagick_distortImage_Projection.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/051_Imagick_distortImage_Projection.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/051_Imagick_distortImage_Projection.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/051_Imagick_distortImage_Projection.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,30 @@ +--TEST-- +Test Imagick, distortImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $points = array( + 0.9,0.3, + -0.2,0.7, + 20,15 + ); + $imagick->setimagebackgroundcolor("#fad888"); + $imagick->setImageVirtualPixelMethod( \Imagick::VIRTUALPIXELMETHOD_BACKGROUND ); + $imagick->distortImage( \Imagick::DISTORTION_AFFINEPROJECTION, $points, TRUE ); + header( "Content-Type: image/jpeg" ); + $bytes = $imagick; + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/052_Imagick_distortImage_Arc.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/052_Imagick_distortImage_Arc.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/052_Imagick_distortImage_Arc.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/052_Imagick_distortImage_Arc.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,32 @@ +--TEST-- +Test Imagick, distortImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $degrees = array( 180 ); + $imagick->setimagebackgroundcolor("#fad888"); + $imagick->setImageVirtualPixelMethod( \Imagick::VIRTUALPIXELMETHOD_BACKGROUND ); + $imagick->distortImage( \Imagick::DISTORTION_ARC, $degrees, TRUE ); + header( "Content-Type: image/jpeg" ); + $bytes = $imagick; + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/053_Imagick_distortImage_RotatedArc.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/053_Imagick_distortImage_RotatedArc.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/053_Imagick_distortImage_RotatedArc.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/053_Imagick_distortImage_RotatedArc.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,26 @@ +--TEST-- +Test Imagick, distortImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $degrees = array( 180, 45, 100, 20 ); + $imagick->setimagebackgroundcolor("#fad888"); + $imagick->setImageVirtualPixelMethod( \Imagick::VIRTUALPIXELMETHOD_BACKGROUND ); + $imagick->distortImage( \Imagick::DISTORTION_ARC, $degrees, TRUE ); + header( "Content-Type: image/jpeg" ); + $bytes = $imagick; + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/054_Imagick_distortImage_Bilinear.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/054_Imagick_distortImage_Bilinear.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/054_Imagick_distortImage_Bilinear.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/054_Imagick_distortImage_Bilinear.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,31 @@ +--TEST-- +Test Imagick, distortImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $points = array( + 0,0, 25,25, # top left + 176,0, 126,0, # top right + 0,135, 0,105, # bottom right + 176,135, 176,135 # bottum left + ); + $imagick->setImageBackgroundColor("#fad888"); + $imagick->setImageVirtualPixelMethod( \Imagick::VIRTUALPIXELMETHOD_BACKGROUND ); + $imagick->distortImage( \Imagick::DISTORTION_BILINEAR, $points, TRUE ); + header( "Content-Type: image/jpeg" ); + $bytes = $imagick; + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/055_Imagick_distortImage_ScaleRotateTransform.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/055_Imagick_distortImage_ScaleRotateTransform.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/055_Imagick_distortImage_ScaleRotateTransform.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/055_Imagick_distortImage_ScaleRotateTransform.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,28 @@ +--TEST-- +Test Imagick, distortImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $points = array( + 1.5, # scale 150% + 150 # rotate + ); + $imagick->setimagebackgroundcolor("#fad888"); + $imagick->setImageVirtualPixelMethod( \Imagick::VIRTUALPIXELMETHOD_BACKGROUND ); + $imagick->distortImage( \Imagick::DISTORTION_SCALEROTATETRANSLATE, $points, TRUE ); + $bytes = $imagick; + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/056_Imagick_distortImage_Perspective.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/056_Imagick_distortImage_Perspective.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/056_Imagick_distortImage_Perspective.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/056_Imagick_distortImage_Perspective.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,50 @@ +--TEST-- +Test Imagick, distortImage +--SKIPIF-- + +--FILE-- +rsiControl->getImagePath())); + $imagick = new \Imagick(); + + /* Create new checkerboard pattern */ + $imagick->newPseudoImage(100, 100, "pattern:checkerboard"); + + /* Set the image format to png */ + $imagick->setImageFormat('png'); + + /* Fill new visible areas with transparent */ + $imagick->setImageVirtualPixelMethod(\Imagick::VIRTUALPIXELMETHOD_TRANSPARENT); + + /* Activate matte */ + $imagick->setImageMatte(true); + + /* Control points for the distortion */ + $controlPoints = array( 10, 10, + 10, 5, + + 10, $imagick->getImageHeight() - 20, + 10, $imagick->getImageHeight() - 5, + + $imagick->getImageWidth() - 10, 10, + $imagick->getImageWidth() - 10, 20, + + $imagick->getImageWidth() - 10, $imagick->getImageHeight() - 10, + $imagick->getImageWidth() - 10, $imagick->getImageHeight() - 30); + + /* Perform the distortion */ + $imagick->distortImage(\Imagick::DISTORTION_PERSPECTIVE, $controlPoints, true); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/057_Imagick_distortImage_PerspectiveProjection.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/057_Imagick_distortImage_PerspectiveProjection.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/057_Imagick_distortImage_PerspectiveProjection.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/057_Imagick_distortImage_PerspectiveProjection.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,36 @@ +--TEST-- +Test Imagick, distortImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $points = array( + 1.945622, 0.071451, + -12.187838, 0.799032, + 1.276214, -24.470275, 0.006258, 0.000715 + ); + $imagick->setimagebackgroundcolor("#fad888"); + $imagick->setImageVirtualPixelMethod( \Imagick::VIRTUALPIXELMETHOD_BACKGROUND); + $imagick->distortImage(\Imagick::DISTORTION_PERSPECTIVEPROJECTION, $points, TRUE); + $bytes = $imagick; + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/058_Imagick_distortImage_Polynomial.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/058_Imagick_distortImage_Polynomial.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/058_Imagick_distortImage_Polynomial.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/058_Imagick_distortImage_Polynomial.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,40 @@ +--TEST-- +Test Imagick, distortImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $points = array( + 1.5, //Order 1.5 = special + 0, 0, 26, 0, + 128,0, 114,23, + 128,128, 128,100, + 0,128, 0,123 + ); + $imagick->setimagebackgroundcolor("#fad888"); + $imagick->setImageVirtualPixelMethod( \Imagick::VIRTUALPIXELMETHOD_BACKGROUND); + $imagick->distortImage(\Imagick::DISTORTION_POLYNOMIAL, $points, TRUE); + $bytes = $imagick; + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/059_Imagick_distortImage_Polar.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/059_Imagick_distortImage_Polar.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/059_Imagick_distortImage_Polar.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/059_Imagick_distortImage_Polar.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,37 @@ +--TEST-- +Test Imagick, distortImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $points = array( + 0 + ); + + //Only do partial arc +// $points = array( +// 60,20, 0,0, -60,60 +// ); + +// HorizontalTile + + $imagick->setimagebackgroundcolor("#fad888"); + $imagick->setImageVirtualPixelMethod( \Imagick::VIRTUALPIXELMETHOD_HORIZONTALTILE); + $imagick->distortImage(\Imagick::DISTORTION_POLAR, $points, TRUE); + + $bytes = $imagick; + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/060_Imagick_distortImage_Polar.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/060_Imagick_distortImage_Polar.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/060_Imagick_distortImage_Polar.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/060_Imagick_distortImage_Polar.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,29 @@ +--TEST-- +Test Imagick, distortImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $points = array( + 0 + ); + + $imagick->setimagebackgroundcolor("#fad888"); + $imagick->setImageVirtualPixelMethod( \Imagick::VIRTUALPIXELMETHOD_BACKGROUND); + $imagick->distortImage(\Imagick::DISTORTION_DEPOLAR, $points, TRUE); + $bytes = $imagick; + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/061_Imagick_distortImage_Barrel.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/061_Imagick_distortImage_Barrel.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/061_Imagick_distortImage_Barrel.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/061_Imagick_distortImage_Barrel.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,40 @@ +--TEST-- +Test Imagick, distortImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + + $points = array( + //0.2, 0.0, 0.0, 1.0 + 0.4, 0.6, 0.0, 1.0 + ); + + $imagick->setimagebackgroundcolor("#fad888"); + $imagick->setImageVirtualPixelMethod( \Imagick::VIRTUALPIXELMETHOD_EDGE); + $imagick->distortImage(\Imagick::DISTORTION_BARREL, $points, TRUE); + $bytes = $imagick; + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/062_Imagick_distortImage_BarrelInverse.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/062_Imagick_distortImage_BarrelInverse.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/062_Imagick_distortImage_BarrelInverse.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/062_Imagick_distortImage_BarrelInverse.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,34 @@ +--TEST-- +Test Imagick, distortImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + + $points = array( + //0.2, 0.0, 0.0, 1.0 + 0.2, 0.1, 0.0, 1.0 + ); + + $imagick->setimagebackgroundcolor("#fad888"); + $imagick->setImageVirtualPixelMethod( \Imagick::VIRTUALPIXELMETHOD_EDGE); + $imagick->distortImage(\Imagick::DISTORTION_BARRELINVERSE, $points, TRUE); + $bytes = $imagick; + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/063_Imagick_distortImage_Shepards.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/063_Imagick_distortImage_Shepards.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/063_Imagick_distortImage_Shepards.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/063_Imagick_distortImage_Shepards.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,49 @@ +--TEST-- +Test Imagick, distortImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + + $points = array( + + //Setup some control points that don't move + 5 * $imagick->getImageWidth() / 100, 5 * $imagick->getImageHeight() / 100, + 5 * $imagick->getImageWidth() / 100, 5 * $imagick->getImageHeight() / 100, + + 5 * $imagick->getImageWidth() / 100, 95 * $imagick->getImageHeight() / 100, + 5 * $imagick->getImageWidth() / 100, 95 * $imagick->getImageHeight() / 100, + + 95 * $imagick->getImageWidth() / 100, 95 * $imagick->getImageHeight() / 100, + 95 * $imagick->getImageWidth() / 100, 95 * $imagick->getImageHeight() / 100, + + 5 * $imagick->getImageWidth() / 100, 5 * $imagick->getImageHeight() / 100, + 95 * $imagick->getImageWidth() / 100, 95 * $imagick->getImageHeight() / 100, +// //Move the centre of the image down and to the right +// 50 * $imagick->getImageWidth() / 100, 50 * $imagick->getImageHeight() / 100, +// 60 * $imagick->getImageWidth() / 100, 60 * $imagick->getImageHeight() / 100, +// +// //Move a point near the top-right of the image down and to the left and down +// 90 * $imagick->getImageWidth(), 10 * $imagick->getImageHeight(), +// 80 * $imagick->getImageWidth(), 15 * $imagick->getImageHeight(), + ); + + $imagick->setimagebackgroundcolor("#fad888"); + $imagick->setImageVirtualPixelMethod( \Imagick::VIRTUALPIXELMETHOD_EDGE); + $imagick->distortImage(\Imagick::DISTORTION_SHEPARDS, $points, TRUE); + $bytes = $imagick; + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/064_cropThumbNailImage.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/064_cropThumbNailImage.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/064_cropThumbNailImage.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/064_cropThumbNailImage.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,78 @@ +--TEST-- +Test for round issues +--SKIPIF-- + +--FILE-- +newPseudoImage($imageWidth, $imageHeight, 'xc:white'); + + $imagick->cropThumbnailImage( + $desired_width, $desired_height, + $legacy + ); + $error = false; + + $thumbnailImageWidth = $imagick->getImageWidth(); + $thumbnailImageHeight = $imagick->getImageHeight(); + + if ($thumbnailImageHeight != $desired_height) { + echo "Incorrect height for desired_width $desired_width imageHeight $imageHeight".PHP_EOL; + $error = true; + } + + $expectedWidth = $desired_width; + $expectedHeight = $desired_height; + + if ($legacy == true && + $desired_width == 250 && + $desired_height == 250) { + // Thumbnail size of 249 x 250 does not matched desired size 250 x 250 for source image of 1128 x 1128 + $expectedWidth = 249; + } + + if ($thumbnailImageWidth != $expectedWidth) { + echo "Incorrect width for desired_width $desired_width imageHeight $imageHeight".PHP_EOL; + $error = true; + } + + if ($thumbnailImageHeight != $expectedHeight) { + echo "Incorrect width for desired_width $desired_width imageHeight $imageHeight".PHP_EOL; + $error = true; + } + + if ($error) { + printf( + "Thumbnail size of %d x %d does not matched expected size %d x %d for source image of %d x %d. Legacy is %d\n", + $thumbnailImageWidth, $thumbnailImageHeight, + $desired_width, $desired_height, + $imageWidth, $imageHeight, + $legacy + ); + } + } +} + + +echo "Done" . PHP_EOL; + +?> +--EXPECTF-- +Done \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/065_Imagick_despeckleImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/065_Imagick_despeckleImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/065_Imagick_despeckleImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/065_Imagick_despeckleImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,24 @@ +--TEST-- +Test Imagick, despeckleImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->despeckleImage(); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +despeckleImage() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/066_Imagick_embossImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/066_Imagick_embossImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/066_Imagick_embossImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/066_Imagick_embossImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,26 @@ +--TEST-- +Test Imagick, embossImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->embossImage($radius, $sigma); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +embossImage($radius, $sigma) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/067_Imagick_edgeImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/067_Imagick_edgeImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/067_Imagick_edgeImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/067_Imagick_edgeImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,25 @@ +--TEST-- +Test Imagick, edgeImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->edgeImage($radius); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +edgeImage($radius) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/068_Imagick_enhanceImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/068_Imagick_enhanceImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/068_Imagick_enhanceImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/068_Imagick_enhanceImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,24 @@ +--TEST-- +Test Imagick, enhanceImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->enhanceImage(); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +enhanceImage() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/069_Imagick_equalizeImage_case1.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/069_Imagick_equalizeImage_case1.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/069_Imagick_equalizeImage_case1.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/069_Imagick_equalizeImage_case1.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,24 @@ +--TEST-- +Test Imagick, equalizeImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->equalizeImage(); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +equalizeImage() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/070_Imagick_equalizeImage_case2.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/070_Imagick_equalizeImage_case2.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/070_Imagick_equalizeImage_case2.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/070_Imagick_equalizeImage_case2.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,33 @@ +--TEST-- +Test Imagick, equalizeImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->equalizeImage(); + $imagick->extentImage( + $startX, $startY, $width, $height + ); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} +$startX = 50; +$startY = 50; +$width = 150; +$height = 150; + +extentImage($startX, $startY, $width, $height) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/071_Imagick_flipImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/071_Imagick_flipImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/071_Imagick_flipImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/071_Imagick_flipImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,24 @@ +--TEST-- +Test Imagick, flipImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->flipImage(); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +flipImage() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/072_Imagick_evaluateImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/072_Imagick_evaluateImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/072_Imagick_evaluateImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/072_Imagick_evaluateImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,111 @@ +--TEST-- +Test Imagick, evaluateImage +--SKIPIF-- + +--FILE-- +newPseudoImage( + $size, + $size, + "gradient:$gradientStartColor-$gradientEndColor" + ); + + $quantumScaledTypes = array( + \Imagick::EVALUATE_ADD, + \Imagick::EVALUATE_AND, + \Imagick::EVALUATE_MAX, + \Imagick::EVALUATE_MIN, + \Imagick::EVALUATE_OR, + \Imagick::EVALUATE_SET, + \Imagick::EVALUATE_SUBTRACT, + \Imagick::EVALUATE_XOR, + \Imagick::EVALUATE_THRESHOLD, + \Imagick::EVALUATE_THRESHOLDBLACK, + \Imagick::EVALUATE_THRESHOLDWHITE, + \Imagick::EVALUATE_ADDMODULUS, + ); + + $unscaledTypes = array( + \Imagick::EVALUATE_DIVIDE, + \Imagick::EVALUATE_MULTIPLY, + \Imagick::EVALUATE_RIGHTSHIFT, + \Imagick::EVALUATE_LEFTSHIFT, + \Imagick::EVALUATE_POW, + \Imagick::EVALUATE_LOG, + \Imagick::EVALUATE_GAUSSIANNOISE, + \Imagick::EVALUATE_IMPULSENOISE, + \Imagick::EVALUATE_LAPLACIANNOISE, + \Imagick::EVALUATE_MULTIPLICATIVENOISE, + \Imagick::EVALUATE_POISSONNOISE, + \Imagick::EVALUATE_UNIFORMNOISE, + \Imagick::EVALUATE_COSINE, + \Imagick::EVALUATE_SINE, + ); + + if (in_array($evaluateType, $unscaledTypes)) { + $imagick->evaluateimage($evaluateType, $firstTerm); + } + else if (in_array($evaluateType, $quantumScaledTypes)) { + $imagick->evaluateimage($evaluateType, $firstTerm * \Imagick::getQuantum()); + } + else { + throw new \Exception("Evaluation type $evaluateType is not listed as either scaled or unscaled"); + } + + $imagick->setimageformat('png'); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +foreach ($evaluateTypes as $evaluateType) { + evaluateImage($evaluateType, $firstTerm, $gradientStartColor, $gradientEndColor) ; +} +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/073_Imagick_forwardFourierTransformImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/073_Imagick_forwardFourierTransformImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/073_Imagick_forwardFourierTransformImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/073_Imagick_forwardFourierTransformImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,73 @@ +--TEST-- +Test Imagick, forwardFourierTransformImage +--SKIPIF-- + +--FILE-- +setStrokeOpacity(0); + $draw->setStrokeColor('rgb(255, 255, 255)'); + $draw->setFillColor('rgb(255, 255, 255)'); + + //Draw a circle on the y-axis, with it's centre + //at x, y that touches the origin + $draw->circle(250, 250, 220, 250); + + $imagick = new \Imagick(); + $imagick->newImage(512, 512, "black"); + $imagick->drawImage($draw); + $imagick->gaussianBlurImage(20, 20); + $imagick->autoLevelImage(); + + return $imagick; +} + + +function forwardFourierTransformImage() { + $imagick = new \Imagick(); + $imagick->newPseudoImage(640, 480, "magick:logo"); + $imagick->resizeimage(512, 512, \Imagick::FILTER_LANCZOS, 1); + + $mask = createMask(); + $imagick->forwardFourierTransformImage(true); + + $imagick->setIteratorIndex(0); + $magnitude = $imagick->getimage(); + + $imagick->setIteratorIndex(1); + $imagickPhase = $imagick->getimage(); + + if (true) { + $imagickPhase->compositeImage($mask, \Imagick::COMPOSITE_MULTIPLY, 0, 0); + } + + if (false) { + $output = clone $imagickPhase; + $output->setimageformat('png'); + $bytes = $output->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + } + + $magnitude->inverseFourierTransformImage($imagickPhase, true); + + $magnitude->setimageformat('png'); + $bytes = $magnitude->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +forwardFourierTransformImage() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/074_Imagick_flopImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/074_Imagick_flopImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/074_Imagick_flopImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/074_Imagick_flopImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,24 @@ +--TEST-- +Test Imagick, flopImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->flopImage(); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +flopImage() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/075_Imagick_floodFillPaintImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/075_Imagick_floodFillPaintImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/075_Imagick_floodFillPaintImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/075_Imagick_floodFillPaintImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,39 @@ +--TEST-- +Test Imagick, floodFillPaintImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + + $imagick->floodFillPaintImage( + $fillColor, + $fuzz * \Imagick::getQuantum(), + $targetColor, + $x, $y, + $inverse, + $channel + ); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +floodFillPaintImage($fillColor, $fuzz, $targetColor, $x, $y, $inverse, $channel) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/076_Imagick_fxImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/076_Imagick_fxImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/076_Imagick_fxImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/076_Imagick_fxImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,29 @@ +--TEST-- +Test Imagick, fxImage +--SKIPIF-- + +--FILE-- +newPseudoImage(200, 200, "xc:white"); + + $fx = 'xx=i-w/2; yy=j-h/2; rr=hypot(xx,yy); (.5-rr/140)*1.2+.5'; + $fxImage = $imagick->fxImage($fx); + + $fxImage->setimageformat('png'); + $bytes = $fxImage->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +fxImage() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/077_Imagick_frameImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/077_Imagick_frameImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/077_Imagick_frameImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/077_Imagick_frameImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,39 @@ +--TEST-- +Test Imagick, frameImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + + $width = $width + $innerBevel + $outerBevel; + $height = $height + $innerBevel + $outerBevel; + + $imagick->frameimage( + $color, + $width, + $height, + $innerBevel, + $outerBevel + ); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +frameImage($color, $width, $height, $innerBevel, $outerBevel) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/078_Imagick_gammaImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/078_Imagick_gammaImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/078_Imagick_gammaImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/078_Imagick_gammaImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,26 @@ +--TEST-- +Test Imagick, gammaImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->gammaImage($gamma, $channel); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +gammaImage($gamma, $channel) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/079_Imagick_getImageGeometry_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/079_Imagick_getImageGeometry_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/079_Imagick_getImageGeometry_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/079_Imagick_getImageGeometry_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,23 @@ +--TEST-- +Test Imagick, getImageGeometry +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +getImageGeometry() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/080_Imagick_gaussianBlurImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/080_Imagick_gaussianBlurImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/080_Imagick_gaussianBlurImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/080_Imagick_gaussianBlurImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,27 @@ +--TEST-- +Test Imagick, gaussianBlurImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->gaussianBlurImage($radius, $sigma, $channel); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +gaussianBlurImage($radius, $sigma, $channel) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/081_Imagick_getImageHistogram_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/081_Imagick_getImageHistogram_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/081_Imagick_getImageHistogram_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/081_Imagick_getImageHistogram_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,103 @@ +--TEST-- +Test Imagick, getImageHistogram +--SKIPIF-- + +--FILE-- +getColorValueQuantum($colorChannel); + $color = $histogramElement->getColorValue($colorChannel); + $color = intval($color * 255); + $count = $histogramElement->getColorCount(); + + if (array_key_exists($color, $colorStatistics)) { + $colorStatistics[$color] += $count; + } + else { + $colorStatistics[$color] = $count; + } + } + + ksort($colorStatistics); + + return $colorStatistics; +} + + + +function getImageHistogram() { + + $backgroundColor = 'black'; + + $draw = new \ImagickDraw(); + $draw->setStrokeWidth(0); //Lines have a wi + + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + $imagick->drawImage($draw); + + $histogramWidth = 256; + $histogramHeight = 100; // the height for each RGB segment + + $imagick = new \Imagick(); + $imagick->newPseudoImage(640, 480, "magick:logo"); + //Resize the image to be small, otherwise PHP tends to run out of memory + //This might lead to bad results for images that are pathologically 'pixelly' + $imagick->adaptiveResizeImage(200, 200, true); + $histogramElements = $imagick->getImageHistogram(); + + $histogram = new \Imagick(); + $histogram->newpseudoimage($histogramWidth, $histogramHeight * 3, 'xc:black'); + $histogram->setImageFormat('png'); + + $getMax = function ($carry, $item) { + if ($item > $carry) { + return $item; + } + return $carry; + }; + + $colorValues = array( + 'red' => getColorStatistics($histogramElements, \Imagick::COLOR_RED), + 'lime' => getColorStatistics($histogramElements, \Imagick::COLOR_GREEN), + 'blue' => getColorStatistics($histogramElements, \Imagick::COLOR_BLUE), + ); + + $max = array_reduce($colorValues['red'] , $getMax, 0); + $max = array_reduce($colorValues['lime'] , $getMax, $max); + $max = array_reduce($colorValues['blue'] , $getMax, $max); + + $scale = $histogramHeight / $max; + + $count = 0; + foreach ($colorValues as $color => $values) { + $draw->setstrokecolor($color); + + $offset = ($count + 1) * $histogramHeight; + + foreach ($values as $index => $value) { + $draw->line($index, $offset, $index, $offset - ($value * $scale)); + } + $count++; + } + + $histogram->drawImage($draw); + $bytes = $histogram->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +getImageHistogram(); +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/083_Imagick_getPixelIterator_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/083_Imagick_getPixelIterator_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/083_Imagick_getPixelIterator_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/083_Imagick_getPixelIterator_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,36 @@ +--TEST-- +Test Imagick, getPixelIterator +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imageIterator = $imagick->getPixelIterator(); + + /** @noinspection PhpUnusedLocalVariableInspection */ + foreach ($imageIterator as $row => $pixels) { /* Loop trough pixel rows */ + foreach ($pixels as $column => $pixel) { /* Loop through the pixels in the row (columns) */ + /** @var $pixel \ImagickPixel */ + if ($column % 2) { + $pixel->setColor("rgba(0, 0, 0, 0)"); /* Paint every second pixel black*/ + } + } + $imageIterator->syncIterator(); /* Sync the iterator, this is important to do on each iteration */ + } + + $bytes = $imagick; + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +getPixelIterator() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/084_Imagick_getPixelRegionIterator_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/084_Imagick_getPixelRegionIterator_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/084_Imagick_getPixelRegionIterator_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/084_Imagick_getPixelRegionIterator_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,36 @@ +--TEST-- +Test Imagick, getPixelRegionIterator +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imageIterator = $imagick->getPixelRegionIterator(100, 100, 200, 200); + + /** @noinspection PhpUnusedLocalVariableInspection */ + foreach ($imageIterator as $row => $pixels) { /* Loop trough pixel rows */ + foreach ($pixels as $column => $pixel) { /* Loop through the pixels in the row (columns) */ + /** @var $pixel \ImagickPixel */ + if ($column % 2) { + $pixel->setColor("rgba(0, 0, 0, 0)"); /* Paint every second pixel black*/ + } + } + $imageIterator->syncIterator(); /* Sync the iterator, this is important to do on each iteration */ + } + + $bytes = $imagick; + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +getPixelRegionIterator() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/085_Imagick_haldClutImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/085_Imagick_haldClutImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/085_Imagick_haldClutImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/085_Imagick_haldClutImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,28 @@ +--TEST-- +Test Imagick, haldClutImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagickPalette = new \Imagick(); + $imagickPalette->newPseudoImage(640, 480, "magick:NETSCAPE"); + + $imagickPalette->sepiatoneImage(55); + $imagick->haldClutImage($imagickPalette); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +haldClutImage() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/086_Imagick_forwardFourierTransformImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/086_Imagick_forwardFourierTransformImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/086_Imagick_forwardFourierTransformImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/086_Imagick_forwardFourierTransformImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,70 @@ +--TEST-- +Test Imagick, forwardFourierTransformImage +--SKIPIF-- + +--FILE-- +setStrokeOpacity(0); + $draw->setStrokeColor('rgb(255, 255, 255)'); + $draw->setFillColor('rgb(255, 255, 255)'); + + //Draw a circle on the y-axis, with it's centre + //at x, y that touches the origin + $draw->circle(250, 250, 220, 250); + + $imagick = new \Imagick(); + $imagick->newImage(512, 512, "black"); + $imagick->drawImage($draw); + $imagick->gaussianBlurImage(20, 20); + $imagick->autoLevelImage(); + + return $imagick; +} + + +function forwardFourierTransformImage() { + $imagick = new \Imagick(); + $imagick->newPseudoImage(640, 480, "magick:logo"); + $imagick->resizeimage(512, 512, \Imagick::FILTER_LANCZOS, 1); + + $mask = createMask(); + $imagick->forwardFourierTransformImage(true); + + $imagick->setIteratorIndex(0); + $magnitude = $imagick->getimage(); + + $imagick->setIteratorIndex(1); + $imagickPhase = $imagick->getimage(); + + if (true) { + $imagickPhase->compositeImage($mask, \Imagick::COMPOSITE_MULTIPLY, 0, 0); + } + + if (false) { + $output = clone $imagickPhase; + $output->setimageformat('png'); + $bytes = $output->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + } + + $magnitude->inverseFourierTransformImage($imagickPhase, true); + + $magnitude->setimageformat('png'); + $bytes = $magnitude->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +forwardFourierTransformImage() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/087_Imagick_levelImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/087_Imagick_levelImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/087_Imagick_levelImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/087_Imagick_levelImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,28 @@ +--TEST-- +Test Imagick, levelImage +--SKIPIF-- + +--FILE-- +newPseudoimage(500, 500, 'gradient:black-white'); + + $imagick->setFormat('png'); + $quantum = $imagick->getQuantum(); + $imagick->levelImage($blackPoint / 100 , $gamma, $quantum * $whitePoint / 100); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +levelImage($blackPoint, $gamma, $whitePoint) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/088_Imagick_implodeImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/088_Imagick_implodeImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/088_Imagick_implodeImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/088_Imagick_implodeImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,25 @@ +--TEST-- +Test Imagick, implodeImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->implodeImage(0.0001); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + +} + +implodeImage() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/089_Imagick_medianFilterImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/089_Imagick_medianFilterImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/089_Imagick_medianFilterImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/089_Imagick_medianFilterImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,26 @@ +--TEST-- +Test Imagick, medianFilterImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + @$imagick->medianFilterImage($radius); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +medianFilterImage($radius) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/090_Imagick_magnifyImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/090_Imagick_magnifyImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/090_Imagick_magnifyImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/090_Imagick_magnifyImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,24 @@ +--TEST-- +Test Imagick, magnifyImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->magnifyImage(); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +magnifyImage() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/091_Imagick_linearStretchImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/091_Imagick_linearStretchImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/091_Imagick_linearStretchImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/091_Imagick_linearStretchImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,28 @@ +--TEST-- +Test Imagick, linearStretchImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $pixels = $imagick->getImageWidth() * $imagick->getImageHeight(); + $imagick->linearStretchImage($blackThreshold * $pixels, $whiteThreshold * $pixels); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +linearStretchImage($blackThreshold, $whiteThreshold) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/092_Imagick_mergeImageLayers_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/092_Imagick_mergeImageLayers_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/092_Imagick_mergeImageLayers_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/092_Imagick_mergeImageLayers_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,39 @@ +--TEST-- +Test Imagick, mergeImageLayers +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, $imageName); + $imagick->addImage($nextImage); + } + + $imagick->resetIterator(); + + $imagick->setImageFormat('png'); + + $result = $imagick->mergeImageLayers($layerMethodType); + $bytes = $result->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +mergeImageLayers($layerMethodType); +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/093_Imagick_modulateImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/093_Imagick_modulateImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/093_Imagick_modulateImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/093_Imagick_modulateImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,27 @@ +--TEST-- +Test Imagick, modulateImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->modulateImage($brightness, $saturation, $hue); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +modulateImage($hue, $brightness, $saturation) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/094_Imagick_motionBlurImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/094_Imagick_motionBlurImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/094_Imagick_motionBlurImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/094_Imagick_motionBlurImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,28 @@ +--TEST-- +Test Imagick, motionBlurImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->motionBlurImage($radius, $sigma, $angle, $channel); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +motionBlurImage($radius, $sigma, $angle, $channel) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/095_Imagick_normalizeImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/095_Imagick_normalizeImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/095_Imagick_normalizeImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/095_Imagick_normalizeImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,28 @@ +--TEST-- +Test Imagick, normalizeImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $original = clone $imagick; + $original->cropimage($original->getImageWidth() / 2, $original->getImageHeight(), 0, 0); + $imagick->normalizeImage($channel); + $imagick->compositeimage($original, \Imagick::COMPOSITE_ATOP, 0, 0); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +normalizeImage($channel) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/096_Imagick_negateImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/096_Imagick_negateImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/096_Imagick_negateImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/096_Imagick_negateImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,26 @@ +--TEST-- +Test Imagick, negateImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->negateImage($grayOnly, $channel); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +negateImage($grayOnly, $channel) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/097_Imagick_newPseudoImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/097_Imagick_newPseudoImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/097_Imagick_newPseudoImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/097_Imagick_newPseudoImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,22 @@ +--TEST-- +Test Imagick, newPseudoImage +--SKIPIF-- + +--FILE-- +newPseudoImage(300, 300, $canvasType); + $imagick->setImageFormat("png"); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +newPseudoImage($canvasType) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/098_Imagick_orderedPosterizeImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/098_Imagick_orderedPosterizeImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/098_Imagick_orderedPosterizeImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/098_Imagick_orderedPosterizeImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,32 @@ +--TEST-- +Test Imagick, orderedPosterizeImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + + + $imagick->orderedPosterizeImage($orderedPosterizeType); + $imagick->setImageFormat('png'); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +orderedPosterizeImage($orderedPosterizeType) ; +echo "Ok"; +?> +--EXPECTF-- +Deprecated: Function Imagick::orderedposterizeimage() is deprecated in %S +Ok diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/099_Imagick_oilPaintImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/099_Imagick_oilPaintImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/099_Imagick_oilPaintImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/099_Imagick_oilPaintImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,25 @@ +--TEST-- +Test Imagick, oilPaintImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->oilPaintImage($radius); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +oilPaintImage($radius) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/100_Imagick_posterizeImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/100_Imagick_posterizeImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/100_Imagick_posterizeImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/100_Imagick_posterizeImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,24 @@ +--TEST-- +Test Imagick, posterizeImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->posterizeImage($numberLevels, $posterizeType); + $imagick->setImageFormat('png'); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +posterizeImage($posterizeType, $numberLevels) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/101_Imagick_quantizeImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/101_Imagick_quantizeImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/101_Imagick_quantizeImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/101_Imagick_quantizeImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,26 @@ +--TEST-- +Test Imagick, quantizeImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->quantizeImage($numberColors, $colorSpace, $treeDepth, $dither, false); + $imagick->setImageFormat('png'); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +quantizeImage($numberColors, $colorSpace, $treeDepth, $dither) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/102_Imagick_radialBlurImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/102_Imagick_radialBlurImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/102_Imagick_radialBlurImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/102_Imagick_radialBlurImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,32 @@ +--TEST-- +Test Imagick, radialBlurImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->radialBlurImage(3); + $imagick->radialBlurImage(5); + $imagick->radialBlurImage(7); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +radialBlurImage() ; +echo "Ok"; +?> +--EXPECTF-- +Deprecated: Function Imagick::radialblurimage() is deprecated in %s + +Deprecated: Function Imagick::radialblurimage() is deprecated in %s + +Deprecated: Function Imagick::radialblurimage() is deprecated in %s +Ok diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/103_Imagick_readImageBlob_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/103_Imagick_readImageBlob_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/103_Imagick_readImageBlob_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/103_Imagick_readImageBlob_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,37 @@ +--TEST-- +Test Imagick, readImageBlob +--SKIPIF-- + +--FILE-- +readImageBlob($imageBlob); + + $bytes = $imageBlob; + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +readImageBlob() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/104_Imagick_randomThresholdImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/104_Imagick_randomThresholdImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/104_Imagick_randomThresholdImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/104_Imagick_randomThresholdImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,32 @@ +--TEST-- +Test Imagick, randomThresholdImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + + $imagick->randomThresholdimage( + $lowThreshold * \Imagick::getQuantum(), + $highThreshold * \Imagick::getQuantum(), + $channel + ); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +randomThresholdimage($lowThreshold, $highThreshold, $channel) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/105_Imagick_raiseImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/105_Imagick_raiseImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/105_Imagick_raiseImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/105_Imagick_raiseImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,31 @@ +--TEST-- +Test Imagick, raiseImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + + //x and y do nothing? + $imagick->raiseImage($width, $height, $x, $y, $raise); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +raiseImage($width, $height, $x, $y, $raise) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/106_Imagick_reduceNoiseImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/106_Imagick_reduceNoiseImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/106_Imagick_reduceNoiseImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/106_Imagick_reduceNoiseImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,26 @@ +--TEST-- +Test Imagick, reduceNoiseImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + @$imagick->reduceNoiseImage($reduceNoise); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +reduceNoiseImage($reduceNoise) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/107_Imagick_recolorImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/107_Imagick_recolorImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/107_Imagick_recolorImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/107_Imagick_recolorImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,32 @@ +--TEST-- +Test Imagick, recolorImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $remapColor = array( + 1, 0, 0, + 0, 0, 1, + 0, 1, 0, + ); + + @$imagick->recolorImage($remapColor); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +recolorImage() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/108_Imagick_resampleImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/108_Imagick_resampleImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/108_Imagick_resampleImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/108_Imagick_resampleImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,25 @@ +--TEST-- +Test Imagick, resampleImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + + $imagick->resampleImage(200, 200, \Imagick::FILTER_LANCZOS, 1); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +resampleImage() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/109_Imagick_rollImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/109_Imagick_rollImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/109_Imagick_rollImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/109_Imagick_rollImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,26 @@ +--TEST-- +Test Imagick, rollImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->rollimage($rollX, $rollY); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +rollImage($rollX, $rollY) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/110_Imagick_resizeImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/110_Imagick_resizeImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/110_Imagick_resizeImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/110_Imagick_resizeImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,56 @@ +--TEST-- +Test Imagick, resizeImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + + $imagick->resizeImage($width, $height, $filterType, $blur, $bestFit); + + $cropWidth = $imagick->getImageWidth(); + $cropHeight = $imagick->getImageHeight(); + + if ($cropZoom) { + $newWidth = $cropWidth / 2; + $newHeight = $cropHeight / 2; + + $imagick->cropimage( + $newWidth, + $newHeight, + ($cropWidth - $newWidth) / 2, + ($cropHeight - $newHeight) / 2 + ); + + $imagick->scaleimage( + $imagick->getImageWidth() * 4, + $imagick->getImageHeight() * 4 + ); + } + + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +foreach ($bestFitSettings as $bestFit) { + resizeImage($width, $height, $filterType, $blur, $bestFit, $cropZoom); +} +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/111_Imagick_rotateImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/111_Imagick_rotateImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/111_Imagick_rotateImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/111_Imagick_rotateImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,26 @@ +--TEST-- +Test Imagick, rotateImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->rotateimage($color, $angle); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +rotateImage($angle, $color) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/112_Imagick_roundCorners_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/112_Imagick_roundCorners_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/112_Imagick_roundCorners_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/112_Imagick_roundCorners_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,44 @@ +--TEST-- +Test Imagick, roundCorners +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->setBackgroundColor('red'); + + $imagick->setbackgroundcolor('pink'); + + $x_rounding = 40; + $y_rounding = 40; + $stroke_width = 5; + $displace = 0; + $size_correction = 0; + + $imagick->roundCornersImage( + $x_rounding, + $y_rounding, + $stroke_width, + $displace, + $size_correction + ); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +roundCorners() ; +echo "Ok"; +?> +--EXPECTF-- +Deprecated: Function Imagick::roundcornersimage() is deprecated in %s +Ok diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/113_Imagick_rotationalBlurImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/113_Imagick_rotationalBlurImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/113_Imagick_rotationalBlurImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/113_Imagick_rotationalBlurImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,27 @@ +--TEST-- +Test Imagick, rotationalBlurImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->rotationalBlurImage(3); + $imagick->rotationalBlurImage(5); + $imagick->rotationalBlurImage(7); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +rotationalBlurImage() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/114_Imagick_scaleImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/114_Imagick_scaleImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/114_Imagick_scaleImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/114_Imagick_scaleImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,49 @@ +--TEST-- +Test Imagick, scaleImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->scaleImage($width, $height, $bestFit); + + $imageWidth = $imagick->getImageWidth(); + $imageHeight = $imagick->getImageHeight(); + + $error = false; + + if ($imageWidth != $expectedWidth) { + echo "Width $imageWidth does not match expected.\n"; + $error = true; + } + + if ($imageHeight != $expectedHeight) { + echo "Height $imageHeight does not match expected.\n"; + $error = true; + } + + if ($error) { + echo "test was ".var_export($test, true)."\n"; + }; +} + + +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/115_Imagick_selectiveBlurImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/115_Imagick_selectiveBlurImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/115_Imagick_selectiveBlurImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/115_Imagick_selectiveBlurImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,28 @@ +--TEST-- +Test Imagick, selectiveBlurImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->selectiveBlurImage($radius, $sigma, $threshold, $channel); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +selectiveBlurImage($radius, $sigma, $threshold, $channel) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/116_Imagick_separateImageChannel_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/116_Imagick_separateImageChannel_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/116_Imagick_separateImageChannel_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/116_Imagick_separateImageChannel_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,25 @@ +--TEST-- +Test Imagick, separateImageChannel +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->separateimagechannel($channel); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +separateImageChannel($channel) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/117_Imagick_segmentImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/117_Imagick_segmentImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/117_Imagick_segmentImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/117_Imagick_segmentImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,27 @@ +--TEST-- +Test Imagick, segmentImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->segmentImage($colorSpace, $clusterThreshold, $smoothThreshold); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +segmentImage($colorSpace, $clusterThreshold, $smoothThreshold) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/118_Imagick_setImageArtifact_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/118_Imagick_setImageArtifact_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/118_Imagick_setImageArtifact_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/118_Imagick_setImageArtifact_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,32 @@ +--TEST-- +Test Imagick, setImageArtifact +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + + $src2 = new \Imagick(); + $src2->newPseudoImage(480, 640, "magick:WIZARD"); + + $src2->setImageVirtualPixelMethod(\Imagick::VIRTUALPIXELMETHOD_TRANSPARENT); + $src2->setImageArtifact('compose:args', "1,0,-0.5,0.5"); + $src1->compositeImage($src2, Imagick::COMPOSITE_MATHEMATICS, 0, 0); + + $src1->setImageFormat('png'); + $bytes = $src1->getImagesBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setImageArtifact() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/119_Imagick_sepiaToneImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/119_Imagick_sepiaToneImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/119_Imagick_sepiaToneImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/119_Imagick_sepiaToneImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,25 @@ +--TEST-- +Test Imagick, sepiaToneImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->sepiaToneImage($sepia); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +sepiaToneImage($sepia) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/120_Imagick_setCompressionQuality_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/120_Imagick_setCompressionQuality_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/120_Imagick_setCompressionQuality_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/120_Imagick_setCompressionQuality_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,42 @@ +--TEST-- +Test Imagick, setCompressionQuality +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + + $imagick = new \Imagick(); + $imagick->setCompressionQuality($quality); + $imagick->newPseudoImage( + $backgroundImagick->getImageWidth(), + $backgroundImagick->getImageHeight(), + 'canvas:white' + ); + + $imagick->compositeImage( + $backgroundImagick, + \Imagick::COMPOSITE_ATOP, + 0, + 0 + ); + + $imagick->setFormat("jpg"); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setCompressionQuality($quality) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/121_Imagick_setImageBias_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/121_Imagick_setImageBias_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/121_Imagick_setImageBias_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/121_Imagick_setImageBias_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,38 @@ +--TEST-- +Test Imagick, setImageBias +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + + $xKernel = array( + -0.70, 0, 0.70, + -0.70, 0, 0.70, + -0.70, 0, 0.70 + ); + + $imagick->setImageBias($bias * \Imagick::getQuantum()); + $imagick->convolveImage($xKernel, \Imagick::CHANNEL_ALL); + + $imagick->setImageFormat('png'); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setImageBias($bias) ; +echo "Ok"; +?> +--EXPECTF-- +Deprecated: Function Imagick::setimagebias() is deprecated in %s +Ok diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/122_Imagick_setImageCompressionQuality_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/122_Imagick_setImageCompressionQuality_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/122_Imagick_setImageCompressionQuality_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/122_Imagick_setImageCompressionQuality_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,25 @@ +--TEST-- +Test Imagick, setImageCompressionQuality +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + //$imagick->setImageCompressionQuality($quality); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setImageCompressionQuality($quality) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/123_Imagick_setImageClipMask_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/123_Imagick_setImageClipMask_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/123_Imagick_setImageClipMask_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/123_Imagick_setImageClipMask_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,52 @@ +--TEST-- +Test Imagick, setImageClipMask +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + + $width = $imagick->getImageWidth(); + $height = $imagick->getImageHeight(); + + $clipMask = new \Imagick(); + $clipMask->newPseudoImage( + $width, + $height, + "canvas:transparent" + ); + + $draw = new \ImagickDraw(); + $draw->setFillColor('white'); + $draw->circle( + $width / 2, + $height / 2, + ($width / 2) + ($width / 4), + $height / 2 + ); + $clipMask->drawImage($draw); + $imagick->setImageClipMask($clipMask); + + $imagick->negateImage(false); + $imagick->setFormat("png"); + + $bytes = $imagick->getImagesBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + +} + +setImageClipMask() ; +echo "Ok"; +?> +--EXPECTF-- +Deprecated: Function Imagick::setimageclipmask() is deprecated in %s +Ok diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/125_Imagick_setImageOrientation_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/125_Imagick_setImageOrientation_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/125_Imagick_setImageOrientation_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/125_Imagick_setImageOrientation_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,26 @@ +--TEST-- +Test Imagick, setImageOrientation +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->setImageOrientation($orientationType); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setImageOrientation($orientationType) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/126_Imagick_getImageChannelStats_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/126_Imagick_getImageChannelStats_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/126_Imagick_getImageChannelStats_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/126_Imagick_getImageChannelStats_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,16 @@ +--TEST-- +Test Imagick, getImageChannelStatistics +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); +$identifyInfo = $imagick->getImageChannelStatistics(); + +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/127_Imagick_progressMonitor_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/127_Imagick_progressMonitor_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/127_Imagick_progressMonitor_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/127_Imagick_progressMonitor_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,62 @@ +--TEST-- +Test Imagick, progressMonitor +--SKIPIF-- + +--FILE-- + 20) { + $status = "Processing cancelled"; + return false; + } + + $nowTime = time(); + + $debug .= "$x: nowTime $nowTime - startTime $startTime".PHP_EOL; + $x++; + + if ($nowTime - $startTime > 5) { + $status = "Processing cancelled"; + return false; + } + + return true; +}; + +$imagick = new \Imagick(); +$imagick->newPseudoImage(640, 480, "magick:logo"); + +$imagick->setProgressMonitor($callback); + +try { + + $imagick->charcoalImage($radius, $sigma); + $bytes = $imagick->getImageBlob(); + echo "Progress monitor failed to interrupt.".PHP_EOL; + echo $debug; +} +catch(\Exception $e) { + echo $status.PHP_EOL; +} +?> +--EXPECTF-- +Processing cancelled \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/130_Imagick_setOption_case1.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/130_Imagick_setOption_case1.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/130_Imagick_setOption_case1.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/130_Imagick_setOption_case1.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,27 @@ +--TEST-- +Test Imagick, setOption +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->setImageFormat('jpg'); + $imagick->setOption('jpeg:extent', $extent); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +renderJPG($extent) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/131_Imagick_setOption_case2.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/131_Imagick_setOption_case2.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/131_Imagick_setOption_case2.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/131_Imagick_setOption_case2.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,24 @@ +--TEST-- +Test Imagick, setOption +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->setImageFormat('png'); + $imagick->setOption('png:format', $format); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +renderPNG($format) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/132_Imagick_setOption_case3.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/132_Imagick_setOption_case3.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/132_Imagick_setOption_case3.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/132_Imagick_setOption_case3.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,24 @@ +--TEST-- +Test Imagick, setOption +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->setImageFormat('png'); + $imagick->setOption('png:bit-depth', '16'); + $imagick->setOption('png:color-type', 6); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +renderCustomBitDepthPNG() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/133_Imagick_setSamplingFactors_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/133_Imagick_setSamplingFactors_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/133_Imagick_setSamplingFactors_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/133_Imagick_setSamplingFactors_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,38 @@ +--TEST-- +Test Imagick, setSamplingFactors +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->setImageFormat('jpg'); + $imagick->setSamplingFactors(array('2x2', '1x1', '1x1')); + + $compressed = $imagick->getImageBlob(); + + + $reopen = new \Imagick(); + $reopen->readImageBlob($compressed); + + $reopen->resizeImage( + $reopen->getImageWidth() * 4, + $reopen->getImageHeight() * 4, + \Imagick::FILTER_POINT, + 1 + ); + + $bytes = $reopen->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setSamplingFactors() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/134_Imagick_shadowImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/134_Imagick_shadowImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/134_Imagick_shadowImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/134_Imagick_shadowImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,24 @@ +--TEST-- +Test Imagick, shadowImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->shadowImage(0.4, 10, 50, 5); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +shadowImage() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/135_Imagick_sharpenImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/135_Imagick_sharpenImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/135_Imagick_sharpenImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/135_Imagick_sharpenImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,27 @@ +--TEST-- +Test Imagick, sharpenImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->sharpenimage($radius, $sigma, $channel); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +sharpenImage($radius, $sigma, $channel) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/136_Imagick_shadeImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/136_Imagick_shadeImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/136_Imagick_shadeImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/136_Imagick_shadeImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,24 @@ +--TEST-- +Test Imagick, shadeImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->shadeImage(true, 45, 20); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +shadeImage() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/137_Imagick_shearImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/137_Imagick_shearImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/137_Imagick_shearImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/137_Imagick_shearImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,27 @@ +--TEST-- +Test Imagick, shearImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->shearimage($color, $shearX, $shearY); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +shearImage($color, $shearX, $shearY) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/138_Imagick_shaveImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/138_Imagick_shaveImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/138_Imagick_shaveImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/138_Imagick_shaveImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,24 @@ +--TEST-- +Test Imagick, shaveImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->shaveImage(100, 50); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +shaveImage() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/139_Imagick_sigmoidalContrastImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/139_Imagick_sigmoidalContrastImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/139_Imagick_sigmoidalContrastImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/139_Imagick_sigmoidalContrastImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,32 @@ +--TEST-- +Test Imagick, sigmoidalContrastImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + //Need some stereo image to work with. + $imagick->sigmoidalcontrastimage( + $sharpening, //sharpen + $midpoint, + $sigmoidalContrast * \Imagick::getQuantum() + ); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +sigmoidalContrastImage($sharpening, $midpoint, $sigmoidalContrast) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/141_Imagick_sketchImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/141_Imagick_sketchImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/141_Imagick_sketchImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/141_Imagick_sketchImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,27 @@ +--TEST-- +Test Imagick, sketchImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->sketchimage($radius, $sigma, $angle); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +sketchImage($radius, $sigma, $angle) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/142_Imagick_solarizeImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/142_Imagick_solarizeImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/142_Imagick_solarizeImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/142_Imagick_solarizeImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,25 @@ +--TEST-- +Test Imagick, solarizeImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->solarizeImage($solarizeThreshold * \Imagick::getQuantum()); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +solarizeImage($solarizeThreshold) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/143_Imagick_spreadImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/143_Imagick_spreadImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/143_Imagick_spreadImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/143_Imagick_spreadImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,25 @@ +--TEST-- +Test Imagick, spreadImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->spreadImage($radius); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +spreadImage($radius) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/144_Imagick_spliceImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/144_Imagick_spliceImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/144_Imagick_spliceImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/144_Imagick_spliceImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,28 @@ +--TEST-- +Test Imagick, spliceImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->spliceImage($width, $height, $startX, $startY); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +spliceImage($startX, $startY, $width, $height) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/145_imagickkernel_coverage.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/145_imagickkernel_coverage.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/145_imagickkernel_coverage.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/145_imagickkernel_coverage.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,210 @@ +--TEST-- +ImagickKernel::fromMatrix test +--SKIPIF-- + +--FILE-- +scale(1, \Imagick::NORMALIZE_KERNEL_VALUE); +$kernel->addUnityKernel(0.50); +$imagick = new \Imagick(); +$imagick->newPseudoImage(640, 480, "magick:logo"); +$imagick->morphology( + \Imagick::MORPHOLOGY_CONVOLVE, + 1, + $kernel +); + + +$tests = array(); + +$tests[] = array( + "Cannot create kernel, matrix is empty.", + array() +); + +$tests[] = array( + "Values must be matrix, with the same number of columns in each row.", + array(0, 1, 1) +); + +//Should fail, matrix needs to have same number columns in each row +$tests[] = array( + "Values must be matrix, with the same number of columns in each row.", + array( + array(1, 0, 1), + array(1, 0, 1), + array(1, 0), + ) +); + +//Should fail, value instead of second row +$tests[] = array( + "Values must be matrix, with the same number of columns in each row.", + array( + array(0, 1), + 1 + ) +); + +//Should fail, value instead of second row +$tests[] = array( + "Only numbers or false are valid values in a kernel matrix.", + array( + array(0, 1), + array(0, new StdClass), + ) +); + +$tests[] = array( + "For kernels with even numbered rows or columns, the origin position must be specified.", + array( + array(1, 0), + ), +); + + +foreach ($tests as $test) { + + list($expectedMessage, $testValue) = $test; + + try { + $kernel = ImagickKernel::fromMatrix($testValue); + echo "Failed to throw exception".PHP_EOL; + } + catch(ImagickKernelException $e) { + if ($e->getMessage() != $expectedMessage) { + echo "Unexpected message ".$e->getMessage()." for test:".PHP_EOL; + var_dump($test); + } + } +} + + +try { + $kernel = ImagickKernel::fromBuiltin(\Imagick::KERNEL_DIAMOND, "CestNestPasUneKernel"); + //echo "builtIn OK".PHP_EOL; +} +catch(Exception $e) { + echo "Unexpected exception: ".$e->getMessage().PHP_EOL; +} + + +//Test adding unity kernel works. +$matrix1 = array( + array(1, 1, 1), + array(0, 0, 0), + array(-1, -1, -1), +); +$kernel = ImagickKernel::fromMatrix($matrix1); +$kernel->addUnityKernel(0.5); +$matrix = $kernel->getMatrix(); + +if ($matrix[1][1] != 0.5) { + echo "center point should be 0.5 but is actually ".$matrix[1][1].PHP_EOL; + var_dump($matrix); +} +//echo "Adding unity kernel ok".PHP_EOL; + +// Test adding kernel works and you can get the values back +$matrix1 = array( + array(1, 1), + array(0, 0), +); +$matrix2 = array( + array(0, 0), + array(1, 1), +); +$kernel1 = ImagickKernel::fromMatrix($matrix1, array(0, 0)); +$kernel2 = ImagickKernel::fromMatrix($matrix2, array(0, 0)); +$kernel1->addKernel($kernel2); + +$kernelList = $kernel1->separate(); +if (count($kernelList) != 2) { + echo "Incorrect number of matrixes returned."; +} +else { + if ($kernelList[0]->getMatrix() != $matrix1) { + echo "Matrix 1 does not match".PHP_EOL; + var_dump($kernelList[0]); + } + if ($kernelList[1]->getMatrix() != $matrix2) { + echo "Matrix 2 does not match".PHP_EOL; + var_dump($kernelList[1]); + } +} + +//Test Scaling +$matrixIn = array( + array(-1, 0, -1), + array( 0, 8, 0), + array(-1, 0, -1), +); +$kernel = ImagickKernel::fromMatrix($matrixIn); +$kernel->scale(1, \Imagick::NORMALIZE_KERNEL_VALUE); +$matrixOut = $kernel->getMatrix(); + +if ($matrixOut[1][1] != 2) { + echo "Matrix was not normalised correctly."; + var_dump($matrixOut); +} + + + +//Test single line kernel works +$matrixIn = array( + array(1, 0), +); +$kernel = ImagickKernel::fromMatrix($matrixIn, array(1, 0)); +if ($kernel->getMatrix() != $matrixIn) { + echo "Values do not match for 'Test single line kernel works'".PHP_EOL; +} + +//Test even sized kernel works +$matrixIn = array( + array(-1, 0), + array( 0, 1) +); +$kernel = ImagickKernel::fromMatrix($matrixIn, array(0, 1)); +if ($kernel->getMatrix() != $matrixIn) { + echo "Values do not match for 'Test even sized kernel works'".PHP_EOL; +} + +//Test 'wrong' order matrix is converted correctly. +$matrix = array( + array(0.0, 1.0), + array(0.5, false) +); + +$outOfOrderMatrix = array(); +$outOfOrderMatrix[1][1] = $matrix[1][1]; +$outOfOrderMatrix[1][0] = $matrix[1][0]; +$outOfOrderMatrix[0][1] = $matrix[0][1]; +$outOfOrderMatrix[0][0] = $matrix[0][0]; + +$kernel = ImagickKernel::fromMatrix($outOfOrderMatrix, array(0, 0)); +$kernelMatrix = $kernel->getMatrix(); +if ($kernelMatrix !== $matrix) { + echo "Kernel generated from 'out of order' matrix is incorrect.".PHP_EOL; + var_dump($matrix); + echo "vs".PHP_EOL; + var_dump($kernelMatrix); +} + +echo "Complete".PHP_EOL; +?> +--EXPECTF-- +Complete diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/149_Imagick_sparseColorImage.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/149_Imagick_sparseColorImage.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/149_Imagick_sparseColorImage.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/149_Imagick_sparseColorImage.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,145 @@ +--TEST-- +Test Imagick, sparseColorImage +--SKIPIF-- + +--FILE-- +newImage($width, $height, "rgba(255, 255, 255, 1)"); + $imagick->setImageFormat("png"); + + $barycentricPoints = array(); + + foreach ($colorPoints as $colorPoint) { + + if ($absolute == true) { + $barycentricPoints[] = $colorPoint[0]; + $barycentricPoints[] = $colorPoint[1]; + } + else { + $barycentricPoints[] = $colorPoint[0] * $width; + $barycentricPoints[] = $colorPoint[1] * $height; + } + + if (is_string($colorPoint[2])) { + $imagickPixel = new \ImagickPixel($colorPoint[2]); + } + else if ($colorPoint[2] instanceof \ImagickPixel) { + $imagickPixel = $colorPoint[2]; + } + else{ + $errorMessage = sprintf( + "Value %s is neither a string nor an ImagickPixel class. Cannot use as a color.", + $colorPoint[2] + ); + + throw new \InvalidArgumentException( + $errorMessage + ); + } + + $red = $imagickPixel->getColorValue(\Imagick::COLOR_RED); + $green = $imagickPixel->getColorValue(\Imagick::COLOR_GREEN); + $blue = $imagickPixel->getColorValue(\Imagick::COLOR_BLUE); + $alpha = $imagickPixel->getColorValue(\Imagick::COLOR_ALPHA); + + $barycentricPoints[] = $red; + $barycentricPoints[] = $green; + $barycentricPoints[] = $blue; + $barycentricPoints[] = $alpha; + } + + $imagick->sparseColorImage($sparseMethod, $barycentricPoints); + + return $imagick; +} + +function renderImageBarycentric() { + $points = array( + array(0, 0, 'skyblue'), + array(-1, 1, 'skyblue'), + array(1, 1, 'black'), + ); + $imagick = createGradientImage(600, 200, $points, \Imagick::SPARSECOLORMETHOD_BARYCENTRIC); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + echo "Ok".PHP_EOL; +} +function renderImageVoronoi() { + $points = array( + array(0.30, 0.10, 'red'), + array(0.10, 0.80, 'blue'), + array(0.70, 0.60, 'lime'), + array(0.80, 0.20, 'yellow'), + ); + $imagick = createGradientImage(500, 500, $points, \Imagick::SPARSECOLORMETHOD_VORONOI); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + echo "Ok".PHP_EOL; +} +function renderImageShepards() { + $points = array( + array(0.30, 0.10, 'red'), + array(0.10, 0.80, "RGBA(0, 255, 0, 0.5)"), + array(0.70, 0.60, "RGBA(0, 255, 0, 1)"), + array(0.80, 0.20, 'yellow'), + ); + $imagick = createGradientImage(600, 600, $points, \Imagick::SPARSECOLORMETHOD_SPEPARDS); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + echo "Ok".PHP_EOL; +} + +function renderImageBilinear() { + $points = array( + array(0.30, 0.10, 'red'), + array(0.10, 0.80, 'blue'), + array(0.70, 0.60, 'lime'), + array(0.80, 0.20, 'yellow'), + ); + $imagick = createGradientImage(500, 500, $points, \Imagick::SPARSECOLORMETHOD_BILINEAR); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + echo "Ok".PHP_EOL; +} + +try { + renderImageBilinear() ; +} +catch (\Exception $e) { + echo "renderImageBilinear failed ".$e->getMessage().PHP_EOL; +} +try { + renderImageShepards(); +} +catch (\Exception $e) { + echo "renderImageShepards failed ".$e->getMessage().PHP_EOL; +} +try { + renderImageVoronoi(); +} +catch (\Exception $e) { + echo "renderImageVoronoi failed ".$e->getMessage().PHP_EOL; +} +try { + renderImageBarycentric(); +} +catch (\Exception $e) { + echo "renderImageBarycentric failed ".$e->getMessage().PHP_EOL; +} + +?> +--EXPECTF-- +Ok +Ok +Ok +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/150_Imagick_setregistry.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/150_Imagick_setregistry.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/150_Imagick_setregistry.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/150_Imagick_setregistry.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,69 @@ +--TEST-- +Test Imagick, setRegistry and getRegistry +--SKIPIF-- + +--FILE-- +getMessage() . "\n"; + } +} + + +?> +--EXPECTF-- +Temporary-path was empty at start. +Temporary path was set correctly. +Temporary path was listed correctly. +This is fine. diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/151_Imagick_subImageMatch_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/151_Imagick_subImageMatch_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/151_Imagick_subImageMatch_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/151_Imagick_subImageMatch_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,64 @@ +--TEST-- +Test Imagick, subImageMatch +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->adaptiveResizeImage(100, 100, true); + //This makes the test fall over on some versions of ImageMagick + //$imagick->setImageAlphaChannel(\Imagick::ALPHACHANNEL_DEACTIVATE); + $imagick2 = clone $imagick; + $imagick2->cropimage(25, 25, 50, 50); + $imagick2->setImageFormat('png'); + + $imagick2->setImagePage(25, 25, 0, 0); + $imagick2->vignetteimage(0.25, 0.75, 3, 3); + + $similarity = 'not set'; + $bestMatch = 'not st'; + $comparison = $imagick->subImageMatch($imagick2, $bestMatch, $similarity); + + $comparison->setImageFormat('png'); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + + $version = Imagick::getVersion(); + if ($version['versionNumber'] >= 0x700) { + $expectedValue = 0.7642; + } + else { + $expectedValue = 0.5585; + } + + // This doesn't work reliably - the values are not comparable across versions + // if (abs($expectedValue - $similarity) <= 0.005) { + // echo "Similarity in range\n"; + // } + // else { + // echo "Similarity is out of range.\n"; + // var_dump($similarity); + // } + + ksort($bestMatch); + foreach ($bestMatch as $key => $value) { + echo "$key : $value\n"; + } +} + +subImageMatch() ; +echo "Ok"; +?> + +--EXPECTF-- +height : 25 +width : 25 +x : 50 +y : 50 +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/152_Imagick_swirlImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/152_Imagick_swirlImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/152_Imagick_swirlImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/152_Imagick_swirlImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,25 @@ +--TEST-- +Test Imagick, swirlImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->swirlImage($swirl); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +swirlImage($swirl) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/153_Imagick_statisticImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/153_Imagick_statisticImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/153_Imagick_statisticImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/153_Imagick_statisticImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,36 @@ +--TEST-- +Test Imagick, statisticImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + + $imagick->statisticImage( + $statisticType, + $w20, + $h20, + $channel + ); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +statisticImage($statisticType, $w20, $h20, $channel) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/154_Imagick_textureImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/154_Imagick_textureImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/154_Imagick_textureImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/154_Imagick_textureImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,26 @@ +--TEST-- +Test Imagick, textureImage +--SKIPIF-- + +--FILE-- +newImage(640, 480, new \ImagickPixel('pink')); + $image->setImageFormat("jpg"); + + $texture = new \Imagick(); + $texture->newPseudoImage(640, 480, "magick:logo"); + $texture->scaleimage($image->getimagewidth() / 4, $image->getimageheight() / 4); + $image = $image->textureImage($texture); + $bytes = $image; + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +textureImage() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/155_Imagick_thresholdImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/155_Imagick_thresholdImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/155_Imagick_thresholdImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/155_Imagick_thresholdImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,27 @@ +--TEST-- +Test Imagick, thresholdImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->thresholdimage($threshold * \Imagick::getQuantum(), $channel); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +thresholdimage($threshold, $channel) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/156_Imagick_tintImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/156_Imagick_tintImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/156_Imagick_tintImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/156_Imagick_tintImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,31 @@ +--TEST-- +Test Imagick, tintImage +--SKIPIF-- + +--FILE-- +newPseudoImage(400, 400, 'gradient:black-white'); + + $tint = new \ImagickPixel("rgb($r, $g, $b)"); + $opacity = new \ImagickPixel("rgb(128, 128, 128, $a)"); + $imagick->tintImage($tint, $opacity); + $imagick->setImageFormat('png'); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +tintImage($r, $g, $b, $a) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/157_Imagick_thumbnailImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/157_Imagick_thumbnailImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/157_Imagick_thumbnailImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/157_Imagick_thumbnailImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,25 @@ +--TEST-- +Test Imagick, thumbnailImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->setbackgroundcolor('rgb(64, 64, 64)'); + $imagick->thumbnailImage(100, 100, true, true); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +thumbnailImage() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/158_Imagick_transposeImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/158_Imagick_transposeImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/158_Imagick_transposeImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/158_Imagick_transposeImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,24 @@ +--TEST-- +Test Imagick, transposeImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->transposeImage(); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +transposeImage() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/159_Imagick_transformImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/159_Imagick_transformImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/159_Imagick_transformImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/159_Imagick_transformImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,26 @@ +--TEST-- +Test Imagick, transformImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $newImage = $imagick->transformimage("400x600", "200x300"); + $bytes = $newImage->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +transformimage() ; +echo "Ok"; +?> +--EXPECTF-- +Deprecated: Function Imagick::transformimage() is deprecated in %s +Ok diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/160_Imagick_transparentPaintImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/160_Imagick_transparentPaintImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/160_Imagick_transparentPaintImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/160_Imagick_transparentPaintImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,34 @@ +--TEST-- +Test Imagick, transparentPaintImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + + //Need to be in a format that supports transparency + $imagick->setimageformat('png'); + + $imagick->transparentPaintImage( + $color, $alpha, $fuzz * \Imagick::getQuantum(), false + ); + + //Not required, but helps tidy up left over pixels + $imagick->despeckleimage(); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +transparentPaintImage($color, $alpha, $fuzz) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/161_Imagick_transformImageColorspace_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/161_Imagick_transformImageColorspace_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/161_Imagick_transformImageColorspace_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/161_Imagick_transformImageColorspace_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,27 @@ +--TEST-- +Test Imagick, transformImageColorspace +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->transformimagecolorspace($colorSpace); + $imagick->separateImageChannel($channel); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +transformImageColorspace($colorSpace, $channel) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/162_Imagick_transverseImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/162_Imagick_transverseImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/162_Imagick_transverseImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/162_Imagick_transverseImage_basic.phpt 2019-05-02 15:25:59.000000000 +0000 @@ -0,0 +1,24 @@ +--TEST-- +Test Imagick, transverseImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->transverseImage(); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +transverseImage() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/163_Imagick_uniqueImageColors_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/163_Imagick_uniqueImageColors_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/163_Imagick_uniqueImageColors_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/163_Imagick_uniqueImageColors_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,27 @@ +--TEST-- +Test Imagick, uniqueImageColors +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + //Reduce the image to 256 colours nicely. + $imagick->quantizeImage(256, \Imagick::COLORSPACE_YIQ, 0, false, false); + $imagick->uniqueImageColors(); + $imagick->scaleimage($imagick->getImageWidth(), $imagick->getImageHeight() * 20); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +uniqueImageColors() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/164_Imagick_trimImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/164_Imagick_trimImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/164_Imagick_trimImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/164_Imagick_trimImage_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,29 @@ +--TEST-- +Test Imagick, trimImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + + $imagick->borderImage($color, 10, 10); + $imagick->trimImage($fuzz * \Imagick::getQuantum()); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +trimImage($color, $fuzz) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/165_Imagick_unsharpMaskImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/165_Imagick_unsharpMaskImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/165_Imagick_unsharpMaskImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/165_Imagick_unsharpMaskImage_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,29 @@ +--TEST-- +Test Imagick, unsharpMaskImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->unsharpMaskImage($radius, $sigma, $amount, $unsharpThreshold); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +unsharpMaskImage($radius, $sigma, $amount, $unsharpThreshold) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/166_Imagick_waveImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/166_Imagick_waveImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/166_Imagick_waveImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/166_Imagick_waveImage_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,26 @@ +--TEST-- +Test Imagick, waveImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->waveImage($amplitude, $length); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +waveImage($amplitude, $length) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/167_Imagick_vignetteImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/167_Imagick_vignetteImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/167_Imagick_vignetteImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/167_Imagick_vignetteImage_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,28 @@ +--TEST-- +Test Imagick, vignetteImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->vignetteImage($blackPoint, $whitePoint, $x, $y); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +vignetteImage($blackPoint, $whitePoint, $x, $y) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/168_Imagick_whiteThresholdImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/168_Imagick_whiteThresholdImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/168_Imagick_whiteThresholdImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/168_Imagick_whiteThresholdImage_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,26 @@ +--TEST-- +Test Imagick, whiteThresholdImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + //TODO needs a control + $imagick->whiteThresholdImage($color); + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +whiteThresholdImage($color) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/169_ImagickPixel_construct_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/169_ImagickPixel_construct_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/169_ImagickPixel_construct_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/169_ImagickPixel_construct_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,60 @@ +--TEST-- +Test ImagickPixel, construct +--SKIPIF-- + +--FILE-- +setstrokewidth(1.0); + $draw->setStrokeColor($black); + $draw->setFillColor($color); + $offsetX = ($count % $columns) * 50 + 5; + $offsetY = intval($count / $columns) * 50 + 5; + $draw->rectangle(0 + $offsetX, 0 + $offsetY, 40 + $offsetX, 40 + $offsetY); + $count++; + } + + $image = new \Imagick(); + $image->newImage(350, 350, "blue"); + $image->setImageFormat("png"); + $image->drawImage($draw); + $bytes = $image->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +construct() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/170_ImagickPixel_setColor_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/170_ImagickPixel_setColor_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/170_ImagickPixel_setColor_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/170_ImagickPixel_setColor_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,35 @@ +--TEST-- +Test ImagickPixel, setColor +--SKIPIF-- + +--FILE-- +setColor('rgba(100%, 75%, 0%, 1.0)'); + + $draw->setstrokewidth(3.0); + $draw->setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->rectangle(200, 200, 300, 300); + + $image = new \Imagick(); + $image->newImage(500, 500, "SteelBlue2"); + $image->setImageFormat("png"); + + $image->drawImage($draw); + + $bytes = $image->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setColor() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/171_ImagickPixel_setColorValue_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/171_ImagickPixel_setColorValue_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/171_ImagickPixel_setColorValue_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/171_ImagickPixel_setColorValue_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,33 @@ +--TEST-- +Test ImagickPixel, setColorValue +--SKIPIF-- + +--FILE-- +setcolorValue(\Imagick::COLOR_RED, 128); + + $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); + + $bytes = $image->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setColorValue() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/172_ImagickPixel_setColorValueQuantum_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/172_ImagickPixel_setColorValueQuantum_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/172_ImagickPixel_setColorValueQuantum_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/172_ImagickPixel_setColorValueQuantum_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,36 @@ +--TEST-- +Test ImagickPixel, setColorValueQuantum +--SKIPIF-- + +--FILE-- +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); + + $bytes = $image->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setColorValueQuantum() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/173_ImagickDraw_bezier_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/173_ImagickDraw_bezier_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/173_ImagickDraw_bezier_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/173_ImagickDraw_bezier_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,83 @@ +--TEST-- +Test ImagickDraw, bezier +--SKIPIF-- + +--FILE-- +setStrokeOpacity(1); + $draw->setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + + $draw->setStrokeWidth(2); + + $smoothPointsSet = array( + array( + array('x' => 10.0 * 5, 'y' => 10.0 * 5), + array('x' => 30.0 * 5, 'y' => 90.0 * 5), + array('x' => 25.0 * 5, 'y' => 10.0 * 5), + array('x' => 50.0 * 5, 'y' => 50.0 * 5), + ), + array( + array('x' => 50.0 * 5, 'y' => 50.0 * 5), + array('x' => 75.0 * 5, 'y' => 90.0 * 5), + array('x' => 70.0 * 5, 'y' => 10.0 * 5), + array('x' => 90.0 * 5, 'y' => 40.0 * 5), + ), + ); + + foreach ($smoothPointsSet as $points) { + $draw->bezier($points); + } + + + $disjointPoints = array( + array( + array('x' => 10 * 5, 'y' => 10 * 5), + array('x' => 30 * 5, 'y' => 90 * 5), + array('x' => 25 * 5, 'y' => 10 * 5), + array('x' => 50 * 5, 'y' => 50 * 5), + ), + array( + array('x' => 50 * 5, 'y' => 50 * 5), + array('x' => 80 * 5, 'y' => 50 * 5), + array('x' => 70 * 5, 'y' => 10 * 5), + array('x' => 90 * 5, 'y' => 40 * 5), + ) + ); + $draw->translate(0, 200); + + foreach ($disjointPoints as $points) { + $draw->bezier($points); + } + + //Create an image object which the draw commands can be rendered into + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + + //Render the draw commands in the ImagickDraw object + //into the image. + $imagick->drawImage($draw); + + //Send the image to the browser + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +bezier($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/174_ImagickDraw_affine_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/174_ImagickDraw_affine_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/174_ImagickDraw_affine_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/174_ImagickDraw_affine_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,74 @@ +--TEST-- +Test ImagickDraw, affine +--SKIPIF-- + +--FILE-- +setStrokeWidth(1); + $draw->setStrokeOpacity(1); + $draw->setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + + $draw->setStrokeWidth(2); + + $PI = 3.141592653589794; + $angle = 60 * $PI / 360; + + //Scale the drawing co-ordinates. + $affineScale = array("sx" => 1.75, "sy" => 1.75, "rx" => 0, "ry" => 0, "tx" => 0, "ty" => 0); + + //Shear the drawing co-ordinates. + $affineShear = array("sx" => 1, "sy" => 1, "rx" => sin($angle), "ry" => -sin($angle), "tx" => 0, "ty" => 0); + + //Rotate the drawing co-ordinates. The shear affine matrix + //produces incorrectly scaled drawings. + $affineRotate = array("sx" => cos($angle), "sy" => cos($angle), "rx" => sin($angle), "ry" => -sin($angle), "tx" => 0, "ty" => 0,); + + //Translate (offset) the drawing + $affineTranslate = array("sx" => 1, "sy" => 1, "rx" => 0, "ry" => 0, "tx" => 30, "ty" => 30); + + //The identiy affine matrix + $affineIdentity = array("sx" => 1, "sy" => 1, "rx" => 0, "ry" => 0, "tx" => 0, "ty" => 0); + + $examples = array($affineScale, $affineShear, $affineRotate, $affineTranslate, $affineIdentity,); + + $count = 0; + + foreach ($examples as $example) { + $draw->push(); + $draw->translate(($count % 2) * 250, intval($count / 2) * 250); + $draw->translate(100, 100); + $draw->affine($example); + $draw->rectangle(-50, -50, 50, 50); + $draw->pop(); + $count++; + } + + //Create an image object which the draw commands can be rendered into + $image = new \Imagick(); + $image->newImage(500, 750, $backgroundColor); + $image->setImageFormat("png"); + + //Render the draw commands in the ImagickDraw object + //into the image. + $image->drawImage($draw); + + //Send the image to the browser + $bytes = $image->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +affine($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/175_ImagickDraw_arc_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/175_ImagickDraw_arc_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/175_ImagickDraw_arc_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/175_ImagickDraw_arc_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,47 @@ +--TEST-- +Test ImagickDraw, arc +--SKIPIF-- + +--FILE-- +setStrokeWidth(1); + $draw->setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeWidth(2); + + $draw->arc($startX, $startY, $endX, $endY, $startAngle, $endAngle); + + //Create an image object which the draw commands can be rendered into + $image = new \Imagick(); + $image->newImage(500, 500, $backgroundColor); + $image->setImageFormat("png"); + + //Render the draw commands in the ImagickDraw object + //into the image. + $image->drawImage($draw); + + //Send the image to the browser + $bytes = $image->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +arc($strokeColor, $fillColor, $backgroundColor, $startX, $startY, $endX, $endY, $startAngle, $endAngle) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/176_ImagickDraw_ellipse_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/176_ImagickDraw_ellipse_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/176_ImagickDraw_ellipse_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/176_ImagickDraw_ellipse_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,50 @@ +--TEST-- +Test ImagickDraw, ellipse +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + + $draw->setStrokeWidth(2); + $draw->setFontSize(72); + + $draw->ellipse(125, 70, 100, 50, 0, 360); + $draw->ellipse(350, 70, 100, 50, 0, 315); + + $draw->push(); + $draw->translate(125, 250); + $draw->rotate(30); + $draw->ellipse(0, 0, 100, 50, 0, 360); + $draw->pop(); + + $draw->push(); + $draw->translate(350, 250); + $draw->rotate(30); + $draw->ellipse(0, 0, 100, 50, 0, 315); + $draw->pop(); + + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +ellipse($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/177_ImagickDraw_composite_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/177_ImagickDraw_composite_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/177_ImagickDraw_composite_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/177_ImagickDraw_composite_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,57 @@ +--TEST-- +Test ImagickDraw, composite +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setFillOpacity(1); + $draw->setStrokeWidth(2); + $draw->setFontSize(72); + $draw->setStrokeOpacity(1); + $draw->setStrokeColor($strokeColor); + $draw->setStrokeWidth(2); + $draw->setFontSize(140); + $draw->rectangle(0, 0, 1000, 300); + $draw->setFillColor('white'); + $draw->setfillopacity(1); + $draw->annotation(50, 180, "Lorem Ipsum!"); + +// $imagick = new \Imagick(realpath("../images/TestImage.jpg")); +// $draw->composite(\Imagick::COMPOSITE_MULTIPLY, -500, -200, 2000, 600, $imagick); + + //$imagick->compositeImage($draw, 0, 0, 1000, 500); + //$draw->composite(Imagick::COMPOSITE_COLORBURN, -500, -200, 2000, 600, $imagick); + + //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 + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +composite($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/178_ImagickDraw_circle_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/178_ImagickDraw_circle_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/178_ImagickDraw_circle_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/178_ImagickDraw_circle_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,46 @@ +--TEST-- +Test ImagickDraw, circle +--SKIPIF-- + +--FILE-- +setStrokeOpacity(1); + $draw->setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + + $draw->setStrokeWidth(2); + $draw->setFontSize(72); + + $draw->circle($originX, $originY, $endX, $endY); + + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +circle($strokeColor, $fillColor, $backgroundColor, $originX, $originY, $endX, $endY) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/179_ImagickDraw_line_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/179_ImagickDraw_line_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/179_ImagickDraw_line_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/179_ImagickDraw_line_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,38 @@ +--TEST-- +Test ImagickDraw, line +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + + $draw->setStrokeWidth(2); + $draw->setFontSize(72); + + $draw->line(125, 70, 100, 50); + $draw->line(350, 170, 100, 150); + + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +line($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/180_ImagickDraw_matte_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/180_ImagickDraw_matte_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/180_ImagickDraw_matte_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/180_ImagickDraw_matte_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,45 @@ +--TEST-- +Test ImagickDraw, matte +--SKIPIF-- + + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + + $draw->setStrokeWidth(2); + $draw->setFontSize(72); + + $draw->matte(120, 120, $paintType); + + $draw->rectangle(100, 100, 300, 200); + + + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +matte($strokeColor, $fillColor, $backgroundColor, $paintType) ; +echo "Ok"; +?> +--EXPECTF-- +Deprecated: Function ImagickDraw::matte() is deprecated in %s +Ok diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/181_ImagickDraw_pathStart_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/181_ImagickDraw_pathStart_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/181_ImagickDraw_pathStart_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/181_ImagickDraw_pathStart_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,59 @@ +--TEST-- +Test ImagickDraw, pathStart +--SKIPIF-- + +--FILE-- +setStrokeOpacity(1); + $draw->setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + + $draw->setStrokeWidth(2); + $draw->setFontSize(72); + + $draw->pathStart(); + $draw->pathMoveToAbsolute(50, 50); + $draw->pathLineToAbsolute(100, 50); + $draw->pathLineToRelative(0, 50); + $draw->pathLineToHorizontalRelative(-50); + $draw->pathFinish(); + + $draw->pathStart(); + $draw->pathMoveToAbsolute(50, 50); + $draw->pathMoveToRelative(300, 0); + $draw->pathLineToRelative(50, 0); + $draw->pathLineToVerticalRelative(50); + $draw->pathLineToHorizontalAbsolute(350); + $draw->pathclose(); + $draw->pathFinish(); + + $draw->pathStart(); + $draw->pathMoveToAbsolute(50, 300); + $draw->pathCurveToAbsolute(50, 300, 100, 200, 300, 300); + $draw->pathLineToVerticalAbsolute(350); + $draw->pathFinish(); + + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +pathStart($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/182_ImagickDraw_pathCurveToQuadraticBezierAbsolute_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/182_ImagickDraw_pathCurveToQuadraticBezierAbsolute_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/182_ImagickDraw_pathCurveToQuadraticBezierAbsolute_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/182_ImagickDraw_pathCurveToQuadraticBezierAbsolute_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,64 @@ +--TEST-- +Test ImagickDraw, pathCurveToQuadraticBezierAbsolute +--SKIPIF-- + +--FILE-- +setStrokeOpacity(1); + $draw->setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + + $draw->setStrokeWidth(2); + $draw->setFontSize(72); + + $draw->pathStart(); + $draw->pathMoveToAbsolute(50,250); + + // This specifies a quadratic bezier curve with the current position as the start + // point, the control point is the first two params, and the end point is the last two params. + $draw->pathCurveToQuadraticBezierAbsolute( + 150,50, + 250,250 + ); + + // This specifies a quadratic bezier curve with the current position as the start + // point, the control point is mirrored from the previous curves control point + // and the end point is defined by the x, y values. + $draw->pathCurveToQuadraticBezierSmoothAbsolute( + 450,250 + ); + + // This specifies a quadratic bezier curve with the current position as the start + // point, the control point is mirrored from the previous curves control point + // and the end point is defined relative from the current position by the x, y values. + $draw->pathCurveToQuadraticBezierSmoothRelative( + 200,-100 + ); + + $draw->pathFinish(); + + $imagick = new \Imagick(); + $imagick->newImage(700, 500, $backgroundColor); + $imagick->setImageFormat("png"); + + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + +} + +pathCurveToQuadraticBezierAbsolute($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/183_ImagickDraw_pathCurveToQuadraticBezierAbsolute_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/183_ImagickDraw_pathCurveToQuadraticBezierAbsolute_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/183_ImagickDraw_pathCurveToQuadraticBezierAbsolute_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/183_ImagickDraw_pathCurveToQuadraticBezierAbsolute_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,64 @@ +--TEST-- +Test ImagickDraw, pathCurveToQuadraticBezierAbsolute +--SKIPIF-- + +--FILE-- +setStrokeOpacity(1); + $draw->setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + + $draw->setStrokeWidth(2); + $draw->setFontSize(72); + + $draw->pathStart(); + $draw->pathMoveToAbsolute(50,250); + + // This specifies a quadratic bezier curve with the current position as the start + // point, the control point is the first two params, and the end point is the last two params. + $draw->pathCurveToQuadraticBezierAbsolute( + 150,50, + 250,250 + ); + + // This specifies a quadratic bezier curve with the current position as the start + // point, the control point is mirrored from the previous curves control point + // and the end point is defined by the x, y values. + $draw->pathCurveToQuadraticBezierSmoothAbsolute( + 450,250 + ); + + // This specifies a quadratic bezier curve with the current position as the start + // point, the control point is mirrored from the previous curves control point + // and the end point is defined relative from the current position by the x, y values. + $draw->pathCurveToQuadraticBezierSmoothRelative( + 200,-100 + ); + + $draw->pathFinish(); + + $imagick = new \Imagick(); + $imagick->newImage(700, 500, $backgroundColor); + $imagick->setImageFormat("png"); + + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + +} + +pathCurveToQuadraticBezierAbsolute($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/184_ImagickDraw_polyline_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/184_ImagickDraw_polyline_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/184_ImagickDraw_polyline_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/184_ImagickDraw_polyline_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,43 @@ +--TEST-- +Test ImagickDraw, polyline +--SKIPIF-- + +--FILE-- +setStrokeOpacity(1); + $draw->setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + + $draw->setStrokeWidth(5); + + $points = array( + array('x' => 40 * 5, 'y' => 10 * 5), + array('x' => 20 * 5, 'y' => 20 * 5), + array('x' => 70 * 5, 'y' => 50 * 5), + array('x' => 60 * 5, 'y' => 15 * 5) + ); + + $draw->polyline($points); + + $image = new \Imagick(); + $image->newImage(500, 300, $backgroundColor); + $image->setImageFormat("png"); + $image->drawImage($draw); + + $bytes = $image->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +polyline($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/185_ImagickDraw_point_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/185_ImagickDraw_point_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/185_ImagickDraw_point_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/185_ImagickDraw_point_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,35 @@ +--TEST-- +Test ImagickDraw, point +--SKIPIF-- + +--FILE-- +setFillColor($fillColor); + + for ($x = 0; $x < 10000; $x++) { + $draw->point(rand(0, 500), rand(0, 500)); + } + + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +point($fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/186_ImagickDraw_polygon_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/186_ImagickDraw_polygon_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/186_ImagickDraw_polygon_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/186_ImagickDraw_polygon_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,44 @@ +--TEST-- +Test ImagickDraw, polygon +--SKIPIF-- + +--FILE-- +setStrokeOpacity(1); + $draw->setStrokeColor($strokeColor); + $draw->setStrokeWidth(4); + + $draw->setFillColor($fillColor); + + $points = array( + array('x' => 40 * 5, 'y' => 10 * 5), + array('x' => 20 * 5, 'y' => 20 * 5), + array('x' => 70 * 5, 'y' => 50 * 5), + array('x' => 60 * 5, 'y' => 15 * 5), + ); + + $draw->polygon($points); + + $image = new \Imagick(); + $image->newImage(500, 300, $backgroundColor); + $image->setImageFormat("png"); + $image->drawImage($draw); + + $bytes = $image->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +polygon($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/187_ImagickDraw_push_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/187_ImagickDraw_push_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/187_ImagickDraw_push_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/187_ImagickDraw_push_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,41 @@ +--TEST-- +Test ImagickDraw, push +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillModifiedColor); + $draw->setStrokeWidth(2); + $draw->setFontSize(72); + $draw->push(); + $draw->translate(50, 50); + $draw->rectangle(200, 200, 300, 300); + $draw->pop(); + $draw->setFillColor($fillColor); + $draw->rectangle(200, 200, 300, 300); + + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +push($strokeColor, $fillColor, $backgroundColor, $fillModifiedColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/188_ImagickDraw_pushPattern_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/188_ImagickDraw_pushPattern_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/188_ImagickDraw_pushPattern_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/188_ImagickDraw_pushPattern_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,59 @@ +--TEST-- +Test ImagickDraw, pushPattern +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeWidth(1); + $draw->setStrokeOpacity(1); + $draw->setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + + $draw->setStrokeWidth(1); + + $draw->pushPattern("MyFirstPattern", 0, 0, 50, 50); + for ($x = 0; $x < 50; $x += 10) { + for ($y = 0; $y < 50; $y += 5) { + $positionX = $x + (($y / 5) % 5); + $draw->rectangle($positionX, $y, $positionX + 5, $y + 5); + } + } + $draw->popPattern(); + + $draw->setFillOpacity(0); + $draw->rectangle(100, 100, 400, 400); + $draw->setFillOpacity(1); + + $draw->setFillOpacity(1); + + $draw->push(); + $draw->setFillPatternURL('#MyFirstPattern'); + $draw->setFillColor('yellow'); + $draw->rectangle(100, 100, 400, 400); + $draw->pop(); + + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +pushPattern($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/189_ImagickDraw_setClipPath_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/189_ImagickDraw_setClipPath_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/189_ImagickDraw_setClipPath_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/189_ImagickDraw_setClipPath_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,48 @@ +--TEST-- +Test ImagickDraw, setClipPath +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeOpacity(1); + $draw->setStrokeWidth(2); + + $clipPathName = 'testClipPath'; + + $draw->pushClipPath($clipPathName); + $draw->rectangle(0, 0, 250, 250); + $draw->popClipPath(); + $draw->setClipPath($clipPathName); + $draw->rectangle(100, 100, 400, 400); + + $storedPathName = $draw->getClipPath(); + + if (strcmp($storedPathName, $clipPathName) != 0) { + echo "Error retrieving clipPath: $storedPathName != $clipPathName\n"; + } + + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setClipPath($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/190_ImagickDraw_popDefs_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/190_ImagickDraw_popDefs_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/190_ImagickDraw_popDefs_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/190_ImagickDraw_popDefs_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,42 @@ +--TEST-- +Test ImagickDraw, popDefs +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setstrokeOpacity(1); + $draw->setStrokeWidth(2); + $draw->setFontSize(72); + $draw->pushDefs(); + $draw->setStrokeColor('white'); + $draw->rectangle(50, 50, 200, 200); + $draw->popDefs(); + + $draw->rectangle(300, 50, 450, 200); + + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +popDefs($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/191_ImagickDraw_push_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/191_ImagickDraw_push_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/191_ImagickDraw_push_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/191_ImagickDraw_push_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,41 @@ +--TEST-- +Test ImagickDraw, push +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillModifiedColor); + $draw->setStrokeWidth(2); + $draw->setFontSize(72); + $draw->push(); + $draw->translate(50, 50); + $draw->rectangle(200, 200, 300, 300); + $draw->pop(); + $draw->setFillColor($fillColor); + $draw->rectangle(200, 200, 300, 300); + + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +push($strokeColor, $fillColor, $backgroundColor, $fillModifiedColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/192_ImagickDraw_setClipPath_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/192_ImagickDraw_setClipPath_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/192_ImagickDraw_setClipPath_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/192_ImagickDraw_setClipPath_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,42 @@ +--TEST-- +Test ImagickDraw, setClipPath +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeOpacity(1); + $draw->setStrokeWidth(2); + + $clipPathName = 'testClipPath'; + + $draw->pushClipPath($clipPathName); + $draw->rectangle(0, 0, 250, 250); + $draw->popClipPath(); + $draw->setClipPath($clipPathName); + $draw->rectangle(100, 100, 400, 400); + + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setClipPath($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/193_ImagickDraw_pushPattern_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/193_ImagickDraw_pushPattern_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/193_ImagickDraw_pushPattern_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/193_ImagickDraw_pushPattern_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,59 @@ +--TEST-- +Test ImagickDraw, pushPattern +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeWidth(1); + $draw->setStrokeOpacity(1); + $draw->setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + + $draw->setStrokeWidth(1); + + $draw->pushPattern("MyFirstPattern", 0, 0, 50, 50); + for ($x = 0; $x < 50; $x += 10) { + for ($y = 0; $y < 50; $y += 5) { + $positionX = $x + (($y / 5) % 5); + $draw->rectangle($positionX, $y, $positionX + 5, $y + 5); + } + } + $draw->popPattern(); + + $draw->setFillOpacity(0); + $draw->rectangle(100, 100, 400, 400); + $draw->setFillOpacity(1); + + $draw->setFillOpacity(1); + + $draw->push(); + $draw->setFillPatternURL('#MyFirstPattern'); + $draw->setFillColor('yellow'); + $draw->rectangle(100, 100, 400, 400); + $draw->pop(); + + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +pushPattern($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/194_ImagickDraw_rectangle_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/194_ImagickDraw_rectangle_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/194_ImagickDraw_rectangle_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/194_ImagickDraw_rectangle_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,37 @@ +--TEST-- +Test ImagickDraw, rectangle +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeOpacity(1); + $draw->setStrokeWidth(2); + + $draw->rectangle(200, 200, 300, 300); + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +rectangle($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/195_ImagickDraw_rotate_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/195_ImagickDraw_rotate_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/195_ImagickDraw_rotate_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/195_ImagickDraw_rotate_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,36 @@ +--TEST-- +Test ImagickDraw, rotate +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setStrokeOpacity(1); + $draw->setFillColor($fillColor); + $draw->rectangle(200, 200, 300, 300); + $draw->setFillColor($fillModifiedColor); + $draw->rotate(15); + $draw->rectangle(200, 200, 300, 300); + + $image = new \Imagick(); + $image->newImage(500, 500, $backgroundColor); + $image->setImageFormat("png"); + $image->drawImage($draw); + + $bytes = $image->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +rotate($strokeColor, $fillColor, $backgroundColor, $fillModifiedColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/196_ImagickDraw_scale_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/196_ImagickDraw_scale_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/196_ImagickDraw_scale_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/196_ImagickDraw_scale_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,37 @@ +--TEST-- +Test ImagickDraw, scale +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setStrokeWidth(4); + $draw->setFillColor($fillColor); + $draw->rectangle(200, 200, 300, 300); + $draw->setFillColor($fillModifiedColor); + $draw->scale(1.4, 1.4); + $draw->rectangle(200, 200, 300, 300); + + $image = new \Imagick(); + $image->newImage(500, 500, $backgroundColor); + $image->setImageFormat("png"); + $image->drawImage($draw); + + $bytes = $image->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +scale($strokeColor, $fillColor, $backgroundColor, $fillModifiedColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/197_ImagickDraw_roundRectangle_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/197_ImagickDraw_roundRectangle_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/197_ImagickDraw_roundRectangle_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/197_ImagickDraw_roundRectangle_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,43 @@ +--TEST-- +Test ImagickDraw, roundRectangle +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeOpacity(1); + $draw->setStrokeWidth(2); + + $draw->roundRectangle($startX, $startY, $endX, $endY, $roundX, $roundY); + + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +roundRectangle($strokeColor, $fillColor, $backgroundColor, $startX, $startY, $endX, $endY, $roundX, $roundY) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/198_ImagickDraw_setClipPath_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/198_ImagickDraw_setClipPath_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/198_ImagickDraw_setClipPath_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/198_ImagickDraw_setClipPath_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,42 @@ +--TEST-- +Test ImagickDraw, setClipPath +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeOpacity(1); + $draw->setStrokeWidth(2); + + $clipPathName = 'testClipPath'; + + $draw->pushClipPath($clipPathName); + $draw->rectangle(0, 0, 250, 250); + $draw->popClipPath(); + $draw->setClipPath($clipPathName); + $draw->rectangle(100, 100, 400, 400); + + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setClipPath($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/199_ImagickDraw_setClipRule_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/199_ImagickDraw_setClipRule_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/199_ImagickDraw_setClipRule_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/199_ImagickDraw_setClipRule_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,52 @@ +--TEST-- +Test ImagickDraw, setClipRule +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeOpacity(1); + $draw->setStrokeWidth(2); + //\Imagick::FILLRULE_EVENODD + //\Imagick::FILLRULE_NONZERO + + $clipPathName = 'testClipPath'; + $draw->pushClipPath($clipPathName); + $draw->setClipRule(\Imagick::FILLRULE_EVENODD); + + $draw->rectangle(0, 0, 300, 500); + $draw->rectangle(200, 0, 500, 500); + $draw->popClipPath(); + $draw->setClipPath($clipPathName); + $draw->rectangle(200, 200, 300, 300); + + $clipRule = $draw->getClipRule(); + if ($clipRule != \Imagick::FILLRULE_EVENODD) { + echo "Failed to get correct clipRule $clipRule != \Imagick::FILLRULE_EVENODD \n"; + } + + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setClipRule($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/200_ImagickDraw_setClipUnits_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/200_ImagickDraw_setClipUnits_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/200_ImagickDraw_setClipUnits_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/200_ImagickDraw_setClipUnits_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,45 @@ +--TEST-- +Test ImagickDraw, setClipUnits +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeOpacity(1); + $draw->setStrokeWidth(2); + $clipPathName = 'testClipPath'; + $draw->setClipUnits(\Imagick::RESOLUTION_PIXELSPERINCH); + $draw->pushClipPath($clipPathName); + $draw->rectangle(0, 0, 250, 250); + $draw->popClipPath(); + $draw->setClipPath($clipPathName); + + //RESOLUTION_PIXELSPERINCH + //RESOLUTION_PIXELSPERCENTIMETER + + $draw->rectangle(200, 200, 300, 300); + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setClipUnits($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/201_ImagickDraw_setFillAlpha_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/201_ImagickDraw_setFillAlpha_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/201_ImagickDraw_setFillAlpha_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/201_ImagickDraw_setFillAlpha_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,37 @@ +--TEST-- +Test ImagickDraw, setFillAlpha +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeOpacity(1); + $draw->setStrokeWidth(2); + $draw->rectangle(100, 200, 200, 300); + @$draw->setFillAlpha(0.4); + $draw->rectangle(300, 200, 400, 300); + + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setFillAlpha($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/202_ImagickDraw_setFillColor_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/202_ImagickDraw_setFillColor_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/202_ImagickDraw_setFillColor_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/202_ImagickDraw_setFillColor_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,39 @@ +--TEST-- +Test ImagickDraw, setFillColor +--SKIPIF-- + +--FILE-- +setStrokeOpacity(1); + $draw->setStrokeWidth(1.5); + $draw->setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->rectangle(50, 50, 150, 150); + + $draw->setFillColor("rgb(200, 32, 32)"); + $draw->rectangle(200, 50, 300, 150); + + $image = new \Imagick(); + $image->newImage(500, 500, $backgroundColor); + $image->setImageFormat("png"); + + $image->drawImage($draw); + + $bytes = $image->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setFillColor($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/203_ImagickDraw_setFillRule_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/203_ImagickDraw_setFillRule_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/203_ImagickDraw_setFillRule_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/203_ImagickDraw_setFillRule_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,69 @@ +--TEST-- +Test ImagickDraw, setFillRule +--SKIPIF-- + +--FILE-- +setStrokeWidth(1); + $draw->setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + + $fillRules = array(\Imagick::FILLRULE_NONZERO, \Imagick::FILLRULE_EVENODD); + + $points = 11; + $size = 150; + + $draw->translate(175, 160); + + for ($x = 0; $x < 2; $x++) { + $draw->setFillRule($fillRules[$x]); + $draw->pathStart(); + for ($n = 0; $n < $points * 2; $n++) { + + if ($n >= $points) { + $angle = fmod($n * 360 * 4 / $points, 360) * pi() / 180; + } + else { + $angle = fmod($n * 360 * 3 / $points, 360) * pi() / 180; + } + + $positionX = $size * sin($angle); + $positionY = $size * cos($angle); + + if ($n == 0) { + $draw->pathMoveToAbsolute($positionX, $positionY); + } + else { + $draw->pathLineToAbsolute($positionX, $positionY); + } + } + + $draw->pathClose(); + $draw->pathFinish(); + + $draw->translate(325, 0); + } + + $image = new \Imagick(); + $image->newImage(700, 320, $backgroundColor); + $image->setImageFormat("png"); + $image->drawImage($draw); + + $bytes = $image->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setFillRule($fillColor, $strokeColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/204_ImagickDraw_setFillOpacity_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/204_ImagickDraw_setFillOpacity_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/204_ImagickDraw_setFillOpacity_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/204_ImagickDraw_setFillOpacity_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,39 @@ +--TEST-- +Test ImagickDraw, setFillOpacity +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeOpacity(1); + $draw->setStrokeWidth(2); + + $draw->rectangle(100, 200, 200, 300); + + $draw->setFillOpacity(0.4); + $draw->rectangle(300, 200, 400, 300); + + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setFillOpacity($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/206_ImagickDraw_setFontSize_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/206_ImagickDraw_setFontSize_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/206_ImagickDraw_setFontSize_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/206_ImagickDraw_setFontSize_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,44 @@ +--TEST-- +Test ImagickDraw, setFontSize +--SKIPIF-- + +--FILE-- +setStrokeOpacity(1); + $draw->setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeWidth(2); + + $sizes = array(24, 36, 48, 60, 72); + + foreach ($sizes as $size) { + $draw->setFontSize($size); + $draw->annotation(50, ($size * $size / 16), "Lorem Ipsum!"); + } + + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setFontSize($fillColor, $strokeColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/207_ImagickDraw_setFontFamily_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/207_ImagickDraw_setFontFamily_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/207_ImagickDraw_setFontFamily_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/207_ImagickDraw_setFontFamily_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,55 @@ +--TEST-- +Test ImagickDraw, setFontFamily +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + //TODO - actually use setFontFamily + $draw->setStrokeWidth(2); + + $draw->setFontSize(24); + $draw->annotation(50, 50, "Lorem Ipsum!"); + + $draw->setFontSize(36); + $draw->annotation(50, 100, "Lorem Ipsum!"); + + $draw->setFontSize(48); + $draw->annotation(50, 150, "Lorem Ipsum!"); + + $draw->setFontSize(60); + $draw->annotation(50, 200, "Lorem Ipsum!"); + + $draw->setFontSize(72); + $draw->annotation(50, 250, "Lorem Ipsum!"); + + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setFontFamily($fillColor, $strokeColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/208_ImagickDraw_setFontStretch_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/208_ImagickDraw_setFontStretch_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/208_ImagickDraw_setFontStretch_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/208_ImagickDraw_setFontStretch_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,46 @@ +--TEST-- +Test ImagickDraw, setFontStretch +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeWidth(2); + $draw->setFontSize(36); + + $fontStretchTypes = array(\Imagick::STRETCH_ULTRACONDENSED, \Imagick::STRETCH_CONDENSED, \Imagick::STRETCH_SEMICONDENSED, \Imagick::STRETCH_SEMIEXPANDED, \Imagick::STRETCH_EXPANDED, \Imagick::STRETCH_EXTRAEXPANDED, \Imagick::STRETCH_ULTRAEXPANDED, \Imagick::STRETCH_ANY); + + $offset = 0; + foreach ($fontStretchTypes as $fontStretch) { + $draw->setFontStretch($fontStretch); + $draw->annotation(50, 75 + $offset, "Lorem Ipsum!"); + $offset += 50; + } + + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setFontStretch($fillColor, $strokeColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/209_ImagickDraw_setFontWeight_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/209_ImagickDraw_setFontWeight_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/209_ImagickDraw_setFontWeight_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/209_ImagickDraw_setFontWeight_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,51 @@ +--TEST-- +Test ImagickDraw, setFontWeight +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + + $draw->setStrokeWidth(1); + + $draw->setFontSize(36); + + $draw->setFontWeight(100); + $draw->annotation(50, 50, "Lorem Ipsum!"); + + $draw->setFontWeight(200); + $draw->annotation(50, 100, "Lorem Ipsum!"); + + $draw->setFontWeight(400); + $draw->annotation(50, 150, "Lorem Ipsum!"); + + $draw->setFontWeight(800); + $draw->annotation(50, 200, "Lorem Ipsum!"); + + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setFontWeight($fillColor, $strokeColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/210_ImagickDraw_setFontStyle_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/210_ImagickDraw_setFontStyle_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/210_ImagickDraw_setFontStyle_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/210_ImagickDraw_setFontStyle_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,43 @@ +--TEST-- +Test ImagickDraw, setFontStyle +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeWidth(1); + $draw->setFontSize(36); + $draw->setFontStyle(\Imagick::STYLE_NORMAL); + $draw->annotation(50, 50, "Lorem Ipsum!"); + + $draw->setFontStyle(\Imagick::STYLE_ITALIC); + $draw->annotation(50, 100, "Lorem Ipsum!"); + + $draw->setFontStyle(\Imagick::STYLE_OBLIQUE); + $draw->annotation(50, 150, "Lorem Ipsum!"); + + $imagick = new \Imagick(); + $imagick->newImage(350, 300, $backgroundColor); + $imagick->setImageFormat("png"); + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setFontStyle($fillColor, $strokeColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/211_ImagickDraw_setStrokeAntialias_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/211_ImagickDraw_setStrokeAntialias_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/211_ImagickDraw_setStrokeAntialias_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/211_ImagickDraw_setStrokeAntialias_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,42 @@ +--TEST-- +Test ImagickDraw, setStrokeAntialias +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeWidth(1); + $draw->setStrokeAntialias(false); + $draw->line(100, 100, 400, 105); + + $draw->line(100, 140, 400, 185); + + $draw->setStrokeAntialias(true); + $draw->line(100, 110, 400, 115); + $draw->line(100, 150, 400, 195); + + $image = new \Imagick(); + $image->newImage(500, 250, $backgroundColor); + $image->setImageFormat("png"); + + $image->drawImage($draw); + + $bytes = $image->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setStrokeAntialias($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/212_ImagickDraw_setGravity_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/212_ImagickDraw_setGravity_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/212_ImagickDraw_setGravity_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/212_ImagickDraw_setGravity_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,44 @@ +--TEST-- +Test ImagickDraw, setGravity +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeWidth(1); + $draw->setFontSize(24); + + $gravitySettings = array(\Imagick::GRAVITY_NORTHWEST => 'NorthWest', \Imagick::GRAVITY_NORTH => 'North', \Imagick::GRAVITY_NORTHEAST => 'NorthEast', \Imagick::GRAVITY_WEST => 'West', \Imagick::GRAVITY_CENTER => 'Centre', \Imagick::GRAVITY_SOUTHWEST => 'SouthWest', \Imagick::GRAVITY_SOUTH => 'South', \Imagick::GRAVITY_SOUTHEAST => 'SouthEast', \Imagick::GRAVITY_EAST => 'East'); + + + foreach ($gravitySettings as $type => $description) { + $draw->setGravity($type); + $draw->annotation(50, 50, '"' . $description . '"'); + } + + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setGravity($fillColor, $strokeColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/213_ImagickDraw_setStrokeAlpha_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/213_ImagickDraw_setStrokeAlpha_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/213_ImagickDraw_setStrokeAlpha_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/213_ImagickDraw_setStrokeAlpha_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,39 @@ +--TEST-- +Test ImagickDraw, setStrokeAlpha +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeWidth(4); + $draw->line(100, 100, 400, 145); + $draw->rectangle(100, 200, 225, 350); + $draw->setStrokeOpacity(0.1); + $draw->line(100, 120, 400, 165); + $draw->rectangle(275, 200, 400, 350); + + $image = new \Imagick(); + $image->newImage(500, 400, $backgroundColor); + $image->setImageFormat("png"); + + $image->drawImage($draw); + + $bytes = $image->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setStrokeAlpha($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/214_ImagickDraw_setStrokeDashOffset_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/214_ImagickDraw_setStrokeDashOffset_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/214_ImagickDraw_setStrokeDashOffset_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/214_ImagickDraw_setStrokeDashOffset_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,46 @@ +--TEST-- +Test ImagickDraw, setStrokeDashOffset +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeWidth(4); + $draw->setStrokeDashArray(array(20, 20)); + $draw->setStrokeDashOffset(0); + $draw->rectangle(100, 50, 225, 175); + + //Start the dash effect halfway through the solid portion + $draw->setStrokeDashOffset(10); + $draw->rectangle(275, 50, 400, 175); + + //Start the dash effect on the space portion + $draw->setStrokeDashOffset(20); + $draw->rectangle(100, 200, 225, 350); + $draw->setStrokeDashOffset(5); + $draw->rectangle(275, 200, 400, 350); + + $image = new \Imagick(); + $image->newImage(500, 400, $backgroundColor); + $image->setImageFormat("png"); + $image->drawImage($draw); + + $bytes = $image->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setStrokeDashOffset($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/215_ImagickDraw_setStrokeColor_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/215_ImagickDraw_setStrokeColor_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/215_ImagickDraw_setStrokeColor_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/215_ImagickDraw_setStrokeColor_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,42 @@ +--TEST-- +Test ImagickDraw, setStrokeColor +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + + $draw->setStrokeWidth(5); + + $draw->line(100, 100, 400, 145); + $draw->rectangle(100, 200, 225, 350); + + $draw->setStrokeOpacity(0.1); + $draw->line(100, 120, 400, 165); + $draw->rectangle(275, 200, 400, 350); + + $image = new \Imagick(); + $image->newImage(500, 400, $backgroundColor); + $image->setImageFormat("png"); + + $image->drawImage($draw); + + $bytes = $image->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setStrokeColor($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/216_ImagickDraw_setStrokeDashArray_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/216_ImagickDraw_setStrokeDashArray_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/216_ImagickDraw_setStrokeDashArray_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/216_ImagickDraw_setStrokeDashArray_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,46 @@ +--TEST-- +Test ImagickDraw, setStrokeDashArray +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeWidth(4); + + $draw->setStrokeDashArray(array(10, 10)); + $draw->rectangle(100, 50, 225, 175); + + $draw->setStrokeDashArray(array(20, 5, 20, 5, 5, 5,)); + $draw->rectangle(275, 50, 400, 175); + + $draw->setStrokeDashArray(array(20, 5, 20, 5, 5)); + $draw->rectangle(100, 200, 225, 350); + + $draw->setStrokeDashArray(array(1, 1, 1, 1, 2, 2, 3, 3, 5, 5, 8, 8, 13, 13, 21, 21, 34, 34, 55, 55, 89, 89, 144, 144, 233, 233, 377, 377, 610, 610, 987, 987, 1597, 1597, 2584, 2584, 4181, 4181,)); + + $draw->rectangle(275, 200, 400, 350); + + $image = new \Imagick(); + $image->newImage(500, 400, $backgroundColor); + $image->setImageFormat("png"); + $image->drawImage($draw); + + $bytes = $image->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setStrokeDashArray($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/217_ImagickDraw_setStrokeMiterLimit_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/217_ImagickDraw_setStrokeMiterLimit_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/217_ImagickDraw_setStrokeMiterLimit_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/217_ImagickDraw_setStrokeMiterLimit_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,56 @@ +--TEST-- +Test ImagickDraw, setStrokeMiterLimit +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setStrokeOpacity(0.6); + $draw->setFillColor($fillColor); + $draw->setStrokeWidth(10); + + $yOffset = 100; + + $draw->setStrokeLineJoin(\Imagick::LINEJOIN_MITER); + + for ($y = 0; $y < 3; $y++) { + + $draw->setStrokeMiterLimit(40 * $y); + + $points = array( + array('x' => 22 * 3, 'y' => 15 * 4 + $y * $yOffset), + array('x' => 20 * 3, 'y' => 20 * 4 + $y * $yOffset), + array('x' => 70 * 5, 'y' => 45 * 4 + $y * $yOffset), + ); + + $draw->polygon($points); + } + + $image = new \Imagick(); + $image->newImage(500, 500, $backgroundColor); + $image->setImageFormat("png"); + $image->drawImage($draw); + + $image->setImageType(\Imagick::IMGTYPE_PALETTE); + //TODO - this should either be everywhere or nowhere + $image->setImageCompressionQuality(100); + $image->stripImage(); + + $bytes = $image->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setStrokeMiterLimit($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/218_ImagickDraw_setStrokeLineCap_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/218_ImagickDraw_setStrokeLineCap_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/218_ImagickDraw_setStrokeLineCap_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/218_ImagickDraw_setStrokeLineCap_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,42 @@ +--TEST-- +Test ImagickDraw, setStrokeLineCap +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeWidth(25); + + $lineTypes = array(\Imagick::LINECAP_BUTT, \Imagick::LINECAP_ROUND, \Imagick::LINECAP_SQUARE,); + + $offset = 0; + + foreach ($lineTypes as $lineType) { + $draw->setStrokeLineCap($lineType); + $draw->line(50 + $offset, 50, 50 + $offset, 250); + $offset += 50; + } + + $imagick = new \Imagick(); + $imagick->newImage(300, 300, $backgroundColor); + $imagick->setImageFormat("png"); + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setStrokeLineCap($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/219_ImagickDraw_setStrokeLineJoin_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/219_ImagickDraw_setStrokeLineJoin_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/219_ImagickDraw_setStrokeLineJoin_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/219_ImagickDraw_setStrokeLineJoin_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,51 @@ +--TEST-- +Test ImagickDraw, setStrokeLineJoin +--SKIPIF-- + +--FILE-- +setStrokeWidth(1); + $draw->setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + + $draw->setStrokeWidth(20); + + $offset = 220; + + $lineJoinStyle = array(\Imagick::LINEJOIN_MITER, \Imagick::LINEJOIN_ROUND, \Imagick::LINEJOIN_BEVEL,); + + for ($x = 0; $x < count($lineJoinStyle); $x++) { + $draw->setStrokeLineJoin($lineJoinStyle[$x]); + $points = array( + array('x' => 40 * 5, 'y' => 10 * 5 + $x * $offset), + array('x' => 20 * 5, 'y' => 20 * 5 + $x * $offset), + array('x' => 70 * 5, 'y' => 50 * 5 + $x * $offset), + array('x' => 40 * 5, 'y' => 10 * 5 + $x * $offset), + ); + + $draw->polyline($points); + } + + $image = new \Imagick(); + $image->newImage(500, 700, $backgroundColor); + $image->setImageFormat("png"); + + $image->drawImage($draw); + + $bytes = $image->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setStrokeLineJoin($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/220_ImagickDraw_setStrokeOpacity_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/220_ImagickDraw_setStrokeOpacity_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/220_ImagickDraw_setStrokeOpacity_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/220_ImagickDraw_setStrokeOpacity_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,42 @@ +--TEST-- +Test ImagickDraw, setStrokeOpacity +--SKIPIF-- + +--FILE-- +setStrokeWidth(1); + $draw->setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeWidth(10); + $draw->setStrokeOpacity(1); + $draw->line(100, 80, 400, 125); + $draw->rectangle(25, 200, 150, 350); + $draw->setStrokeOpacity(0.5); + $draw->line(100, 100, 400, 145); + $draw->rectangle(200, 200, 325, 350); + $draw->setStrokeOpacity(0.2); + $draw->line(100, 120, 400, 165); + $draw->rectangle(375, 200, 500, 350); + + $image = new \Imagick(); + $image->newImage(550, 400, $backgroundColor); + $image->setImageFormat("png"); + $image->drawImage($draw); + + $bytes = $image->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setStrokeOpacity($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/221_ImagickDraw_setStrokeWidth_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/221_ImagickDraw_setStrokeWidth_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/221_ImagickDraw_setStrokeWidth_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/221_ImagickDraw_setStrokeWidth_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,38 @@ +--TEST-- +Test ImagickDraw, setStrokeWidth +--SKIPIF-- + +--FILE-- +setStrokeWidth(1); + $draw->setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->line(100, 100, 400, 145); + $draw->rectangle(100, 200, 225, 350); + $draw->setStrokeWidth(5); + $draw->line(100, 120, 400, 165); + $draw->rectangle(275, 200, 400, 350); + + $image = new \Imagick(); + $image->newImage(500, 400, $backgroundColor); + $image->setImageFormat("png"); + $image->drawImage($draw); + + $bytes = $image->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setStrokeWidth($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/222_ImagickDraw_setTextAlignment_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/222_ImagickDraw_setTextAlignment_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/222_ImagickDraw_setTextAlignment_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/222_ImagickDraw_setTextAlignment_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,43 @@ +--TEST-- +Test ImagickDraw, setTextAlignment +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeWidth(1); + $draw->setFontSize(36); + + $draw->setTextAlignment(\Imagick::ALIGN_LEFT); + $draw->annotation(250, 75, "Lorem Ipsum!"); + $draw->setTextAlignment(\Imagick::ALIGN_CENTER); + $draw->annotation(250, 150, "Lorem Ipsum!"); + $draw->setTextAlignment(\Imagick::ALIGN_RIGHT); + $draw->annotation(250, 225, "Lorem Ipsum!"); + $draw->line(250, 0, 250, 500); + + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setTextAlignment($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/223_ImagickDraw_setTextAntialias_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/223_ImagickDraw_setTextAntialias_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/223_ImagickDraw_setTextAntialias_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/223_ImagickDraw_setTextAntialias_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,44 @@ +--TEST-- +Test ImagickDraw, setTextAntialias +--SKIPIF-- + +--FILE-- +setStrokeColor('none'); + $draw->setFillColor($fillColor); + $draw->setStrokeWidth(1); + $draw->setFontSize(32); + $draw->setTextAntialias(false); + $draw->annotation(5, 30, "Lorem Ipsum!"); + $draw->setTextAntialias(true); + $draw->annotation(5, 65, "Lorem Ipsum!"); + + $imagick = new \Imagick(); + $imagick->newImage(220, 80, $backgroundColor); + $imagick->setImageFormat("png"); + $imagick->drawImage($draw); + + //Scale the image so that people can see the aliasing. + $imagick->scaleImage(220 * 6, 80 * 6); + $imagick->cropImage(640, 480, 0, 0); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setTextAntialias($fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/224_ImagickDraw_setTextUnderColor_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/224_ImagickDraw_setTextUnderColor_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/224_ImagickDraw_setTextUnderColor_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/224_ImagickDraw_setTextUnderColor_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,41 @@ +--TEST-- +Test ImagickDraw, setTextUnderColor +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeWidth(2); + $draw->setFontSize(72); + $draw->annotation(50, 75, "Lorem Ipsum!"); + $draw->setTextUnderColor($textUnderColor); + $draw->annotation(50, 175, "Lorem Ipsum!"); + + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setTextUnderColor($strokeColor, $fillColor, $backgroundColor, $textUnderColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/225_ImagickDraw_setTextDecoration_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/225_ImagickDraw_setTextDecoration_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/225_ImagickDraw_setTextDecoration_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/225_ImagickDraw_setTextDecoration_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,40 @@ +--TEST-- +Test ImagickDraw, setTextDecoration +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeWidth(2); + $draw->setFontSize(72); + $draw->setTextDecoration($textDecoration); + $draw->annotation(50, 75, "Lorem Ipsum!"); + + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setTextDecoration($strokeColor, $fillColor, $backgroundColor, $textDecoration) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/226_ImagickDraw_setViewBox_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/226_ImagickDraw_setViewBox_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/226_ImagickDraw_setViewBox_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/226_ImagickDraw_setViewBox_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,48 @@ +--TEST-- +Test ImagickDraw, setViewBox +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeWidth(2); + $draw->setFontSize(72); + + /* + + Sets the overall canvas size to be recorded with the drawing vector data. Usually this will be specified using the same size as the canvas image. When the vector data is saved to SVG or MVG formats, the viewbox is use to specify the size of the canvas image that a viewer will render the vector data on. + + */ + + $draw->circle(250, 250, 250, 0); + $draw->setviewbox(0, 0, 200, 200); + $draw->circle(125, 250, 250, 250); + $draw->translate(250, 125); + $draw->circle(0, 0, 125, 0); + + + $imagick = new \Imagick(); + $imagick->newImage(500, 500, $backgroundColor); + $imagick->setImageFormat("png"); + + $imagick->drawImage($draw); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setViewBox($strokeColor, $fillColor, $backgroundColor) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/227_ImagickDraw_skewY_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/227_ImagickDraw_skewY_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/227_ImagickDraw_skewY_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/227_ImagickDraw_skewY_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,45 @@ +--TEST-- +Test ImagickDraw, skewY +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setStrokeWidth(2); + $draw->setFillColor($fillColor); + $draw->rectangle($startX, $startY, $endX, $endY); + $draw->setFillColor($fillModifiedColor); + $draw->skewY($skew); + $draw->rectangle($startX, $startY, $endX, $endY); + + $image = new \Imagick(); + $image->newImage(500, 500, $backgroundColor); + $image->setImageFormat("png"); + $image->drawImage($draw); + + $bytes = $image->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +skewY($strokeColor, $fillColor, $backgroundColor, $fillModifiedColor, + $startX, $startY, $endX, $endY, $skew); +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/228_ImagickDraw_skewX_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/228_ImagickDraw_skewX_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/228_ImagickDraw_skewX_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/228_ImagickDraw_skewX_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,46 @@ +--TEST-- +Test ImagickDraw, skewX +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setStrokeWidth(2); + $draw->setFillColor($fillColor); + $draw->rectangle($startX, $startY, $endX, $endY); + $draw->setFillColor($fillModifiedColor); + $draw->skewX($skew); + $draw->rectangle($startX, $startY, $endX, $endY); + + $image = new \Imagick(); + $image->newImage(500, 500, $backgroundColor); + $image->setImageFormat("png"); + + $image->drawImage($draw); + + $bytes = $image->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +skewX($strokeColor, $fillColor, $backgroundColor, $fillModifiedColor, + $startX, $startY, $endX, $endY, $skew); +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/229_Tutorial_fxAnalyzeImage_case1.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/229_Tutorial_fxAnalyzeImage_case1.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/229_Tutorial_fxAnalyzeImage_case1.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/229_Tutorial_fxAnalyzeImage_case1.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,87 @@ +--TEST-- +Test Tutorial, fxAnalyzeImage +--SKIPIF-- + +--FILE-- +getImageWidth(); + $sampleHeight = 20; + $graphHeight = 128; + $border = 2; + + $imageIterator = new \ImagickPixelIterator($imagick); + + $reds = array(); + + foreach ($imageIterator as $pixels) { /* Loop trough pixel rows */ + foreach ($pixels as $pixel) { /* Loop through the pixels in the row (columns) */ + /** @var $pixel \ImagickPixel */ + $color = $pixel->getColor(); + $reds[] = $color['r']; + } + $imageIterator->syncIterator(); /* Sync the iterator, this is important to do on each iteration */ + } + + $draw = new \ImagickDraw(); + + $strokeColor = new \ImagickPixel('red'); + $fillColor = new \ImagickPixel('none'); + $draw->setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->setStrokeWidth(1); + $draw->setFontSize(72); + $draw->setStrokeAntiAlias(true); + + $x = 0; + $points = array(); + + foreach ($reds as $red) { + $pos = $graphHeight - ($red * $graphHeight / 256); + $points[] = array('x' => $x, 'y' => $pos); + $x += 1; + } + + $draw->polyline($points); + + $plot = new \Imagick(); + $plot->newImage($graphWidth, $graphHeight, 'white'); + $plot->drawImage($draw); + + $outputImage = new \Imagick(); + $outputImage->newImage($graphWidth, $graphHeight + $sampleHeight, 'white'); + $outputImage->compositeimage($plot, \Imagick::COMPOSITE_ATOP, 0, 0); + + $imagick->resizeimage($imagick->getImageWidth(), $sampleHeight, \Imagick::FILTER_LANCZOS, 1); + + $outputImage->compositeimage($imagick, \Imagick::COMPOSITE_ATOP, 0, $graphHeight); + $outputImage->borderimage('black', $border, $border); + + $outputImage->setImageFormat("png"); + $bytes = $outputImage; + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + + +$arguments = array(5, 1, 0.5); + +$imagick = new \Imagick(); +$imagick->newPseudoImage(200, 200, 'gradient:black-white'); +$imagick->functionImage(\Imagick::FUNCTION_POLYNOMIAL, $arguments); +$imagick->setimageformat('png'); + +fxAnalyzeImage($imagick); + +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/234_Tutorial_edgeExtend_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/234_Tutorial_edgeExtend_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/234_Tutorial_edgeExtend_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/234_Tutorial_edgeExtend_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,57 @@ +--TEST-- +Test Tutorial, edgeExtend +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imagick->setImageVirtualPixelMethod($virtualPixelType); + + $imagick->scaleimage(400, 300, true); + + $imagick->setbackgroundcolor('pink'); + + $desiredWidth = 600; + $originalWidth = $imagick->getImageWidth(); + + //Make the image be the desired width. + $imagick->sampleimage($desiredWidth, $imagick->getImageHeight()); + + //Now scale, rotate, translate (aka affine project) it + //to be how you want + $points = array(//The x scaling factor is 0.5 when the desired width is double + //the source width + ($originalWidth / $desiredWidth), 0, //Don't scale vertically + 0, 1, //Offset the image so that it's in the centre + ($desiredWidth - $originalWidth) / 2, 0); + + $imagick->distortImage(\Imagick::DISTORTION_AFFINEPROJECTION, $points, false); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + +//Fyi it may be easier to think of the affine transform by +//how it works for a rotation: +//$affineRotate = array( +// "sx" => cos($angle), +// "sy" => cos($angle), +// "rx" => sin($angle), +// "ry" => -sin($angle), +// "tx" => 0, +// "ty" => 0, +//); +} + +edgeExtend($virtualPixelType) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/235_ImagickDraw_translate_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/235_ImagickDraw_translate_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/235_ImagickDraw_translate_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/235_ImagickDraw_translate_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,47 @@ +--TEST-- +Test ImagickDraw, translate +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + $draw->rectangle($startX, $startY, $endX, $endY); + + $draw->setFillColor($fillModifiedColor); + $draw->translate($translateX, $translateY); + $draw->rectangle($startX, $startY, $endX, $endY); + + $image = new \Imagick(); + $image->newImage(500, 500, $backgroundColor); + $image->setImageFormat("png"); + + $image->drawImage($draw); + + $bytes = $image->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +translate($strokeColor, $fillColor, $backgroundColor, $fillModifiedColor, + $startX, $startY, $endX, $endY, $translateX, $translateY); +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/236_Imagick_identify_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/236_Imagick_identify_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/236_Imagick_identify_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/236_Imagick_identify_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,33 @@ +--TEST-- +Test Imagick, identifyImage +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); +$imagick->setFormat('png'); +$data = $imagick->identifyimage(); + +if (array_key_exists('geometry', $data)) { + $geometry = $data['geometry']; + if (array_key_exists('width', $geometry) && array_key_exists('height', $geometry)) { + printf( + "Image geometry %dx%d", + $geometry['width'], + $geometry['height'] + ); + exit(0); + } +} + +echo "Failed get geometry from identifyimage:\n"; +var_dump($data); + +?> +--EXPECTF-- +Image geometry 640x480 \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/237_Tutorial_deconstructGif_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/237_Tutorial_deconstructGif_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/237_Tutorial_deconstructGif_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/237_Tutorial_deconstructGif_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,73 @@ +--TEST-- +Test Tutorial, deconstructGif +--SKIPIF-- + +--FILE-- +setFormat("gif"); + + $circleRadius = 20; + $imageFrames = 6; + $imageSize = 200; + + $background = new \Imagick(); + $background->newpseudoimage($imageSize, $imageSize, "canvas:gray"); + + $blackWhite = new \Imagick(); + $blackWhite->newpseudoimage($imageSize, $imageSize, "gradient:black-white"); + + $backgroundPalette = clone $background; + $backgroundPalette->quantizeImage(240, \Imagick::COLORSPACE_RGB, 8, false, false); + + $blackWhitePalette = clone $blackWhite; + $blackWhitePalette->quantizeImage(16, \Imagick::COLORSPACE_RGB, 8, false, false); + + $backgroundPalette->addimage($blackWhitePalette); + + for($count=0 ; $count<$imageFrames ; $count++) { + echo "Frame: ".$count."\n"; + $drawing = new \ImagickDraw(); + $drawing->setFillColor('white'); + $drawing->setStrokeColor('rgba(64, 64, 64, 0.8)'); + $strokeWidth = 4; + $drawing->setStrokeWidth($strokeWidth); + + $distanceToMove = $imageSize + (($circleRadius + $strokeWidth) * 2); + $offset = ($distanceToMove * $count / ($imageFrames -1)) - ($circleRadius + $strokeWidth); + $drawing->translate($offset, ($imageSize / 2) + ($imageSize / 3 * cos(20 * $count / $imageFrames))); + $drawing->circle(0, 0, $circleRadius, 0); + + $frame = clone $background; + $frame->drawimage($drawing); + $frame->clutimage($backgroundPalette); + $frame->setImageDelay(10); + $aniGif->addImage($frame); + } + + if ($deconstruct == true) { + $aniGif = $aniGif->deconstructImages(); + } + + $bytes = $aniGif->getImagesBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +makeSimpleGif($deconstruct) ; +echo "Ok"; +?> +--EXPECTF-- +Frame: 0 +Frame: 1 +Frame: 2 +Frame: 3 +Frame: 4 +Frame: 5 +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/239_Tutorial_gradientReflection_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/239_Tutorial_gradientReflection_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/239_Tutorial_gradientReflection_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/239_Tutorial_gradientReflection_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,50 @@ +--TEST-- +Test Tutorial, gradientReflection +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + + $reflection = clone $im; + + $reflection->flipImage(); + + $reflection->cropImage($im->getImageWidth(), $im->getImageHeight() * 0.75, 0, 0); + + $gradient = new \Imagick(); + $gradient->newPseudoImage( + $reflection->getImageWidth(), + $reflection->getImageHeight(), + //Putting spaces in the rgba string is bad + 'gradient:rgba(255,0,255,0.6)-rgba(255,255,0,0.99)' + ); + + $reflection->compositeimage( + $gradient, + \Imagick::COMPOSITE_DSTOUT, + 0, 0 + ); + + $canvas = new \Imagick(); + $canvas->newImage($im->getImageWidth(), $im->getImageHeight() * 1.75, new \ImagickPixel('rgba(255, 255, 255, 0)')); + $canvas->compositeImage($im, \Imagick::COMPOSITE_BLEND, 0, 0); + $canvas->setImageFormat('png'); + $canvas->compositeImage($reflection, \Imagick::COMPOSITE_BLEND, 0, $im->getImageHeight()); + + $canvas->stripImage(); + $canvas->setImageFormat('png'); + header('Content-Type: image/png'); + $bytes = $canvas; + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +gradientReflection() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/240_Tutorial_imagickCompositeGen_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/240_Tutorial_imagickCompositeGen_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/240_Tutorial_imagickCompositeGen_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/240_Tutorial_imagickCompositeGen_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,155 @@ +--TEST-- +Test Tutorial, imagickCompositeGen +--SKIPIF-- + +--FILE-- +newPseudoImage($height, $overlap, 'gradient:black-white'); + $quantum = $imagick->getQuantum(); + $imagick->sigmoidalContrastImage(true, $contrast, $midpoint * $quantum); + + return $imagick; +} + + +function mergeImages($outputSize, $overlap, $contrast = 10, $blendMidpoint = 0.5, $horizontal = true) { + + $images = array(); + $newImageWidth = 0; + $newImageHeight = 0; + + if ($horizontal == true) { + $resizeWidth = 0; + $resizeHeight = $outputSize; + } + else { + $resizeWidth = $outputSize; + $resizeHeight = 0; + } + + $blendWidth = 0; + + $srcImages = array(1, 2, 3); + + foreach ($srcImages as $srcImage) { + $nextImage = new \Imagick(); + $nextImage->newPseudoImage(640, 480, "magick:logo"); + + + $nextImage->resizeImage($resizeWidth, $resizeHeight, \Imagick::FILTER_LANCZOS, 0.5); + + if ($horizontal == true) { + $newImageWidth += $nextImage->getImageWidth(); + $blendWidth = $nextImage->getImageHeight(); + } + else { + //$newImageWidth = $nextImage->getImageWidth(); + $blendWidth = $nextImage->getImageWidth(); + $newImageHeight += $nextImage->getImageHeight(); + } + + $images[] = $nextImage; + } + + if ($horizontal == true) { + $newImageWidth -= $overlap * (count($srcImages) - 1); + $newImageHeight = $outputSize; + } + else { + $newImageWidth = $outputSize; + $newImageHeight -= $overlap * (count($srcImages) - 1); + } + + if ($blendWidth == 0) { + throw new \Exception("Failed to read source images"); + } + + $fadeLeftSide = generateBlendImage($blendWidth, $overlap, $contrast, $blendMidpoint); + + if ($horizontal == true) { + //We are placing the images horizontally. + $fadeLeftSide->rotateImage('black', -90); + } + + //Fade out the left part - need to negate the mask to + //make math correct + $fadeRightSide = clone $fadeLeftSide; + $fadeRightSide->negateimage(false); + + //Create a new canvas to render everything in to. + $canvas = new \Imagick(); + $canvas->newImage($newImageWidth, $newImageHeight, new \ImagickPixel('black')); + + $count = 0; + + $imagePositionX = 0; + $imagePositionY = 0; + + /** @var $image \Imagick */ + foreach ($images as $image) { + $finalBlending = new \Imagick(); + $finalBlending->newImage($image->getImageWidth(), $image->getImageHeight(), 'white'); + + if ($count != 0) { + $finalBlending->compositeImage($fadeLeftSide, \Imagick::COMPOSITE_ATOP, 0, 0); + } + + $offsetX = 0; + $offsetY = 0; + + if ($horizontal == true) { + $offsetX = $image->getImageWidth() - $overlap; + } + else { + $offsetY = $image->getImageHeight() - $overlap; + } + + if ($count != count($images) - 1) { + $finalBlending->compositeImage($fadeRightSide, \Imagick::COMPOSITE_ATOP, $offsetX, $offsetY); + } + + $image->compositeImage($finalBlending, \Imagick::COMPOSITE_COPYOPACITY, 0, 0); + $canvas->compositeimage($image, \Imagick::COMPOSITE_BLEND, $imagePositionX, $imagePositionY); + + if ($horizontal == true) { + $imagePositionX = $imagePositionX + $image->getImageWidth() - $overlap; + } + else { + $imagePositionY = $imagePositionY + $image->getImageHeight() - $overlap; + } + $count++; + } + + return $canvas; +} + +function imagickCompositeGen($contrast = 10, $blendMidpoint = 0.5) { + + $size = 160; + + //Load the images + $output = mergeImages( + $size, + 0.2 * $size, //overlap + $contrast, + $blendMidpoint, + true); + + //$output = generateBlendImage(200, 200, 5, 0.5); + $output->setImageFormat('png'); + + $bytes = $output->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +imagickCompositeGen($contrast = 10, $blendMidpoint = 0.5) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/241_Tutorial_psychedelicFont_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/241_Tutorial_psychedelicFont_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/241_Tutorial_psychedelicFont_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/241_Tutorial_psychedelicFont_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,46 @@ +--TEST-- +Test Tutorial, psychedelicFont +--SKIPIF-- + +--FILE-- +setStrokeOpacity(1); + $draw->setFillColor('black'); + + $draw->setfontsize(150); + + for ($strokeWidth = 25; $strokeWidth > 0; $strokeWidth--) { + $hue = intval(170 + $strokeWidth * 360 / 25); + $draw->setStrokeColor("hsl($hue, 255, 128)"); + $draw->setStrokeWidth($strokeWidth * 3); + $draw->annotation(60, 165, $name); + } + + //Create an image object which the draw commands can be rendered into + $imagick = new \Imagick(); + $imagick->newImage(650, 230, "#eee"); + $imagick->setImageFormat("png"); + + //Render the draw commands in the ImagickDraw object + //into the image. + $imagick->drawImage($draw); + + //Send the image to the browser + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +psychedelicFont() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/242_Tutorial_levelizeImage_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/242_Tutorial_levelizeImage_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/242_Tutorial_levelizeImage_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/242_Tutorial_levelizeImage_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,36 @@ +--TEST-- +Test Tutorial, levelizeImage +--SKIPIF-- + +--FILE-- +newPseudoimage(300, 300, 'gradient:black-white'); + $maxQuantum = $imagick->getQuantum(); + $imagick->evaluateimage(\Imagick::EVALUATE_POW, 1 / $gamma); + + //Adjust the scale from black to white to the new 'distance' between black and white + $imagick->evaluateimage(\Imagick::EVALUATE_MULTIPLY, ($whitePoint - $blackPoint) / 100 ); + + //Add move the black point to it's new value + $imagick->evaluateimage(\Imagick::EVALUATE_ADD, ($blackPoint / 100) * $maxQuantum); + $imagick->setFormat("png"); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +levelizeImage($blackPoint, $gamma, $whitePoint) ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/243_Tutorial_svgExample_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/243_Tutorial_svgExample_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/243_Tutorial_svgExample_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/243_Tutorial_svgExample_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,58 @@ +--TEST-- +Test Tutorial, svgExample +--SKIPIF-- + +--FILE-- + + + + + + + + + + +END; + + + + $svg = ' + + + + + + + + + + + + '; + + + + + $image = new \Imagick(); + + $image->readImageBlob($svg); + $image->setImageFormat("jpg"); + $bytes = $image; + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +svgExample() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/244_Tutorial_psychedelicFontGif_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/244_Tutorial_psychedelicFontGif_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/244_Tutorial_psychedelicFontGif_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/244_Tutorial_psychedelicFontGif_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,69 @@ +--TEST-- +Test Tutorial, psychedelicFontGif +--SKIPIF-- + +--FILE-- +setFormat("gif"); + + $maxFrames = 11; + $scale = 0.25; + + for ($frame = 0; $frame < $maxFrames; $frame++) { + + $draw = new \ImagickDraw(); + + $draw->setStrokeOpacity(1); + $draw->setfontsize(150 * $scale); + + for ($strokeWidth = 25; $strokeWidth > 0; $strokeWidth--) { + $hue = intval(fmod(($frame * 360 / $maxFrames) + 170 + $strokeWidth * 360 / 25, 360)); + $color = "hsl($hue, 255, 128)"; + $draw->setStrokeColor($color); + $draw->setFillColor($color); + $draw->setStrokeWidth($strokeWidth * 3 * $scale); + $draw->annotation(60 * $scale, 165 * $scale, $name); + } + + $draw->setStrokeColor('none'); + $draw->setFillColor('black'); + $draw->setStrokeWidth(0); + $draw->annotation(60 * $scale, 165 * $scale, $name); + + //Create an image object which the draw commands can be rendered into + $imagick = new \Imagick(); + $imagick->newImage(650 * $scale, 230 * $scale, "#eee"); + $imagick->setImageFormat("png"); + + //Render the draw commands in the ImagickDraw object + //into the image. + $imagick->drawImage($draw); + + $imagick->setImageDelay(5); + $aniGif->addImage($imagick); + + $imagick->destroy(); + } + + $aniGif->setImageIterations(0); //loop forever + $aniGif->deconstructImages(); + + $bytes = $aniGif->getImagesBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +psychedelicFontGif($name = 'Danack') ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/245_Tutorial_screenEmbed_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/245_Tutorial_screenEmbed_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/245_Tutorial_screenEmbed_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/245_Tutorial_screenEmbed_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,46 @@ +--TEST-- +Test Tutorial, screenEmbed +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + + $overlay = new \Imagick(); + $overlay->newPseudoImage(640, 480, "magick:logo"); + + $overlay->setImageVirtualPixelMethod(\Imagick::VIRTUALPIXELMETHOD_TRANSPARENT); + + $width = $overlay->getImageWidth(); + $height = $overlay->getImageHeight(); + + $offset = 332.9; + + $points = array( + 0, 0, 364 - $offset, 51, + $width, 0, 473.4 - $offset, 23, + 0, $height, 433.5 - $offset, 182, + $width, $height, 523 - $offset, 119.4 + ); + + $overlay->modulateImage(97, 100, 0); + $overlay->distortImage(\Imagick::DISTORTION_PERSPECTIVE, $points, true); + + $imagick->compositeImage($overlay, \Imagick::COMPOSITE_OVER, 364.5 - $offset, 23.5); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +screenEmbed() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/246_antialias_image.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/246_antialias_image.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/246_antialias_image.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/246_antialias_image.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,28 @@ +--TEST-- +Test pseudo formats +--SKIPIF-- + +--FILE-- +newPseudoImage(0, 0, "magick:logo"); +//On by default +var_export($im->getAntiAlias()); +echo PHP_EOL; + +//Turn off +$im->setAntiAlias(false); +var_export($im->getAntiAlias()); +echo PHP_EOL; + +//Turn back on +$im->setAntiAlias(true); +var_export($im->getAntiAlias()); +echo PHP_EOL; + +?> +--EXPECTF-- +true +false +true \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/247_ImagickPixelIterator_construct_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/247_ImagickPixelIterator_construct_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/247_ImagickPixelIterator_construct_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/247_ImagickPixelIterator_construct_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,39 @@ +--TEST-- +Test ImagickPixelIterator, construct +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imageIterator = new \ImagickPixelIterator($imagick); + + /* Loop through pixel rows */ + foreach ($imageIterator as $pixels) { + /* Loop through the pixels in the row (columns) */ + foreach ($pixels as $column => $pixel) { + /** @var $pixel \ImagickPixel */ + if ($column % 2) { + /* Paint every second pixel black*/ + $pixel->setColor("rgba(0, 0, 0, 0)"); + } + } + /* Sync the iterator, this is important to do on each iteration */ + $imageIterator->syncIterator(); + } + + $bytes = $imagick; + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +construct() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/248_ImagickPixelIterator_clear_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/248_ImagickPixelIterator_clear_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/248_ImagickPixelIterator_clear_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/248_ImagickPixelIterator_clear_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,42 @@ +--TEST-- +Test ImagickPixelIterator, clear +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + + $imageIterator = $imagick->getPixelRegionIterator(100, 100, 250, 200); + + /* Loop trough pixel rows */ + foreach ($imageIterator as $pixels) { + /** @var $pixel \ImagickPixel */ + /* Loop through the pixels in the row (columns) */ + foreach ($pixels as $column => $pixel) { + if ($column % 2) { + /* Paint every second pixel black*/ + $pixel->setColor("rgba(0, 0, 0, 0)"); + } + } + /* Sync the iterator, this is important to do on each iteration */ + $imageIterator->syncIterator(); + } + + $imageIterator->clear(); + + $bytes = $imagick; + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +clear() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/249_ImagickPixelIterator_getNextIteratorRow_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/249_ImagickPixelIterator_getNextIteratorRow_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/249_ImagickPixelIterator_getNextIteratorRow_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/249_ImagickPixelIterator_getNextIteratorRow_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,43 @@ +--TEST-- +Test ImagickPixelIterator, getNextIteratorRow +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imageIterator = $imagick->getPixelIterator(); + + $count = 0; + while ($pixels = $imageIterator->getNextIteratorRow()) { + if (($count % 3) == 0) { + /* Loop through the pixels in the row (columns) */ + foreach ($pixels as $column => $pixel) { + /** @var $pixel \ImagickPixel */ + if ($column % 2) { + /* Paint every second pixel black*/ + $pixel->setColor("rgba(0, 0, 0, 0)"); + } + } + /* Sync the iterator, this is important to do on each iteration */ + $imageIterator->syncIterator(); + } + + $count += 1; + } + + $bytes = $imagick; + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +getNextIteratorRow() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/250_ImagickPixelIterator_resetIterator_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/250_ImagickPixelIterator_resetIterator_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/250_ImagickPixelIterator_resetIterator_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/250_ImagickPixelIterator_resetIterator_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,59 @@ +--TEST-- +Test ImagickPixelIterator, resetIterator +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + + $imageIterator = $imagick->getPixelIterator(); + + /* Loop trough pixel rows */ + foreach ($imageIterator as $pixels) { + /* Loop through the pixels in the row (columns) */ + foreach ($pixels as $column => $pixel) { + /** @var $pixel \ImagickPixel */ + if ($column % 2) { + + /* Make every second pixel 25% red*/ + $pixel->setColorValue(\Imagick::COLOR_RED, 64); + } + } + /* Sync the iterator, this is important to do on each iteration */ + $imageIterator->syncIterator(); + } + + $imageIterator->resetiterator(); + + /* Loop trough pixel rows */ + foreach ($imageIterator as $pixels) { + /* Loop through the pixels in the row (columns) */ + foreach ($pixels as $column => $pixel) { + /** @var $pixel \ImagickPixel */ + if ($column % 3) { + $pixel->setColorValue(\Imagick::COLOR_BLUE, 64); /* Make every second pixel a little blue*/ + //$pixel->setColor("rgba(0, 0, 128, 0)"); /* Paint every second pixel black*/ + } + } + $imageIterator->syncIterator(); /* Sync the iterator, this is important to do on each iteration */ + } + + $imageIterator->clear(); + + $bytes = $imagick; + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +resetIterator() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/251_ImagickPixelIterator_setIteratorRow_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/251_ImagickPixelIterator_setIteratorRow_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/251_ImagickPixelIterator_setIteratorRow_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/251_ImagickPixelIterator_setIteratorRow_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,39 @@ +--TEST-- +Test ImagickPixelIterator, setIteratorRow +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imageIterator = $imagick->getPixelRegionIterator(200, 100, 200, 200); + + for ($x = 0; $x < 20; $x++) { + $imageIterator->setIteratorRow($x * 5); + $pixels = $imageIterator->getCurrentIteratorRow(); + /* Loop through the pixels in the row (columns) */ + foreach ($pixels as $pixel) { + /** @var $pixel \ImagickPixel */ + /* Paint every second pixel black*/ + $pixel->setColor("rgba(0, 0, 0, 0)"); + } + + /* Sync the iterator, this is important to do on each iteration */ + $imageIterator->syncIterator(); + } + + $bytes = $imagick; + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +setIteratorRow() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/252_ImagickPixelIterator_construct_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/252_ImagickPixelIterator_construct_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/252_ImagickPixelIterator_construct_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/252_ImagickPixelIterator_construct_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,39 @@ +--TEST-- +Test ImagickPixelIterator, construct +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "magick:logo"); + $imageIterator = new \ImagickPixelIterator($imagick); + + /* Loop through pixel rows */ + foreach ($imageIterator as $pixels) { + /* Loop through the pixels in the row (columns) */ + foreach ($pixels as $column => $pixel) { + /** @var $pixel \ImagickPixel */ + if ($column % 2) { + /* Paint every second pixel black*/ + $pixel->setColor("rgba(0, 0, 0, 0)"); + } + } + /* Sync the iterator, this is important to do on each iteration */ + $imageIterator->syncIterator(); + } + + $bytes = $imagick; + if (strlen($bytes) <= 0) { echo "Failed to generate image.";} +} + +construct() ; +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/253_getHdri.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/253_getHdri.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/253_getHdri.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/253_getHdri.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,27 @@ +--TEST-- +Test ImagickPixelIterator, construct +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/254_getConfigureOptions.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/254_getConfigureOptions.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/254_getConfigureOptions.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/254_getConfigureOptions.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,54 @@ +--TEST-- +Test Imagick::getConfigureOptions +--SKIPIF-- + +--FILE-- + $value) { + $key = strtolower($key); + + if (strpos($key, "c") !== 0) { + echo "key $key does not start with c".PHP_EOL; + } +} + +echo "Ok"; + +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/255_getFeatures.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/255_getFeatures.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/255_getFeatures.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/255_getFeatures.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,25 @@ +--TEST-- +Test Imagick::getfeatures +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/256_Imagick_exportImagePixels_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/256_Imagick_exportImagePixels_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/256_Imagick_exportImagePixels_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/256_Imagick_exportImagePixels_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,60 @@ +--TEST-- +Test Imagick, Imagick::exportImagePixels +--SKIPIF-- + +--FILE-- +newPseudoImage(256, 256, "gradient:black-white"); + +$pixelTypes = array( + Imagick::PIXEL_CHAR => function($v) { return $v / 255; } , + Imagick::PIXEL_DOUBLE => function($v) { return $v; } , + Imagick::PIXEL_FLOAT => function($v) { return $v; } , + Imagick::PIXEL_LONG => function($v) { return $v / 4294967295; }, + Imagick::PIXEL_QUANTUM => function($v) { return $v / Imagick::getQuantum(); } , + Imagick::PIXEL_SHORT => function($v) { return $v / 65535; } , + + // This is not supported as ints close to 64bits are weird in PHP + // Imagick::PIXEL_LONGLONG => function($v) { return $v / (2 << 64 -1 ); } , +); + +$v = Imagick::getVersion(); +if ($v['versionNumber'] < 0x700) { + //This test will probably fail on 32bit platforms. If you see this please + //submit a PR that fixes the problem. + $pixelTypes[Imagick::PIXEL_INTEGER] = function($v) { return $v / 4294967295; }; +} + + + +foreach ($pixelTypes as $pixelType => $scaleFn) { + try { + $pixels = $imagick->exportImagePixels(0, 0, 1, 256, "R", $pixelType); + + for ($i = 0; $i<10 ; $i++) { + $expectedValue = $i / 255; + $scaledActualValue = $scaleFn($pixels[$i]); + + if (abs($expectedValue - $scaledActualValue) > 0.0001) { + echo "pixel type $pixelType has incorrect values. They should be 0/255, 1/255, 2/255... 255/255 or the scaled equivalent\n"; + var_dump($pixels); + break; + } + } + } + catch (\Exception $e) { + echo "Exception caught for pixelType: $pixelType "; + echo $e->getMessage(); + } +} + + +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/257_Imagick_setImageChannelMask_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/257_Imagick_setImageChannelMask_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/257_Imagick_setImageChannelMask_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/257_Imagick_setImageChannelMask_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,32 @@ +--TEST-- +Test Imagick, Imagick::exportImagePixels +--SKIPIF-- + +--FILE-- +newPseudoImage(256, 256, "gradient:black-white"); + +$initialMask = $imagick->setImageChannelMask(\Imagick::CHANNEL_RED); +$imagick->brightnessContrastImage(-20, 20); +$imagick->setImageFormat("png"); +$imagick->writeImage("./maskTest.png"); + +$redMask = $imagick->setImageChannelMask(\Imagick::CHANNEL_DEFAULT); + +if ($initialMask != \Imagick::CHANNEL_DEFAULT) { + echo "initialMask is not equal to \Imagick::CHANNEL_DEFAULT but instead is $initialMask\n"; +} + +if ($redMask != \Imagick::CHANNEL_RED) { + echo "redMask is not equal to \Imagick::CHANNEL_RED but instead is $redMask\n"; +} + +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/258_Imagick_evaluateImages_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/258_Imagick_evaluateImages_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/258_Imagick_evaluateImages_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/258_Imagick_evaluateImages_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,35 @@ +--TEST-- +Test Imagick, Imagick::evaluateImages +--SKIPIF-- + +--FILE-- +newPseudoImage(256, 256, "gradient:black-white"); + +$imagick2 = new \Imagick(); +$imagick2->newPseudoImage(256, 256, "gradient:red-white"); + +$imagick->addImage($imagick2); +$imagick->setImageFormat('png'); + +$imagick->setIteratorIndex(0); + +$evaluated = $imagick->evaluateImages(\Imagick::EVALUATE_MEAN); + +$evaluated->setImageFormat('png'); +// $evaluated->writeImage("./evaluateTest.png"); +$data = $evaluated->getImageBlob(); + +if (strlen($data) < 50) { + echo "Image data seems too short."; +} + +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/259_Imagick_colorPoints_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/259_Imagick_colorPoints_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/259_Imagick_colorPoints_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/259_Imagick_colorPoints_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,68 @@ +--TEST-- +Test Imagick, Imagick::evaluateImages +--SKIPIF-- + +--FILE-- + 0.0000001) { + echo "Unexpected value of $value for check $count\n"; + } + + $count++; +} + + +$imagick = new \Imagick(); +$imagick->newPseudoImage(640, 480, "magick:logo"); + +$imagick->setImageFormat('png'); +$v = Imagick::getVersion(); +if ($v['versionNumber'] < 0x700) { + $imagick->setImageRedPrimary(0.5, 0.5); + $imagick->setImageGreenPrimary(0.5, 0.5); + $imagick->setImageBluePrimary(0.5, 0.5); + $imagick->setImageWhitePoint(0.5, 0.5); + + $color = $imagick->getImageRedPrimary(); + im_check($color['x']);im_check($color['y']); + + $color = $imagick->getImageGreenPrimary(); + im_check($color['x']);im_check($color['y']); + + $color = $imagick->getImageBluePrimary(); + im_check($color['x']);im_check($color['y']); + + $color = $imagick->getImageWhitePoint(); + im_check($color['x']);im_check($color['y']); +} +else { + $imagick->setImageRedPrimary(0.5, 0.5, 0.5); + $imagick->setImageGreenPrimary(0.5, 0.5, 0.5); + $imagick->setImageBluePrimary(0.5, 0.5, 0.5); + $imagick->setImageWhitePoint(0.5, 0.5, 0.5); + + $color = $imagick->getImageRedPrimary(); + im_check($color['x']);im_check($color['y']);im_check($color['z']); + + $color = $imagick->getImageGreenPrimary(); + im_check($color['x']);im_check($color['y']);im_check($color['z']); + + $color = $imagick->getImageBluePrimary(); + im_check($color['x']);im_check($color['y']);im_check($color['z']); + + $color = $imagick->getImageWhitePoint(); + im_check($color['x']);im_check($color['y']);im_check($color['z']); +} + + +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/260_localContrastImage.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/260_localContrastImage.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/260_localContrastImage.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/260_localContrastImage.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,20 @@ +--TEST-- +Test localContrastImage +--SKIPIF-- + +--FILE-- +localContrastImage(2, 2); + +echo "Ok"; + +?> +--EXPECT-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/261_compositeImageGravity.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/261_compositeImageGravity.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/261_compositeImageGravity.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/261_compositeImageGravity.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,45 @@ +--TEST-- +Test compositeImageGravity +--SKIPIF-- += 0x660 && $v ['versionNumber'] < 0x670) +// die ('skip seems to be broken in this version of ImageMagick'); +?> +--FILE-- +scaleImage( + $im2->getImageWidth() / 2, + $im2->getImageHeight() / 2 +); + +$im1->compositeImageGravity( + $im2, + \Imagick::COMPOSITE_ATOP, + \Imagick::GRAVITY_NORTHEAST +); + +$im1->compositeImageGravity( + $im2, + \Imagick::COMPOSITE_ATOP, + \Imagick::GRAVITY_SOUTH +); + +// $im1->setImageFormat('png'); +// $im1->writeImage('compositeImageGravity.png'); + +echo "Ok"; + +?> +--EXPECT-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/262_autoOrient.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/262_autoOrient.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/262_autoOrient.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/262_autoOrient.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,23 @@ +--TEST-- +Test autoOrient +--SKIPIF-- += 0x660 && $v ['versionNumber'] < 0x670) +// die ('skip seems to be broken in this version of ImageMagick'); +?> +--FILE-- +autoOrient(); + +echo "Ok"; + +?> +--EXPECT-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/263_autoGammaImage.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/263_autoGammaImage.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/263_autoGammaImage.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/263_autoGammaImage.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,22 @@ +--TEST-- +Test autoGammaImage +--SKIPIF-- + +--FILE-- +autoGammaImage(); + + +$im = new Imagick("magick:logo"); +$im->autoGammaImage(\Imagick::CHANNEL_RED); + +echo "Ok"; + +?> +--EXPECT-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/264_ImagickDraw_getTextDirection_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/264_ImagickDraw_getTextDirection_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/264_ImagickDraw_getTextDirection_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/264_ImagickDraw_getTextDirection_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,63 @@ +--TEST-- +Test ImagickDraw, getTextDirection +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); +$draw->setFillColor($fillColor); + +$draw->setStrokeWidth(2); +$draw->setFontSize(56); + +$directions = array( + \Imagick::DIRECTION_LEFT_TO_RIGHT, + \Imagick::DIRECTION_RIGHT_TO_LEFT, + \Imagick::DIRECTION_LEFT_TO_RIGHT, +); + +$i = 0; +foreach ($directions as $directionToSet) { + $draw->setTextDirection($directionToSet); + $directionReturned = $draw->getTextDirection(); + + if ($directionReturned != $directionToSet) { + echo "Direction error for $i \n"; + } + + $position = 36; + if ($directionToSet == \Imagick::DIRECTION_RIGHT_TO_LEFT) { + $position = 500 - 36; + } + + $draw->annotation($position, (72 * $i) + 64, "Lorem Ipsum!"); + + $i++; +} + +$imagick = new \Imagick(); +$imagick->newImage(500, 500, $backgroundColor); +$imagick->setImageFormat("png"); +$imagick->drawImage($draw); + +$bytes = $imagick->getImageBlob(); +if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + +$imagick->writeImage('./directionTest.png'); + +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/265_ImagickDraw_getOpacity_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/265_ImagickDraw_getOpacity_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/265_ImagickDraw_getOpacity_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/265_ImagickDraw_getOpacity_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,56 @@ +--TEST-- +Test ImagickDraw, getOpacity +--SKIPIF-- + + +--FILE-- +setStrokeColor($strokeColor); +$draw->setFillColor($fillColor); + +$draw->setStrokeWidth(2); +$draw->setFontSize(72); + +$opacityToSet = 0.1; + +$draw->setOpacity($opacityToSet); +$opacity = $draw->getOpacity(); + +$delta = abs($opacity - $opacityToSet); +if ($delta > 0.0001) { + echo "Failed to get correct opacity, it should be $opacityToSet but got $opacity, which is a delta of $delta\n"; +} + +$draw->line(125, 70, 100, 50); +$draw->line(350, 170, 100, 150); + +$imagick = new \Imagick(); +$imagick->newImage(500, 500, $backgroundColor); +$imagick->setImageFormat("png"); +$imagick->drawImage($draw); + + + + +$bytes = $imagick->getImageBlob(); +if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + + + +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/266_ImagickDraw_getFontResolution_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/266_ImagickDraw_getFontResolution_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/266_ImagickDraw_getFontResolution_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/266_ImagickDraw_getFontResolution_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,68 @@ +--TEST-- +Test ImagickDraw, getFontResolution +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); +$draw->setFillColor($fillColor); + +$draw->setStrokeWidth(2); +$draw->setFontSize(72); + +$fontResolution = $draw->getFontResolution(); + +if (isset($fontResolution["x"]) == false || isset($fontResolution["y"]) == false) { + echo "$fontResolution doesn't contain expected values:\n"; + var_dump($fontResolution); +} + +if ($fontResolution["x"] < 8 || $fontResolution["x"] > 100) { + echo "Font resolution x outside expected range: ".$fontResolution["x"]."\n"; +} +if ($fontResolution["y"] < 8 || $fontResolution["y"] > 100) { + echo "Font resolution y outside expected range: ".$fontResolution["y"]."\n"; +} + +$resolutionToSet = 36; + +$draw->setFontResolution($resolutionToSet, $resolutionToSet); +$fontResolution = $draw->getFontResolution(); + +if (abs($fontResolution["x"] - $resolutionToSet) > 0.0001) { + echo "Font resolution x after set is not $resolutionToSet instead: ".$fontResolution["x"]."\n"; +} +if (abs($fontResolution["y"] - $resolutionToSet) > 0.0001) { + echo "Font resolution y after set is not $resolutionToSet instead: ".$fontResolution["y"]."\n"; +} + +$draw->line(125, 70, 100, 50); +$draw->annotation(50, 32, "Lorem Ipsum!"); + +$imagick = new \Imagick(); +$imagick->newImage(500, 500, $backgroundColor); +$imagick->setImageFormat("png"); +$imagick->drawImage($draw); + + +$bytes = $imagick->getImageBlob(); +if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + + +echo "Ok"; +?> + +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/267_ImagickDraw_getBorderColor_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/267_ImagickDraw_getBorderColor_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/267_ImagickDraw_getBorderColor_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/267_ImagickDraw_getBorderColor_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,59 @@ +--TEST-- +Test ImagickDraw, getBorderColor +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); +$draw->setFillColor($fillColor); + +$draw->setStrokeWidth(2); +$draw->setFontSize(72); + +$opacityToSet = 0.1; + +$borderColor = $draw->getBorderColor(); +//var_dump($borderColor->getColor()); + +$draw->setBorderColor("red"); +$borderColor = $draw->getBorderColor(); + +$borderColorElements = $borderColor->getColor(); +if ($borderColorElements["r"] != 255 || + $borderColorElements["g"] != 0 || + $borderColorElements["b"] != 0) { + echo "Wrong colors after set."; +} + +$draw->line(125, 70, 100, 50); +$draw->line(350, 170, 100, 150); + +$imagick = new \Imagick(); +$imagick->newImage(500, 500, $backgroundColor); +$imagick->setImageFormat("png"); +$imagick->drawImage($draw); + + + + +$bytes = $imagick->getImageBlob(); +if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + + + +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/268_ImagickDraw_getDensity_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/268_ImagickDraw_getDensity_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/268_ImagickDraw_getDensity_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/268_ImagickDraw_getDensity_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,52 @@ +--TEST-- +Test ImagickDraw, getDensity +--SKIPIF-- + +--XFAIL-- +Expected behaviour is not known :-p +--FILE-- +setStrokeColor($strokeColor); +$draw->setFillColor($fillColor); + +$draw->setStrokeWidth(2); +$draw->setFontSize(72); + +$opacityToSet = 0.1; + +$densitySet = "200"; + + +$draw->setDensity($densitySet); +$densityGet = $draw->getDensity(); + +if (strcmp($densitySet, $densityGet) !== 0) { + echo "Density retrieved [$densityGet] is not the value set [$densitySet]."; +} + +$draw->line(125, 70, 100, 50); +$draw->line(350, 170, 100, 150); + +$imagick = new \Imagick(); +$imagick->newImage(500, 500, $backgroundColor); +$imagick->setImageFormat("png"); +$imagick->drawImage($draw); + +$bytes = $imagick->getImageBlob(); +if (strlen($bytes) <= 0) { echo "Failed to generate image.";} + +echo "Ok"; + +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/269_ImagickPixel_setColorFromPixel_basic.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/269_ImagickPixel_setColorFromPixel_basic.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/269_ImagickPixel_setColorFromPixel_basic.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/269_ImagickPixel_setColorFromPixel_basic.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,36 @@ +--TEST-- +Test ImagickPixel, setColor +--SKIPIF-- + +--FILE-- +setColorFromPixel($red); + +$expected = array( + "r" => 255, + "g" => 0, + "b" => 0, + "a" => 1 +); + +$actualColor = $backgroundColor->getColor(); + +if ($actualColor != $expected) { + echo "Not as expected :\n"; + var_dump($actualColor); +} + + +echo "Ok"; +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/270_imagick_restoreErrorHandler.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/270_imagick_restoreErrorHandler.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/270_imagick_restoreErrorHandler.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/270_imagick_restoreErrorHandler.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,30 @@ +--TEST-- +Imagick don't borg the error handler +--SKIPIF-- + +--FILE-- +getMessage(); +} + +?> +--EXPECTF-- +Normal exception +Normal warning is suppressed \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/271_imagick_constants.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/271_imagick_constants.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/271_imagick_constants.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/271_imagick_constants.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,20 @@ +--TEST-- +Imagick::readImage test +--SKIPIF-- + +--FILE-- +getConstants(); + +$output = ''; + +foreach ($constants as $key => $value) { + $output .= "$key: $value \n"; +} +echo "Ok"; + +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/272_imagick_identifyimagetype.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/272_imagick_identifyimagetype.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/272_imagick_identifyimagetype.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/272_imagick_identifyimagetype.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,25 @@ +--TEST-- +Test identifyImageType +--SKIPIF-- + +--FILE-- +newPseudoImage(100, 100, "magick:logo"); + +$type = $im->identifyImageType(); + +if ($type !== Imagick::IMGTYPE_PALETTE) { + echo "Unexpected type value. Expecting: ".Imagick::IMGTYPE_PALETTE.", but got $type. \n"; +} +echo "Ok"; + +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/273_imagick_falsyimage.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/273_imagick_falsyimage.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/273_imagick_falsyimage.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/273_imagick_falsyimage.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,18 @@ +--TEST-- +Imagick::__construct false +--SKIPIF-- + +--FILE-- +getMessage()."\n"; +} + + +?> +--EXPECTF-- +Constructor shouldn't be called with a boolean as the filename \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/274_imagick_setImageAlpha.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/274_imagick_setImageAlpha.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/274_imagick_setImageAlpha.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/274_imagick_setImageAlpha.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,43 @@ +--TEST-- +Imagick::setImageAlpha +--SKIPIF-- + +--FILE-- +newPseudoImage(256, 256, 'xc:purple'); +$imagick->setImageAlpha(0.5); + +$imagick->setImageFormat('png'); +$imagick->writeImage("./setAlphaTest.png"); + +$pixelTypes = array( + Imagick::PIXEL_CHAR => array(128, 0, 128, 128), + Imagick::PIXEL_FLOAT => array(0.50196081399918, 0, 0.50196081399918, 0.5), + Imagick::PIXEL_DOUBLE => array(0.50196078431373, 0, 0.50196078431373, 0.5), + Imagick::PIXEL_SHORT => array(32896, 0, 32896, 32768), +); + + +foreach ($pixelTypes as $pixelType => $expectedValues) { + $pixels = $imagick->exportImagePixels(0, 0, 1, 1, "RGBA", $pixelType); + for ($i=0; $i<4; $i++) { + $actual = $pixels[$i]; + $expected = $expectedValues[$i]; + if (abs($actual - $expected) > 0.0000001) { + echo "Pixel values appear incorrect for pixelType $pixelType:"; + var_dump($pixels); + break; + } + } +} + +echo "Ok"; + +?> +--EXPECTF-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/275_ImagickPixel_unitializedObjects.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/275_ImagickPixel_unitializedObjects.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/275_ImagickPixel_unitializedObjects.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/275_ImagickPixel_unitializedObjects.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,90 @@ +--TEST-- +Testing ImagickPixel with unitialized pixel_wand +--SKIPIF-- + +--FILE-- +newInstanceWithoutConstructor(); +$methods = $reflectionClass->getMethods(); + +$methodsAndParams = array( + 'clear' => [], + 'destroy' => [], + 'getColor' => [], + 'getColorAsString' => [], + 'getColorCount' => [], + 'getColorQuantum' => [], + 'getColorValue' => [Imagick::COLOR_BLUE], + 'getColorValueQuantum' => [Imagick::COLOR_RED], + 'getHSL' => [], + 'getIndex' => [], + 'isPixelSimilar' => ['red', 0.1], + 'isPixelSimilarQuantum' => ['red', 100], + 'isSimilar' => ['red', 0.1], + 'setColor' => ['red'], + 'setcolorcount' => [4], + 'setColorValue' => [Imagick::COLOR_BLUE, 0.5], + 'setColorValueQuantum' => [Imagick::COLOR_BLUE, 1], + 'setHSL' => [0.5, 0.5, 0.5], + 'setIndex' => [5], + 'setcolorfrompixel' => [$instance], +); + +$testedMethods = array(); +foreach ($methodsAndParams as $methodName => $params) { + + if ($reflectionClass->hasMethod($methodName) == false) { + continue; + } + + try { + call_user_func_array([$instance, $methodName], $params); + echo "failed to throw an exception.\n"; + } + catch (ImagickPixelException $ipe) { + if (strpos($ipe->getMessage(), "Can not process empty ImagickPixel object") === false) { + echo "Incorrect message: " . $ipe->getMessage() . "\n"; + } + } + + $testedMethods[] = strtolower($methodName); +} + + +// pretend we tested these. +$testedMethods[] = '__construct'; +$testedMethods[] = 'clone'; + +foreach ($methods as $method) { + $allMethods[] = strtolower($method->getName()); +} + +// Have we tested all but __construct +$missedMethods = array_diff($allMethods, $testedMethods); + +if (count($missedMethods) !== 0) { + echo "We didn't test all of the ImagickPixel methods\n"; + var_dump($missedMethods); +} + +echo "Ok" + +?> +--EXPECTF-- + +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/276_Imagick_artifacts.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/276_Imagick_artifacts.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/276_Imagick_artifacts.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/276_Imagick_artifacts.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,27 @@ +--TEST-- +Test Imagick::setImageArtifact and Imagick::getImageArtifact +--SKIPIF-- + +--FILE-- +setImageArtifact('compose:args', '1,0,-0.5,0.5')); + +var_dump($im->getImageArtifact('compose:args')); +var_dump($im->deleteImageArtifact('compose:args')); + +?> +--EXPECT-- +bool(true) +string(12) "1,0,-0.5,0.5" +bool(true) \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/277_Imagick_colorDecisionListImage.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/277_Imagick_colorDecisionListImage.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/277_Imagick_colorDecisionListImage.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/277_Imagick_colorDecisionListImage.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,37 @@ +--TEST-- +Test Imagick::colorDecisionListImage +--SKIPIF-- + +--FILE-- + + + + 0.9 1.2 0.5 + 0.4 -0.5 0.6 + 1.0 0.8 1.5 + + + 0.85 + + + +CCC; + +$im->colorDecisionListImage($ccc); + +echo "Ok" +?> +--EXPECT-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/278_Imagick_optimaze_gif.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/278_Imagick_optimaze_gif.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/278_Imagick_optimaze_gif.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/278_Imagick_optimaze_gif.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,86 @@ +--TEST-- +Test Imagick::optimizeimagelayers and Imagick::optimizeimagetransparency +--SKIPIF-- + +--FILE-- +setFormat("gif"); + + $circleRadius = 20; + $imageFrames = 6; + $imageSize = 200; + + $background = new \Imagick(); + $background->newpseudoimage($imageSize, $imageSize, "canvas:gray"); + + $blackWhite = new \Imagick(); + $blackWhite->newpseudoimage($imageSize, $imageSize, "gradient:black-white"); + + $backgroundPalette = clone $background; + $backgroundPalette->quantizeImage(240, \Imagick::COLORSPACE_RGB, 8, false, false); + + $blackWhitePalette = clone $blackWhite; + $blackWhitePalette->quantizeImage(16, \Imagick::COLORSPACE_RGB, 8, false, false); + + $backgroundPalette->addimage($blackWhitePalette); + + for($count=0 ; $count<$imageFrames ; $count++) { + echo "Frame: ".$count."\n"; + $drawing = new \ImagickDraw(); + $drawing->setFillColor('white'); + $drawing->setStrokeColor('rgba(64, 64, 64, 0.8)'); + $strokeWidth = 4; + $drawing->setStrokeWidth($strokeWidth); + + $distanceToMove = $imageSize + (($circleRadius + $strokeWidth) * 2); + $offset = ($distanceToMove * $count / ($imageFrames -1)) - ($circleRadius + $strokeWidth); + $drawing->translate($offset, ($imageSize / 2) + ($imageSize / 3 * cos(20 * $count / $imageFrames))); + $drawing->circle(0, 0, $circleRadius, 0); + + $frame = clone $background; + $frame->drawimage($drawing); + $frame->clutimage($backgroundPalette); + $frame->setImageDelay(10); + $aniGif->addImage($frame); + } + + $aniGif = $aniGif->deconstructImages(); + + $bytes = $aniGif->getImagesBlob(); + if (strlen($bytes) <= 0) { + echo "Failed to generate image."; + } + + return $aniGif; +} + +function optimizeGif($im) { + $im = $im->coalesceImages(); + $im->optimizeImageLayers(); + $im->optimizeimagetransparency(); +} + +$simpleGif = makeSimpleGif(); +optimizeGif($simpleGif); + +echo "Ok" +?> +--EXPECT-- +Frame: 0 +Frame: 1 +Frame: 2 +Frame: 3 +Frame: 4 +Frame: 5 +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/279_ImagickDraw_setTextInterlineSpacing.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/279_ImagickDraw_setTextInterlineSpacing.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/279_ImagickDraw_setTextInterlineSpacing.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/279_ImagickDraw_setTextInterlineSpacing.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,80 @@ +--TEST-- +Test ImagickDraw:: setTextInterlineSpacing +--SKIPIF-- + +--FILE-- +setStrokeColor($strokeColor); + $draw->setFillColor($fillColor); + + $draw->setStrokeWidth(2); + $draw->setFontSize(56); + + $draw->setFontSize(16); + $draw->setStrokeAntialias(true); + $draw->setTextAntialias(true); + $draw->setFillColor('#ff0000'); + $draw->setTextInterlineSpacing($interlineSpacing); + + $imagick = new \Imagick(); + $imagick->newImage(600, 600, "rgb(230, 230, 230)"); + $imagick->setImageFormat('png'); + $imagick->annotateImage($draw, 30, 40, 0, "Line 1\nLine 2\nLine 3"); + $imagick->trimImage(0); + $imagick->setImagePage($imagick->getimageWidth(), $imagick->getimageheight(), 0, 0); + + $bytes = $imagick->getImageBlob(); + if (strlen($bytes) <= 0) { + die("Failed to generate image."); + } + + $imageHeights[$interlineSpacing] = $imagick->getImageHeight(); + + $imagick->writeImage(__DIR__ . "/interline_spacing_test_$interlineSpacing.png"); +} + + +$previousHeight = null; + +foreach ($imageHeights as $interlineSpacing => $imageHeight) { + if ($previousHeight !== null) { + $differenceFromPrevious = $imageHeight - $previousHeight; + if ($differenceFromPrevious < 15) { + echo "textInterlineSpacing of $interlineSpacing only resulted in extra height of $differenceFromPrevious\n"; + } + } + + $previousHeight = $imageHeight; +} + +echo "Ok"; +?> +--CLEAN-- + +--EXPECTF-- +Ok diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/280_imagickkernel_exception_invalid_origin.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/280_imagickkernel_exception_invalid_origin.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/280_imagickkernel_exception_invalid_origin.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/280_imagickkernel_exception_invalid_origin.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,115 @@ +--TEST-- +ImagickKernel::fromMatrix exceptions +--SKIPIF-- + +--FILE-- +getMessage(); + } +} + +foreach ($invalidOrigins as $invalidOrigin) { + try { + $kernel = ImagickKernel::fromMatrix($kernelArray, $invalidOrigin); + echo "Exception wasn't thrown for case: \n"; + var_dump($invalidOrigin); + } + catch (\ImagickKernelException $e) { + $message = $e->getMessage(); + if (strpos($message, "origin_y for matrix is outside bounds of rows") === 0) { + // this is fine. + } + else if (strpos($message, "origin_x for matrix is outside bounds of columns") === 0) { + // this is fine. + } + else { + echo "Unexpected message: " . $message . "\n"; + } + } +} + +$flatKernelArray = array( + array(1, 0, -2, 0, 1), +); + +try { + $kernel = ImagickKernel::fromMatrix($flatKernelArray, [1, 4]); + echo "Exception wasn't thrown for case: \n"; + var_dump($invalidOrigin); +} +catch (\ImagickKernelException $e) { + $message = $e->getMessage(); + if (strpos($message, "origin_y for matrix is outside bounds of rows") === 0) { + // this is fine. + } + else { + echo "Unexpected message: " . $message . "\n"; + } +} + + +$tallKernelArray = array( + array(1), + array(0), + array(-2), + array(0), + array(1), +); + + +try { + $kernel = ImagickKernel::fromMatrix($tallKernelArray, [4, 1]); + echo "Exception wasn't thrown for case: \n"; + var_dump($invalidOrigin); +} +catch (\ImagickKernelException $e) { + $message = $e->getMessage(); + if (strpos($message, "origin_x for matrix is outside bounds of columns") === 0) { + // this is fine. + } + else { + echo "Unexpected message: " . $message . "\n"; + } +} + + + +echo "Complete".PHP_EOL; +?> +--EXPECTF-- +Complete Binary files /tmp/tmpBRUnKh/PjeLJCBDLw/php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/anonymous_pro_minus.ttf and /tmp/tmpBRUnKh/CZemUl191I/php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/anonymous_pro_minus.ttf differ diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/bug20636.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/bug20636.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/bug20636.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/bug20636.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,31 @@ +--TEST-- +Test PECL bug #20636 +--SKIPIF-- + +--FILE-- +newImage(0, 0, '#dddddd', 'png' ); + +try { + $image->roundCorners(5, 5); + echo "fail\n"; +} catch (ImagickException $e) { + echo "success\n"; +} + +?> +--EXPECTF-- +Deprecated: Function Imagick::roundcorners() is deprecated in %s +success diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/bug21229.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/bug21229.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/bug21229.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/bug21229.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,41 @@ +--TEST-- +Test PECL bug #21229 +--SKIPIF-- + +--FILE-- +test = $value; + return $this; + } + + public function getTestValue() { + return $this->test; + } +} + +$test = new ImagickTest("magick:logo"); +$test->setTestValue("test value"); + +echo "Value: " , $test->getTestValue() , PHP_EOL; + +var_dump($test->width, $test->height); + +echo "OK" , PHP_EOL; + + +?> +--EXPECTF-- +Value: test value +int(112233) +int(%d) +OK \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/bug59378.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/bug59378.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/bug59378.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/bug59378.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,40 @@ +--TEST-- +Test PHP bug #59378 writing to php://memory is incomplete +--SKIPIF-- + +--FILE-- +newPseudoImage(640, 480, "LOGO:"); +$imagick->setFormat("png"); + +$fp = fopen("php://memory", 'r+'); +$imagick->writeImageFile($fp); +rewind($fp); +$memoryBlob = stream_get_contents($fp); +fclose($fp); + +//This test depends on getImageBlob working correctly. +$imageBlob = $imagick->getImageBlob(); + +//Read the images from the data blobs. +$imageReopened = new Imagick(); +$imageReopened->readImageBlob($imageBlob); +$memoryReopened = new Imagick(); +$memoryReopened->readImageBlob($memoryBlob); + +//Compare to see if they are identical. +$result = $imageReopened->compareImages($memoryReopened, \Imagick::METRIC_MEANABSOLUTEERROR); + +if ($result[1] == 0) { + echo "Reopened images are identical."; +} +else { + echo "Error, reopened images have changed."; + var_dump($result); +} + +?> +--EXPECTF-- +Reopened images are identical. diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/bug64015.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/bug64015.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/bug64015.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/bug64015.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,26 @@ +--TEST-- +Test PHP bug #64015 +--SKIPIF-- + +--FILE-- +getImageLength()); + +// Both should return filesize in bytes. + +var_dump($im->getImageLength()); + +// All cases below now return 0; +$cloned_im = clone $im; +var_dump($im->getImageLength()); + +echo "OK" , PHP_EOL; + + +?> +--EXPECTF-- +int(2523) +int(2523) +int(2523) +OK \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/bug_66098.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/bug_66098.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/bug_66098.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/bug_66098.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,15 @@ +--TEST-- +Bug #66098 Check that there is no segfault from zval_addref_p +--SKIPIF-- +foobar; + +echo "OK"; + +?> +--EXPECT-- +OK \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/bug_71742.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/bug_71742.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/bug_71742.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/bug_71742.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,53 @@ +--TEST-- +Bug #71742 polyline touched by array_walk +--SKIPIF-- + +--FILE-- + 2 * $index, + 'y' => pow($index, 2) + ); +} + +$callback = function (&$coordinate) { + $coordinate['y'] = 200 - $coordinate['y'] / 50; +}; + +array_walk($coordinates, $callback); + +$imagick = new Imagick(); +$imagick->newImage(200, 200, "white"); + +$draw = new ImagickDraw (); +$draw->setFillColor("none"); +$draw->setStrokeColor("black"); + +//Fatal error in PHP 7, but not in PHP <= 5.6 +$draw->polyline($coordinates); + +$draw->translate(0, -20); +////Works in PHP 7 +$draw->polyline (array_values($coordinates)); +$imagick->drawImage($draw); +//$imagick->writeImage(getcwd()."/test.png"); +$imagick->setImageFormat('png'); +$bytes = $imagick->getImageBlob(); + +if (strlen($bytes) <= 0) { + echo "Failed to generate image."; +} + +//$imagick->writeImage("./bugTest.png"); + +echo "Ok"; + +?> +--EXPECT-- +Ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/bug_72226.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/bug_72226.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/bug_72226.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/bug_72226.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,22 @@ +--TEST-- +Allow Imagick exceptions to be extended. +--SKIPIF-- + +--FILE-- + +--EXPECTF-- diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/bug_73840.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/bug_73840.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/bug_73840.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/bug_73840.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,44 @@ +--TEST-- +ImagickPixel iterator +--SKIPIF-- + +--XFAIL-- +This needs a significant amount of work to fix. The issue is the iterator object is going out of scope and being freed, but the row object still has a reference to that pixel iterator, internally in ImageMagick. We need to stop the pixeliterator being freed while the row is still active. +--FILE-- +newImage(1, 1, 'black'); +// +//// This works fine +//$it = $im->getPixelIterator(); +//$row = $it->getCurrentIteratorRow(); +//$rgb = $row[0]->getColor(); +// +//$expected = array ( +// "r" => 0, +// "g" => 0, +// "b" => 0, +// "a" => 1, +//); +// +//if ($rgb !== $expected) { +// echo "values are incorrect:\n"; +// var_dump($rgb); +//} +// +//// This crashes with SIGABRT +//$row = $im->getPixelIterator()->getCurrentIteratorRow(); +//$rgb = $row[0]->getColor(); +// +//if ($rgb !== $expected) { +// echo "values are incorrect:\n"; +// var_dump($rgb); +//} + +echo "Not ok"; + +?> +--EXPECTF-- +Not ok \ No newline at end of file diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/functions.inc php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/functions.inc --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/functions.inc 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/functions.inc 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,65 @@ += 0) { + return true; + } + + return false; +} + + + diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/github_174.phpt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/github_174.phpt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/github_174.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/github_174.phpt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,13 @@ +--TEST-- +Imagick::resizeImage prevent 0 width/height images +--SKIPIF-- + +--FILE-- +newPseudoImage(1, 1000, "xc:red"); +$i->resizeImage(0, 250, 0, 1); +echo $i->getImageWidth(); // should be 1 +?> +--EXPECTF-- +1 diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/OFL.txt php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/OFL.txt --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/OFL.txt 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/OFL.txt 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,94 @@ +Copyright (c) 2009, Mark Simonson (http://www.ms-studio.com, mark@marksimonson.com), +with Reserved Font Name Anonymous Pro Minus. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. Binary files /tmp/tmpBRUnKh/PjeLJCBDLw/php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/php.gif and /tmp/tmpBRUnKh/CZemUl191I/php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/php.gif differ diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/skipif.inc php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/skipif.inc --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/skipif.inc 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/skipif.inc 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,119 @@ += $imageMagickBelowVersion) { + $message = sprintf( + "skip ImageMagick installed %x >= limit check %x", + $versionInstalled, + $imageMagickBelowVersion + ); + die($message); + } +} + + +if (isset($imageMagickBelowVersion)) { + $versionInfo = \Imagick::getVersion(); + + if (array_key_exists("versionNumber", $versionInfo) == false) { + die("skip unable to determine ImageMagick version."); + } + + $versionInstalled = $versionInfo["versionNumber"]; + + if ($versionInstalled >= $imageMagickBelowVersion) { + $message = sprintf( + "skip ImageMagick installed %x >= %x", + $versionInstalled, + $imageMagickBelowVersion + ); + die($message); + } +} + +function checkClassMethods($class, $methods) +{ + foreach ($methods as $method) { + if (method_exists($class, $method) == false) { + die("skip Class method $class::$method not present"); + } + } +} + +function checkFormatPresent($format) +{ + $result = Imagick::queryFormats(strtoupper($format)); + if (count($result) == false) { + die("skip format $format not supported by ImageMagick as compiled."); + } +} + +function requirePHP($required) +{ + if (version_compare(PHP_VERSION, $required) < 0) { + die("skip PHP version $required required, but have ".PHP_VERSION."."); + } +} + +function requireFormat($requiredFormat) +{ + $formats = \Imagick::queryformats(); + + foreach ($formats as $format) { + if (strcasecmp($format, $requiredFormat) === 0) { + return; + } + } + + die("skip test suite requires format $requiredFormat but not available"); +} + +requireFormat("png"); +requireFormat("jpg"); + +if (isset($minimumVersions) === true) { + if (isVersionGreaterEqual($minimumVersions[0], $minimumVersions[1]) !== true) { + + $message = sprintf( + "skip either version '%s' or '%s' is minimum reliable for test.\n", + $minimumVersions[0], + $minimumVersions[1] + ); + + die($message); + } +} + +?> diff -Nru php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/skipprobefourier.inc php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/skipprobefourier.inc --- php-imagick-3.4.4/imagick-3.4.4+php8.0/tests/skipprobefourier.inc 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/imagick-3.4.4+php8.0/tests/skipprobefourier.inc 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,26 @@ +newPseudoImage(640, 480, "magick:logo"); + $imagick->resizeimage(512, 512, \Imagick::FILTER_LANCZOS, 1); + $imagick->forwardFourierTransformImage(true); + $canCallFourier = true; +} +catch(\Exception $e) { + //fftw probably not available. +} + +ob_end_clean(); + +if ($canCallFourier == false) { + die("skip fourier function seems unavailable"); +} + +?> \ No newline at end of file diff -Nru php-imagick-3.4.4/package-8.xml php-imagick-3.4.4+php8.0+3.4.4/package-8.xml --- php-imagick-3.4.4/package-8.xml 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/package-8.xml 2020-12-23 17:00:47.000000000 +0000 @@ -0,0 +1,421 @@ + + + imagick + pecl.php.net + Provides a wrapper to the ImageMagick library. + Imagick is a native php extension to create and modify images using the ImageMagick API. +This extension requires ImageMagick version 6.5.3-10+ and PHP 5.4.0+. + + Mikko Koppanen + mkoppanen + mkoppanen@php.net + no + + + Dan Ackroyd + danack + danack@php.net + yes + + + Scott MacVicar + scottmac + scottmac@php.net + no + + 2019-05-02 + + + 3.4.4+php8.0 + 3.4.4 + + + stable + stable + + PHP License + +- The 3.4.4 release is intended to be the last release (other than small bug fixes) that will support either PHP 5.x, or ImageMagick 6.x. The next planned release will be PHP > 7.0 and ImageMagick > 7.0 at least, if not higher. +- Added: +* function Imagick::optimizeImageTransparency() +* METRIC_STRUCTURAL_SIMILARITY_ERROR +* METRIC_STRUCTURAL_DISSIMILARITY_ERROR +* COMPRESSION_ZSTD - https://github.com/facebook/zstd +* COMPRESSION_WEBP +* CHANNEL_COMPOSITE_MASK +* FILTER_CUBIC_SPLINE - "Define the lobes with the -define filter:lobes={2,3,4} (reference https://imagemagick.org/discourse-server/viewtopic.php?f=2&t=32506)." +* Imagick now explicitly conflicts with the Gmagick extension. +- Fixes: +* Correct version check to make RemoveAlphaChannel and FlattenAlphaChannel be available when using Imagick with ImageMagick version 6.7.8-x +* Bug 77128 - Imagick::setImageInterpolateMethod() not available on Windows +* Prevent memory leak when ImagickPixel::__construct called after object instantiation. +* Prevent segfault when ImagickPixel internal constructor not called. +* Imagick::setResourceLimit support for values larger than 2GB (2^31) on 32bit platforms. +* Corrected memory overwrite in Imagick::colorDecisionListImage() +* Bug 77791 - ImagickKernel::fromMatrix() out of bounds write. +- Deprecated: +* The following functions have been deprecated: +ImagickDraw, matte +Imagick::averageimages +Imagick::colorfloodfillimage +Imagick::filter +Imagick::flattenimages +Imagick::getimageattribute +Imagick::getimagechannelextrema +Imagick::getimageclipmask +Imagick::getimageextrema +Imagick::getimageindex +Imagick::getimagematte +Imagick::getimagemattecolor +Imagick::getimagesize +Imagick::mapimage +Imagick::mattefloodfillimage +Imagick::medianfilterimage +Imagick::mosaicimages +Imagick::orderedposterizeimage +Imagick::paintfloodfillimage +Imagick::paintopaqueimage +Imagick::painttransparentimage +Imagick::radialblurimage +Imagick::recolorimage +Imagick::reducenoiseimage +Imagick::roundcornersimage +Imagick::roundcorners +Imagick::setimageattribute +Imagick::setimagebias +Imagick::setimageclipmask +Imagick::setimageindex +Imagick::setimagemattecolor +Imagick::setimagebiasquantum +Imagick::setimageopacity +Imagick::transformimage + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5.4.0 + + + 1.4.0 + + + + imagick + + + + diff -Nru php-imagick-3.4.4/package-8.xml~ php-imagick-3.4.4+php8.0+3.4.4/package-8.xml~ --- php-imagick-3.4.4/package-8.xml~ 1970-01-01 00:00:00.000000000 +0000 +++ php-imagick-3.4.4+php8.0+3.4.4/package-8.xml~ 2019-05-02 15:26:00.000000000 +0000 @@ -0,0 +1,421 @@ + + + imagick + pecl.php.net + Provides a wrapper to the ImageMagick library. + Imagick is a native php extension to create and modify images using the ImageMagick API. +This extension requires ImageMagick version 6.5.3-10+ and PHP 5.4.0+. + + Mikko Koppanen + mkoppanen + mkoppanen@php.net + no + + + Dan Ackroyd + danack + danack@php.net + yes + + + Scott MacVicar + scottmac + scottmac@php.net + no + + 2019-05-02 + + + 3.4.4 + 3.4.4 + + + stable + stable + + PHP License + +- The 3.4.4 release is intended to be the last release (other than small bug fixes) that will support either PHP 5.x, or ImageMagick 6.x. The next planned release will be PHP > 7.0 and ImageMagick > 7.0 at least, if not higher. +- Added: +* function Imagick::optimizeImageTransparency() +* METRIC_STRUCTURAL_SIMILARITY_ERROR +* METRIC_STRUCTURAL_DISSIMILARITY_ERROR +* COMPRESSION_ZSTD - https://github.com/facebook/zstd +* COMPRESSION_WEBP +* CHANNEL_COMPOSITE_MASK +* FILTER_CUBIC_SPLINE - "Define the lobes with the -define filter:lobes={2,3,4} (reference https://imagemagick.org/discourse-server/viewtopic.php?f=2&t=32506)." +* Imagick now explicitly conflicts with the Gmagick extension. +- Fixes: +* Correct version check to make RemoveAlphaChannel and FlattenAlphaChannel be available when using Imagick with ImageMagick version 6.7.8-x +* Bug 77128 - Imagick::setImageInterpolateMethod() not available on Windows +* Prevent memory leak when ImagickPixel::__construct called after object instantiation. +* Prevent segfault when ImagickPixel internal constructor not called. +* Imagick::setResourceLimit support for values larger than 2GB (2^31) on 32bit platforms. +* Corrected memory overwrite in Imagick::colorDecisionListImage() +* Bug 77791 - ImagickKernel::fromMatrix() out of bounds write. +- Deprecated: +* The following functions have been deprecated: +ImagickDraw, matte +Imagick::averageimages +Imagick::colorfloodfillimage +Imagick::filter +Imagick::flattenimages +Imagick::getimageattribute +Imagick::getimagechannelextrema +Imagick::getimageclipmask +Imagick::getimageextrema +Imagick::getimageindex +Imagick::getimagematte +Imagick::getimagemattecolor +Imagick::getimagesize +Imagick::mapimage +Imagick::mattefloodfillimage +Imagick::medianfilterimage +Imagick::mosaicimages +Imagick::orderedposterizeimage +Imagick::paintfloodfillimage +Imagick::paintopaqueimage +Imagick::painttransparentimage +Imagick::radialblurimage +Imagick::recolorimage +Imagick::reducenoiseimage +Imagick::roundcornersimage +Imagick::roundcorners +Imagick::setimageattribute +Imagick::setimagebias +Imagick::setimageclipmask +Imagick::setimageindex +Imagick::setimagemattecolor +Imagick::setimagebiasquantum +Imagick::setimageopacity +Imagick::transformimage + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5.4.0 + + + 1.4.0 + + + + imagick + + + +