package.xml 0000644 0000765 0000024 00000010041 12220473715 012167 0 ustar mikko staff
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.2.4+ and PHP 5.1.3+.
IMPORTANT: Version 2.x API is not compatible with earlier versions.
Mikko Koppanen
mkoppanen
mkoppanen@php.net
yes
Scott MacVicar
scottmac
scottmac@php.net
no
2013-09-25
3.1.2
3.1.2
stable
stable
PHP License
- Fix ZTS build
- Fix small memory leak in identifyImage
- Added LICENSE
- Added mimetype to identify image as per PECL bug 65037
- Fixed type conversion error in newpseudoimage
5.1.3
1.4.0
imagick
imagick-3.1.2/examples/polygon.php 0000644 0000765 0000024 00000005330 12220473715 016140 0 ustar mikko staff 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( );
?>
imagick-3.1.2/examples/captcha.php 0000644 0000765 0000024 00000003050 12220473715 016051 0 ustar mikko staff 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( );
?> imagick-3.1.2/examples/thumbnail.php 0000644 0000765 0000024 00000000656 12220473715 016442 0 ustar mikko staff 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();
?> imagick-3.1.2/examples/watermark.php 0000644 0000765 0000024 00000001213 12220473715 016442 0 ustar mikko staff 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();
?> imagick-3.1.2/config.m4 0000644 0000765 0000024 00000010030 12220473715 013622 0 ustar mikko staff 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)
PHP_ARG_WITH(imagick-gm, whether to enable the imagick GraphicsMagick backend,
[ --with-imagick-gm[=DIR] GraphicsMagick backend. NO LONGER SUPPORTED!], no, no)
if test $PHP_IMAGICK_GM != "no"; then
AC_MSG_ERROR(GraphicsMagick backend is no longer supported)
fi
if test $PHP_IMAGICK != "no"; then
AC_MSG_CHECKING(ImageMagick MagickWand API configuration program)
for i in $PHP_IMAGICK /usr/local /usr;
do
test -r $i/bin/MagickWand-config && IMAGICK_AFTER_BWC_BREAK=true && WAND_BINARY=$i/bin/MagickWand-config && break
done
if test -z "$WAND_BINARY"; then
for i in $PHP_IMAGICK /usr/local /usr;
do
test -r $i/bin/Wand-config && WAND_BINARY=$i/bin/Wand-config && break
done
fi
if test -z "$WAND_BINARY"; then
AC_MSG_ERROR(not found. Please provide a path to MagickWand-config or Wand-config program.)
fi
AC_MSG_RESULT(found in $WAND_BINARY)
IMAGEMAGICK_VERSION_ORIG=`$WAND_BINARY --version`
IMAGEMAGICK_VERSION_MASK=`echo ${IMAGEMAGICK_VERSION_ORIG} | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
AC_MSG_CHECKING(if ImageMagick version is at least 6.2.4)
if test "$IMAGEMAGICK_VERSION_MASK" -ge 6002004; then
AC_MSG_RESULT(found version $IMAGEMAGICK_VERSION_ORIG)
else
AC_MSG_ERROR(no. You need at least Imagemagick version 6.2.4 to use Imagick.)
fi
WAND_DIR=`$WAND_BINARY --prefix`
if test -z "$IMAGICK_AFTER_BWC_BREAK"; then
AC_MSG_CHECKING(for magick-wand.h header file)
if test -r $WAND_DIR/include/wand/magick-wand.h; then
AC_MSG_RESULT(found in $WAND_DIR/include/wand/magick-wand.h)
else
AC_MSG_ERROR(Cannot locate header file magick-wand.h)
fi
elif test "$IMAGEMAGICK_VERSION_MASK" -gt 6008000; then
if test -r $WAND_DIR/include/ImageMagick-6/wand/magick-wand.h; then
AC_MSG_RESULT(found in $WAND_DIR/include/ImageMagick-6/wand/magick-wand.h)
else
AC_MSG_ERROR(Cannot locate header file magick-wand.h)
fi
else
AC_MSG_CHECKING(for MagickWand.h header file)
if test -r $WAND_DIR/include/ImageMagick/wand/MagickWand.h; then
AC_MSG_RESULT(found in $WAND_DIR/include/ImageMagick/wand/MagickWand.h)
else
AC_MSG_ERROR(Cannot locate header file MagickWand.h)
fi
AC_DEFINE(IMAGICK_USE_NEW_HEADER,1,[ ])
PHP_IMAGICK_USE_NEW_HEADER=1
fi
AC_MSG_CHECKING([PHP version is at least 5.1.3])
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 "50103"; then
AC_MSG_RESULT(yes. found $PHP_IMAGICK_FOUND_VERSION)
else
AC_MSG_ERROR(no. found $PHP_IMAGICK_FOUND_VERSION)
fi
AC_DEFINE(HAVE_IMAGICK,1,[ ])
IMAGICK_MAGICK_PREFIX=`$WAND_BINARY --prefix`
export ORIG_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
export PKG_CONFIG_PATH="$IMAGICK_MAGICK_PREFIX/lib/pkgconfig/"
IMAGICK_LIBS=`$WAND_BINARY --libs`
IMAGICK_LIBS="$IMAGICK_LIBS -L$WAND_DIR/lib"
IMAGICK_CFLAGS=`$WAND_BINARY --cflags`
IMAGICK_CFLAGS="$IMAGICK_CFLAGS -I$WAND_DIR/include"
PHP_EVAL_LIBLINE($IMAGICK_LIBS, IMAGICK_SHARED_LIBADD)
PHP_EVAL_INCLINE($IMAGICK_CFLAGS)
export PKG_CONFIG_PATH="$ORIG_PKG_CONFIG_PATH"
PHP_SUBST(IMAGICK_SHARED_LIBADD)
PHP_NEW_EXTENSION(imagick, imagick_file.c imagick_class.c imagickdraw_class.c imagickpixel_class.c imagickpixeliterator_class.c imagick_helpers.c imagick.c, $ext_shared,, $IMAGICK_CFLAGS)
PHP_INSTALL_HEADERS([ext/imagick], [php_imagick.h php_imagick_defs.h php_imagick_shared.h])
fi
imagick-3.1.2/config.w32 0000644 0000765 0000024 00000001450 12220473715 013723 0 ustar mikko staff ARG_WITH("imagick", "ImageMagick support", "no");
if (PHP_IMAGICK != "no") {
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");
EXTENSION('imagick', 'imagick_class.c imagickdraw_class.c imagickpixel_class.c imagickpixeliterator_class.c imagick_helpers.c imagick_file.c imagick.c');
AC_DEFINE('HAVE_IMAGICK', 1);
} else {
WARNING("imagick not enabled; libraries and headers not found");
}
}
imagick-3.1.2/CREDITS 0000644 0000765 0000024 00000000047 12220473715 013142 0 ustar mikko staff Imagick
Mikko Koppanen, Scott MacVicar
imagick-3.1.2/imagick.c 0000644 0000765 0000024 00000320474 12220473715 013703 0 ustar mikko staff /*
+----------------------------------------------------------------------+
| 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 "ext/standard/php_smart_str.h"
ZEND_DECLARE_MODULE_GLOBALS(imagick)
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;
#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;
/* External API */
MY_IMAGICK_EXPORTS zend_class_entry *php_imagick_get_class_entry()
{
return php_imagick_sc_entry;
}
MY_IMAGICK_EXPORTS zend_class_entry *php_imagickdraw_get_class_entry()
{
return php_imagickdraw_sc_entry;
}
MY_IMAGICK_EXPORTS 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_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()
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()
ZEND_BEGIN_ARG_INFO_EX(imagick_setiteratorindex_args, 0, 0, 1)
ZEND_ARG_INFO(0, index)
ZEND_END_ARG_INFO()
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
#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_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
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
ZEND_BEGIN_ARG_INFO_EX(imagick_setimageopacity_args, 0, 0, 1)
ZEND_ARG_INFO(0, opacity)
ZEND_END_ARG_INFO()
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
#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_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(imagick_writeimagesfile_args, 0, 0, 1)
ZEND_ARG_INFO(0, handle)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(imagick_resetimagepage_args, 0, 0, 1)
ZEND_ARG_INFO(0, page)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(imagick_setimageclipmask_args, 0, 0, 1)
ZEND_ARG_OBJ_INFO(0, Imagick, Imagick, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(imagick_animateimages_args, 0, 0, 1)
ZEND_ARG_INFO(0, server_name)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(imagick_recolorimage_args, 0, 0, 1)
ZEND_ARG_INFO(0, matrix)
ZEND_END_ARG_INFO()
#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 > 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()
#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_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_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_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(imagick_setimagefilename_args, 0, 0, 1)
ZEND_ARG_INFO(0, filename)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(imagick_setimageindex_args, 0, 0, 1)
ZEND_ARG_INFO(0, index)
ZEND_END_ARG_INFO()
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()
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()
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()
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_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()
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()
ZEND_BEGIN_ARG_INFO_EX(imagick_getimageattribute_args, 0, 0, 1)
ZEND_ARG_INFO(0, key)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(imagick_setimagebackgroundcolor_args, 0, 0, 1)
ZEND_ARG_INFO(0, color)
ZEND_END_ARG_INFO()
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()
ZEND_BEGIN_ARG_INFO_EX(imagick_setimagemattecolor_args, 0, 0, 1)
ZEND_ARG_INFO(0, color)
ZEND_END_ARG_INFO()
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_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_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()
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()
ZEND_BEGIN_ARG_INFO_EX(imagick_colorizeimage_args, 0, 0, 2)
ZEND_ARG_INFO(0, colorize_color)
ZEND_ARG_INFO(0, opacity)
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()
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()
ZEND_BEGIN_ARG_INFO_EX(imagick_getimagechannelextrema_args, 0, 0, 1)
ZEND_ARG_INFO(0, CHANNEL)
ZEND_END_ARG_INFO()
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()
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()
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()
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()
ZEND_BEGIN_ARG_INFO_EX(imagick_medianfilterimage_args, 0, 0, 1)
ZEND_ARG_INFO(0, radius)
ZEND_END_ARG_INFO()
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()
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()
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()
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()
ZEND_BEGIN_ARG_INFO_EX(imagick_reducenoiseimage_args, 0, 0, 1)
ZEND_ARG_INFO(0, radius)
ZEND_END_ARG_INFO()
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()
ZEND_BEGIN_ARG_INFO_EX(imagick_setimagebias_args, 0, 0, 1)
ZEND_ARG_INFO(0, bias)
ZEND_END_ARG_INFO()
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, alpha)
ZEND_ARG_INFO(0, beta)
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_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_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()
/* 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()
/* 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_issimilar_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()
/* 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()
static zend_function_entry php_imagick_functions[] =
{
{ NULL, NULL, NULL }
};
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)
PHP_ME(imagickdraw, destroy, 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)
PHP_ME(imagickdraw, matte, imagickdraw_matte_args, ZEND_ACC_PUBLIC)
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)
{ NULL, NULL, NULL }
};
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)
PHP_ME(imagickpixeliterator, destroy, imagickpixeliterator_zero_args, ZEND_ACC_PUBLIC)
PHP_ME(imagickpixeliterator, clear, imagickpixeliterator_zero_args, ZEND_ACC_PUBLIC)
/* 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 }
};
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_zero_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)
PHP_ME(imagickpixel, destroy, imagickpixel_zero_args, ZEND_ACC_PUBLIC)
PHP_ME(imagickpixel, issimilar, imagickpixel_issimilar_args, ZEND_ACC_PUBLIC)
PHP_ME(imagickpixel, getcolor, imagickpixel_getcolor_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)
{ NULL, NULL, NULL }
};
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)
PHP_ME(imagick, getimagematte, imagick_zero_args, ZEND_ACC_PUBLIC)
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)
PHP_ME(imagick, roundcornersimage, imagick_roundcornersimage_args, ZEND_ACC_PUBLIC)
/* This alias is due to BWC */
PHP_MALIAS(imagick, roundcorners, roundcornersimage, imagick_roundcornersimage_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, setiteratorindex, imagick_setiteratorindex_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, getiteratorindex, imagick_zero_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, transformimage, imagick_transformimage_args, ZEND_ACC_PUBLIC)
#endif
#if MagickLibVersion > 0x630
PHP_ME(imagick, setimageopacity, imagick_setimageopacity_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, orderedposterizeimage, imagick_orderedposterizeimage_args, ZEND_ACC_PUBLIC)
#endif
#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, 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 MagickLibVersion > 0x634
PHP_ME(imagick, paintfloodfillimage, imagick_paintfloodfillimage_args, ZEND_ACC_PUBLIC)
#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)
PHP_ME(imagick, setimageclipmask, imagick_setimageclipmask_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, getimageclipmask, imagick_zero_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, animateimages, imagick_animateimages_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, recolorimage, imagick_recolorimage_args, ZEND_ACC_PUBLIC)
#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 > 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)
#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, 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)
PHP_ME(imagick, destroy, imagick_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)
PHP_ME(imagick, getimagesize, imagick_zero_args, ZEND_ACC_PUBLIC)
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)
PHP_ME(imagick, setimageindex, imagick_setimageindex_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, getimageindex, imagick_zero_args, ZEND_ACC_PUBLIC)
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, 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)
PHP_ME(imagick, radialblurimage, imagick_radialblurimage_args, ZEND_ACC_PUBLIC)
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)
PHP_ME(imagick, setimageattribute, imagick_setimageattribute_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, setimagebackgroundcolor, imagick_setimagebackgroundcolor_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, setimagecompose, imagick_setimagecompose_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, setimagecompression, imagick_setimagecompression_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)
PHP_ME(imagick, setimagemattecolor, imagick_setimagemattecolor_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, setimagepage, imagick_setimagepage_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, setimageprogressmonitor, imagick_setimageprogressmonitor_args, ZEND_ACC_PUBLIC)
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_ALLOW_STATIC|ZEND_ACC_PUBLIC)
PHP_ME(imagick, queryfonts, imagick_queryfonts_args, ZEND_ACC_ALLOW_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)
PHP_ME(imagick, mosaicimages, imagick_zero_args, ZEND_ACC_PUBLIC)
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)
PHP_ME(imagick, averageimages, imagick_zero_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, borderimage, imagick_borderimage_args, 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)
PHP_ME(imagick, colorfloodfillimage, imagick_colorfloodfillimage_args, ZEND_ACC_PUBLIC)
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)
PHP_ME(imagick, flattenimages, imagick_zero_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, flipimage, imagick_zero_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, flopimage, imagick_zero_args, ZEND_ACC_PUBLIC)
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)
PHP_ME(imagick, getimageattribute, imagick_getimageattribute_args, ZEND_ACC_PUBLIC)
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)
PHP_ME(imagick, getimagechannelextrema, imagick_getimagechannelextrema_args, ZEND_ACC_PUBLIC)
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)
PHP_ME(imagick, getimageextrema, imagick_zero_args, ZEND_ACC_PUBLIC)
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)
PHP_ME(imagick, getimagemattecolor, imagick_zero_args, ZEND_ACC_PUBLIC)
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)
PHP_ME(imagick, levelimage, imagick_levelimage_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, magnifyimage, imagick_zero_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, mapimage, imagick_mapimage_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, mattefloodfillimage, imagick_mattefloodfillimage_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, medianfilterimage, imagick_medianfilterimage_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, negateimage, imagick_negateimage_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, paintopaqueimage, imagick_paintopaqueimage_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, painttransparentimage, imagick_painttransparentimage_args, ZEND_ACC_PUBLIC)
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)
PHP_ME(imagick, reducenoiseimage, imagick_reducenoiseimage_args, ZEND_ACC_PUBLIC)
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)
PHP_ME(imagick, setimagebias, imagick_setimagebias_args, ZEND_ACC_PUBLIC)
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_ALLOW_STATIC|ZEND_ACC_PUBLIC)
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_ALLOW_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_ALLOW_STATIC|ZEND_ACC_PUBLIC)
PHP_ME(imagick, getpage, imagick_zero_args, ZEND_ACC_PUBLIC)
PHP_ME(imagick, getquantumdepth, imagick_zero_args, ZEND_ACC_ALLOW_STATIC|ZEND_ACC_PUBLIC)
PHP_ME(imagick, getquantumrange, imagick_zero_args, ZEND_ACC_ALLOW_STATIC|ZEND_ACC_PUBLIC)
PHP_ME(imagick, getreleasedate, imagick_zero_args, ZEND_ACC_ALLOW_STATIC|ZEND_ACC_PUBLIC)
PHP_ME(imagick, getresource, imagick_getresource_args, ZEND_ACC_ALLOW_STATIC|ZEND_ACC_PUBLIC)
PHP_ME(imagick, getresourcelimit, imagick_getresourcelimit_args, ZEND_ACC_ALLOW_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_ALLOW_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_ALLOW_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
PHP_MALIAS(imagick, key, getimageindex, imagick_zero_args, ZEND_ACC_PUBLIC)
#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)
{ NULL, NULL, NULL }
};
static void php_imagick_object_free_storage(void *object TSRMLS_DC)
{
php_imagick_object *intern = (php_imagick_object *)object;
if (!intern) {
return;
}
if (intern->progress_monitor_name) {
efree(intern->progress_monitor_name);
}
if (intern->magick_wand != (MagickWand *)NULL) {
intern->magick_wand = DestroyMagickWand(intern->magick_wand);
}
zend_object_std_dtor(&intern->zo TSRMLS_CC);
efree(intern);
}
static void php_imagickdraw_object_free_storage(void *object TSRMLS_DC)
{
php_imagickdraw_object *intern = (php_imagickdraw_object *)object;
if (!intern) {
return;
}
if (intern->drawing_wand != (DrawingWand *)NULL) {
intern->drawing_wand = DestroyDrawingWand(intern->drawing_wand);
}
zend_object_std_dtor(&intern->zo TSRMLS_CC);
efree(intern);
}
static void php_imagickpixeliterator_object_free_storage(void *object TSRMLS_DC)
{
php_imagickpixeliterator_object *intern = (php_imagickpixeliterator_object *)object;
if (!intern) {
return;
}
if (intern->pixel_iterator != (PixelIterator *)NULL) {
intern->pixel_iterator = DestroyPixelIterator(intern->pixel_iterator);
}
zend_object_std_dtor(&intern->zo TSRMLS_CC);
efree(intern);
}
static void php_imagickpixel_object_free_storage(void *object TSRMLS_DC)
{
php_imagickpixel_object *intern = (php_imagickpixel_object *)object;
if (!intern) {
return;
}
if (intern->initialized_via_iterator < 1) {
if(intern->pixel_wand != (PixelWand *)NULL) {
intern->pixel_wand = DestroyPixelWand(intern->pixel_wand);
}
}
zend_object_std_dtor(&intern->zo TSRMLS_CC);
efree(intern);
}
#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
static zend_object_value php_imagick_object_new_ex(zend_class_entry *class_type, php_imagick_object **ptr, zend_bool init_wand TSRMLS_DC)
{
zend_object_value retval;
php_imagick_object *intern;
/* Allocate memory for it */
intern = (php_imagick_object *) emalloc(sizeof(php_imagick_object));
memset(&intern->zo, 0, sizeof(zend_object));
#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();
} else {
intern->magick_wand = NULL;
}
intern->next_out_of_bound = 0;
intern->progress_monitor_name = NULL;
/* 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_imagick_object_free_storage, NULL TSRMLS_CC);
retval.handlers = (zend_object_handlers *) &imagick_object_handlers;
return retval;
}
static zend_object_value php_imagick_object_new(zend_class_entry *class_type TSRMLS_DC)
{
return php_imagick_object_new_ex(class_type, NULL, 1 TSRMLS_CC);
}
static zend_object_value php_imagickdraw_object_new_ex(zend_class_entry *class_type, php_imagickdraw_object **ptr, zend_bool init_wand TSRMLS_DC)
{
zend_object_value retval;
php_imagickdraw_object *intern;
/* Allocate memory for it */
intern = (php_imagickdraw_object *) emalloc(sizeof(php_imagickdraw_object));
memset(&intern->zo, 0, sizeof(zend_object));
if (ptr) {
*ptr = intern;
}
/* Set the DrawingWand */
if (init_wand) {
intern->drawing_wand = NewDrawingWand();
} else {
intern->drawing_wand = NULL;
}
/* 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;
}
static zend_object_value php_imagickdraw_object_new(zend_class_entry *class_type TSRMLS_DC)
{
return php_imagickdraw_object_new_ex(class_type, NULL, 1 TSRMLS_CC);
}
static zend_object_value php_imagickpixeliterator_object_new(zend_class_entry *class_type TSRMLS_DC)
{
zend_object_value retval;
php_imagickpixeliterator_object *intern;
/* Allocate memory for it */
intern = (php_imagickpixeliterator_object *) emalloc(sizeof(php_imagickpixeliterator_object));
memset(&intern->zo, 0, sizeof(zend_object));
/* We cant initialize yet */
intern->pixel_iterator = NULL;
intern->instanciated_correctly = 0;
#if MagickLibVersion <= 0x628
intern->rows = 0;
intern->iterator_position = 0;
#endif
/* 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_imagickpixeliterator_object_free_storage, NULL TSRMLS_CC);
retval.handlers = (zend_object_handlers *) &imagickpixeliterator_object_handlers;
return retval;
}
static zend_object_value php_imagickpixel_object_new_ex(zend_class_entry *class_type, php_imagickpixel_object **ptr TSRMLS_DC)
{
zend_object_value retval;
php_imagickpixel_object *intern;
/* Allocate memory for it */
intern = (php_imagickpixel_object *) emalloc(sizeof(php_imagickpixel_object));
memset(&intern->zo, 0, sizeof(zend_object));
if (ptr) {
*ptr = intern;
}
/* Set the pixeliterator */
intern->pixel_wand = NULL;
intern->initialized_via_iterator = 0;
/* 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_imagickpixel_object_free_storage, NULL TSRMLS_CC);
retval.handlers = (zend_object_handlers *) &imagickpixel_object_handlers;
return retval;
}
#undef object_properties_init
static zend_object_value php_imagickpixel_object_new(zend_class_entry *class_type TSRMLS_DC)
{
return php_imagickpixel_object_new_ex(class_type, NULL TSRMLS_CC);
}
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.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;
}
#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_MEMORY(char *, format);
} else {
ZVAL_STRING(retval, "", 1);
}
}
}
}
}
if (member == &tmp_member) {
zval_dtor(member);
}
return retval;
}
static zend_object_value php_imagick_clone_imagick_object(zval *this_ptr TSRMLS_DC)
{
MagickWand *wand_copy = NULL;
php_imagick_object *new_obj = NULL;
php_imagick_object *old_obj = (php_imagick_object *) zend_object_store_get_object(this_ptr TSRMLS_CC);
zend_object_value new_ov = php_imagick_object_new_ex(old_obj->zo.ce, &new_obj, 0 TSRMLS_CC);
zend_objects_clone_members(&new_obj->zo, new_ov, &old_obj->zo, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
wand_copy = CloneMagickWand(old_obj->magick_wand);
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_ov;
}
static zend_object_value php_imagick_clone_imagickdraw_object(zval *this_ptr TSRMLS_DC)
{
DrawingWand *wand_copy = NULL;
php_imagickdraw_object *new_obj = NULL;
php_imagickdraw_object *old_obj = (php_imagickdraw_object *) zend_object_store_get_object(this_ptr TSRMLS_CC);
zend_object_value new_ov = php_imagickdraw_object_new_ex(old_obj->zo.ce, &new_obj, 0 TSRMLS_CC);
zend_objects_clone_members(&new_obj->zo, new_ov, &old_obj->zo, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
wand_copy = CloneDrawingWand(old_obj->drawing_wand);
IMAGICKDRAW_REPLACE_DRAWINGWAND(new_obj, wand_copy);
return new_ov;
}
static zend_object_value php_imagick_clone_imagickpixel_object(zval *this_ptr TSRMLS_DC)
{
PixelWand *wand_copy = NULL;
php_imagickpixel_object *new_obj = NULL;
php_imagickpixel_object *old_obj = (php_imagickpixel_object *) zend_object_store_get_object(this_ptr TSRMLS_CC);
zend_object_value new_ov = php_imagickpixel_object_new_ex(old_obj->zo.ce, &new_obj TSRMLS_CC);
zend_objects_clone_members(&new_obj->zo, new_ov, &old_obj->zo, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
IMAGICK_CLONE_PIXELWAND(old_obj->pixel_wand, wand_copy);
IMAGICKPIXEL_REPLACE_PIXELWAND(new_obj, wand_copy);
new_obj->initialized_via_iterator = 0;
return new_ov;
}
PHP_MINIT_FUNCTION(imagick)
{
zend_class_entry ce;
/* Initialize globals */
ZEND_INIT_MODULE_GLOBALS(imagick, php_imagick_init_globals, NULL);
/*
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));
/* Setup magickwand env */
MagickWandGenesis();
/*
Initialize exceptions (Imagick exception)
*/
INIT_CLASS_ENTRY(ce, PHP_IMAGICK_EXCEPTION_SC_NAME, NULL);
php_imagick_exception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC);
php_imagick_exception_class_entry->ce_flags |= ZEND_ACC_FINAL;
/*
Initialize exceptions (ImagickDraw exception)
*/
INIT_CLASS_ENTRY(ce, PHP_IMAGICKDRAW_EXCEPTION_SC_NAME, NULL);
php_imagickdraw_exception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC);
php_imagickdraw_exception_class_entry->ce_flags |= ZEND_ACC_FINAL;
/*
Initialize exceptions (ImagickPixelIterator exception)
*/
INIT_CLASS_ENTRY(ce, PHP_IMAGICKPIXELITERATOR_EXCEPTION_SC_NAME, NULL);
php_imagickpixeliterator_exception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC);
php_imagickpixeliterator_exception_class_entry->ce_flags |= ZEND_ACC_FINAL;
/*
Initialize exceptions (ImagickPixel exception)
*/
INIT_CLASS_ENTRY(ce, PHP_IMAGICKPIXEL_EXCEPTION_SC_NAME, NULL);
php_imagickpixel_exception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC);
php_imagickpixel_exception_class_entry->ce_flags |= ZEND_ACC_FINAL;
/*
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;
php_imagick_sc_entry = zend_register_internal_class(&ce TSRMLS_CC);
zend_class_implements(php_imagick_sc_entry TSRMLS_CC, 1, zend_ce_iterator);
/*
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;
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;
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;
php_imagickpixel_sc_entry = zend_register_internal_class(&ce TSRMLS_CC);
initialize_imagick_constants();
#if defined(ZTS) && defined(PHP_WIN32)
imagick_mutex = tsrm_mutex_alloc();
#endif
REGISTER_INI_ENTRIES();
return SUCCESS;
}
PHP_MINFO_FUNCTION(imagick)
{
smart_str formats = {0};
char **supported_formats, buffer[52];
unsigned long version_number, num_formats = 0, i;
supported_formats = MagickQueryFormats("*", &num_formats);
snprintf(buffer, 52, "%ld", 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);
php_info_print_table_row(2, "imagick classes", "Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator");
php_info_print_table_row(2, "ImageMagick 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);
if (supported_formats) {
for (i = 0; i < num_formats; i++) {
smart_str_appends(&formats, supported_formats[i]);
if (i != (num_formats - 1)) {
smart_str_appends(&formats, ", ");
}
IMAGICK_FREE_MEMORY(char *, supported_formats[i]);
}
smart_str_0(&formats);
php_info_print_table_row(2, "ImageMagick supported formats", formats.c);
smart_str_free(&formats);
IMAGICK_FREE_MEMORY(char **, supported_formats);
}
php_info_print_table_end();
DISPLAY_INI_ENTRIES();
}
PHP_MSHUTDOWN_FUNCTION(imagick)
{
/* Destroy the magick wand env */
MagickWandTerminus();
#if defined(ZTS) && defined(PHP_WIN32)
tsrm_mutex_free(imagick_mutex);
#endif
UNREGISTER_INI_ENTRIES();
return(SUCCESS);
}
#if defined(ZTS) && defined(PHP_WIN32)
PHP_RSHUTDOWN_FUNCTION(imagick)
{
/* 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);
}
return SUCCESS;
}
#endif
zend_module_entry imagick_module_entry =
{
#if ZEND_MODULE_API_NO >= 20010901
STANDARD_MODULE_HEADER,
#endif
PHP_IMAGICK_EXTNAME,
php_imagick_functions, /* Functions */
PHP_MINIT(imagick), /* MINIT */
PHP_MSHUTDOWN(imagick), /* MSHUTDOWN */
NULL, /* RINIT */
#if defined(ZTS) && defined(PHP_WIN32)
PHP_RSHUTDOWN(imagick),
#else
NULL, /* RSHUTDOWN */
#endif
PHP_MINFO(imagick), /* MINFO */
PHP_IMAGICK_VERSION,
STANDARD_MODULE_PROPERTIES
};
#ifdef COMPILE_DL_IMAGICK
ZEND_GET_MODULE(imagick)
#endif
imagick-3.1.2/imagick_class.c 0000644 0000765 0000024 00001052751 12220473715 015071 0 ustar mikko staff /*
+----------------------------------------------------------------------+
| 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;
int filename_len;
php_imagick_object *intern;
zval *zstream;
php_stream *stream;
int result;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|s!", &zstream, &filename, &filename_len) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
php_stream_from_zval(stream, &zstream);
result = php_imagick_stream_handler(intern, stream, ImagickPingImageFile TSRMLS_CC);
if (result == 1) {
RETURN_FALSE;
} else if (result == 2) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to ping image from the filehandle", 1);
}
if (filename) {
MagickSetImageFilename(intern->magick_wand, filename);
IMAGICK_CORRECT_ITERATOR_POSITION(intern);
}
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;
int 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) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Empty image string passed", 1);
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
status = MagickPingImageBlob(intern->magick_wand, image_string, image_string_len);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to ping image blob", 1);
}
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;
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickVignetteImage(intern->magick_wand, black_point, white_point, x, y);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to apply vignette filter", 1);
}
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickTransposeImage(intern->magick_wand);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to transpose image", 1);
}
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickTransverseImage(intern->magick_wand);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to transverse image", 1);
}
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;
long channel = DefaultChannels;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd|l", &radius, &sigma, &channel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickAdaptiveBlurImageChannel(intern->magick_wand, channel, radius, sigma);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to adaptive blur image", 1);
}
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickUniqueImageColors(intern->magick_wand);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get unique image colors", 1);
}
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;
long channel = DefaultChannels;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd|l", &black_point, &white_point, &channel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickContrastStretchImageChannel(intern->magick_wand, channel, black_point, white_point);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to contrast strech image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ 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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
matte = MagickGetImageMatte(intern->magick_wand);
if (matte == MagickTrue) {
RETURN_TRUE;
} else {
RETURN_FALSE;
}
}
/* }}} */
/* {{{ 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageMatte(intern->magick_wand, matte);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image matte", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::adaptiveResizeImage(int width, int height[, bool bestfit])
Adaptively resize image with data dependent triangulation
*/
PHP_METHOD(imagick, adaptiveresizeimage)
{
php_imagick_object *intern;
MagickBooleanType status;
long width, height, new_width, new_height;
zend_bool bestfit = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll|b", &width, &height, &bestfit) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
if (!php_imagick_thumbnail_dimensions(intern->magick_wand, bestfit, width, height, &new_width, &new_height)) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Invalid image geometry", 1);
}
status = MagickAdaptiveResizeImage(intern->magick_wand, new_width, new_height);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to adaptive resize image", 1);
}
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSketchImage(intern->magick_wand, sigma, radius, angle);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to sketch image", 1);
}
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickShadeImage(intern->magick_wand, gray, azimuth, elevation);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to shade image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto int Imagick::getSizeOffset()
Returns the size offset associated with the Imagick object
*/
PHP_METHOD(imagick, getsizeoffset)
{
php_imagick_object *intern;
long offset;
MagickBooleanType status;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
status = MagickGetSizeOffset(intern->magick_wand, &offset);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get size offset", 1);
}
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;
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
status = MagickSetSizeOffset(intern->magick_wand, columns, rows, offset);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set size offset", 1);
}
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;
long channel = DefaultChannels;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd|l", &radius, &sigma, &channel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickAdaptiveSharpenImageChannel(intern->magick_wand, channel, radius, sigma);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to adaptive sharpen image", 1);
}
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;
long channel = DefaultChannels;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd|l", &low, &high, &channel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickRandomThresholdImageChannel(intern->magick_wand, channel, low, high);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to random threshold image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto string Imagick::roundCornersImage(float x_rounding, float y_rounding[, float stroke_width, float displace, float size_correction] )
Rounds image corners
*/
PHP_METHOD(imagick, roundcornersimage)
{
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;
char *old_locale = NULL, *buffer = NULL;
zend_bool restore = 0;
/* 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
image_width = MagickGetImageWidth(intern->magick_wand);
image_height = MagickGetImageHeight(intern->magick_wand);
if (!image_width || !image_height) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Unable to round corners on empty image", 1);
}
status = MagickSetImageMatte(intern->magick_wand, MagickTrue);
if (status == MagickFalse) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Unable to set image matte", 1);
}
/* Here we go.. */
color = (PixelWand *)NewPixelWand();
draw = (DrawingWand *)NewDrawingWand();
mask_image = (MagickWand *)NewMagickWand();
#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();
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Unable to set pixel color", 1);
}
status = MagickNewImage(mask_image, image_width, image_height, color);
if (status == MagickFalse) {
exit_cleanup();
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Unable to allocate mask image", 1);
}
MagickSetImageBackgroundColor(mask_image, color);
status = PixelSetColor(color, "white");
if (status == MagickFalse) {
exit_cleanup();
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Unable to set pixel color", 1);
}
DrawSetFillColor(draw, color);
status = PixelSetColor(color, "black");
if (status == MagickFalse) {
exit_cleanup();
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Unable to set pixel color", 1);
}
DrawSetStrokeColor(draw, color);
DrawSetStrokeWidth(draw, stroke_width);
DrawRoundRectangle(draw, displace, displace, image_width + correction, image_height + correction, x_rounding, y_rounding);
IMAGICK_SET_LOCALE(old_locale, buffer, restore);
status = MagickDrawImage(mask_image, draw);
IMAGICK_RESTORE_LOCALE(old_locale, restore);
if (status == MagickFalse) {
exit_cleanup();
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Unable to draw on image", 1);
}
status = MagickCompositeImage(intern->magick_wand, mask_image, DstInCompositeOp, 0, 0);
if (status == MagickFalse) {
exit_cleanup();
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Unable to composite image", 1);
}
exit_cleanup();
RETURN_TRUE;
#undef exit_cleanup
}
/* }}} */
/* {{{ 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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
status = MagickSetIteratorIndex(intern->magick_wand, index);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set iterator index", 1);
}
intern->next_out_of_bound = 0;
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::transformimage(string crop, string geometry )
Comfortability method for crop and resize
*/
PHP_METHOD(imagick, transformimage)
{
char *crop, *geometry;
int 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
transformed = MagickTransformImage(intern->magick_wand, crop, geometry);
if (transformed == (MagickWand *)NULL) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Transforming image failed", 1);
}
object_init_ex(return_value, php_imagick_sc_entry);
intern_return = (php_imagick_object *)zend_object_store_get_object(return_value TSRMLS_CC);
IMAGICK_REPLACE_MAGICKWAND(intern_return, transformed);
return;
}
/* }}} */
#endif
#if MagickLibVersion > 0x630
/* {{{ 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageOpacity(intern->magick_wand, opacity);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image opacity", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::orderedposterizeImage(string threshold_map[, int CHANNEL])
Performs an ordered dither
*/
PHP_METHOD(imagick, orderedposterizeimage)
{
char *map;
int map_len;
MagickBooleanType status;
php_imagick_object *intern;
long channel = DefaultChannels;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &map, &map_len, &channel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickOrderedPosterizeImageChannel(intern->magick_wand, channel, map);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to posterize image", 1);
}
RETURN_TRUE;
}
/* }}} */
#endif
#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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
internd = (php_imagickdraw_object *)zend_object_store_get_object(objvar TSRMLS_CC);
status = MagickPolaroidImage(intern->magick_wand, internd->drawing_wand, angle);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to polaroid image", 1);
}
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;
int name_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
value = MagickGetImageProperty(intern->magick_wand, name);
if (value) {
ZVAL_STRING(return_value, (char *)value, 1);
IMAGICK_FREE_MEMORY(char *, 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;
int 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageProperty(intern->magick_wand, name, value);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image property", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ 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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
interpolate = MagickGetImageInterpolateMethod(intern->magick_wand);
RETVAL_LONG(interpolate);
}
/* }}} */
/* {{{ proto bool Imagick::setImageInterpolateMethod(int method)
Sets the image interpolate pixel method.
*/
PHP_METHOD(imagick, setimageinterpolatemethod)
{
php_imagick_object *intern;
long interpolate;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &interpolate) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageInterpolateMethod(intern->magick_wand, interpolate);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set the image interpolate method", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickLinearStretchImage(intern->magick_wand, blackPoint, whitePoint);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to linear strech image", 1);
}
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickGetImageLength(intern->magick_wand, &length);
if (status == MagickFalse) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Unable to acquire image length", 1);
}
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;
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickExtentImage(intern->magick_wand, width, height, x, y);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to extent image", 1);
}
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
RETVAL_LONG(MagickGetImageOrientation(intern->magick_wand));
}
/* }}} */
/* {{{ proto Imagick Imagick::setImageOrientation(int orientation)
Sets the image orientation
*/
PHP_METHOD(imagick, setimageorientation)
{
php_imagick_object *intern;
long orientation;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &orientation) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageOrientation(intern->magick_wand, orientation);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image orientation", 1);
}
RETURN_TRUE;
}
/* }}} */
#endif
#if MagickLibVersion > 0x634
/* {{{ 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;
php_imagickpixel_object *intern_fill, *intern_border;
zval *fill_param, *border_param;
long x, y, channel = DefaultChannels;
double fuzz;
MagickBooleanType status;
/* 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
IMAGICK_CAST_PARAMETER_TO_COLOR(fill_param, intern_fill, 1);
if (Z_TYPE_P(border_param) == IS_NULL) {
status = MagickPaintFloodfillImage(intern->magick_wand, channel, intern_fill->pixel_wand, fuzz, NULL, x, y);
} else {
IMAGICK_CAST_PARAMETER_TO_COLOR(border_param, intern_border, 1);
status = MagickPaintFloodfillImage(intern->magick_wand, channel, intern_fill->pixel_wand, fuzz, intern_border->pixel_wand, x, y);
}
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to paint floodfill image", 1);
}
RETURN_TRUE;
}
/* }}} */
#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;
long channel = DefaultChannels;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|d", &objvar, php_imagick_sc_entry, &channel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
lookup = (php_imagick_object *)zend_object_store_get_object(objvar TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(lookup->magick_wand, 1, 1);
status = MagickClutImageChannel(intern->magick_wand, channel, lookup->magick_wand);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to replace colors in the image from a color lookup table", 1);
}
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;
int pattern_len;
unsigned long properties_count, i;
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
properties = MagickGetImageProperties(intern->magick_wand, pattern, &properties_count);
if (!properties) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Unable to get image properties", 1);
}
array_init(return_value);
if (values) {
for (i = 0; i < properties_count; i++) {
property = MagickGetImageProperty(intern->magick_wand, properties[i]);
add_assoc_string(return_value, properties[i], property, 1);
IMAGICK_FREE_MEMORY(char *, property);
}
} else {
for (i = 0; i < properties_count; i++) {
add_next_index_string(return_value, properties[i], 1);
}
}
IMAGICK_FREE_MEMORY(char **, 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;
int pattern_len;
unsigned long profiles_count, i;
php_imagick_object *intern;
size_t length;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sb", &pattern, &pattern_len, &values) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
profiles = MagickGetImageProfiles(intern->magick_wand, pattern, &profiles_count);
if (!profiles) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Unable to get image profiles", 1);
}
array_init(return_value);
if (values) {
for (i = 0; i < profiles_count; i++) {
profile = MagickGetImageProfile(intern->magick_wand, profiles[i], &length);
add_assoc_stringl(return_value, profiles[i], profile, length, 1);
IMAGICK_FREE_MEMORY(char *, profile);
}
} else {
for (i = 0; i < profiles_count; i++) {
add_next_index_string(return_value, profiles[i], 1);
}
}
IMAGICK_FREE_MEMORY(char **, 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;
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
arguments = get_double_array_from_zval(arg_array, &elements TSRMLS_CC);
if (!arguments) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Can't read argument array", 1);
}
status = MagickDistortImage(intern->magick_wand, distort_method, elements, arguments, bestfit);
efree(arguments);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to distort the image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::writeImageFile(resource $handle)
Writes image to an open filehandle
*/
PHP_METHOD(imagick, writeimagefile)
{
php_imagick_object *intern;
zval *zstream;
php_stream *stream;
int result;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zstream) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
php_stream_from_zval(stream, &zstream);
result = php_imagick_stream_handler(intern, stream, ImagickWriteImageFile TSRMLS_CC);
if (result == 1) {
RETURN_FALSE;
} else if (result == 2) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to write image to the filehandle", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::writeImagesFile(resource $handle)
Writes images to an open filehandle
*/
PHP_METHOD(imagick, writeimagesfile)
{
php_imagick_object *intern;
zval *zstream;
php_stream *stream;
int result;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zstream) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
php_stream_from_zval(stream, &zstream);
result = php_imagick_stream_handler(intern, stream, ImagickWriteImagesFile TSRMLS_CC);
if (result == 1) {
RETURN_FALSE;
} else if (result == 2) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to write images to the filehandle", 1);
}
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;
int page_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &page, &page_len) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickResetImagePage(intern->magick_wand, page);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to reset image page", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto Imagick Imagick::getImageClipMask()
Gets image clip mask
*/
PHP_METHOD(imagick, getimageclipmask)
{
MagickWand *tmp_wand;
php_imagick_object *intern;
php_imagick_object *intern_return;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
tmp_wand = MagickGetImageClipMask(intern->magick_wand);
/* No magick is going to happen */
if (tmp_wand == NULL) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get image clip mask", 1);
}
object_init_ex(return_value, php_imagick_sc_entry);
intern_return = (php_imagick_object *)zend_object_store_get_object(return_value TSRMLS_CC);
IMAGICK_REPLACE_MAGICKWAND(intern_return, tmp_wand);
return;
}
/* }}} */
/* {{{ proto bool Imagick::setImageClipMask(Imagick clip_mask)
Sets the image clip mask
*/
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
clip_mask = (php_imagick_object *)zend_object_store_get_object(objvar TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(clip_mask->magick_wand, 1, 1);
status = MagickSetImageClipMask(intern->magick_wand, clip_mask->magick_wand);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image clip mask", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ 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;
int server_name_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &server_name, &server_name_len) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
(void)MagickSetFirstIterator(intern->magick_wand);
status = MagickAnimateImages(intern->magick_wand, server_name);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to animate images", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::recolorImage(array matrix)
Translate, scale, shear, or rotate image colors
*/
PHP_METHOD(imagick, recolorimage)
{
php_imagick_object *intern;
MagickBooleanType status;
long num_elements;
zval *matrix;
double *array;
unsigned long order;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &matrix) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
array = get_double_array_from_zval(matrix, &num_elements TSRMLS_CC);
if (!array) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "The map contains disallowed characters", 1);
}
order = (unsigned long)sqrt(num_elements);
if (pow((double)order, 2) != num_elements) {
efree(array);
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "The color matrix must contain a square number of elements", 1);
}
status = MagickRecolorImage(intern->magick_wand, order, array);
efree(array);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to recolor image", 1);
}
RETURN_TRUE;
}
/* }}} */
#endif
#if MagickLibVersion > 0x636
PHP_METHOD(imagick, setfont)
{
php_imagick_object *intern;
char *font, *absolute;
int font_len, error = 0;
MagickBooleanType status;
/* 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) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Can not set empty font", 1);
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
/* And if it wasn't */
if (!check_configured_font(font, font_len TSRMLS_CC)) {
if (!(absolute = expand_filepath(font, NULL TSRMLS_CC))) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Unable to set font", 1);
}
/* Do a safe-mode check for the font */
IMAGICK_SAFE_MODE_CHECK(absolute, error);
IMAGICK_CHECK_READ_OR_WRITE_ERROR(intern, absolute, error, IMAGICK_FREE_FILENAME, "Unable to read the file: %s");
if (VCWD_ACCESS(absolute, F_OK|R_OK)) {
zend_throw_exception_ex(php_imagick_exception_class_entry, 2 TSRMLS_CC,
"The given font is not found in the ImageMagick configuration and the file (%s) is not accessible", absolute);
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) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set font", 1);
}
RETURN_TRUE;
}
PHP_METHOD(imagick, getfont)
{
char *font;
php_imagick_object *intern;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
font = MagickGetFont(intern->magick_wand);
if (font) {
ZVAL_STRING(return_value, font, 1);
IMAGICK_FREE_MEMORY(char *, 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
status = MagickSetPointsize(intern->magick_wand, point_size);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set font", 1);
}
RETURN_TRUE;
}
PHP_METHOD(imagick, getpointsize)
{
php_imagick_object *intern;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
RETVAL_DOUBLE(MagickGetPointsize(intern->magick_wand));
}
PHP_METHOD(imagick, mergeimagelayers)
{
php_imagick_object *intern, *intern_return;
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
/* Reset the iterator */
(void)MagickSetFirstIterator(intern->magick_wand);
merged = MagickMergeImageLayers(intern->magick_wand, layer_method);
/* No magick is going to happen */
if (!merged) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to merge image layers", 1);
}
object_init_ex(return_value, php_imagick_sc_entry);
intern_return = (php_imagick_object *)zend_object_store_get_object(return_value TSRMLS_CC);
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;
long x, y, channel = DefaultChannels;
zend_bool invert;
php_imagickpixel_object *fill_obj, *border_obj;
double fuzz;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zdzllb|l",
&fill_param, &fuzz, &border_param, &x, &y, &invert, &channel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
IMAGICK_CAST_PARAMETER_TO_COLOR(fill_param, fill_obj, 1);
IMAGICK_CAST_PARAMETER_TO_COLOR(border_param, border_obj, 1);
status = MagickFloodfillPaintImage(intern->magick_wand, channel, fill_obj->pixel_wand, fuzz, border_obj->pixel_wand, x, y, invert);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to floodfill paint image", 1);
}
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;
php_imagickpixel_object *fill_obj, *target_obj;
zend_bool invert;
double fuzz;
long channel = DefaultChannels;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzdb|l", &fill_param, &target_param, &fuzz, &invert, &channel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
IMAGICK_CAST_PARAMETER_TO_COLOR(fill_param, fill_obj, 1);
IMAGICK_CAST_PARAMETER_TO_COLOR(target_param, target_obj, 1);
status = MagickOpaquePaintImageChannel(intern->magick_wand, channel, fill_obj->pixel_wand, target_obj->pixel_wand, fuzz, invert);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to opaque paint image", 1);
}
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;
php_imagickpixel_object *target_obj;
zend_bool invert;
double fuzz, alpha;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zddb", &target_param, &alpha, &fuzz, &invert) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
IMAGICK_CAST_PARAMETER_TO_COLOR(target_param, target_obj, 1);
status = MagickTransparentPaintImage(intern->magick_wand, target_obj->pixel_wand, alpha, fuzz, invert);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to paint transparent image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto Imagick Imagick::setImageAlphaChannel(int ALPHACHANNEL )
Activates, deactivates, resets, or sets the alpha channel
*/
PHP_METHOD(imagick, setimagealphachannel)
{
php_imagick_object *intern;
long alpha_channel;
MagickBooleanType status;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &alpha_channel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageAlphaChannel(intern->magick_wand, alpha_channel);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image alpha channel", 1);
}
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;
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickLiquidRescaleImage(intern->magick_wand, cols, rows, delta_x, rigidity);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to liquid rescale image", 1);
}
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;
int passphrase_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &passphrase, &passphrase_len) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickDecipherImage(intern->magick_wand, passphrase);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to decipher image", 1);
}
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;
int passphrase_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &passphrase, &passphrase_len) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickEncipherImage(intern->magick_wand, passphrase);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to encipher image", 1);
}
RETURN_TRUE;
}
/* }}} */
#endif
#if MagickLibVersion > 0x639
/* {{ proto bool Imagick::setGravity(int GRAVITY)
Sets the gravity value
*/
PHP_METHOD(imagick, setgravity)
{
php_imagick_object *intern;
long gravity;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &gravity) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
if (MagickSetGravity(intern->magick_wand, gravity) == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set gravity", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{ proto int Imagick::getGravity()
Gets the gravity value
*/
PHP_METHOD(imagick, getgravity)
{
php_imagick_object *intern;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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;
long channel;
double maxima, minima;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &channel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
if (MagickGetImageChannelRange(intern->magick_wand, channel, &minima, &maxima) == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get channel range", 1);
}
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
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;
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
intern_reference = (php_imagick_object *)zend_object_store_get_object(reference_param TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern_reference->magick_wand, 1, 1);
status = MagickGetImageChannelDistortion(intern->magick_wand, intern_reference->magick_wand, channel, metric, &distortion);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get image channel distortion metrics", 1);
}
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
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;
long gravity;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &gravity) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageGravity(intern->magick_wand, gravity);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image gravity", 1);
}
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;
long *long_array;
unsigned char *char_array;
php_imagick_object *intern;
MagickBooleanType status;
long storage, num_elements;
long x, y, width, height;
int 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
if (x < 0 || y < 0) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "The coordinates must be non-negative", 1);
}
if (width <= 0 || height <= 0) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "The width and height must be greater than zero", 1);
}
array = Z_ARRVAL_P(pixels);
if (zend_hash_num_elements(array) != ((width * height) * map_len)) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "The map contains incorrect number of elements", 1);
} else {
if (!php_imagick_validate_map(map TSRMLS_CC)) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "The map contains disallowed characters", 1);
}
}
switch (storage) {
case FloatPixel:
case DoublePixel:
/* Use doubles */
storage = DoublePixel;
double_array = (double *)get_double_array_from_zval(pixels, &num_elements TSRMLS_CC);
if (!double_array) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "The map must contain only numeric values", 1);
}
status = MagickImportImagePixels(intern->magick_wand, x, y, width, height, map, storage, double_array);
efree(double_array);
break;
case ShortPixel:
case IntegerPixel:
case LongPixel:
/* Use longs */
storage = LongPixel;
long_array = (long *)get_long_array_from_zval(pixels, &num_elements TSRMLS_CC);
if (!long_array) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "The map must contain only numeric values", 1);
}
status = MagickImportImagePixels(intern->magick_wand, x, y, width, height, map, storage, long_array);
efree(long_array);
break;
case CharPixel:
char_array = (unsigned char *)get_char_array_from_zval(pixels, &num_elements TSRMLS_CC);
if (!char_array) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "The character array contains incorrect values", 1);
}
status = MagickImportImagePixels(intern->magick_wand, x, y, width, height, map, storage, char_array);
efree(char_array);
break;
default:
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Unknown storage format", 1);
break;
}
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to import image pixels", 1);
}
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickDeskewImage(intern->magick_wand, threshold);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to deskew image", 1);
}
RETURN_TRUE;
}
PHP_METHOD(imagick, segmentimage)
{
php_imagick_object *intern;
MagickBooleanType status;
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSegmentImage(intern->magick_wand, colorspace, verbose, cluster_threshold, smooth_threshold);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to segment image", 1);
}
RETURN_TRUE;
}
PHP_METHOD(imagick, sparsecolorimage)
{
php_imagick_object *intern;
MagickBooleanType status;
long num_elements, sparse_method, channel = DefaultChannels;
zval *arguments;
double *double_array;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "la|l", &sparse_method, &arguments, &channel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
double_array = (double *)get_double_array_from_zval(arguments, &num_elements TSRMLS_CC);
if (!double_array) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "The map must contain only numeric values", 1);
}
status = MagickSparseColorImage(intern->magick_wand, channel, sparse_method, num_elements, double_array);
efree(double_array);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to sparse color image", 1);
}
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;
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
intern_remap = (php_imagick_object *)zend_object_store_get_object(remap_param TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern_remap->magick_wand, 1, 1);
status = MagickRemapImage(intern->magick_wand, intern_remap->magick_wand, dither_method);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to remap image", 1);
}
RETURN_TRUE;
}
/* }}} */
#endif
#if MagickLibVersion > 0x646
/* {{{ proto bool Imagick::exportImagePixels(int x, int y, int width, int height, string map, INT STORAGE)
TODO: IMPLEMENTATION
*/
PHP_METHOD(imagick, exportimagepixels)
{
php_imagick_object *intern;
MagickBooleanType status;
long x, y, width, height, storage;
char *map;
int map_size, map_len, i = 0;
double *double_array;
long *long_array;
char *char_array;
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)) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "The coordinates must be non-negative", 1);
}
if (width <= 0 || height <= 0) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "The width and height must be greater than zero", 1);
}
if (!php_imagick_validate_map(map TSRMLS_CC)) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "The map contains disallowed characters", 1);
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
map_size = (map_len * width * height);
switch (storage) {
case FloatPixel:
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:
case IntegerPixel:
case LongPixel:
long_array = emalloc(map_size * sizeof(long));
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;
default:
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Unknown storage format", 1);
break;
}
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to export image pixels", 1);
}
RETURN_TRUE;
}
/* }}} */
#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;
long channel = DefaultChannels;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &channel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickGetImageChannelKurtosis(intern->magick_wand, channel, &kurtosis, &skewness);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get image channel kurtosis", 1);
}
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;
long func, num_elements, channel = DefaultChannels;
double *array;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "la|l", &func, &arguments, &channel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
array = get_double_array_from_zval(arguments, &num_elements TSRMLS_CC);
if (!array) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "The arguments array contains disallowed characters", 1);
}
status = MagickFunctionImageChannel(intern->magick_wand, channel, func, num_elements, array);
efree(array);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to execute function on the image", 1);
}
RETURN_TRUE;
}
/* }}} */
#endif
#if MagickLibVersion > 0x651
/* {{{ proto boolean Imagick::transformImageColorspace()
Transform image colorspace
*/
PHP_METHOD(imagick, transformimagecolorspace)
{
php_imagick_object *intern;
long colorspace;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &colorspace) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickTransformImageColorspace(intern->magick_wand, colorspace);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to transform image colorspace", 1);
}
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;
long channel = DefaultChannels;
/* 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
hald = (php_imagick_object *)zend_object_store_get_object(objvar TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(hald->magick_wand, 1, 1);
status = MagickHaldClutImageChannel(intern->magick_wand, channel, hald->magick_wand);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to hald clut image", 1);
}
RETURN_TRUE;
}
/* }}} */
#endif
#if MagickLibVersion > 0x656
PHP_METHOD(imagick, setimageartifact)
{
php_imagick_object *intern;
MagickBooleanType status;
char *artifact, *value;
int artifact_len, value_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &artifact, &artifact_len, &value, &value_len) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageArtifact(intern->magick_wand, artifact, value);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image artifact", 1);
}
RETURN_TRUE;
}
PHP_METHOD(imagick, getimageartifact)
{
php_imagick_object *intern;
char *artifact, *value;
int artifact_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &artifact, &artifact_len) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
value = MagickGetImageArtifact(intern->magick_wand, artifact);
if (!value) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get image artifact", 1);
}
RETVAL_STRING(value, 1);
IMAGICK_FREE_MEMORY(char *, value);
return;
}
/* {{{ proto boolean Imagick::deleteImageArtifact(string $artifact)
Delete image artifact
*/
PHP_METHOD(imagick, deleteimageartifact)
{
php_imagick_object *intern;
MagickBooleanType status;
char *artifact;
int artifact_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &artifact, &artifact_len) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickDeleteImageArtifact(intern->magick_wand, artifact);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to delete image artifact", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto integer Imagick::getColorspace()
Get the object colorspace property
*/
PHP_METHOD(imagick, getcolorspace)
{
php_imagick_object *intern;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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;
long colorspace;
MagickBooleanType status;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &colorspace) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
status = MagickSetColorspace(intern->magick_wand, colorspace);
RETURN_BOOL(status == MagickTrue);
}
/* }}} */
#endif
/* {{{ proto Imagick Imagick::__construct([mixed files] )
The Imagick constructor
*/
PHP_METHOD(imagick, __construct)
{
php_imagick_object *intern;
zval *files = NULL;
HashPosition pos;
int status = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z!", &files) == FAILURE) {
return;
}
/* No files given.. or null passed */
if (!files) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
/* 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)) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "The filename is too long", 1);
}
status = php_imagick_read_file(intern, &file, ImagickReadImage TSRMLS_CC);
php_imagick_file_deinit(&file);
IMAGICK_CHECK_READ_OR_WRITE_ERROR(intern, Z_STRVAL_P(files), status, IMAGICK_DONT_FREE_FILENAME, "Unable to read the file: %s");
}
/* an array of filenames was given */
if (Z_TYPE_P(files) == IS_ARRAY) {
char *filename = NULL;
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)) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "The filename is too long", 1);
}
status = php_imagick_read_file(intern, &file, ImagickReadImage TSRMLS_CC);
php_imagick_file_deinit(&file);
if (status != IMAGICK_READ_WRITE_NO_ERROR) {
filename = estrdup(Z_STRVAL_PP(ppzval));
break;
}
}
IMAGICK_CHECK_READ_OR_WRITE_ERROR(intern, filename, status, IMAGICK_FREE_FILENAME, "Unable to read the file: %s");
RETURN_TRUE;
}
}
/* }}} */
/* {{{ 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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
if (MagickGetNumberImages(intern->magick_wand) == 0) {
ZVAL_STRING(return_value, "", 1);
return;
}
buffer = MagickGetImageFormat(intern->magick_wand);
if (!buffer) {
ZVAL_STRING(return_value, "", 1);
return;
} else {
IMAGICK_FREE_MEMORY(char *, buffer);
}
image = MagickGetImageBlob(intern->magick_wand, &image_size);
ZVAL_STRINGL(return_value, (char *)image, image_size, 1);
IMAGICK_FREE_MEMORY(unsigned char *, image);
return;
}
/* }}} */
/* {{{ proto array Imagick::queryFormats([string pattern] )
Returns formats supported by ImageMagick
*/
PHP_METHOD(imagick, queryformats)
{
char **supported_formats;
unsigned long num_formats = 0, i;
char *pattern = "*";
int pattern_len = 1;
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++) {
add_next_index_string(return_value, supported_formats[i], 1);
IMAGICK_FREE_MEMORY(char *, supported_formats[i]);
}
IMAGICK_FREE_MEMORY(char **, supported_formats);
return;
}
/* }}} */
/* {{{ proto array Imagick::queryFonts([string pattern] )
Returns fonts supported by ImageMagick
*/
PHP_METHOD(imagick, queryfonts)
{
char **fonts;
unsigned long num_fonts = 0, i;
char *pattern = "*";
int pattern_len = 1;
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++) {
add_next_index_string(return_value, fonts[i], 1);
IMAGICK_FREE_MEMORY(char *, fonts[i]);
}
IMAGICK_FREE_MEMORY(char **, 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 = NULL;
zend_bool remove_canvas = 0, query_multiline;
php_imagick_object *intern;
php_imagickdraw_object *internd;
char *text;
int text_len;
double *metrics;
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 (count_occurences_of('\n', text TSRMLS_CC ) > 0) {
query_multiline = 1;
} else {
query_multiline = 0;
}
} else {
convert_to_boolean(multiline);
query_multiline = Z_BVAL_P(multiline);
}
/* fetch the objects */
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
internd = (php_imagickdraw_object *)zend_object_store_get_object(objvar TSRMLS_CC);
/* 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) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to allocate background color for the temporary canvas", 1);
}
/* 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) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to allocate temporary canvas", 1);
}
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) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Failed to query the font metrics", 1);
} else {
zval *bounding;
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]);
MAKE_STD_ZVAL(bounding);
array_init(bounding);
add_assoc_double(bounding, "x1", metrics[7]);
add_assoc_double(bounding, "y1", metrics[8]);
add_assoc_double(bounding, "x2", metrics[9]);
add_assoc_double(bounding, "y2", metrics[10]);
add_assoc_zval(return_value, "boundingBox", bounding);
add_assoc_double(return_value, "originX", metrics[11]);
add_assoc_double(return_value, "originY", metrics[12]);
IMAGICK_FREE_MEMORY(double *, 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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
if (intern->next_out_of_bound > 0) {
RETURN_FALSE;
}
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
RETURN_ZVAL(getThis(), 1, 0);
}
/* }}} */
/* {{{ proto bool Imagick::readImage(string filename)
Reads image from filename
*/
PHP_METHOD(imagick, readimage)
{
char *filename;
int filename_len, status;
php_imagick_object *intern;
struct php_imagick_file_t file = {0};
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
if (!php_imagick_file_init(&file, filename, filename_len TSRMLS_CC)) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "The filename is too long", 1);
}
status = php_imagick_read_file(intern, &file, ImagickReadImage TSRMLS_CC);
php_imagick_file_deinit(&file);
IMAGICK_CHECK_READ_OR_WRITE_ERROR(intern, filename, status, IMAGICK_DONT_FREE_FILENAME, "Unable to read the file: %s");
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::readImages(array files )
Reads image from an array of filenames
*/
PHP_METHOD(imagick, readimages)
{
zval *files;
char *filename = NULL;
int status = 0;
php_imagick_object *intern;
HashPosition pos;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &files) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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)) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "The filename is too long", 1);
}
status = php_imagick_read_file(intern, &file, ImagickReadImage TSRMLS_CC);
php_imagick_file_deinit(&file);
if (status != IMAGICK_READ_WRITE_NO_ERROR) {
filename = estrdup(Z_STRVAL_PP(ppzval));
break;
}
}
IMAGICK_CHECK_READ_OR_WRITE_ERROR(intern, filename, status, IMAGICK_FREE_FILENAME, "Unable to read the file: %s");
RETURN_TRUE;
}
/* {{{ 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;
int filename_len;
int status = 0;
php_imagick_object *intern;
struct php_imagick_file_t file = {0};
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
if (!php_imagick_file_init(&file, filename, filename_len TSRMLS_CC)) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "The filename is too long", 1);
}
status = php_imagick_read_file(intern, &file, ImagickPingImage TSRMLS_CC);
php_imagick_file_deinit(&file);
IMAGICK_CHECK_READ_OR_WRITE_ERROR(intern, filename, status, IMAGICK_DONT_FREE_FILENAME, "Unable to ping the file: %s");
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::readImageFile(resource filehandle )
Reads image from open filehandle
*/
PHP_METHOD(imagick, readimagefile)
{
char *filename = NULL;
int filename_len;
php_imagick_object *intern;
zval *zstream;
int result;
php_stream *stream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|s!", &zstream, &filename, &filename_len) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
php_stream_from_zval(stream, &zstream);
result = php_imagick_stream_handler(intern, stream, ImagickReadImageFile TSRMLS_CC);
if (result == 1) {
RETURN_FALSE;
} else if (result == 2) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to read image from the filehandle", 1);
}
if (filename) {
MagickSetImageFilename(intern->magick_wand, filename);
IMAGICK_CORRECT_ITERATOR_POSITION(intern);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::displayImage(string serverName )
Displays an image
*/
PHP_METHOD(imagick, displayimage)
{
php_imagick_object *intern;
MagickBooleanType status;
char *server_name;
int 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickDisplayImage(intern->magick_wand, server_name);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to display image", 1);
}
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;
int 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickDisplayImages(intern->magick_wand, server_name);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to display images", 1);
}
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;
int 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 == 0) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Zero size image string passed", 1);
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
status = MagickReadImageBlob(intern->magick_wand, image_string, image_string_len);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to read image blob", 1);
}
/* Even if filename is null we need to give a name here. Otherwise segfaults will happen */
MagickSetImageFilename(intern->magick_wand, filename);
IMAGICK_CORRECT_ITERATOR_POSITION(intern);
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*/
long channel = DefaultChannels;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd|l", &radius, &sigma, &channel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickBlurImageChannel(intern->magick_wand, channel, radius, sigma);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to blur image", 1);
}
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickWaveImage(intern->magick_wand, amplitude, wave_length);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to wave image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::clear()
Clears all resources associated to Imagick object
*/
PHP_METHOD(imagick, clear)
{
php_imagick_object *intern;
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
if (intern->magick_wand == (MagickWand *)NULL) {
RETURN_FALSE;
}
ClearMagickWand(intern->magick_wand);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::destroy()
Destroys the Imagick object
*/
PHP_METHOD(imagick, destroy)
{
zval *object;
php_imagick_object *intern;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
object = getThis();
intern = (php_imagick_object *)zend_object_store_get_object(object TSRMLS_CC);
if (intern->magick_wand == (MagickWand *)NULL) {
RETURN_FALSE;
}
ClearMagickWand(intern->magick_wand);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::scaleImage(int width, int height[, bool bestfit = false] )
Scales the size of an image to the given dimensions. Passing zero as either of
the arguments will preserve dimension while scaling.
*/
PHP_METHOD(imagick, scaleimage)
{
long width, height, new_width, new_height;
php_imagick_object *intern;
MagickBooleanType status;
zend_bool bestfit = 0;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll|b", &width, &height, &bestfit) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
if (!php_imagick_thumbnail_dimensions(intern->magick_wand, bestfit, width, height, &new_width, &new_height)) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Invalid image geometry", 1);
}
status = MagickScaleImage(intern->magick_wand, new_width, new_height);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to scale image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::cropImage(int width, height, int x, int y )
Extracts a region of the image.
*/
PHP_METHOD(imagick, cropimage)
{
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickCropImage(intern->magick_wand, width, height, x, y);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to crop image", 1);
}
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSpreadImage(intern->magick_wand, radius);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to spread image", 1);
}
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSwirlImage(intern->magick_wand, degrees);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to swirl image", 1);
}
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickStripImage(intern->magick_wand);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to strip image", 1);
}
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickTrimImage(intern->magick_wand, fuzz);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to trim image", 1);
}
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;
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickChopImage(intern->magick_wand, width, height, x, y);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to chop image", 1);
}
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickClipImage(intern->magick_wand);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to clip image", 1);
}
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;
int 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
#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) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to clip path image", 1);
}
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
tmp_wand = MagickCoalesceImages(intern->magick_wand);
if (tmp_wand == (MagickWand *)NULL) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Coalesce image failed", 1);
}
object_init_ex(return_value, php_imagick_sc_entry);
intern_return = (php_imagick_object *)zend_object_store_get_object(return_value TSRMLS_CC);
IMAGICK_REPLACE_MAGICKWAND(intern_return, tmp_wand);
return;
}
/* }}} */
/* {{{ 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;
php_imagickpixel_object *intern_fill, *intern_border;
zval *fillParam, *borderParam;
long x, y;
double fuzz;
MagickBooleanType status;
IMAGICK_METHOD_DEPRECATED("Imagick", "colorFloodFillImage");
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zdzll", &fillParam, &fuzz, &borderParam, &x, &y) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
IMAGICK_CAST_PARAMETER_TO_COLOR(fillParam, intern_fill, 1);
IMAGICK_CAST_PARAMETER_TO_COLOR(borderParam, intern_border, 1);
status = MagickColorFloodfillImage(intern->magick_wand, intern_fill->pixel_wand, fuzz, intern_border->pixel_wand, x, y);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to color floodfill image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ 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;
long channel_type;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &channel_type) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
tmp_wand = MagickCombineImages(intern->magick_wand, channel_type);
if (tmp_wand == (MagickWand *)NULL) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Combine images failed", 1);
}
object_init_ex(return_value, php_imagick_sc_entry);
intern_return = (php_imagick_object *)zend_object_store_get_object(return_value TSRMLS_CC);
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
replace = (php_imagick_object *)zend_object_store_get_object(objvar TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(replace->magick_wand, 1, 1);
status = MagickSetImage(intern->magick_wand, replace->magick_wand);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set the image", 1);
}
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
tmp_wand = MagickGetImage(intern->magick_wand);
if (tmp_wand == (MagickWand *)NULL) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Get image failed", 1);
}
object_init_ex(return_value, php_imagick_sc_entry);
intern_return = (php_imagick_object *)zend_object_store_get_object(return_value TSRMLS_CC);
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
intern_add = (php_imagick_object *)zend_object_store_get_object(add_obj TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern_add->magick_wand, 1, 1);
status = MagickAddImage(intern->magick_wand, intern_add->magick_wand);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to add image", 1);
}
IMAGICK_CORRECT_ITERATOR_POSITION(intern);
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;
php_imagickpixel_object *internp;
zval *param;
MagickBooleanType status;
long columns, rows;
char *format = NULL;
int format_len = 0;
/* 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CAST_PARAMETER_TO_COLOR(param, internp, 1);
status = MagickNewImage(intern->magick_wand, columns, rows, internp->pixel_wand);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to create new image", 1);
}
/* 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) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set the image format", 1);
}
}
IMAGICK_CORRECT_ITERATOR_POSITION(intern);
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;
long columns, rows;
char *pseudo_string;
int pseudo_string_len, rc;
struct php_imagick_file_t file = {0};
/* 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 (count_occurences_of(':', pseudo_string TSRMLS_CC ) < 1) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Invalid pseudo format string", 1);
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
/* Pseudo image needs a size set manually */
status = MagickSetSize(intern->magick_wand, columns, rows);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to create new pseudo image", 1);
}
if (!php_imagick_file_init(&file, pseudo_string, pseudo_string_len TSRMLS_CC)) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "The filename is too long", 1);
}
rc = php_imagick_read_file(intern, &file, ImagickReadImage TSRMLS_CC);
php_imagick_file_deinit(&file);
IMAGICK_CHECK_READ_OR_WRITE_ERROR(intern, pseudo_string, rc, IMAGICK_DONT_FREE_FILENAME, "Unable to create new pseudo image: %s");
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickImplodeImage(intern->magick_wand, radius);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to implode image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ 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;
long channel = DefaultChannels;
/* 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickLevelImageChannel(intern->magick_wand, channel, black_point, gamma, white_point);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to level image", 1);
}
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickMagnifyImage(intern->magick_wand);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to magnify image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ 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;
/* 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
intern_map = (php_imagick_object *)zend_object_store_get_object(map_obj TSRMLS_CC);
status = MagickMapImage(intern->magick_wand, intern_map->magick_wand, dither);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to map image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ 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;
php_imagickpixel_object *internp;
zval *param;
long x, y;
double alpha, fuzz;
MagickBooleanType status;
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
IMAGICK_CAST_PARAMETER_TO_COLOR(param, internp, 1);
status = MagickMatteFloodfillImage(intern->magick_wand, alpha, fuzz, internp->pixel_wand, x, y);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to matte floodfill image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ 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;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &radius) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickMedianFilterImage(intern->magick_wand, radius);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to median filter image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ 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;
long channel = DefaultChannels;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b|l", &gray, &channel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickNegateImageChannel(intern->magick_wand, channel, gray);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to negate image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ 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;
php_imagickpixel_object *intern_fill, *intern_target;
zval *target_param, *fill_param;
double fuzz;
MagickBooleanType status;
long channel = DefaultChannels;
/* 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
IMAGICK_CAST_PARAMETER_TO_COLOR(target_param, intern_target, 1);
IMAGICK_CAST_PARAMETER_TO_COLOR(fill_param, intern_fill, 1);
#if MagickLibVersion > 0x628
status = MagickPaintOpaqueImageChannel(intern->magick_wand, channel, intern_target->pixel_wand, intern_fill->pixel_wand, fuzz);
#else
status = MagickPaintOpaqueImage(intern->magick_wand, intern_target->pixel_wand, intern_fill->pixel_wand, fuzz);
#endif
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable paint opaque image", 1);
}
RETURN_TRUE;
}
/* }}} */
#if MagickLibVersion > 0x628
/* {{{ proto bool 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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
tmp_wand = (MagickWand *)MagickOptimizeImageLayers(intern->magick_wand);
if (tmp_wand == (MagickWand *)NULL) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Optimize image layers failed", 1);
}
object_init_ex(return_value, php_imagick_sc_entry);
intern_return = (php_imagick_object *)zend_object_store_get_object(return_value TSRMLS_CC);
IMAGICK_REPLACE_MAGICKWAND(intern_return, tmp_wand);
return;
}
/* }}} */
#endif
/* {{{ 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;
php_imagickpixel_object *internp;
zval *param;
double alpha, fuzz;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zdd", ¶m, &alpha, &fuzz) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
IMAGICK_CAST_PARAMETER_TO_COLOR(param, internp, 1);
status = MagickPaintTransparentImage(intern->magick_wand, internp->pixel_wand, alpha, fuzz);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to paint transparent image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::paintTransparentImage(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;
long preview;
MagickWand *tmp_wand;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &preview) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
tmp_wand = MagickPreviewImages(intern->magick_wand, preview);
if (tmp_wand == (MagickWand *)NULL) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Preview images failed", 1);
}
object_init_ex(return_value, php_imagick_sc_entry);
intern_return = (php_imagick_object *)zend_object_store_get_object(return_value TSRMLS_CC);
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;
int 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickProfileImage(intern->magick_wand, name, profile, profile_len);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to profile image", 1);
}
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickQuantizeImage(intern->magick_wand, number_colors, colorspace, tree_depth, dither, measure_error);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to quantize image", 1);
}
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;
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickQuantizeImages(intern->magick_wand, number_colors, colorspace, tree_depth, dither, measure_error);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to quantize images", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::reduceNoiseImage(float radius)
Smooths the contours of an image
*/
PHP_METHOD(imagick, reducenoiseimage)
{
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickReduceNoiseImage(intern->magick_wand, radius);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to reduce image noise", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ 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;
int 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
profile = MagickRemoveImageProfile(intern->magick_wand, name, &profile_len);
if (profile == (unsigned char *)NULL) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "The image profile does not exist", 1);
}
ZVAL_STRING(return_value, (char *)profile, 1);
IMAGICK_FREE_MEMORY(unsigned char *, profile);
return;
}
/* }}} */
/* {{{ proto bool Imagick::separateImageChannel(int channel)
Separates a channel from the image
*/
PHP_METHOD(imagick, separateimagechannel)
{
php_imagick_object *intern;
long channel;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &channel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSeparateImageChannel(intern->magick_wand, channel);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to separate image channel", 1);
}
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSepiaToneImage(intern->magick_wand, c_opacity);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to sepia tone image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::setImageBias(float bias)
Sets the image bias
*/
PHP_METHOD(imagick, setimagebias)
{
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageBias(intern->magick_wand, bias);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image bias", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::setImageBluePrimary(float x,float y)
Sets the image chromaticity blue primary point
*/
PHP_METHOD(imagick, setimageblueprimary)
{
php_imagick_object *intern;
double x, y;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageBluePrimary(intern->magick_wand, x, y);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image blue primary", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::setImageBorderColor(ImagickPixel border)
Sets the image border color
*/
PHP_METHOD(imagick, setimagebordercolor)
{
zval *param;
php_imagick_object *intern;
php_imagickpixel_object *internp;
MagickBooleanType status;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶m) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
IMAGICK_CAST_PARAMETER_TO_COLOR(param, internp, 1);
status = MagickSetImageBorderColor(intern->magick_wand, internp->pixel_wand);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image border color", 1);
}
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;
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageChannelDepth(intern->magick_wand, channel_type, depth);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image channel depth", 1);
}
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;
php_imagickpixel_object *internp;
zval *param;
long index;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz", &index, ¶m) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
IMAGICK_CAST_PARAMETER_TO_COLOR(param, internp, 1);
status = MagickSetImageColormapColor(intern->magick_wand, index, internp->pixel_wand);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image color map color", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::setImageColorspace(int colorspace)
Sets the image colorspace
*/
PHP_METHOD(imagick, setimagecolorspace)
{
php_imagick_object *intern;
long colorspace;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &colorspace) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageColorspace(intern->magick_wand, colorspace);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image colorspace", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::setImageDispose(int dispose)
Sets the image disposal method
*/
PHP_METHOD(imagick, setimagedispose)
{
php_imagick_object *intern;
long dispose;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &dispose) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageDispose(intern->magick_wand, dispose);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image dispose", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::setImageExtent(int columns, int rows)
Sets the image size
*/
PHP_METHOD(imagick, setimageextent)
{
php_imagick_object *intern;
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageExtent(intern->magick_wand, rows, columns);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image extent", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::setImageGreenPrimary(float x, float y)
Sets the image chromaticity green primary point
*/
PHP_METHOD(imagick, setimagegreenprimary)
{
php_imagick_object *intern;
double x, y;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageGreenPrimary(intern->magick_wand, x, y);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image green primary", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::setImageInterlaceScheme(int interlace_scheme)
Sets the image interlace scheme
*/
PHP_METHOD(imagick, setimageinterlacescheme)
{
php_imagick_object *intern;
long interlace;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &interlace) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageInterlaceScheme(intern->magick_wand, interlace);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image interlace scheme", 1);
}
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;
int 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageProfile(intern->magick_wand, name, profile, profile_len);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image profile", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::setImageRedPrimary(float x,float y)
Sets the image chromaticity red primary point.
*/
PHP_METHOD(imagick, setimageredprimary)
{
php_imagick_object *intern;
double x, y;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageRedPrimary(intern->magick_wand, x, y);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image red primary", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::setImageRenderingIntent(int rendering_intent)
Sets the image rendering intent.
*/
PHP_METHOD(imagick, setimagerenderingintent)
{
php_imagick_object *intern;
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageRenderingIntent(intern->magick_wand, rendering_intent);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image rendering intent", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::setImageVirtualPixelMethod(int method)
Sets the image virtual pixel method.
*/
PHP_METHOD(imagick, setimagevirtualpixelmethod)
{
php_imagick_object *intern;
long virtual_pixel;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &virtual_pixel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
MagickSetImageVirtualPixelMethod(intern->magick_wand, virtual_pixel);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::setImageWhitePoint(float x,float y)
Sets the image chromaticity white point.
*/
PHP_METHOD(imagick, setimagewhitepoint)
{
php_imagick_object *intern;
double x, y;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageWhitePoint(intern->magick_wand, x, y);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image white point", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::sigmoidalContrastImage(bool sharpen, float alpha, float beta[, 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 alpha, beta;
MagickBooleanType status;
long channel = DefaultChannels;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "bdd|l", &sharpen, &alpha, &beta, &channel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSigmoidalContrastImageChannel(intern->magick_wand, channel, sharpen, alpha, beta);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to sigmoidal contrast image", 1);
}
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
intern_second = (php_imagick_object *)zend_object_store_get_object(magick_object TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern_second->magick_wand, 1, 1);
tmp_wand = MagickStereoImage(intern->magick_wand, intern_second->magick_wand);
if (tmp_wand == (MagickWand *)NULL) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Stereo image failed", 1);
}
object_init_ex(return_value, php_imagick_sc_entry);
intern_return = (php_imagick_object *)zend_object_store_get_object(return_value TSRMLS_CC);
IMAGICK_REPLACE_MAGICKWAND(intern_return, tmp_wand);
return;
}
/* }}} */
/* {{{ proto bool 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
intern_second = (php_imagick_object *)zend_object_store_get_object(magick_object TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern_second->magick_wand, 1, 1);
tmp_wand = MagickTextureImage(intern->magick_wand, intern_second->magick_wand);
if (tmp_wand == (MagickWand *)NULL) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Texture image failed", 1);
}
object_init_ex(return_value, php_imagick_sc_entry);
intern_return = (php_imagick_object *)zend_object_store_get_object(return_value TSRMLS_CC);
IMAGICK_REPLACE_MAGICKWAND(intern_return, tmp_wand);
return;
}
/* }}} */
/* {{{ proto bool Imagick::tintImage(ImagickPixel tint, ImagickPixel opacity)
Applies a color vector to each pixel in the image
*/
PHP_METHOD(imagick, tintimage)
{
php_imagick_object *intern;
php_imagickpixel_object *intern_tint, *intern_opacity;
zval *tint_param, *opacity_param;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &tint_param, &opacity_param) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
IMAGICK_CAST_PARAMETER_TO_COLOR(tint_param, intern_tint, 1);
IMAGICK_CAST_PARAMETER_TO_OPACITY(opacity_param, intern_opacity, 1);
status = MagickTintImage(intern->magick_wand, intern_tint->pixel_wand, intern_opacity->pixel_wand);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable tint image", 1);
}
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;
long channel = DefaultChannels;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddd|l", &radius, &sigma, &amount, &threshold, &channel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickUnsharpMaskImageChannel(intern->magick_wand, channel, radius, sigma, amount, threshold);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to unsharp mask image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ 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;
long channel = DefaultChannels;
unsigned long order = 0;
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
kernel = get_double_array_from_zval(kernel_array, &num_elements TSRMLS_CC);
if (!kernel) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Unable to read matrix array", 1);
}
order = (unsigned long)sqrt(num_elements);
if (pow((double)order, 2) != num_elements) {
efree(kernel);
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "The kernel must contain a square number of elements", 1);
}
status = MagickConvolveImageChannel(intern->magick_wand, channel, order, kernel);
efree(kernel);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to convolve image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ 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;
long displace;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &displace) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickCycleColormapImage(intern->magick_wand, displace);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to cycle image colormap", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool 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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
tmp_wand = MagickDeconstructImages(intern->magick_wand);
if (tmp_wand == (MagickWand *)NULL) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Deconstruct image failed", 1);
}
object_init_ex(return_value, php_imagick_sc_entry);
intern_return = (php_imagick_object *)zend_object_store_get_object(return_value TSRMLS_CC);
IMAGICK_REPLACE_MAGICKWAND(intern_return, tmp_wand);
return;
}
/* }}} */
/* {{{ proto bool Imagick::getImageRegion(int width, int height, int x, int y)
Extracts a region of the image and returns it as a a new wand.
*/
PHP_METHOD(imagick, getimageregion)
{
MagickWand *tmp_wand;
php_imagick_object *intern, *intern_return;
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
tmp_wand = MagickGetImageRegion(intern->magick_wand, width, height, x, y);
if (tmp_wand == (MagickWand *)NULL) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Get image region failed", 1);
}
object_init_ex(return_value, php_imagick_sc_entry);
intern_return = (php_imagick_object *)zend_object_store_get_object(return_value TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickDespeckleImage(intern->magick_wand);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to despeckle image", 1);
}
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickEdgeImage(intern->magick_wand, radius);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to edge image", 1);
}
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickEmbossImage(intern->magick_wand, radius, sigma);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to emboss image", 1);
}
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickEnhanceImage(intern->magick_wand);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to enchance image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::equalizeImage()
Equalizes the image histogram.
*/
PHP_METHOD(imagick, equalizeimage)
{
php_imagick_object *intern;
MagickBooleanType status;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickEqualizeImage(intern->magick_wand);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to equalize image", 1);
}
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;
long evaluate_operator;
double constant;
MagickBooleanType status;
long channel = DefaultChannels;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ld|l", &evaluate_operator, &constant, &channel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickEvaluateImageChannel(intern->magick_wand, channel, evaluate_operator, constant);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to evaluate image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ 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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
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;
}
/* }}} */
/* {{{ proto ImagickPixel Imagick::getImageAttribute(string key )
Returns a named attribute
*/
PHP_METHOD(imagick, getimageattribute)
{
php_imagick_object *intern;
char *key, *attribute;
int 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
attribute = MagickGetImageAttribute(intern->magick_wand, key);
if (!attribute) {
RETURN_FALSE;
}
ZVAL_STRING(return_value, attribute, 1);
IMAGICK_FREE_MEMORY(char *, attribute);
return;
}
/* }}} */
/* {{{ 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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
tmp_wand = NewPixelWand();
status = MagickGetImageBackgroundColor(intern->magick_wand, tmp_wand);
if (tmp_wand == (PixelWand *)NULL) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get image background color", 1);
}
if (status == MagickFalse) {
tmp_wand = DestroyPixelWand(tmp_wand);
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get image background color", 1);
}
object_init_ex(return_value, php_imagickpixel_sc_entry);
internp = (php_imagickpixel_object *)zend_object_store_get_object(return_value TSRMLS_CC);
IMAGICKPIXEL_REPLACE_PIXELWAND(internp, tmp_wand);
return;
}
/* }}} */
/* {{{ proto ImagickPixel Imagick::getImageBluePrimary(float x, float y)
Returns the chromaticy blue primary point for the image.
*/
PHP_METHOD(imagick, getimageblueprimary)
{
php_imagick_object *intern;
MagickBooleanType status;
double x, y;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickGetImageBluePrimary(intern->magick_wand, &x, &y);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get image blue primary", 1);
}
array_init(return_value);
add_assoc_double(return_value, "x", x);
add_assoc_double(return_value, "y", y);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
tmp_wand = NewPixelWand();
status = MagickGetImageBorderColor(intern->magick_wand, tmp_wand);
if (tmp_wand == (PixelWand *)NULL) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get image border color", 1);
}
if (status == MagickFalse) {
tmp_wand = DestroyPixelWand(tmp_wand);
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get image border color", 1);
}
object_init_ex(return_value, php_imagickpixel_sc_entry);
internp = (php_imagickpixel_object *)zend_object_store_get_object(return_value TSRMLS_CC);
IMAGICKPIXEL_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;
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
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;
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
intern_second = (php_imagick_object *)zend_object_store_get_object(objvar TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern_second->magick_wand, 1, 1);
status = MagickGetImageChannelDistortion(intern->magick_wand, intern_second->magick_wand, channel_type, metric_type, &distortion);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get image channel distortion", 1);
}
RETVAL_DOUBLE(distortion);
}
/* }}} */
/* {{{ 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;
long channel_type;
unsigned long minima, maxima;
MagickBooleanType status;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &channel_type) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickGetImageChannelExtrema(intern->magick_wand, channel_type, &minima, &maxima);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get image channel extrema", 1);
}
array_init(return_value);
add_assoc_long(return_value, "minima", minima);
add_assoc_long(return_value, "maxima", maxima);
return;
}
/* }}} */
/* {{{ 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;
long channel_type;
double mean, standard_deviation;
MagickBooleanType status;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &channel_type) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickGetImageChannelMean(intern->magick_wand, channel_type, &mean, &standard_deviation);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get image channel mean", 1);
}
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)
{
zval *tmp;
const long channels[] = { UndefinedChannel, RedChannel, CyanChannel,
GreenChannel, MagentaChannel, BlueChannel,
YellowChannel, OpacityChannel, BlackChannel,
MatteChannel };
php_imagick_object *intern;
ChannelStatistics *statistics;
int elements = 10, i;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
statistics = MagickGetImageChannelStatistics(intern->magick_wand);
array_init(return_value);
for (i = 0; i < elements ; i++) {
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);
}
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;
long index;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &index) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
tmp_wand = NewPixelWand();
status = MagickGetImageColormapColor(intern->magick_wand, index , tmp_wand);
if (tmp_wand == (PixelWand *)NULL) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get image colormap color", 1);
}
if (status == MagickFalse) {
tmp_wand = DestroyPixelWand(tmp_wand);
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get image colormap color", 1);
}
object_init_ex(return_value, php_imagickpixel_sc_entry);
internp = (php_imagickpixel_object *)zend_object_store_get_object(return_value TSRMLS_CC);
IMAGICKPIXEL_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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
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;
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
intern_second = (php_imagick_object *)zend_object_store_get_object(objvar TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern_second->magick_wand, 1, 1);
status = MagickGetImageDistortion(intern->magick_wand, intern_second->magick_wand, metric_type, &distortion);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get image distortion", 1);
}
RETVAL_DOUBLE(distortion);
}
/* }}} */
/* {{{ 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;
unsigned long min, max;
MagickBooleanType status;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickGetImageExtrema(intern->magick_wand, &min, &max);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get image extrema", 1);
}
array_init(return_value);
add_assoc_long(return_value, "min", min);
add_assoc_long(return_value, "max", max);
return;
}
/* }}} */
/* {{{ proto long Imagick::getImageDispose()
Gets the image disposal method.
*/
PHP_METHOD(imagick, getimagedispose)
{
php_imagick_object *intern;
long dispose;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
gamma = MagickGetImageGamma(intern->magick_wand);
RETVAL_DOUBLE(gamma);
}
/* }}} */
/* {{{ proto array Imagick::getImageGreenPrimary()
Returns the chromaticy green primary point. Returns an array with the keys "x" and "y".
*/
PHP_METHOD(imagick, getimagegreenprimary)
{
php_imagick_object *intern;
double x, y;
MagickBooleanType status;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickGetImageGreenPrimary(intern->magick_wand, &x, &y);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get image green primary", 1);
}
array_init(return_value);
add_assoc_double(return_value, "x", x);
add_assoc_double(return_value, "y", y);
return;
}
/* }}} */
/* {{{ proto int Imagick::getImageHeight()
Returns the image height.
*/
PHP_METHOD(imagick, getimageheight)
{
php_imagick_object *intern;
long height;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
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;
unsigned long colors = 0;
unsigned long i;
zval *tmp_pixelwand;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
wand_array = MagickGetImageHistogram(intern->magick_wand, &colors);
array_init(return_value);
for (i = 0; i < colors; i++) {
if (wand_array[i]) {
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);
IMAGICKPIXEL_REPLACE_PIXELWAND(internp, wand_array[i]);
add_next_index_zval(return_value, tmp_pixelwand);
}
}
IMAGICK_FREE_MEMORY(PixelWand **, wand_array);
return;
}
/* }}} */
/* {{{ proto int Imagick::getImageInterlaceScheme()
Gets the image interlace scheme.
*/
PHP_METHOD(imagick, getimageinterlacescheme)
{
php_imagick_object *intern;
long interlace;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
iterations = MagickGetImageIterations(intern->magick_wand);
RETVAL_LONG(iterations);
}
/* }}} */
/* {{{ 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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
tmp_wand = NewPixelWand();
status = MagickGetImageMatteColor(intern->magick_wand, tmp_wand);
if (tmp_wand == (PixelWand *)NULL) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get image matte color", 1);
}
if (status == MagickFalse) {
tmp_wand = DestroyPixelWand(tmp_wand);
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable get image matter color", 1);
}
object_init_ex(return_value, php_imagickpixel_sc_entry);
internp = (php_imagickpixel_object *)zend_object_store_get_object(return_value TSRMLS_CC);
IMAGICKPIXEL_REPLACE_PIXELWAND(internp, tmp_wand);
return;
}
/* }}} */
/* {{{ 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;
unsigned long width, height;
long x, y;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickGetImagePage(intern->magick_wand, &width, &height, &x, &y);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get image page", 1);
}
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;
long x, y;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &x, &y) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
tmp_wand = NewPixelWand();
if (!tmp_wand) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Failed to allocate new PixelWand", 1);
}
status = MagickGetImagePixelColor(intern->magick_wand, x, y , tmp_wand);
if (status == MagickFalse) {
tmp_wand = DestroyPixelWand(tmp_wand);
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable get image pixel color", 1);
}
object_init_ex(return_value, php_imagickpixel_sc_entry);
internp = (php_imagickpixel_object *)zend_object_store_get_object(return_value TSRMLS_CC);
IMAGICKPIXEL_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;
int 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
profile = (char *)MagickGetImageProfile(intern->magick_wand, name, &length);
if (profile != (char *)NULL) {
ZVAL_STRINGL(return_value, profile, length, 1);
IMAGICK_FREE_MEMORY(char *, profile);
return;
}
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Can not get image profile", 1);
}
/* }}} */
/* {{{ proto array Imagick::getImageRedPrimary()
Returns the chromaticy red primary point as an array with the keys "x" and "y".
*/
PHP_METHOD(imagick, getimageredprimary)
{
php_imagick_object *intern;
MagickBooleanType status;
double x, y;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickGetImageRedPrimary(intern->magick_wand, &x, &y);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get image red primary", 1);
}
array_init(return_value);
add_assoc_double(return_value, "x", x);
add_assoc_double(return_value, "y", y);
return;
}
/* }}} */
/* {{{ proto int Imagick::getImageRenderingIntent()
Gets the image rendering intent.
*/
PHP_METHOD(imagick, getimagerenderingintent)
{
php_imagick_object *intern;
long renderingIntent;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickGetImageResolution(intern->magick_wand, &x, &y);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get image resolution", 1);
}
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
signature = MagickGetImageSignature(intern->magick_wand);
ZVAL_STRING(return_value, signature, 1);
IMAGICK_FREE_MEMORY(char *, 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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
pixelMethod = MagickGetImageVirtualPixelMethod(intern->magick_wand);
RETVAL_LONG(pixelMethod);
}
/* }}} */
/* {{{ proto array Imagick::getImageWhitePoint()
Returns the chromaticy white point as an associative array with the keys "x" and "y".
*/
PHP_METHOD(imagick, getimagewhitepoint)
{
php_imagick_object *intern;
MagickBooleanType status;
double x, y;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickGetImageWhitePoint(intern->magick_wand, &x, &y);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get image white point", 1);
}
array_init(return_value);
add_assoc_double(return_value, "x", x);
add_assoc_double(return_value, "y", y);
return;
}
/* }}} */
/* {{{ proto int Imagick::getImageWidth()
Returns the image width.
*/
PHP_METHOD(imagick, getimagewidth)
{
php_imagick_object *intern;
unsigned long width;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
num_images = MagickGetNumberImages(intern->magick_wand);
RETVAL_LONG(num_images);
}
/* }}} */
/* {{{ proto bool Imagick::thumbnailImage(int columns, int rows[, bool bestfit = false, bool fill = false])
Changes the size of an image to the given dimensions and removes any associated profiles
*/
PHP_METHOD(imagick, thumbnailimage)
{
long width, height, new_width, new_height;
php_imagick_object *intern;
MagickBooleanType status;
zend_bool bestfit = 0, fill = 0;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll|bb", &width, &height, &bestfit, &fill) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
if (bestfit && fill) {
#if MagickLibVersion > 0x631
if (!php_imagick_resize_bounding_box(intern->magick_wand, width, height, fill)) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to resize and fill image", 1);
}
#else
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Fill parameter is only supported with ImageMagick 6.3.2+", 1);
#endif
} else {
if (!php_imagick_thumbnail_dimensions(intern->magick_wand, bestfit, width, height, &new_width, &new_height)) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Invalid image geometry", 1);
}
/* No magick is going to happen */
if (MagickThumbnailImage(intern->magick_wand, new_width, new_height) == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to thumbnail image", 1);
}
}
RETURN_TRUE;
}
/* }}} */
//
/* {{{ proto bool Imagick::cropthumbnailImage(int columns, int rows)
Creates a crop thumbnail
*/
PHP_METHOD(imagick, cropthumbnailimage)
{
long crop_width, crop_height;
php_imagick_object *intern;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &crop_width, &crop_height) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
/* The world collapses.. */
if (!crop_thumbnail_image(intern->magick_wand, crop_width, crop_height TSRMLS_CC)) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to crop-thumbnail image", 1);
}
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
/* No magick is going to happen */
if (intern->magick_wand == (MagickWand *)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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
/* No magick is going to happen */
if (intern->magick_wand == (MagickWand *)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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
/* No magick is going to happen */
if (intern->magick_wand == (MagickWand *)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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
status = MagickHasNextImage(intern->magick_wand);
/* No magick is going to happen */
if (status == MagickFalse) {
RETURN_FALSE;
}
RETURN_TRUE;
}
/* }}} */
/* {{{ 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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
status = MagickGetImageIndex(intern->magick_wand);
ZVAL_LONG(return_value, (long)status);
return;
}
/* }}} */
/* {{{ proto bool Imagick::setImageIndex(int index)
Returns the index of the current active image, within the Imagick object.
*/
PHP_METHOD(imagick, setimageindex)
{
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
status = MagickSetImageIndex(intern->magick_wand, index);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image index", 1);
}
intern->next_out_of_bound = 0;
RETURN_TRUE;
}
/* }}} */
/* {{{ 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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickRemoveImage(intern->magick_wand);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to remove image", 1);
}
intern->next_out_of_bound = 0;
IMAGICK_CORRECT_ITERATOR_POSITION(intern);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
filename = MagickGetImageFilename(intern->magick_wand);
if (filename == (char *)NULL) {
return;
}
ZVAL_STRING(return_value, filename, 1);
IMAGICK_FREE_MEMORY(char *, filename);
return;
}
/* }}} */
/* {{{ 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
ZVAL_LONG(return_value, (long)MagickGetImageSize(intern->magick_wand));
return;
}
/* }}} */
/* {{{ 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;
char *buffer;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
IMAGICK_HAS_FORMAT(buffer, intern->magick_wand, 1);
image_contents = MagickGetImageBlob(intern->magick_wand, &image_size);
if (!image_contents) {
return;
}
ZVAL_STRINGL(return_value, (char *)image_contents, image_size, 1);
IMAGICK_FREE_MEMORY(unsigned char *, 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;
char *buffer;
int current;
MagickBooleanType status;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
#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)) {
IMAGICK_HAS_FORMAT(buffer, intern->magick_wand, 1);
}
#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) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set the iterator index", 1);
}
image_contents = MagickGetImagesBlob(intern->magick_wand, &image_size);
if (!image_contents) {
return;
}
ZVAL_STRINGL(return_value, (char *)image_contents, image_size, 1);
IMAGICK_FREE_MEMORY(unsigned char *, 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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
IMAGICK_HAS_FORMAT(format, intern->magick_wand, 0);
ZVAL_STRING(return_value, format, 1);
IMAGICK_FREE_MEMORY(char *, 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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
IMAGICK_HAS_FORMAT(format, intern->magick_wand, 0);
mime_type = (char *) MagickToMime(format);
IMAGICK_FREE_MEMORY(char *, format);
if (!mime_type) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Unable to get image mime-type", 1);
}
ZVAL_STRING(return_value, mime_type, 1);
IMAGICK_FREE_MEMORY(char *, mime_type);
return;
}
/* }}} */
static
void s_add_assoc_str (zval *array, const char *key, const char *value, int copy)
{
add_assoc_string (array, key, value ? value : "", copy);
}
static
void s_add_named_strings (zval *array, const char *haystack TSRMLS_DC)
{
int done = 0;
char *line, *last_ptr = NULL, *buffer;
size_t num_keys;
const char *str_keys [] = {
"Format: ",
"Units: ",
"Type: ",
"Colorspace: ",
"Filesize: ",
"Compression: "
};
const char *arr_keys [] = {
"format",
"units",
"type",
"colorSpace",
"fileSize",
"compression"
};
buffer = estrdup (haystack);
num_keys = sizeof (str_keys) / sizeof (str_keys[0]);
line = php_strtok_r (buffer, "\r\n", &last_ptr);
int i, found = 0;
while ((found < num_keys) && line) {
// Break the line further into tokens
char *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
add_assoc_string (array, arr_keys [i], trim + strlen (str_keys [i]), 1);
found++;
}
}
efree (trim);
line = php_strtok_r (NULL, "\r\n", &last_ptr);
}
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;
zval *array;
double x, y;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &append_raw_string) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
// 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, 1);
s_add_named_strings (return_value, identify TSRMLS_CC);
format = MagickGetImageFormat (intern->magick_wand);
if (format) {
char *mime_type = MagickToMime(format);
if (mime_type) {
s_add_assoc_str (return_value, "mimetype", mime_type, 1);
IMAGICK_FREE_MEMORY(char *, mime_type);
} else
s_add_assoc_str (return_value, "mimetype", "unknown", 1);
IMAGICK_FREE_MEMORY(char *, format);
}
else
s_add_assoc_str (return_value, "mimetype", "unknown", 1);
// Geometry is an associative array
MAKE_STD_ZVAL (array);
array_init (array);
add_assoc_long (array, "width", MagickGetImageWidth (intern->magick_wand));
add_assoc_long (array, "height", MagickGetImageHeight (intern->magick_wand));
add_assoc_zval (return_value, "geometry", array);
if (MagickGetImageResolution(intern->magick_wand, &x, &y) == MagickTrue) {
MAKE_STD_ZVAL (array);
array_init (array);
add_assoc_double (array, "x", x);
add_assoc_double (array, "y", y);
add_assoc_zval (return_value, "resolution", array);
}
signature = MagickGetImageSignature (intern->magick_wand);
s_add_assoc_str (return_value, "signature", signature, 1);
if (append_raw_string == 1)
add_assoc_string (return_value, "rawOutput", identify, 1);
IMAGICK_FREE_MEMORY(char *, filename);
IMAGICK_FREE_MEMORY(char *, identify);
IMAGICK_FREE_MEMORY(char *, signature);
return;
}
/* }}} */
/* {{{ 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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
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;
int 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickCommentImage(intern->magick_wand, comment);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to comment image", 1);
}
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;
int 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageFilename(intern->magick_wand, filename);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image filename", 1);
}
RETURN_TRUE;
}
/* }}} */
/* 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;
int 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageAttribute(intern->magick_wand, key, attribute);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image attribute", 1);
}
RETURN_TRUE;
}
/* {{{ proto bool Imagick::setImageBackgroundColor(ImagickPixel background)
Sets the image background color.
*/
PHP_METHOD(imagick, setimagebackgroundcolor)
{
zval *param;
php_imagick_object *intern;
php_imagickpixel_object *internp;
MagickBooleanType status;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶m) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
IMAGICK_CAST_PARAMETER_TO_COLOR(param, internp, 1);
status = MagickSetImageBackgroundColor(intern->magick_wand, internp->pixel_wand);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image background color", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ 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;
long compose;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &compose) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageCompose(intern->magick_wand, compose);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image composite operator", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::setImageCompression(int compression)
Sets the image compression.
*/
PHP_METHOD(imagick, setimagecompression)
{
php_imagick_object *intern;
long compression;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &compression) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageCompression(intern->magick_wand, compression);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image compression", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::setImageDelay(int delay)
Sets the image delay.
*/
PHP_METHOD(imagick, setimagedelay)
{
php_imagick_object *intern;
long delay;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &delay) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageDelay(intern->magick_wand, delay);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image delay", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::colorizeImage(ImagickPixel colorize, ImagickPixel opacity)
Blends the fill color with each pixel in the image.
*/
PHP_METHOD(imagick, colorizeimage)
{
PixelWand *param_wand = NULL;
php_imagick_object *intern;
php_imagickpixel_object *intern_color = NULL, *intern_opacity = NULL;
zval *color_param, *opacity_param;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &color_param, &opacity_param) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
IMAGICK_CAST_PARAMETER_TO_COLOR(color_param, intern_color, 1);
IMAGICK_CAST_PARAMETER_TO_OPACITY(opacity_param, intern_opacity, 1);
/* Colorize wants both wand to be of same instance */
IMAGICK_CLONE_PIXELWAND(intern_color->pixel_wand, param_wand);
PixelSetOpacity(param_wand, PixelGetOpacity(intern_opacity->pixel_wand));
PixelSetAlpha(param_wand, PixelGetAlpha(intern_opacity->pixel_wand));
status = MagickColorizeImage(intern->magick_wand, param_wand, param_wand);
param_wand = DestroyPixelWand(param_wand);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to colorize image", 1);
}
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;
long channel_type, metric_type;
double distortion;
zval *new_wand;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Oll", &objvar, php_imagick_sc_entry, &channel_type, &metric_type) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
intern_second = (php_imagick_object *)zend_object_store_get_object(objvar TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern_second->magick_wand, 1, 1);
tmp_wand = MagickCompareImageChannels(intern->magick_wand, intern_second->magick_wand, channel_type, metric_type, &distortion);
if (tmp_wand == (MagickWand *)NULL) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Compare image channels failed", 1);
}
MAKE_STD_ZVAL(new_wand);
array_init(return_value);
object_init_ex(new_wand, php_imagick_sc_entry);
intern_return = (php_imagick_object *)zend_object_store_get_object(new_wand TSRMLS_CC);
IMAGICK_REPLACE_MAGICKWAND(intern_return, tmp_wand);
add_next_index_zval(return_value, new_wand);
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;
long compare_method;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &compare_method) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
tmp_wand = (MagickWand *)MagickCompareImageLayers(intern->magick_wand, compare_method);
if (tmp_wand == (MagickWand *)NULL) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Compare image layers failed", 1);
}
object_init_ex(return_value, php_imagick_sc_entry);
intern_return = (php_imagick_object *)zend_object_store_get_object(return_value TSRMLS_CC);
IMAGICK_REPLACE_MAGICKWAND(intern_return, tmp_wand);
return;
}
/* }}} */
#endif
/* {{{ 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;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
MagickSetFirstIterator(intern->magick_wand);
tmp_wand = MagickFlattenImages(intern->magick_wand);
if (tmp_wand == (MagickWand *)NULL) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Flatten images failed", 1);
}
object_init_ex(return_value, php_imagick_sc_entry);
intern_return = (php_imagick_object *)zend_object_store_get_object(return_value TSRMLS_CC);
IMAGICK_REPLACE_MAGICKWAND(intern_return, tmp_wand);
return;
}
/* }}} */
/* {{{ 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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickFlipImage(intern->magick_wand);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to flip image", 1);
}
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickFlopImage(intern->magick_wand);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to flop image", 1);
}
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;
php_imagickpixel_object *internp;
MagickBooleanType status;
long width, height, inner_bevel, outer_bevel;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zllll", ¶m, &width, &height, &inner_bevel, &outer_bevel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
IMAGICK_CAST_PARAMETER_TO_COLOR(param, internp, 1);
status = MagickFrameImage(intern->magick_wand, internp->pixel_wand, width, height, inner_bevel, outer_bevel);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to frame image", 1);
}
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;
int expression_len;
long channel = DefaultChannels;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &expression, &expression_len, &channel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
tmp_wand = MagickFxImageChannel(intern->magick_wand, channel, expression);
if (tmp_wand == (MagickWand *)NULL) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Fx image failed", 1);
}
object_init_ex(return_value, php_imagick_sc_entry);
intern_return = (php_imagick_object *)zend_object_store_get_object(return_value TSRMLS_CC);
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;
long channel = DefaultChannels;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|l", &gamma, &channel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickGammaImageChannel(intern->magick_wand, channel, gamma);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to gamma image", 1);
}
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;
long channel = DefaultChannels;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd|l", &radius, &sigma, &channel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickGaussianBlurImageChannel(intern->magick_wand, channel, radius, sigma);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to gaussian blur image", 1);
}
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;
long metric_type;
double distortion;
zval *new_wand;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol", &objvar, php_imagick_sc_entry, &metric_type) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
intern_second = (php_imagick_object *)zend_object_store_get_object(objvar TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern_second->magick_wand, 1, 1);
MAKE_STD_ZVAL(new_wand);
array_init(return_value);
tmp_wand = MagickCompareImages(intern->magick_wand, intern_second->magick_wand, metric_type, &distortion);
if (tmp_wand == (MagickWand *)NULL) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Compare images failed", 1);
}
object_init_ex(new_wand, php_imagick_sc_entry);
intern_return = (php_imagick_object *)zend_object_store_get_object(new_wand TSRMLS_CC);
IMAGICK_REPLACE_MAGICKWAND(intern_return, tmp_wand);
add_next_index_zval(return_value, new_wand);
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickContrastImage(intern->magick_wand, contrast);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to contrast image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::setImageDepth(int depth)
Sets the image depth.
*/
PHP_METHOD(imagick, setimagedepth)
{
php_imagick_object *intern;
long depth;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &depth) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageDepth(intern->magick_wand, depth);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image depth", 1);
}
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageGamma(intern->magick_wand, gamma);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image gamma", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::setImageIterations(int iterations)
Sets the image iterations.
*/
PHP_METHOD(imagick, setimageiterations)
{
php_imagick_object *intern;
long iterations;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &iterations) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageIterations(intern->magick_wand, iterations);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image iterations", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::setImageMatteColor(ImagickPixel matte)
Sets the image matte color.
*/
PHP_METHOD(imagick, setimagemattecolor)
{
zval *param;
php_imagick_object *intern;
php_imagickpixel_object *internp;
MagickBooleanType status;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶m) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
IMAGICK_CAST_PARAMETER_TO_COLOR(param, internp, 1);
status = MagickSetImageMatteColor(intern->magick_wand, internp->pixel_wand);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image matte color", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ 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;
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImagePage(intern->magick_wand, width, height, x, y);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image page", 1);
}
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageResolution(intern->magick_wand, x_res, y_res);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image resolution", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::setImageScene(int scene)
Sets the image scene.
*/
PHP_METHOD(imagick, setimagescene)
{
php_imagick_object *intern;
long scene;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &scene) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageScene(intern->magick_wand, scene);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image scene", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::setImageTicksPerSecond(int ticks_per-second)
Sets the image ticks-per-second.
*/
PHP_METHOD(imagick, setimagetickspersecond)
{
php_imagick_object *intern;
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageTicksPerSecond(intern->magick_wand, ticks_per_second);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image ticks per second", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::setImageType(int image_type)
Sets the image type.
*/
PHP_METHOD(imagick, setimagetype)
{
php_imagick_object *intern;
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageType(intern->magick_wand, image_type);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image type", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::setImageUnits(int units)
Sets the image units of resolution.
*/
PHP_METHOD(imagick, setimageunits)
{
php_imagick_object *intern;
long units;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &units) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageUnits(intern->magick_wand, units);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image units", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::setImageFormat(string format)
Sets the format of a particular image in a sequence.
*/
PHP_METHOD(imagick, setimageformat)
{
char *format;
int 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageFormat(intern->magick_wand, format);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image format", 1);
}
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickCharcoalImage(intern->magick_wand, sigma, radius);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to charcoal image", 1);
}
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;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &radius) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickOilPaintImage(intern->magick_wand, radius);
/* No magick is going to happen */
if (status == MagickFalse)
{
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to oilpaint image", 1);
}
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;
long channel;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &channel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
#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) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to normalize image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::labelImage(string label)
Adds a label to your image.
*/
PHP_METHOD(imagick, labelimage)
{
char *label;
int 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickLabelImage(intern->magick_wand, label);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to label image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::writeImage(string filename)
Writes an image to the specified filename
*/
PHP_METHOD(imagick, writeimage)
{
char *filename = NULL;
int status = 0;
int filename_len = 0;
php_imagick_object *intern;
struct php_imagick_file_t file = {0};
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!", &filename, &filename_len) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
if (!filename) {
filename = MagickGetImageFilename(intern->magick_wand);
if (!filename) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "No image filename specified", 1);
}
filename_len = strlen(filename);
}
if (!filename_len) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Can not use empty string as a filename", 1);
}
if (!php_imagick_file_init(&file, filename, filename_len TSRMLS_CC)) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "The filename is too long", 1);
}
status = php_imagick_write_file(intern, &file, ImagickWriteImage, 0 TSRMLS_CC);
php_imagick_file_deinit(&file);
IMAGICK_CHECK_READ_OR_WRITE_ERROR(intern, filename, status, IMAGICK_DONT_FREE_FILENAME, "Unable to write the file: %s");
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;
int filename_len;
php_imagick_object *intern;
int status = 0;
struct php_imagick_file_t file = {0};
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sb", &filename, &filename_len, &adjoin) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
if (!filename_len) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Can not use empty string as a filename", 1);
}
if (!php_imagick_file_init(&file, filename, filename_len TSRMLS_CC)) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "The filename is too long", 1);
}
status = php_imagick_write_file(intern, &file, ImagickWriteImages, adjoin TSRMLS_CC);
php_imagick_file_deinit(&file);
IMAGICK_CHECK_READ_OR_WRITE_ERROR(intern, filename, status, IMAGICK_DONT_FREE_FILENAME, "Unable to write the file: %s");
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 = NULL, *buffer = NULL;
zend_bool restore = 0;
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &objvar, php_imagickdraw_sc_entry) == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(objvar TSRMLS_CC);
IMAGICK_SET_LOCALE(old_locale, buffer, restore);
status = MagickDrawImage(intern->magick_wand, internd->drawing_wand);
IMAGICK_RESTORE_LOCALE(old_locale, restore);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to draw image", 1);
}
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;
int 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
internd = (php_imagickdraw_object *)zend_object_store_get_object(objvar TSRMLS_CC);
#if MagickLibVersion < 0x632
font = DrawGetFont(internd->drawing_wand);
/* Fixes PECL Bug #11328 */
if (!font) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Font needs to be set before annotating an image", 1);
}
#endif
status = MagickAnnotateImage(intern->magick_wand, internd->drawing_wand, x, y, angle, text);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to annotate image", 1);
}
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
RETVAL_LONG(MagickGetImageCompressionQuality(intern->magick_wand));
}
/* }}} */
/* {{{ proto bool Imagick::setImageCompressionQuality(int quality)
Sets the image compression quality
*/
PHP_METHOD(imagick, setimagecompressionquality)
{
long quality;
php_imagick_object *intern;
MagickBooleanType status;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &quality) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSetImageCompressionQuality(intern->magick_wand, quality);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set image compression quality", 1);
}
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;
long x, y;
long composite_id = 0;
long channel = DefaultChannels;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Olll|l", &objvar, php_imagick_sc_entry, &composite_id, &x, &y, &channel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
intern_second = (php_imagick_object *)zend_object_store_get_object(objvar TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern_second->magick_wand, 1, 1);
#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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickModulateImage(intern->magick_wand, brightness, saturation, hue);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to modulate image", 1);
}
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;
long noise;
long channel = DefaultChannels;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &noise, &channel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
#if MagickLibVersion > 0x628
status = MagickAddNoiseImageChannel(intern->magick_wand, channel, noise);
#else
status = MagickAddNoiseImage(intern->magick_wand, noise);
#endif
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to add image noise", 1);
}
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;
int tile_geometry_len, thumbnail_geometry_len, frame_len;
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
internd = (php_imagickdraw_object *)zend_object_store_get_object(objvar TSRMLS_CC);
tmp_wand = MagickMontageImage(intern->magick_wand, internd->drawing_wand, tile_geometry, thumbnail_geometry, montage_mode, frame);
if (tmp_wand == (MagickWand *)NULL) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Montage image failed", 1);
}
object_init_ex(return_value, php_imagick_sc_entry);
intern_return = (php_imagick_object *)zend_object_store_get_object(return_value TSRMLS_CC);
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
internd = (php_imagickdraw_object *)zend_object_store_get_object(objvar TSRMLS_CC);
status = MagickAffineTransformImage(intern->magick_wand, internd->drawing_wand);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to affine transform image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto Imagick Imagick::averageImages()
Average a set of images.
*/
PHP_METHOD(imagick, averageimages)
{
MagickWand *tmp_wand;
php_imagick_object *intern, *intern_return;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
tmp_wand = MagickAverageImages(intern->magick_wand);
if (tmp_wand == (MagickWand *)NULL) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Averaging images failed", 1);
}
object_init_ex(return_value, php_imagick_sc_entry);
intern_return = (php_imagick_object *)zend_object_store_get_object(return_value TSRMLS_CC);
IMAGICK_REPLACE_MAGICKWAND(intern_return, tmp_wand);
return;
}
/* }}} */
/* {{{ 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;
php_imagickpixel_object *internp;
MagickBooleanType status;
long width, height;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zll", ¶m, &width, &height) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
IMAGICK_CAST_PARAMETER_TO_COLOR(param, internp, 1);
status = MagickBorderImage(intern->magick_wand, internp->pixel_wand, width, height);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to border image", 1);
}
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;
long channel = DefaultChannels;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|l", &threshold, &channel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickThresholdImageChannel(intern->magick_wand, channel, threshold);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to threshold image", 1);
}
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;
long width, height, offset;
MagickBooleanType status;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &width, &height, &offset) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickAdaptiveThresholdImage(intern->magick_wand, width, height, offset);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to adaptive threshold image", 1);
}
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;
long channel = DefaultChannels;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd|l", &radius, &sigma, &channel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSharpenImageChannel(intern->magick_wand, channel, radius, sigma);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to sharpen image", 1);
}
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;
long columns, rows;
MagickBooleanType status;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &columns, &rows) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickShaveImage(intern->magick_wand, columns, rows);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to shave image", 1);
}
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;
php_imagickpixel_object *internp;
double x_shear, y_shear;
MagickBooleanType status;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zdd", ¶m, &x_shear, &y_shear) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
IMAGICK_CAST_PARAMETER_TO_COLOR(param, internp, 1);
status = MagickShearImage(intern->magick_wand, internp->pixel_wand, x_shear, y_shear);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to shear image", 1);
}
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)
{
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSpliceImage(intern->magick_wand, width, height, x, y);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to splice image", 1);
}
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;
long offset;
MagickWand *tmp_wand;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol", &objvar, php_imagick_sc_entry, &offset) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
intern_second = (php_imagick_object *)zend_object_store_get_object(objvar TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern_second->magick_wand, 1, 1);
tmp_wand = MagickSteganoImage(intern->magick_wand, intern_second->magick_wand, offset);
if (tmp_wand == (MagickWand *)NULL) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Stegano image failed", 1);
}
object_init_ex(return_value, php_imagick_sc_entry);
intern_return = (php_imagick_object *)zend_object_store_get_object(return_value TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
IMAGICK_METHOD_DEPRECATED("Imagick", "clone");
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
tmp_wand = CloneMagickWand(intern->magick_wand);
if (tmp_wand == (MagickWand *)NULL) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Cloning Imagick object failed", 1);
}
object_init_ex(return_value, php_imagick_sc_entry);
intern_return = (php_imagick_object *)zend_object_store_get_object(return_value TSRMLS_CC);
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;
php_imagickpixel_object *internp;
double degrees;
MagickBooleanType status;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zd", ¶m, °rees) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
IMAGICK_CAST_PARAMETER_TO_COLOR(param, internp, 1);
status = MagickRotateImage(intern->magick_wand, internp->pixel_wand, degrees);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to rotate image", 1);
}
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;
long columns, rows;
MagickBooleanType status;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &columns, &rows) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSampleImage(intern->magick_wand, columns, rows);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to sample image", 1);
}
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;
long threshold;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &threshold) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickSolarizeImage(intern->magick_wand, threshold);
/* No magick is going to happen */
if (status == MagickFalse)
{
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to solarize image", 1);
}
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickShadowImage(intern->magick_wand, opacity, sigma, x, y);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to shadow image", 1);
}
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;
long channel = DefaultChannels;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ddd|l", &radius, &sigma, &angle, &channel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
#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) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to motion blur image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ 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;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
MagickSetFirstIterator(intern->magick_wand);
tmp_wand = MagickMosaicImages(intern->magick_wand);
if (tmp_wand == (MagickWand *)NULL) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Mosaic image failed", 1);
}
object_init_ex(return_value, php_imagick_sc_entry);
intern_return = (php_imagick_object *)zend_object_store_get_object(return_value TSRMLS_CC);
IMAGICK_REPLACE_MAGICKWAND(intern_return, tmp_wand);
return;
}
/* }}} */
/* {{{ 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;
long frames;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &frames) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
tmp_wand = MagickMorphImages(intern->magick_wand, frames);
if (tmp_wand == (MagickWand *)NULL) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Morphing images failed", 1);
}
object_init_ex(return_value, php_imagick_sc_entry);
intern_return = (php_imagick_object *)zend_object_store_get_object(return_value TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickMinifyImage(intern->magick_wand);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to minify image", 1);
}
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;
long levels;
zend_bool dither;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lb", &levels, &dither) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickPosterizeImage(intern->magick_wand, levels, dither);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to posterize image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::radialBlurImage(float angle[, int channel])
Radial blurs an image.
*/
PHP_METHOD(imagick, radialblurimage)
{
php_imagick_object *intern;
MagickBooleanType status;
double angle;
long channel = DefaultChannels;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|l", &angle, &channel) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickRadialBlurImageChannel(intern->magick_wand, channel, angle);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to radial blur image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ 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;
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickRaiseImage(intern->magick_wand, width, height, x, y, raise);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to raise image", 1);
}
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;
php_imagickpixel_object *internp;
zval *param;
MagickBooleanType status;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶m) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
IMAGICK_CAST_PARAMETER_TO_COLOR(param, internp, 1);
status = MagickBlackThresholdImage(intern->magick_wand, internp->pixel_wand);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to black threshold image", 1);
}
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;
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickResampleImage(intern->magick_wand, xRes, yRes, filter, blur);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to resample image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::resizeImage(int width, int height, int filter, float blur[, bool bestfit = false])
Scales an image to the desired dimensions with one of these filters:
*/
PHP_METHOD(imagick, resizeimage)
{
double blur;
long width, height, new_width, new_height, filter = 0;
php_imagick_object *intern;
MagickBooleanType status;
zend_bool bestfit = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llld|b", &width, &height, &filter, &blur, &bestfit) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
if (!php_imagick_thumbnail_dimensions(intern->magick_wand, bestfit, width, height, &new_width, &new_height)) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Invalid image geometry", 1);
}
status = MagickResizeImage(intern->magick_wand, new_width, new_height, filter, blur);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to resize image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::rollImage(int x, int y)
Offsets an image as defined by x and y.
*/
PHP_METHOD(imagick, rollimage)
{
long x, y;
php_imagick_object *intern;
MagickBooleanType status;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &x, &y) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
status = MagickRollImage(intern->magick_wand, x, y);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to roll image", 1);
}
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
tmp_wand = MagickAppendImages(intern->magick_wand, stack);
if (tmp_wand == (MagickWand *)NULL) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to append images", 1);
}
object_init_ex(return_value, php_imagick_sc_entry);
intern_return = (php_imagick_object *)zend_object_store_get_object(return_value TSRMLS_CC);
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;
php_imagickpixel_object *internp;
zval *param;
MagickBooleanType status;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶m) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
IMAGICK_CAST_PARAMETER_TO_COLOR(param, internp, 1);
status = MagickWhiteThresholdImage(intern->magick_wand, internp->pixel_wand);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to white threshold image", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto ImagickPixelIterator Imagick::getPixelIterator()
Returns a MagickPixelIterator.
*/
PHP_METHOD(imagick, getpixeliterator)
{
php_imagick_object *intern;
zval retval, *method_array;
zval *args[1];
zval *tmp_object;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
MAKE_STD_ZVAL(tmp_object);
object_init_ex(tmp_object, php_imagickpixeliterator_sc_entry);
MAKE_STD_ZVAL(method_array);
array_init(method_array);
add_next_index_zval(method_array, tmp_object);
add_next_index_string(method_array, "newpixeliterator", 1);
args[0] = getThis();
call_user_function(EG(function_table), NULL, method_array, &retval, 1, args TSRMLS_CC);
*return_value = *tmp_object;
zval_copy_ctor(return_value);
zval_dtor(method_array);
FREE_ZVAL(method_array);
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)
{
zval *object;
php_imagick_object *intern;
zval retval, *method_array;
zval *args[5];
zval *tmp_object;
zval *x, *y, *columns, *rows;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzzz", &x, &y, &columns, &rows) == FAILURE) {
return;
}
object = getThis();
intern = (php_imagick_object *)zend_object_store_get_object(object TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
MAKE_STD_ZVAL(tmp_object);
object_init_ex(tmp_object, php_imagickpixeliterator_sc_entry);
MAKE_STD_ZVAL(method_array);
array_init(method_array);
add_next_index_zval(method_array, tmp_object);
add_next_index_string(method_array, "newpixelregioniterator", 1);
args[0] = object;
args[1] = x;
args[2] = y;
args[3] = columns;
args[4] = rows;
call_user_function(EG(function_table), NULL, method_array, &retval, 5, args TSRMLS_CC);
*return_value = *tmp_object;
zval_copy_ctor(return_value);
zval_dtor(method_array);
FREE_ZVAL(method_array);
return;
}
/* }}} */
/* {{{ proto int Imagick::getCompression()
Gets the wand compression type.
*/
PHP_METHOD(imagick, getcompression)
{
php_imagick_object *intern;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
copyright = (char *)MagickGetCopyright();
ZVAL_STRING(return_value, copyright, 1);
return;
}
/* }}} */
/* {{{ 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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
filename = (char *)MagickGetFilename(intern->magick_wand);
if (filename) {
ZVAL_STRING(return_value, filename, 1);
IMAGICK_FREE_MEMORY(char *, 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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
format = (char *)MagickGetFormat(intern->magick_wand);
if (format) {
ZVAL_STRING(return_value, format, 1);
IMAGICK_FREE_MEMORY(char *, format);
}
return;
}
/* }}} */
/* {{{ proto string Imagick::getHomeURL()
Returns the ImageMagick home URL.
*/
PHP_METHOD(imagick, gethomeurl)
{
char *home_url;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
home_url = (char *)MagickGetHomeURL();
if (home_url) {
ZVAL_STRING(return_value, home_url, 1);
IMAGICK_FREE_MEMORY(char *, home_url);
}
return;
}
/* }}} */
/* {{{ proto int Imagick::getInterlaceScheme()
Gets the wand interlace scheme.
*/
PHP_METHOD(imagick, getinterlacescheme)
{
php_imagick_object *intern;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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;
int key_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &key, &key_len) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
value = MagickGetOption(intern->magick_wand, key);
if (value) {
ZVAL_STRING(return_value, value, 1);
IMAGICK_FREE_MEMORY(char *, 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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
package_name = (char *)MagickGetPackageName();
ZVAL_STRING(return_value, package_name, 1);
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;
long width, height, x, y;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
status = MagickGetPage(intern->magick_wand, &width, &height, &x, &y);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get page", 1);
}
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 array Imagick::getQuantumDepth()
Returns the ImageMagick quantum depth as a string constant.
*/
PHP_METHOD(imagick, getquantumdepth)
{
char *quantum_depth;
long depth;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
quantum_depth = (char *)MagickGetQuantumDepth(&depth);
array_init(return_value);
add_assoc_long(return_value, "quantumDepthLong", depth);
add_assoc_string(return_value, "quantumDepthString", quantum_depth, 1);
return;
}
/* }}} */
/* {{{ proto array Imagick::getQuantumRange()
Returns the ImageMagick quantum range as a string constant.
*/
PHP_METHOD(imagick, getquantumrange)
{
char *quantum_range;
long range;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
quantum_range = (char *)MagickGetQuantumRange(&range);
array_init(return_value);
add_assoc_long(return_value, "quantumRangeLong", range);
add_assoc_string(return_value, "quantumRangeString", quantum_range, 1);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
release_date = (char *)MagickGetReleaseDate();
ZVAL_STRING(return_value, release_date, 1);
return;
}
/* }}} */
/* {{{ proto int Imagick::getResource(int type)
Returns the specified resource in megabytes.
*/
PHP_METHOD(imagick, getresource)
{
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)
{
long resource_type;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &resource_type) == FAILURE) {
return;
}
RETVAL_LONG(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;
long number_factors = 0, i;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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]);
}
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;
unsigned long columns, rows;
MagickBooleanType status;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
status = MagickGetSize(intern->magick_wand, &columns, &rows);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to get size", 1);
}
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;
long version_number;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
version_string = (char *)MagickGetVersion(&version_number);
array_init(return_value);
add_assoc_long(return_value, "versionNumber", version_number);
add_assoc_string(return_value, "versionString", version_string, 1);
return;
}
/* }}} */
/* {{{ proto bool Imagick::setBackgroundColor(ImagickPixel background)
Sets the wand background color.
*/
PHP_METHOD(imagick, setbackgroundcolor)
{
zval *param;
php_imagick_object *intern;
php_imagickpixel_object *internp;
MagickBooleanType status;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶m) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CAST_PARAMETER_TO_COLOR(param, internp, 1);
status = MagickSetBackgroundColor(intern->magick_wand, internp->pixel_wand);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set background color", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::setCompression(COMPRESSIONTYPE compression)
Sets the wand compression type.
*/
PHP_METHOD(imagick, setcompression)
{
php_imagick_object *intern;
long compression;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &compression) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
status = MagickSetCompression(intern->magick_wand, compression);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set compression", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::setCompressionQuality(int quality)
Sets the wand compression quality.
*/
PHP_METHOD(imagick, setcompressionquality)
{
php_imagick_object *intern;
long quality;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &quality) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
status = MagickSetCompressionQuality(intern->magick_wand, quality);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set compression quality", 1);
}
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;
int 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
status = MagickSetFilename(intern->magick_wand, filename);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set filename", 1);
}
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;
int 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
status = MagickSetFormat(intern->magick_wand, format);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set format", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::setInterlaceScheme(INTERLACETYPE interlace_scheme)
Sets the image compression.
*/
PHP_METHOD(imagick, setinterlacescheme)
{
php_imagick_object *intern;
long schema;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &schema) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
status = MagickSetInterlaceScheme(intern->magick_wand, schema);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set interlace scheme", 1);
}
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;
int 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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
status = MagickSetOption(intern->magick_wand, key, value);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set option", 1);
}
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;
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
status = MagickSetPage(intern->magick_wand, width, height, x, y);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set page", 1);
}
RETURN_TRUE;
}
/* }}} */
PHP_METHOD(imagick, setimageprogressmonitor)
{
int status = IMAGICK_READ_WRITE_NO_ERROR;
char *filename;
int filename_len;
php_imagick_object *intern;
if (!IMAGICK_G(progress_monitor)) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(1, "Progress monitoring is disabled in ini-settings", 1);
}
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_SAFE_MODE_CHECK(filename, status);
IMAGICK_CHECK_READ_OR_WRITE_ERROR(intern, filename, status, IMAGICK_DONT_FREE_FILENAME, "Unable to read the file: %s");
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::setResourceLimit(RESOURCETYPE type, int limit)
Sets the limit for a particular resource in megabytes.
*/
PHP_METHOD(imagick, setresourcelimit)
{
MagickBooleanType status;
long type, limit;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &type, &limit) == FAILURE) {
return;
}
status = MagickSetResourceLimit(type, limit);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Unable to set resource limit", 1);
}
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
status = MagickSetResolution(intern->magick_wand, x_resolution, y_resolution);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set resolution", 1);
}
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;
long elements = 0;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &factors) == FAILURE) {
return;
}
double_array = get_double_array_from_zval(factors, &elements TSRMLS_CC);
if (double_array == (double *)NULL) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Can't read array", 1);
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
status = MagickSetSamplingFactors(intern->magick_wand, elements, double_array);
efree(double_array);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set sampling factors", 1);
}
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;
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 = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
status = MagickSetSize(intern->magick_wand, columns, rows);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set size", 1);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::setType(IMAGETYPE image_type)
Sets the image type attribute.
*/
PHP_METHOD(imagick, settype)
{
php_imagick_object *intern;
long type;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &type) == FAILURE) {
return;
}
intern = (php_imagick_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
status = MagickSetType(intern->magick_wand, type);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICK_EXCEPTION(intern->magick_wand, "Unable to set type", 1);
}
RETURN_TRUE;
}
/* }}} */
/* end of Imagick */
imagick-3.1.2/imagickdraw_class.c 0000644 0000765 0000024 00000246775 12220473715 015761 0 ustar mikko staff /*
+----------------------------------------------------------------------+
| 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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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 */
}
/* }}} */
/* {{{ 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 = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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;
php_imagickpixel_object *internp;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶m) == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CAST_PARAMETER_TO_COLOR(param, internp, 2);
DrawSetFillColor(internd->drawing_wand, internp->pixel_wand);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setResolution(float x, float y)
Sets the resolution
*/
PHP_METHOD(imagickdraw, setresolution)
{
char *density, buf[512];
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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
(void) snprintf(buf, 512, "%fx%f", x, y);
density = AcquireString(buf);
if (!density) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICKDRAW_CLASS, "Failed to allocate memory", 2);
}
draw_info = PeekDrawingWand(internd->drawing_wand);
draw_info->density = density;
d_wand = (DrawingWand *) DrawAllocateWand(draw_info, NULL);
if (!d_wand) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICKDRAW_CLASS, "Failed to allocate new DrawingWand structure", 2);
}
IMAGICKDRAW_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;
php_imagickpixel_object *internp;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶m) == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CAST_PARAMETER_TO_COLOR(param, internp, 2);
DrawSetStrokeColor(internd->drawing_wand, internp->pixel_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 = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
DrawSetFillAlpha(internd->drawing_wand, opacity);
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 = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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;
int encoding_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &encoding, &encoding_len) == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
DrawSetStrokeAlpha(internd->drawing_wand, opacity);
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 = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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;
int font_len, error = 0;
MagickBooleanType status;
/* 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) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICKDRAW_CLASS, "Can not set empty font", 2);
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
/* And if it wasn't */
if (!check_configured_font(font, font_len TSRMLS_CC )) {
if (!(absolute = expand_filepath(font, NULL TSRMLS_CC))) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICKDRAW_CLASS, "Unable to set font", 2);
}
/* Do a safe-mode check for the font */
IMAGICK_SAFE_MODE_CHECK(absolute, error);
IMAGICKDRAW_CHECK_READ_OR_WRITE_ERROR(internd, absolute, error, IMAGICK_FREE_FILENAME);
if (VCWD_ACCESS(absolute, F_OK|R_OK )) {
zend_throw_exception_ex(php_imagickdraw_exception_class_entry, 2 TSRMLS_CC,
"The given font is not found in the ImageMagick configuration and the file (%s) is not accessible", absolute);
efree(absolute);
return;
}
status = DrawSetFont(internd->drawing_wand, absolute);
efree(absolute);
} else {
status = DrawSetFont(internd->drawing_wand, font);
}
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICKDRAW_EXCEPTION(internd->drawing_wand, "Unable to set font", 1);
}
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;
int 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) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICKDRAW_CLASS, "Can not set empty font family", 2);
}
if (!check_configured_font(font_family, font_family_len TSRMLS_CC )) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICKDRAW_CLASS, "Unable to set font family; parameter not found in the list of configured fonts", 2);
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
status = DrawSetFontFamily(internd->drawing_wand, font_family);
/* No magick is going to happen */
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICKDRAW_EXCEPTION(internd->drawing_wand, "Unable to set font family", 1);
}
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 = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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;
long style_id = AnyStyle;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &style_id) == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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;
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 = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
DrawSetFontWeight(internd->drawing_wand, weight);
RETURN_TRUE;
} else {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICKDRAW_CLASS, "Font weight valid range is 100-900", 2);
}
}
/* }}} */
/* {{{ 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 = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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;
long stretch;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &stretch) == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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;
long align;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &align) == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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;
long decoration;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &decoration) == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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;
php_imagickpixel_object *internp;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶m) == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CAST_PARAMETER_TO_COLOR(param, internp, 2);
DrawSetTextUnderColor(internd->drawing_wand, internp->pixel_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;
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 = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
font = DrawGetFont(internd->drawing_wand);
if (!font) {
RETURN_FALSE;
} else {
ZVAL_STRING(return_value, font, 1);
IMAGICK_FREE_MEMORY(char *, 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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
font_family = DrawGetFontFamily(internd->drawing_wand);
if (!font_family) {
RETURN_FALSE;
} else {
ZVAL_STRING(return_value, font_family, 1);
IMAGICK_FREE_MEMORY(char *, 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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
if (!internd->drawing_wand) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICKDRAW_CLASS, "ImagickDraw object is not allocated properly", 2);
}
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
encoding = DrawGetTextEncoding(internd->drawing_wand);
if (!encoding) {
RETURN_FALSE;
} else {
ZVAL_STRING(return_value, encoding, 1);
IMAGICK_FREE_MEMORY(char *, encoding);
return;
}
}
/* }}} */
/* {{{ proto bool ImagickDraw::destroy()
Frees all resources associated with the drawing wand.
*/
PHP_METHOD(imagickdraw, destroy)
{
zval *object;
php_imagickdraw_object *internd;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
object = getThis();
internd = (php_imagickdraw_object *)zend_object_store_get_object(object TSRMLS_CC);
if (!internd->drawing_wand) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICKDRAW_CLASS, "ImagickDraw object is not allocated properly", 2);
}
ClearDrawingWand(internd->drawing_wand);
RETURN_TRUE;
}
/* }}} */
/* {{{ 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;
int 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 = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
#if MagickLibVersion < 0x632
font = DrawGetFont(internd->drawing_wand);
/* Fixes PECL Bug #11328 */
if (!font) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICKDRAW_CLASS, "Font needs to be set before annotating an image", 2);
}
#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 = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
DrawArc(internd->drawing_wand, sx, sy, ex, ey, sd, ed);
RETURN_TRUE;
}
/* }}} */
/* {{{ 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;
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 = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
DrawMatte(internd->drawing_wand, x, y, paint_method);
RETURN_TRUE;
}
/* }}} */
/* {{{ 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 = get_pointinfo_array(coordinate_array, &num_elements TSRMLS_CC);
if (!coordinates) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICKDRAW_CLASS, "Unable to read coordinate array", 2);
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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 = get_pointinfo_array(coordinate_array, &num_elements TSRMLS_CC);
if (!coordinates) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICKDRAW_CLASS, "Unable to read coordinate array", 2);
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
IMAGICK_METHOD_DEPRECATED("ImagickDraw", "clone");
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
tmp_wand = CloneDrawingWand(internd->drawing_wand);
object_init_ex(return_value, php_imagickdraw_sc_entry);
intern_return = (php_imagickdraw_object *)zend_object_store_get_object(return_value TSRMLS_CC);
IMAGICKDRAW_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, **ppzval;
HashTable *affine;
char *matrix_elements[] = { "sx", "rx", "ry",
"sy", "tx", "ty" };
int i;
double value;
AffineMatrix *pmatrix;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &affine_matrix) == FAILURE) {
return;
}
/* Allocate space to build matrix */
pmatrix = emalloc(sizeof(AffineMatrix));
affine = Z_ARRVAL_P(affine_matrix);
zend_hash_internal_pointer_reset_ex(affine, (HashPosition *) 0);
for (i = 0; i < 6 ; i++) {
if (zend_hash_find(affine, matrix_elements[i], 3, (void**)&ppzval) == FAILURE) {
efree(pmatrix);
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICKDRAW_CLASS, "AffineMatrix should contain keys: sx, rx, ry, sy, tx and ty", 2);
} 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);
if (strcmp(matrix_elements[i], "sx") == 0) {
pmatrix->sx = value;
} else if (strcmp(matrix_elements[i], "rx") == 0) {
pmatrix->rx = value;
} else if (strcmp(matrix_elements[i], "ry") == 0) {
pmatrix->ry = value;
} else if (strcmp(matrix_elements[i], "sy") == 0) {
pmatrix->sy = value;
} else if (strcmp(matrix_elements[i], "tx") == 0) {
pmatrix->tx = value;
} else if (strcmp(matrix_elements[i], "ty") == 0) {
pmatrix->ty = value;
}
}
}
internd = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
DrawAffine(internd->drawing_wand, pmatrix);
efree(pmatrix);
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;
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 = (php_imagick_object *) zend_object_store_get_object(magick_obj TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY(intern->magick_wand, 1, 1);
internd = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
status = DrawComposite(internd->drawing_wand, compose, x, y, width, height, intern->magick_wand);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICKDRAW_EXCEPTION(internd->drawing_wand, "Unable to composite", 2);
}
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;
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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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;
int comment_len;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &comment, &comment_len) == FAILURE) {
return;
}
internd = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
clip_path = DrawGetClipPath(internd->drawing_wand);
if (!clip_path) {
RETURN_FALSE;
} else {
ZVAL_STRING(return_value, clip_path, 1);
IMAGICK_FREE_MEMORY(char *, 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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
tmp_wand = NewPixelWand();
DrawGetFillColor(internd->drawing_wand, tmp_wand);
object_init_ex(return_value, php_imagickpixel_sc_entry);
internp = (php_imagickpixel_object *) zend_object_store_get_object(return_value TSRMLS_CC);
IMAGICKPIXEL_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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
tmp_wand = NewPixelWand();
DrawGetStrokeColor(internd->drawing_wand, tmp_wand);
object_init_ex(return_value, php_imagickpixel_sc_entry);
internp = (php_imagickpixel_object *) zend_object_store_get_object(return_value TSRMLS_CC);
IMAGICKPIXEL_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 num_elements, i;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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_MEMORY(double *, 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;
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 = get_double_array_from_zval(param_array, &elements TSRMLS_CC);
if (!double_array) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICKDRAW_CLASS, "Can't read array", 2);
}
internd = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
vector = DrawGetVectorGraphics(internd->drawing_wand);
ZVAL_STRING(return_value, vector, 1);
IMAGICK_FREE_MEMORY(char *, 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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
tmp_wand = NewPixelWand();
if (!tmp_wand) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICKDRAW_CLASS, "Failed to allocate memory", 2);
}
DrawGetTextUnderColor(internd->drawing_wand, tmp_wand);
object_init_ex(return_value, php_imagickpixel_sc_entry);
internp = (php_imagickpixel_object *) zend_object_store_get_object(return_value TSRMLS_CC);
IMAGICKPIXEL_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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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 = get_pointinfo_array(coordinate_array, &num_elements TSRMLS_CC);
if (!coordinates) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICKDRAW_CLASS, "Unable to read coordinate array", 2);
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
status = DrawPopPattern(internd->drawing_wand);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICKDRAW_EXCEPTION(internd->drawing_wand, "Unable to terminate the pattern definition", 2);
} else {
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;
int 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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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;
int 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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
DrawPushPattern(internd->drawing_wand, pattern_id, x, y, width, height);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool Imagick::render()
Renders all preceding drawing commands.
*/
PHP_METHOD(imagickdraw, render)
{
php_imagickdraw_object *internd;
MagickBooleanType status;
char *old_locale = NULL, *buffer = NULL;
zend_bool restore = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_SET_LOCALE(old_locale, buffer, restore);
status = DrawRender(internd->drawing_wand);
IMAGICK_RESTORE_LOCALE(old_locale, restore);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICKDRAW_EXCEPTION(internd->drawing_wand, "Unable to render the drawing commands", 2);
} else {
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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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;
int 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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
status = DrawSetClipPath(internd->drawing_wand, clip_mask);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICKDRAW_EXCEPTION(internd->drawing_wand, "Unable to set clipping path", 2);
} else {
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;
long fill_rule;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &fill_rule) == FAILURE) {
return;
}
internd = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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;
long units;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &units) == FAILURE) {
return;
}
internd = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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;
int 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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
status = DrawSetFillPatternURL(internd->drawing_wand, url);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICKDRAW_EXCEPTION(internd->drawing_wand, "Unable to set fill pattern URL", 2);
} else {
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;
long fill_rule;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &fill_rule) == FAILURE) {
return;
}
internd = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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;
long gravity;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &gravity) == FAILURE) {
return;
}
internd = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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;
int 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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
status = DrawSetStrokePatternURL(internd->drawing_wand, url);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICKDRAW_EXCEPTION(internd->drawing_wand, "Unable to set the stroke pattern URL", 2);
} else {
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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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;
long line_cap;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &line_cap) == FAILURE) {
return;
}
internd = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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;
long line_join;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &line_join) == FAILURE) {
return;
}
internd = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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;
long miter_limit;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &miter_limit) == FAILURE) {
return;
}
internd = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
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;
int 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 = (php_imagickdraw_object *) zend_object_store_get_object(getThis() TSRMLS_CC);
status = DrawSetVectorGraphics(internd->drawing_wand, vector);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICKDRAW_EXCEPTION(internd->drawing_wand, "Unable to set the vector graphics", 2);
} else {
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
status = PopDrawingWand(internd->drawing_wand);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICKDRAW_EXCEPTION(internd->drawing_wand, "Unable to pop the current ImagickDraw object", 2);
} else {
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internd = (php_imagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
status = PushDrawingWand(internd->drawing_wand);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICKDRAW_EXCEPTION(internd->drawing_wand, "Unable to push the current ImagickDraw object", 2);
} else {
RETURN_TRUE;
}
}
/* }}} */
/* END OF DRAWINGWAND METHODS */
imagick-3.1.2/imagickpixel_class.c 0000644 0000765 0000024 00000041150 12220473715 016121 0 ustar mikko staff /*
+----------------------------------------------------------------------+
| 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"
#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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internp = (php_imagickpixel_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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 = (php_imagickpixel_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
PixelSetHSL(internp->pixel_wand, hue, saturation, luminosity);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto int ImagickPixel::getColorValueQuantum(int color)
Gets the quantum color of the ImagickPixel
*/
PHP_METHOD(imagickpixel, getcolorvaluequantum)
{
php_imagickpixel_object *internp;
long color, color_value;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &color) == FAILURE) {
return;
}
internp = (php_imagickpixel_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
switch (color) {
case IMAGICKCOLORBLACK:
color_value = PixelGetBlackQuantum(internp->pixel_wand);
break;
case IMAGICKCOLORBLUE:
color_value = PixelGetBlueQuantum(internp->pixel_wand);
break;
case IMAGICKCOLORCYAN:
color_value = PixelGetCyanQuantum(internp->pixel_wand);
break;
case IMAGICKCOLORGREEN:
color_value = PixelGetGreenQuantum(internp->pixel_wand);
break;
case IMAGICKCOLORRED:
color_value = PixelGetRedQuantum(internp->pixel_wand);
break;
case IMAGICKCOLORYELLOW:
color_value = PixelGetYellowQuantum(internp->pixel_wand);
break;
case IMAGICKCOLORMAGENTA:
color_value = PixelGetMagentaQuantum(internp->pixel_wand);
break;
case IMAGICKCOLOROPACITY:
color_value = PixelGetOpacityQuantum(internp->pixel_wand);
break;
case IMAGICKCOLORALPHA:
color_value = PixelGetAlphaQuantum(internp->pixel_wand);
break;
default:
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICKPIXEL_CLASS, "Unknown color type", 4);
break;
}
RETVAL_LONG(color_value);
}
/* }}} */
/* {{{ proto bool ImagickPixel::setColorValueQuantum(int color, float value)
Sets the quantum color of the ImagickPixel.
*/
PHP_METHOD(imagickpixel, setcolorvaluequantum)
{
php_imagickpixel_object *internp;
long color, color_value;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &color, &color_value) == FAILURE) {
return;
}
internp = (php_imagickpixel_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
switch (color) {
case IMAGICKCOLORBLACK:
PixelSetBlackQuantum(internp->pixel_wand, color_value);
break;
case IMAGICKCOLORBLUE:
PixelSetBlueQuantum(internp->pixel_wand, color_value);
break;
case IMAGICKCOLORCYAN:
PixelSetCyanQuantum(internp->pixel_wand, color_value);
break;
case IMAGICKCOLORGREEN:
PixelSetGreenQuantum(internp->pixel_wand, color_value);
break;
case IMAGICKCOLORRED:
PixelSetRedQuantum(internp->pixel_wand, color_value);
break;
case IMAGICKCOLORYELLOW:
PixelSetYellowQuantum(internp->pixel_wand, color_value);
break;
case IMAGICKCOLORMAGENTA:
PixelSetMagentaQuantum(internp->pixel_wand, color_value);
break;
case IMAGICKCOLOROPACITY:
PixelSetOpacityQuantum(internp->pixel_wand, color_value);
break;
case IMAGICKCOLORALPHA:
PixelSetAlphaQuantum(internp->pixel_wand, color_value);
break;
default:
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICKPIXEL_CLASS, "Unknown color type", 4);
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internp = (php_imagickpixel_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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;
long index;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &index) == FAILURE) {
return;
}
internp = (php_imagickpixel_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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;
int color_name_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &color_name, &color_name_len) == FAILURE) {
return;
}
internp = (php_imagickpixel_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
internp->pixel_wand = NewPixelWand();
if (!internp->pixel_wand) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICKPIXEL_CLASS, "Failed to allocate PixelWand structure", 4);
}
/* If color was given as parameter, set it here.*/
if (color_name && color_name_len) {
if (PixelSetColor(internp->pixel_wand, color_name) == MagickFalse) {
IMAGICK_THROW_IMAGICKPIXEL_EXCEPTION(internp->pixel_wand, "Unable to construct ImagickPixel", 4);
}
}
RETURN_TRUE;
}
/* }}} */
/* {{{ 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;
int 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 = (php_imagickpixel_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
status = PixelSetColor(internp->pixel_wand, color_name);
if (status == MagickFalse) {
IMAGICK_THROW_IMAGICKPIXEL_EXCEPTION(internp->pixel_wand, "Unable to set ImagickPixel color", 4);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickPixel::clear()
Clears resources associated with the wand.
*/
PHP_METHOD(imagickpixel, clear)
{
php_imagickpixel_object *internp;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internp = (php_imagickpixel_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
if (!internp->pixel_wand) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICKPIXEL_CLASS, "ImagickPixel is not allocated", 4);
}
ClearPixelWand(internp->pixel_wand);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickPixel::destroy()
Deallocates resources associated with a PixelWand.
*/
PHP_METHOD(imagickpixel, destroy)
{
zval *object;
php_imagickpixel_object *internp;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
object = getThis();
internp = (php_imagickpixel_object *)zend_object_store_get_object(object TSRMLS_CC);
if (!internp->pixel_wand) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICKPIXEL_CLASS, "ImagickPixel is not allocated properly", 4);
}
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.
*/
PHP_METHOD(imagickpixel, issimilar)
{
zval *param;
double fuzz;
php_imagickpixel_object *internp, *internp_second;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zd", ¶m, &fuzz) == FAILURE) {
return;
}
internp = (php_imagickpixel_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CAST_PARAMETER_TO_COLOR(param, internp_second, 4);
status = IsPixelWandSimilar(internp->pixel_wand, internp_second->pixel_wand, fuzz);
if(status == MagickFalse) {
RETURN_FALSE;
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto float ImagickPixel::getColorValue(int color)
Gets the normalized color of the ImagickPixel.
*/
PHP_METHOD(imagickpixel, getcolorvalue)
{
php_imagickpixel_object *internp;
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 = (php_imagickpixel_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
switch (color) {
case IMAGICKCOLORBLACK:
color_value = PixelGetBlack(internp->pixel_wand);
break;
case IMAGICKCOLORBLUE:
color_value = PixelGetBlue(internp->pixel_wand);
break;
case IMAGICKCOLORCYAN:
color_value = PixelGetCyan(internp->pixel_wand);
break;
case IMAGICKCOLORGREEN:
color_value = PixelGetGreen(internp->pixel_wand);
break;
case IMAGICKCOLORRED:
color_value = PixelGetRed(internp->pixel_wand);
break;
case IMAGICKCOLORYELLOW:
color_value = PixelGetYellow(internp->pixel_wand);
break;
case IMAGICKCOLORMAGENTA:
color_value = PixelGetMagenta(internp->pixel_wand);
break;
case IMAGICKCOLOROPACITY:
color_value = PixelGetOpacity(internp->pixel_wand);
break;
case IMAGICKCOLORALPHA:
color_value = PixelGetAlpha(internp->pixel_wand);
break;
#if MagickLibVersion > 0x628
case IMAGICKCOLORFUZZ:
color_value = PixelGetFuzz(internp->pixel_wand);
break;
#endif
default:
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICKPIXEL_CLASS, "Unknown color type", 4);
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_imagickpixel_object *internp;
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 = (php_imagickpixel_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
switch (color) {
case IMAGICKCOLORBLACK:
PixelSetBlack(internp->pixel_wand, color_value);
break;
case IMAGICKCOLORBLUE:
PixelSetBlue(internp->pixel_wand, color_value);
break;
case IMAGICKCOLORCYAN:
PixelSetCyan(internp->pixel_wand, color_value);
break;
case IMAGICKCOLORGREEN:
PixelSetGreen(internp->pixel_wand, color_value);
break;
case IMAGICKCOLORRED:
PixelSetRed(internp->pixel_wand, color_value);
break;
case IMAGICKCOLORYELLOW:
PixelSetYellow(internp->pixel_wand, color_value);
break;
case IMAGICKCOLORMAGENTA:
PixelSetMagenta(internp->pixel_wand, color_value);
break;
case IMAGICKCOLOROPACITY:
PixelSetOpacity(internp->pixel_wand, color_value);
break;
case IMAGICKCOLORALPHA:
PixelSetAlpha(internp->pixel_wand, color_value);
break;
#if MagickLibVersion > 0x628
case IMAGICKCOLORFUZZ:
PixelSetFuzz(internp->pixel_wand, color_value);
break;
#endif
default:
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICKPIXEL_CLASS, "Unknown color type", 4);
break;
}
RETVAL_TRUE;
}
/* }}} */
/* {{{ proto array ImagickPixel::getColor([bool normalized])
Returns the color of the pixel in an array
*/
PHP_METHOD(imagickpixel, getcolor)
{
php_imagickpixel_object *internp;
zend_bool normalized = 0;
double red, green, blue, alpha;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &normalized) == FAILURE) {
return;
}
internp = (php_imagickpixel_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
array_init(return_value);
if (normalized == 1) {
red = PixelGetRed(internp->pixel_wand);
green = PixelGetGreen(internp->pixel_wand);
blue = PixelGetBlue(internp->pixel_wand);
alpha = PixelGetAlpha(internp->pixel_wand);
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 {
/* TODO: should this be quantum range instead of hardcoded 255.. */
red = PixelGetRed(internp->pixel_wand ) * 255;
green = PixelGetGreen(internp->pixel_wand ) * 255;
blue = PixelGetBlue(internp->pixel_wand ) * 255;
alpha = PixelGetAlpha(internp->pixel_wand);
add_assoc_long(return_value, "r", (int)(red > 0.0 ? red + 0.5 : red - 0.5));
add_assoc_long(return_value, "g", (int)(green > 0.0 ? green + 0.5 : green - 0.5));
add_assoc_long(return_value, "b", (int)(blue > 0.0 ? blue + 0.5 : blue - 0.5));
add_assoc_long(return_value, "a", alpha);
}
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internp = (php_imagickpixel_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
color_string = PixelGetColorAsString(internp->pixel_wand);
ZVAL_STRING(return_value, color_string, 1);
IMAGICK_FREE_MEMORY(char *, color_string);
return;
}
/* }}} */
/* {{{ proto array 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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
IMAGICK_METHOD_DEPRECATED("ImagickPixel", "clone");
internp = (php_imagickpixel_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
IMAGICK_CLONE_PIXELWAND(internp->pixel_wand, pixel_wand);
object_init_ex(return_value, php_imagickpixel_sc_entry);
intern_return = (php_imagickpixel_object *)zend_object_store_get_object(return_value TSRMLS_CC);
IMAGICKPIXEL_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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internp = (php_imagickpixel_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
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;
long color_count;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &color_count) == FAILURE) {
return;
}
internp = (php_imagickpixel_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
PixelSetColorCount(internp->pixel_wand, color_count);
RETVAL_TRUE;
}
/* }}} */
imagick-3.1.2/imagickpixeliterator_class.c 0000644 0000765 0000024 00000050073 12220473715 017677 0 ustar mikko staff /*
+----------------------------------------------------------------------+
| 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"
/* {{{ 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", &magick_object, php_imagick_sc_entry) == FAILURE ) {
return;
}
internpix = (php_imagickpixeliterator_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
intern = (php_imagick_object *)zend_object_store_get_object(magick_object TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY( intern->magick_wand, 1, 1 );
if ( intern->magick_wand == (MagickWand *)NULL || !IsMagickWand( intern->magick_wand ) ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "Invalid Imagick object passed", 3 );
}
internpix->pixel_iterator = NewPixelIterator( intern->magick_wand );
internpix->iterator_type = 1;
#if MagickLibVersion <= 0x628
count_pixeliterator_rows( internpix TSRMLS_CC );
#endif
if ( internpix->pixel_iterator == (PixelIterator *)NULL || !IsPixelIterator( internpix->pixel_iterator ) ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "Can not allocate ImagickPixelIterator", 3 );
}
internpix->instanciated_correctly = 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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internpix = (php_imagickpixeliterator_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
if ( internpix->instanciated_correctly < 1 ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "PixelIterator is not initialized correctly", 3 );
}
if ( internpix->pixel_iterator == (PixelIterator *)NULL || !IsPixelIterator( internpix->pixel_iterator ) ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "PixelIterator is not initialized correctly", 3 );
}
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internpix = (php_imagickpixeliterator_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
if ( internpix->instanciated_correctly < 1 ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly", 3 );
}
if ( internpix->pixel_iterator == (PixelIterator *)NULL || !IsPixelIterator( internpix->pixel_iterator ) ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly", 3 );
}
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internpix = (php_imagickpixeliterator_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
if ( internpix->instanciated_correctly < 1 ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly", 3 );
}
if ( internpix->pixel_iterator == (PixelIterator *)NULL || !IsPixelIterator( internpix->pixel_iterator ) ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly", 3 );
}
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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internpix = (php_imagickpixeliterator_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
if ( internpix->instanciated_correctly != 1 ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly", 3 );
}
if ( internpix->pixel_iterator == (PixelIterator *)NULL || !IsPixelIterator( internpix->pixel_iterator ) ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly", 3 );
}
PixelSetLastIteratorRow( internpix->pixel_iterator );
#if MagickLibVersion <= 0x628
internpix->iterator_position = (internpix->rows - 1);
#endif
RETURN_TRUE;
}
/* }}} */
/* {{{ proto ImagickPixelIterator ImagickPixelIterator::newPixelIterator( Imagick source )
Returns a new pixel iterator.
*/
PHP_METHOD(imagickpixeliterator, newpixeliterator)
{
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;
}
internpix = (php_imagickpixeliterator_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
intern = (php_imagick_object *)zend_object_store_get_object(magick_object TSRMLS_CC);
IMAGICK_CHECK_NOT_EMPTY( intern->magick_wand, 1, 1 );
if ( intern->magick_wand == (MagickWand *)NULL || !IsMagickWand( intern->magick_wand ) ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "Invalid Imagick object passed", 3 );
}
internpix->pixel_iterator = NewPixelIterator( intern->magick_wand );
internpix->iterator_type = 1;
#if MagickLibVersion <= 0x628
count_pixeliterator_rows( internpix TSRMLS_CC );
#endif
if ( internpix->pixel_iterator == (PixelIterator *)NULL || !IsPixelIterator( internpix->pixel_iterator ) ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "Can not allocate ImagickPixelIterator", 3 );
}
internpix->instanciated_correctly = 1;
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickPixelIterator::newPixelRegionIterator(Imagick source, int x, int y, int columns, int rows)
Returns a new pixel iterator.
*/
PHP_METHOD(imagickpixeliterator, newpixelregioniterator)
{
zval *magick_object;
php_imagickpixeliterator_object *internpix;
php_imagick_object *intern;
zval *x, *y, *columns, *rows;
/* Parse parameters given to function */
if (zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "Ozzzz", &magick_object, php_imagick_sc_entry, &x, &y, &columns, &rows) == FAILURE ) {
return;
}
if ( Z_TYPE_P( x ) != IS_LONG || Z_TYPE_P( y ) != IS_LONG || Z_TYPE_P( columns ) != IS_LONG || Z_TYPE_P( rows ) != IS_LONG ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator::newPixelRegionIterator() parameters should be integers", 3 );
}
internpix = (php_imagickpixeliterator_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
intern = (php_imagick_object *)zend_object_store_get_object(magick_object TSRMLS_CC);
if ( intern->magick_wand == (MagickWand *)NULL || !IsMagickWand( intern->magick_wand ) ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "Invalid Imagick object passed", 3 );
}
IMAGICK_CHECK_NOT_EMPTY( intern->magick_wand, 1, 1 );
internpix->pixel_iterator = NewPixelRegionIterator( intern->magick_wand, Z_LVAL_P( x ), Z_LVAL_P(y), Z_LVAL_P(columns), Z_LVAL_P(rows) );
internpix->iterator_type = 2;
#if MagickLibVersion <= 0x628
count_pixeliterator_rows( internpix TSRMLS_CC );
#endif
if ( internpix->pixel_iterator == (PixelIterator *)NULL || !IsPixelIterator( internpix->pixel_iterator ) ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "Can not allocate ImagickPixelIterator", 3 );
}
internpix->instanciated_correctly = 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(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internpix = (php_imagickpixeliterator_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
if ( internpix->instanciated_correctly < 1 ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly", 3 );
}
if ( internpix->pixel_iterator == (PixelIterator *)NULL || !IsPixelIterator( internpix->pixel_iterator ) )
{
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly", 3 );
}
#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 = (php_imagickpixeliterator_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
if ( internpix->instanciated_correctly < 1 ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly", 3 );
}
if ( internpix->pixel_iterator == (PixelIterator *)NULL || !IsPixelIterator( internpix->pixel_iterator ) ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly", 3 );
}
status = PixelSetIteratorRow( internpix->pixel_iterator, row );
if ( status == MagickFalse) {
IMAGICK_THROW_IMAGICKPIXELITERATOR_EXCEPTION( internpix->pixel_iterator, "Unable to set iterator row", 3 );
}
#if MagickLibVersion <= 0x628
internpix->iterator_position = row;
#endif
RETURN_TRUE;
}
/* }}} */
/* {{{ 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;
php_imagickpixel_object *internp;
PixelWand **wand_array;
unsigned long num_wands, i;
zval *tmp_pixelwand;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internpix = (php_imagickpixeliterator_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
if ( internpix->instanciated_correctly < 1 ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly", 3 );
}
if ( internpix->pixel_iterator == (PixelIterator *)NULL || !IsPixelIterator( internpix->pixel_iterator ) ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly", 3 );
}
wand_array = PixelGetPreviousIteratorRow( internpix->pixel_iterator, &num_wands );
#if MagickLibVersion <= 0x628
if ( internpix->iterator_position != 0 ) {
internpix->iterator_position--;
}
#endif
if ( wand_array == (PixelWand **)NULL ) {
RETURN_NULL();
}
array_init( return_value );
for (i = 0; i < num_wands; i++ ) {
if ( wand_array[i] != (PixelWand *)NULL && IsPixelWand ( wand_array[i] ) ) {
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);
IMAGICKPIXEL_REPLACE_PIXELWAND( internp, wand_array[i] );
internp->initialized_via_iterator = 1;
add_next_index_zval( return_value, tmp_pixelwand );
}
}
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;
php_imagickpixel_object *internp;
PixelWand **wand_array;
long num_wands;
int i;
zval *tmp_pixelwand;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internpix = (php_imagickpixeliterator_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
if ( internpix->instanciated_correctly < 1 ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly", 3 );
}
if ( internpix->pixel_iterator == (PixelIterator *)NULL || !IsPixelIterator( internpix->pixel_iterator ) ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly", 3 );
}
#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 = (PixelWand **)PixelGetNextIteratorRow( internpix->pixel_iterator, &num_wands );
#else
wand_array = (PixelWand **)PixelGetCurrentIteratorRow( internpix->pixel_iterator, &num_wands );
#endif
if ( wand_array == (PixelWand **)NULL ) {
RETURN_NULL();
}
array_init( return_value );
for (i = 0; i < num_wands; i++ ) {
if ( wand_array[i] != (PixelWand *)NULL && IsPixelWand ( wand_array[i] ) ) {
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);
IMAGICKPIXEL_REPLACE_PIXELWAND( internp, wand_array[i] );
internp->initialized_via_iterator = 1;
add_next_index_zval( return_value, tmp_pixelwand );
}
}
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;
php_imagickpixel_object *internp;
PixelWand **wand_array;
unsigned long num_wands, i;
zval *tmp_pixelwand;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internpix = (php_imagickpixeliterator_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
if ( internpix->instanciated_correctly < 1 ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly", 3 );
}
if ( internpix->pixel_iterator == (PixelIterator *)NULL || !IsPixelIterator( internpix->pixel_iterator ) ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly", 3 );
}
wand_array = PixelGetNextIteratorRow( internpix->pixel_iterator, &num_wands );
#if MagickLibVersion <= 0x628
internpix->iterator_position++;
#endif
if ( wand_array == (PixelWand **)NULL ) {
RETURN_NULL();
}
array_init( return_value );
for (i = 0; i < num_wands; i++ ) {
if ( wand_array[i] != (PixelWand *)NULL && IsPixelWand ( wand_array[i] ) ) {
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);
IMAGICKPIXEL_REPLACE_PIXELWAND( internp, wand_array[i] );
internp->initialized_via_iterator = 1;
add_next_index_zval( return_value, tmp_pixelwand );
}
}
return;
}
/* }}} */
/* {{{ proto bool ImagickPixelIterator::destroy()
Deallocates resources associated with a PixelIterator.
*/
PHP_METHOD(imagickpixeliterator, destroy)
{
zval *object;
php_imagickpixeliterator_object *internpix;
object = getThis();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internpix = (php_imagickpixeliterator_object *)zend_object_store_get_object(object TSRMLS_CC);
if ( internpix->instanciated_correctly < 1 ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly", 3 );
}
if ( internpix->pixel_iterator == (PixelIterator *)NULL || !IsPixelIterator( internpix->pixel_iterator ) ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly", 3 );
}
#if MagickLibVersion >= 0x628
ClearPixelIterator( internpix->pixel_iterator );
#endif
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickPixelIterator::clear()
Clear resources associated with a PixelIterator.
*/
PHP_METHOD(imagickpixeliterator, clear)
{
php_imagickpixeliterator_object *internpix;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internpix = (php_imagickpixeliterator_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
if ( internpix->instanciated_correctly < 1 ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly", 3 );
}
if ( internpix->pixel_iterator == (PixelIterator *)NULL || !IsPixelIterator( internpix->pixel_iterator ) ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly", 3 );
}
/* Assertion failure with earlier versions */
#if MagickLibVersion <= 0x628
RETURN_TRUE;
#else
ClearPixelIterator( internpix->pixel_iterator );
RETURN_TRUE;
#endif
}
/* }}} */
/* {{{ proto bool ImagickPixelIterator::clear()
Clear resources associated with a PixelIterator.
*/
PHP_METHOD(imagickpixeliterator, valid)
{
php_imagickpixeliterator_object *internpix;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
return;
}
internpix = (php_imagickpixeliterator_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
if ( internpix->instanciated_correctly < 1 ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly", 3 );
}
if ( internpix->pixel_iterator == (PixelIterator *)NULL || !IsPixelIterator( internpix->pixel_iterator ) ) {
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE( IMAGICKPIXELITERATOR_CLASS, "ImagickPixelIterator is not initialized correctly", 3 );
}
#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 */
imagick-3.1.2/imagick_helpers.c 0000644 0000765 0000024 00000115743 12220473715 015426 0 ustar mikko staff /*
+----------------------------------------------------------------------+
| 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"
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: %ld, span: %ld\n", text, offset, span);
fclose(fp);
return MagickTrue;
}
zend_bool php_imagick_thumbnail_dimensions(MagickWand *magick_wand, zend_bool bestfit, long desired_width, long desired_height, long *new_width, long *new_height)
{
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;
*new_height = ratio_x * (double)orig_height;
} else {
*new_height = desired_height;
*new_width = 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;
*new_width = orig_width / ratio;
*new_height = desired_height;
} else {
ratio = (double)orig_width / (double)desired_width;
*new_height = orig_height / ratio;
*new_width = desired_width;
}
} else {
*new_width = desired_width;
*new_height = desired_height;
}
}
return 1;
}
#if MagickLibVersion > 0x631
/*
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
*/
zend_bool php_imagick_resize_bounding_box(MagickWand *magick_wand, long box_width, long box_height, zend_bool fill)
{
long new_width, new_height;
long extent_x, extent_y;
/* Calculate dimensions */
if (!php_imagick_thumbnail_dimensions(magick_wand, 1, box_width, box_height, &new_width, &new_height)) {
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
zend_bool php_imagick_validate_map(const char *map TSRMLS_DC)
{
zend_bool match;
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;
}
}
if (!match) {
return 0;
}
*(p++);
}
return 1;
}
int count_occurences_of(char needle, char *haystack TSRMLS_DC)
{
int occurances = 0;
if (haystack == (char *)NULL) {
return 0;
}
while (*haystack != '\0') {
if (*(haystack++) == needle) {
occurances++;
}
}
return occurances;
}
double *get_double_array_from_zval(zval *param_array, long *num_elements TSRMLS_DC)
{
zval **ppzval;
HashTable *ht;
double *double_array;
long elements, i = 0;
*num_elements = elements = zend_hash_num_elements(Z_ARRVAL_P(param_array));
if (elements == 0) {
return NULL;
}
double_array = (double *)emalloc(sizeof(double) * elements);
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;
tmp_zval = **ppzval;
zval_copy_ctor(&tmp_zval);
tmp_pzval = &tmp_zval;
convert_to_double(tmp_pzval);
double_array[i] = Z_DVAL_P(tmp_pzval);
tmp_pzval = NULL;
}
*num_elements = elements;
return double_array;
}
long *get_long_array_from_zval(zval *param_array, long *num_elements TSRMLS_DC)
{
zval **ppzval;
long *long_array;
long elements, i = 0;
*num_elements = elements = zend_hash_num_elements(Z_ARRVAL_P(param_array));
if (elements == 0) {
return NULL;
}
long_array = emalloc(sizeof(long) * elements);
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;
tmp_zval = **ppzval;
zval_copy_ctor(&tmp_zval);
tmp_pzval = &tmp_zval;
convert_to_long(tmp_pzval);
long_array[i] = Z_LVAL_P(tmp_pzval);
tmp_pzval = NULL;
}
*num_elements = elements;
return long_array;
}
unsigned char *get_char_array_from_zval(zval *param_array, long *num_elements TSRMLS_DC)
{
zval **ppzval;
unsigned char *char_array;
long elements, i = 0;
*num_elements = elements = zend_hash_num_elements(Z_ARRVAL_P(param_array));
if (elements == 0) {
return NULL;
}
char_array = emalloc(sizeof(unsigned char) * elements);
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;
tmp_zval = **ppzval;
zval_copy_ctor(&tmp_zval);
tmp_pzval = &tmp_zval;
convert_to_long(tmp_pzval);
char_array[i] = Z_LVAL_P(tmp_pzval);
tmp_pzval = NULL;
}
*num_elements = elements;
return char_array;
}
int check_configured_font(char *font, int font_len TSRMLS_DC)
{
int retval = 0;
char **fonts;
unsigned long num_fonts = 0, i = 0;
/* Check that user is only able to set a proper font */
fonts = (char **) 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_MEMORY(char **, fonts);
return retval;
}
zend_bool crop_thumbnail_image(MagickWand *magick_wand, long desired_width, long desired_height TSRMLS_DC)
{
double ratio_x, ratio_y;
long crop_x = 0, crop_y = 0, new_width, new_height;
long orig_width = MagickGetImageWidth(magick_wand);
long orig_height = 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;
}
ratio_x = (double)desired_width / (double)orig_width;
ratio_y = (double)desired_height / (double)orig_height;
if (ratio_x > ratio_y) {
new_width = desired_width;
new_height = ratio_x * (double)orig_height;
} else {
new_height = desired_height;
new_width = ratio_y * (double)orig_width;
}
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;
}
crop_x = (new_width - desired_width) / 2;
crop_y = (new_height - desired_height) / 2;
if (MagickCropImage(magick_wand, desired_width, desired_height, crop_x, crop_y) == MagickFalse) {
return 0;
}
MagickSetImagePage(magick_wand, desired_width, desired_height, 0, 0);
return 1;
}
void *get_pointinfo_array(zval *coordinate_array, int *num_elements TSRMLS_DC)
{
PointInfo *coordinates;
long elements, sub_elements, i;
HashTable *coords;
zval **ppzval;
HashTable *sub_array;
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 = (PointInfo *)emalloc(sizeof(PointInfo) * elements);
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);
}
return coordinates;
}
#if MagickLibVersion <= 0x628
void count_pixeliterator_rows(php_imagickpixeliterator_object *internpix TSRMLS_DC)
{
long rows = 0, tmp;
PixelWand **row;
(void) PixelResetIterator(internpix->pixel_iterator);
while ((row = (PixelWand **)PixelGetNextIteratorRow(internpix->pixel_iterator, &tmp))) {
if (row == (PixelWand **)NULL) {
break;
}
rows++;
}
internpix->rows = rows;
}
#endif
void initialize_imagick_constants()
{
TSRMLS_FETCH();
/* Constants defined in php_imagick.h */
IMAGICK_REGISTER_CONST_LONG("COLOR_BLACK", IMAGICKCOLORBLACK);
IMAGICK_REGISTER_CONST_LONG("COLOR_BLUE", IMAGICKCOLORBLUE);
IMAGICK_REGISTER_CONST_LONG("COLOR_CYAN", IMAGICKCOLORCYAN);
IMAGICK_REGISTER_CONST_LONG("COLOR_GREEN", IMAGICKCOLORGREEN);
IMAGICK_REGISTER_CONST_LONG("COLOR_RED", IMAGICKCOLORRED);
IMAGICK_REGISTER_CONST_LONG("COLOR_YELLOW", IMAGICKCOLORYELLOW);
IMAGICK_REGISTER_CONST_LONG("COLOR_MAGENTA", IMAGICKCOLORMAGENTA);
IMAGICK_REGISTER_CONST_LONG("COLOR_OPACITY", IMAGICKCOLOROPACITY);
IMAGICK_REGISTER_CONST_LONG("COLOR_ALPHA", IMAGICKCOLORALPHA);
IMAGICK_REGISTER_CONST_LONG("COLOR_FUZZ", IMAGICKCOLORFUZZ);
/* 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);
/* ImageMagick defined constants */
IMAGICK_REGISTER_CONST_LONG("COMPOSITE_DEFAULT", OverCompositeOp);
IMAGICK_REGISTER_CONST_LONG("COMPOSITE_UNDEFINED", UndefinedCompositeOp);
IMAGICK_REGISTER_CONST_LONG("COMPOSITE_NO", NoCompositeOp);
IMAGICK_REGISTER_CONST_LONG("COMPOSITE_ADD", AddCompositeOp);
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);
IMAGICK_REGISTER_CONST_LONG("COMPOSITE_COPYOPACITY", CopyOpacityCompositeOp);
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);
IMAGICK_REGISTER_CONST_LONG("COMPOSITE_MINUS", MinusCompositeOp);
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);
IMAGICK_REGISTER_CONST_LONG("COMPOSITE_SUBTRACT", SubtractCompositeOp);
IMAGICK_REGISTER_CONST_LONG("COMPOSITE_THRESHOLD", ThresholdCompositeOp);
IMAGICK_REGISTER_CONST_LONG("COMPOSITE_XOR", XorCompositeOp);
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);
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);
IMAGICK_REGISTER_CONST_LONG("FILTER_HANNING", HanningFilter);
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);
IMAGICK_REGISTER_CONST_LONG("IMGTYPE_UNDEFINED", UndefinedType);
IMAGICK_REGISTER_CONST_LONG("IMGTYPE_BILEVEL", BilevelType);
IMAGICK_REGISTER_CONST_LONG("IMGTYPE_GRAYSCALE", GrayscaleType);
IMAGICK_REGISTER_CONST_LONG("IMGTYPE_GRAYSCALEMATTE", GrayscaleMatteType);
IMAGICK_REGISTER_CONST_LONG("IMGTYPE_PALETTE", PaletteType);
IMAGICK_REGISTER_CONST_LONG("IMGTYPE_PALETTEMATTE", PaletteMatteType);
IMAGICK_REGISTER_CONST_LONG("IMGTYPE_TRUECOLOR", TrueColorType);
IMAGICK_REGISTER_CONST_LONG("IMGTYPE_TRUECOLORMATTE", TrueColorMatteType);
IMAGICK_REGISTER_CONST_LONG("IMGTYPE_COLORSEPARATION", ColorSeparationType);
IMAGICK_REGISTER_CONST_LONG("IMGTYPE_COLORSEPARATIONMATTE", ColorSeparationMatteType);
IMAGICK_REGISTER_CONST_LONG("IMGTYPE_OPTIMIZE", OptimizeType);
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
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("STRETCH_NORMAL", NormalStretch);
IMAGICK_REGISTER_CONST_LONG("STRETCH_ULTRACONDENSED", UltraCondensedStretch);
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);
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);
IMAGICK_REGISTER_CONST_LONG("CHANNEL_MATTE", MatteChannel); /* deprecated, needs to throw E_STRICT if used */
IMAGICK_REGISTER_CONST_LONG("CHANNEL_BLACK", BlackChannel);
IMAGICK_REGISTER_CONST_LONG("CHANNEL_INDEX", IndexChannel);
IMAGICK_REGISTER_CONST_LONG("CHANNEL_ALL", AllChannels);
#ifdef DefaultChannels
IMAGICK_REGISTER_CONST_LONG("CHANNEL_DEFAULT", DefaultChannels);
#endif
IMAGICK_REGISTER_CONST_LONG("METRIC_UNDEFINED", UndefinedMetric);
IMAGICK_REGISTER_CONST_LONG("METRIC_MEANABSOLUTEERROR", MeanAbsoluteErrorMetric);
IMAGICK_REGISTER_CONST_LONG("METRIC_MEANSQUAREERROR", MeanSquaredErrorMetric);
IMAGICK_REGISTER_CONST_LONG("METRIC_PEAKABSOLUTEERROR", PeakAbsoluteErrorMetric);
IMAGICK_REGISTER_CONST_LONG("METRIC_PEAKSIGNALTONOISERATIO", PeakSignalToNoiseRatioMetric);
IMAGICK_REGISTER_CONST_LONG("METRIC_ROOTMEANSQUAREDERROR", RootMeanSquaredErrorMetric);
IMAGICK_REGISTER_CONST_LONG("PIXEL_CHAR", CharPixel);
IMAGICK_REGISTER_CONST_LONG("PIXEL_DOUBLE", DoublePixel);
IMAGICK_REGISTER_CONST_LONG("PIXEL_FLOAT", FloatPixel);
IMAGICK_REGISTER_CONST_LONG("PIXEL_INTEGER", IntegerPixel);
IMAGICK_REGISTER_CONST_LONG("PIXEL_LONG", LongPixel);
IMAGICK_REGISTER_CONST_LONG("PIXEL_QUANTUM", QuantumPixel);
IMAGICK_REGISTER_CONST_LONG("PIXEL_SHORT", ShortPixel);
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
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);
IMAGICK_REGISTER_CONST_LONG("COLORSPACE_LAB", LABColorspace);
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);
IMAGICK_REGISTER_CONST_LONG("COLORSPACE_REC601LUMA", Rec601LumaColorspace);
IMAGICK_REGISTER_CONST_LONG("COLORSPACE_REC709LUMA", Rec709LumaColorspace);
IMAGICK_REGISTER_CONST_LONG("COLORSPACE_LOG", LogColorspace);
#if MagickLibVersion >= 0x642
IMAGICK_REGISTER_CONST_LONG("COLORSPACE_CMY", CMYColorspace);
#endif
IMAGICK_REGISTER_CONST_LONG("VIRTUALPIXELMETHOD_UNDEFINED", UndefinedVirtualPixelMethod);
IMAGICK_REGISTER_CONST_LONG("VIRTUALPIXELMETHOD_BACKGROUND", BackgroundVirtualPixelMethod);
IMAGICK_REGISTER_CONST_LONG("VIRTUALPIXELMETHOD_CONSTANT", ConstantVirtualPixelMethod); /* deprecated */
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
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);
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);
IMAGICK_REGISTER_CONST_LONG("INTERPOLATE_BICUBIC", BicubicInterpolatePixel);
IMAGICK_REGISTER_CONST_LONG("INTERPOLATE_BILINEAR", BilinearInterpolatePixel);
IMAGICK_REGISTER_CONST_LONG("INTERPOLATE_FILTER", FilterInterpolatePixel);
IMAGICK_REGISTER_CONST_LONG("INTERPOLATE_INTEGER", IntegerInterpolatePixel);
IMAGICK_REGISTER_CONST_LONG("INTERPOLATE_MESH", MeshInterpolatePixel);
IMAGICK_REGISTER_CONST_LONG("INTERPOLATE_NEARESTNEIGHBOR", NearestNeighborInterpolatePixel);
#endif
#if MagickLibVersion > 0x634
IMAGICK_REGISTER_CONST_LONG("INTERPOLATE_SPLINE", SplineInterpolatePixel);
#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 > 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_BARRELINVERSE", BarrelInverseDistortion);
IMAGICK_REGISTER_CONST_LONG("DISTORTION_SHEPARDS", ShepardsDistortion);
IMAGICK_REGISTER_CONST_LONG("DISTORTION_SENTINEL", SentinelDistortion);
#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);
IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_DEACTIVATE", DeactivateAlphaChannel);
IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_RESET", ResetAlphaChannel);
IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_SET", SetAlphaChannel);
#endif
#if MagickLibVersion > 0x645
IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_UNDEFINED", UndefinedAlphaChannel);
IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_COPY", CopyAlphaChannel);
IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_DEACTIVATE", DeactivateAlphaChannel);
IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_EXTRACT", ExtractAlphaChannel);
IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_OPAQUE", OpaqueAlphaChannel);
IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_SHAPE", ShapeAlphaChannel);
IMAGICK_REGISTER_CONST_LONG("ALPHACHANNEL_TRANSPARENT", TransparentAlphaChannel);
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);
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
}
imagick-3.1.2/imagick_file.c 0000644 0000765 0000024 00000024050 12220473715 014671 0 ustar mikko staff /*
+----------------------------------------------------------------------+
| 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"
static zend_bool php_imagick_is_virtual_format(const char *format)
{
#ifdef PHP_WIN32
const int elements = 18;
int i = 0;
const char *virtual_fmt[] = { "CAPTION", "CLIPBOARD", "FRACTAL", "GRADIENT", "LABEL", "MATTE",
"NULL", "PLASMA", "PRINT", "SCAN", "RADIAL-GRADIENT", "SCANX",
"WIN", "XC", "MAGICK", "GRANITE", "LOGO", "NETSCAPE", "ROSE" };
#else
const int elements = 19;
int i = 0;
const char *virtual_fmt[] = { "CAPTION", "CLIPBOARD", "FRACTAL", "GRADIENT", "LABEL", "MATTE",
"NULL", "PLASMA", "PRINT", "SCAN", "RADIAL-GRADIENT", "SCANX",
"WIN", "X", "XC", "MAGICK", "GRANITE", "LOGO", "NETSCAPE", "ROSE" };
#endif
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)
{
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];
/* 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);
}
}
static int php_imagick_read_image_using_imagemagick(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type TSRMLS_DC)
{
if (type == ImagickReadImage) {
if (MagickReadImage(intern->magick_wand, file->filename) == MagickFalse) {
return IMAGICK_READ_WRITE_UNDERLYING_LIBRARY;
}
} else if (type == ImagickPingImage){
if (MagickPingImage(intern->magick_wand, file->filename) == MagickFalse) {
return IMAGICK_READ_WRITE_UNDERLYING_LIBRARY;
}
} else {
return IMAGICK_READ_WRITE_UNDERLYING_LIBRARY;
}
MagickSetImageFilename(intern->magick_wand, file->absolute_path);
IMAGICK_CORRECT_ITERATOR_POSITION(intern);
return IMAGICK_READ_WRITE_NO_ERROR;
}
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;
#if ZEND_MODULE_API_NO > 20060613
zend_error_handling error_handling;
#endif
#if ZEND_MODULE_API_NO > 20060613
zend_replace_error_handling(EH_THROW, php_imagick_exception_class_entry, &error_handling TSRMLS_CC);
#else
php_set_error_handling(EH_THROW, php_imagick_exception_class_entry TSRMLS_CC);
#endif
stream = php_stream_open_wrapper(file->filename, "rb", (ENFORCE_SAFE_MODE|IGNORE_PATH) & ~REPORT_ERRORS, NULL);
if (!stream) {
goto return_error;
}
if (php_stream_can_cast(stream, PHP_STREAM_AS_STDIO|PHP_STREAM_CAST_INTERNAL) == FAILURE) {
goto return_error;
}
if (php_stream_cast(stream, PHP_STREAM_AS_STDIO|PHP_STREAM_CAST_INTERNAL, (void*)&fp, 0) == FAILURE) {
goto return_error;
}
#if ZEND_MODULE_API_NO > 20060613
zend_restore_error_handling(&error_handling TSRMLS_CC);
#else
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
#endif
if (type == ImagickReadImage) {
status = MagickReadImageFile(intern->magick_wand, fp);
} else if (type == ImagickPingImage){
status = MagickPingImageFile(intern->magick_wand, fp);
} else {
goto return_error;
}
if (status == MagickFalse) {
php_stream_close(stream);
return IMAGICK_READ_WRITE_UNDERLYING_LIBRARY;
}
MagickSetImageFilename(intern->magick_wand, file->absolute_path);
php_stream_close(stream);
if (status == MagickFalse) {
return IMAGICK_READ_WRITE_UNDERLYING_LIBRARY;
}
IMAGICK_CORRECT_ITERATOR_POSITION(intern);
return IMAGICK_READ_WRITE_NO_ERROR;
return_error:
#if ZEND_MODULE_API_NO > 20060613
zend_restore_error_handling(&error_handling TSRMLS_CC);
#else
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
#endif
if (stream) {
php_stream_close(stream);
}
return IMAGICK_READ_WRITE_UNDERLYING_LIBRARY;
}
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_READ_WRITE_SAFE_MODE_ERROR;
}
#endif
if (PG(open_basedir) && php_check_open_basedir_ex(filename, 0 TSRMLS_CC)) {
return IMAGICK_READ_WRITE_OPEN_BASEDIR_ERROR;
}
return IMAGICK_READ_WRITE_NO_ERROR;
}
int php_imagick_read_file(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type TSRMLS_DC)
{
int rc;
if (file->type == ImagickFile) {
rc = php_imagick_safe_mode_check(file->absolute_path TSRMLS_CC);
if (rc != IMAGICK_READ_WRITE_NO_ERROR) {
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);
}
}
int php_imagick_write_file(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type, zend_bool adjoin TSRMLS_DC)
{
int rc;
MagickBooleanType status;
if (file->type == ImagickFile) {
rc = php_imagick_safe_mode_check(file->absolute_path TSRMLS_CC);
if (rc != IMAGICK_READ_WRITE_NO_ERROR) {
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_READ_WRITE_UNDERLYING_LIBRARY;
}
/* All went well it seems */
return IMAGICK_READ_WRITE_NO_ERROR;
}
int php_imagick_stream_handler(php_imagick_object *intern, php_stream *stream, ImagickOperationType type TSRMLS_DC)
{
#if ZEND_MODULE_API_NO > 20060613
zend_error_handling error_handling;
#endif
FILE *fp;
MagickBooleanType status = MagickFalse;
#if ZEND_MODULE_API_NO > 20060613
zend_replace_error_handling(EH_THROW, php_imagick_exception_class_entry, &error_handling TSRMLS_CC);
#else
php_set_error_handling(EH_THROW, php_imagick_exception_class_entry TSRMLS_CC);
#endif
if (php_stream_can_cast(stream, PHP_STREAM_AS_STDIO | PHP_STREAM_CAST_INTERNAL) == FAILURE) {
goto return_on_error;
}
if (php_stream_cast(stream, PHP_STREAM_AS_STDIO | PHP_STREAM_CAST_INTERNAL, (void*)&fp, 0) == FAILURE) {
goto return_on_error;
}
#if ZEND_MODULE_API_NO > 20060613
zend_restore_error_handling(&error_handling TSRMLS_CC);
#else
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
#endif
/* php_stream_cast returns warning on some streams but still does not return FAILURE */
if (EG(exception)) {
return 1;
}
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:
goto return_on_error;
break;
}
if (status == MagickFalse) {
return 2;
}
return 0;
return_on_error:
#if ZEND_MODULE_API_NO > 20060613
zend_restore_error_handling(&error_handling TSRMLS_CC);
#else
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
#endif
if (EG(exception)) {
return 1;
} else {
return 2;
}
}
imagick-3.1.2/php_imagick.h 0000644 0000765 0000024 00000004654 12220473715 014556 0 ustar mikko staff /*
+----------------------------------------------------------------------+
| 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"
#define PHP_IMAGICK_VERSION "3.1.2"
#define PHP_IMAGICK_EXTNUM 30102
/* 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"
/* Include locale header */
#ifdef HAVE_LOCALE_H
# include
#endif
/* Include magic wand header */
#ifdef IMAGICK_USE_NEW_HEADER
# include
#else
# include
#endif
#ifndef DefaultChannels
# define DefaultChannels (AllChannels &~ OpacityChannel)
#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"
/* Define the entry point symbol
* Zend will use when loading this module
*/
extern zend_module_entry imagick_module_entry;
#define phpext_imagick_ptr &imagick_module_entry
#endif /* PHP_IMAGICK_H */
imagick-3.1.2/php_imagick_defs.h 0000644 0000765 0000024 00000060614 12220473715 015555 0 ustar mikko staff /*
+----------------------------------------------------------------------+
| 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
/*
API exports
*/
#ifndef MY_IMAGICK_EXPORTS
# ifdef PHP_WIN32
# define MY_IMAGICK_EXPORTS __declspec(dllexport)
# else
# define MY_IMAGICK_EXPORTS PHPAPI
# endif
#endif
/* Globals, needed for the ini settings */
ZEND_BEGIN_MODULE_GLOBALS(imagick)
zend_bool locale_fix;
zend_bool progress_monitor;
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
/* 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"
/* Structure for Imagick object. */
typedef struct _php_imagick_object {
zend_object zo;
MagickWand *magick_wand;
char *progress_monitor_name;
int next_out_of_bound;
} php_imagick_object;
/* Structure for ImagickDraw object. */
typedef struct _php_imagickdraw_object {
zend_object zo;
DrawingWand *drawing_wand;
} php_imagickdraw_object;
/* Structure for ImagickPixelIterator object. */
typedef struct _php_imagickpixeliterator_object {
zend_object zo;
PixelIterator *pixel_iterator;
long instanciated_correctly;
int iterator_type;
#if MagickLibVersion <= 0x628
long rows;
long iterator_position;
#endif
} php_imagickpixeliterator_object;
/* Structure for ImagickPixel object. */
typedef struct _php_imagickpixel_object {
zend_object zo;
PixelWand *pixel_wand;
int initialized_via_iterator;
} php_imagickpixel_object;
/* Define some color constants */
#define IMAGICKCOLORBLACK 11
#define IMAGICKCOLORBLUE 12
#define IMAGICKCOLORCYAN 13
#define IMAGICKCOLORGREEN 14
#define IMAGICKCOLORRED 15
#define IMAGICKCOLORYELLOW 16
#define IMAGICKCOLORMAGENTA 17
#define IMAGICKCOLOROPACITY 18
#define IMAGICKCOLORALPHA 19
#define IMAGICKCOLORFUZZ 20
/* Class enum */
#define IMAGICK_CLASS 1
#define IMAGICKDRAW_CLASS 2
#define IMAGICKPIXELITERATOR_CLASS 3
#define IMAGICKPIXEL_CLASS 4
/* Free filename constants */
#define IMAGICK_DONT_FREE_FILENAME 0
#define IMAGICK_FREE_FILENAME 1
/* Read / write constants */
#define IMAGICK_READ_WRITE_NO_ERROR 0
#define IMAGICK_READ_WRITE_SAFE_MODE_ERROR 1
#define IMAGICK_READ_WRITE_OPEN_BASEDIR_ERROR 2
#define IMAGICK_READ_WRITE_UNDERLYING_LIBRARY 3
#define IMAGICK_READ_WRITE_PERMISSION_DENIED 4
#define IMAGICK_READ_WRITE_FILENAME_TOO_LONG 5
#define IMAGICK_READ_WRITE_PATH_DOES_NOT_EXIST 6
/* Filehandle handling */
#define IMAGICK_WRITE_IMAGE_FILE 1
#define IMAGICK_WRITE_IMAGES_FILE 2
#define IMAGICK_READ_IMAGE_FILE 3
#define IMAGICK_PING_IMAGE_FILE 4
/* Filename */
#define PHP_IMAGICK_FILE_PLAIN 1
#define PHP_IMAGICK_FILE_FORMAT 2
#define PHP_IMAGICK_FILE_URL 3
/* 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;
/* 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);
PHP_METHOD(imagick, getimagematte);
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);
PHP_METHOD(imagick, roundcornersimage);
PHP_METHOD(imagick, setiteratorindex);
PHP_METHOD(imagick, getiteratorindex);
PHP_METHOD(imagick, transformimage);
#endif
#if MagickLibVersion > 0x630
PHP_METHOD(imagick, setimageopacity);
PHP_METHOD(imagick, orderedposterizeimage);
#endif
#if MagickLibVersion > 0x631
PHP_METHOD(imagick, polaroidimage);
PHP_METHOD(imagick, getimageproperty);
PHP_METHOD(imagick, setimageproperty);
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 MagickLibVersion > 0x634
PHP_METHOD(imagick, paintfloodfillimage);
#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);
PHP_METHOD(imagick, setimageclipmask);
PHP_METHOD(imagick, getimageclipmask);
PHP_METHOD(imagick, animateimages);
PHP_METHOD(imagick, recolorimage);
#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 > 0x656
PHP_METHOD(imagick, setimageartifact);
PHP_METHOD(imagick, getimageartifact);
PHP_METHOD(imagick, deleteimageartifact);
PHP_METHOD(imagick, setcolorspace);
PHP_METHOD(imagick, getcolorspace);
#endif
PHP_METHOD(imagick, __construct);
PHP_METHOD(imagick, __tostring);
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);
PHP_METHOD(imagick, setimageindex);
PHP_METHOD(imagick, getimageindex);
PHP_METHOD(imagick, setimageformat);
PHP_METHOD(imagick, setimagefilename);
PHP_METHOD(imagick, getimagefilename);
PHP_METHOD(imagick, getimageformat);
PHP_METHOD(imagick, getimagemimetype);
PHP_METHOD(imagick, getimagesize);
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, annotateimage);
PHP_METHOD(imagick, compositeimage);
PHP_METHOD(imagick, modulateimage);
PHP_METHOD(imagick, montageimage);
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);
PHP_METHOD(imagick, radialblurimage);
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);
PHP_METHOD(imagick, setimageattribute);
PHP_METHOD(imagick, setimagebackgroundcolor);
PHP_METHOD(imagick, setimagecompose);
PHP_METHOD(imagick, setimagecompression);
PHP_METHOD(imagick, setimagedelay);
PHP_METHOD(imagick, setimagedepth);
PHP_METHOD(imagick, setimagegamma);
PHP_METHOD(imagick, setimageiterations);
PHP_METHOD(imagick, setimagemattecolor);
PHP_METHOD(imagick, setimagepage);
PHP_METHOD(imagick, setimageprogressmonitor);
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);
PHP_METHOD(imagick, mosaicimages);
PHP_METHOD(imagick, morphimages);
PHP_METHOD(imagick, minifyimage);
PHP_METHOD(imagick, addnoiseimage);
PHP_METHOD(imagick, affinetransformimage);
PHP_METHOD(imagick, averageimages);
PHP_METHOD(imagick, borderimage);
PHP_METHOD(imagick, chopimage);
PHP_METHOD(imagick, clipimage);
PHP_METHOD(imagick, clippathimage);
PHP_METHOD(imagick, coalesceimages);
PHP_METHOD(imagick, colorfloodfillimage);
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);
PHP_METHOD(imagick, flattenimages);
PHP_METHOD(imagick, flipimage);
PHP_METHOD(imagick, flopimage);
PHP_METHOD(imagick, frameimage);
PHP_METHOD(imagick, fximage);
PHP_METHOD(imagick, gammaimage);
PHP_METHOD(imagick, gaussianblurimage);
PHP_METHOD(imagick, getimageattribute);
PHP_METHOD(imagick, getimagebackgroundcolor);
PHP_METHOD(imagick, getimageblueprimary);
PHP_METHOD(imagick, getimagebordercolor);
PHP_METHOD(imagick, getimagechanneldepth);
PHP_METHOD(imagick, getimagechanneldistortion);
PHP_METHOD(imagick, getimagechannelextrema);
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);
PHP_METHOD(imagick, getimageextrema);
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);
PHP_METHOD(imagick, getimagemattecolor);
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);
PHP_METHOD(imagick, levelimage);
PHP_METHOD(imagick, magnifyimage);
PHP_METHOD(imagick, mapimage);
PHP_METHOD(imagick, mattefloodfillimage);
PHP_METHOD(imagick, medianfilterimage);
PHP_METHOD(imagick, negateimage);
PHP_METHOD(imagick, paintopaqueimage);
PHP_METHOD(imagick, painttransparentimage);
PHP_METHOD(imagick, previewimages);
PHP_METHOD(imagick, profileimage);
PHP_METHOD(imagick, quantizeimage);
PHP_METHOD(imagick, quantizeimages);
PHP_METHOD(imagick, reducenoiseimage);
PHP_METHOD(imagick, removeimageprofile);
PHP_METHOD(imagick, separateimagechannel);
PHP_METHOD(imagick, sepiatoneimage);
PHP_METHOD(imagick, setimagebias);
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, 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, 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);
/* 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);
PHP_METHOD(imagickdraw, matte);
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);
/* Imagick Pixel iterator */
PHP_METHOD(imagickpixeliterator, __construct);
PHP_METHOD(imagickpixeliterator, newpixeliterator);
PHP_METHOD(imagickpixeliterator, newpixelregioniterator);
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, issimilar);
PHP_METHOD(imagickpixel, getcolorvalue);
PHP_METHOD(imagickpixel, setcolorvalue);
PHP_METHOD(imagickpixel, getcolor);
PHP_METHOD(imagickpixel, getcolorasstring);
PHP_METHOD(imagickpixel, getcolorcount);
PHP_METHOD(imagickpixel, setcolorcount);
PHP_METHOD(imagickpixel, clone);
#endif /* PHP_IMAGICK_DEFS_H */
imagick-3.1.2/php_imagick_helpers.h 0000644 0000765 0000024 00000005420 12220473715 016270 0 ustar mikko staff /*
+----------------------------------------------------------------------+
| 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 initialize_imagick_constants();
void add_assoc_string_helper(zval *retvalue, char *name, char *key, char *hash_value TSRMLS_DC);
void *get_pointinfo_array(zval *coordinate_array, int *num_elements TSRMLS_DC);
#if MagickLibVersion <= 0x628
void count_pixeliterator_rows(php_imagickpixeliterator_object *internpix TSRMLS_DC );
#endif
int count_occurences_of(char needle, char *haystack TSRMLS_DC);
int check_configured_font(char *font, int font_len TSRMLS_DC);
int check_write_access(char *absolute TSRMLS_DC);
zend_bool php_imagick_thumbnail_dimensions(MagickWand *magick_wand, zend_bool bestfit, long desired_width, long desired_height, long *new_width, long *new_height);
zend_bool php_imagick_resize_bounding_box(MagickWand *magick_wand, long box_width, long box_height, zend_bool fill);
zend_bool crop_thumbnail_image(MagickWand *magick_wand, long desired_width, long desired_height TSRMLS_DC);
char *get_pseudo_filename(char* pseudo_string TSRMLS_DC);
double *get_double_array_from_zval(zval *param_array, long *num_elements TSRMLS_DC);
long *get_long_array_from_zval(zval *param_array, long *num_elements TSRMLS_DC);
unsigned char *get_char_array_from_zval(zval *param_array, long *num_elements TSRMLS_DC);
MagickBooleanType php_imagick_progress_monitor(const char *text, const MagickOffsetType offset, const MagickSizeType span, void *client_data);
zend_bool php_imagick_validate_map(const char *map TSRMLS_DC);
#endif /* PHP_IMAGICK_HELPERS_H */ imagick-3.1.2/php_imagick_macros.h 0000644 0000765 0000024 00000035232 12220473715 016116 0 ustar mikko staff /*
+----------------------------------------------------------------------+
| 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 a set of macros to throw exceptions */
#define IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(type, description, code) \
{ \
switch(type) { \
case 1: \
zend_throw_exception(php_imagick_exception_class_entry, description, (long)code TSRMLS_CC); \
RETURN_NULL(); \
break; \
case 2: \
zend_throw_exception(php_imagickdraw_exception_class_entry, description, (long)code TSRMLS_CC); \
RETURN_NULL(); \
break; \
case 3: \
zend_throw_exception(php_imagickpixeliterator_exception_class_entry, description, (long)code TSRMLS_CC); \
RETURN_NULL(); \
break; \
case 4: \
zend_throw_exception(php_imagickpixel_exception_class_entry, description, (long)code TSRMLS_CC); \
RETURN_NULL(); \
break; \
} \
} \
#define IMAGICK_THROW_IMAGICK_EXCEPTION(magick_wand, fallback, code) \
{ \
ExceptionType severity; \
char *description; \
description = MagickGetException(magick_wand, &severity); \
if (description && strlen(description) == 0) { \
IMAGICK_FREE_MEMORY(char *, description); \
description = NULL; \
} \
if (!description) { \
zend_throw_exception(php_imagick_exception_class_entry, fallback, (long)code TSRMLS_CC); \
RETURN_NULL(); \
} else { \
zend_throw_exception(php_imagick_exception_class_entry, description, (long)severity TSRMLS_CC); \
IMAGICK_FREE_MEMORY(char *, description); \
MagickClearException(magick_wand); \
RETURN_NULL(); \
} \
} \
#define IMAGICK_THROW_IMAGICKDRAW_EXCEPTION(drawing_wand, fallback, code) \
{ \
ExceptionType severity; \
char *description; \
description = DrawGetException(drawing_wand, &severity); \
if (description && strlen(description) == 0) { \
IMAGICK_FREE_MEMORY(char *, description); \
description = NULL; \
} \
if (!description) { \
zend_throw_exception(php_imagickdraw_exception_class_entry, fallback, (long)code TSRMLS_CC); \
RETURN_NULL(); \
} else { \
zend_throw_exception(php_imagickdraw_exception_class_entry, description, (long)severity TSRMLS_CC); \
IMAGICK_FREE_MEMORY(char *, description); \
DrawClearException(drawing_wand); \
RETURN_NULL(); \
} \
} \
#define IMAGICK_THROW_IMAGICKPIXEL_EXCEPTION(pixel_wand, fallback, code) \
{ \
ExceptionType severity; \
char *description; \
description = PixelGetException(pixel_wand, &severity); \
if (description && strlen(description) == 0) { \
IMAGICK_FREE_MEMORY(char *, description); \
description = NULL; \
} \
if (!description) { \
zend_throw_exception(php_imagickpixel_exception_class_entry, fallback, (long)code TSRMLS_CC); \
RETURN_NULL(); \
} else { \
zend_throw_exception(php_imagickpixel_exception_class_entry, description, (long)severity TSRMLS_CC); \
IMAGICK_FREE_MEMORY(char *, description); \
PixelClearException(pixel_wand); \
RETURN_NULL(); \
} \
} \
#define IMAGICK_THROW_IMAGICKPIXELITERATOR_EXCEPTION(pixel_iterator, fallback, code) \
{ \
ExceptionType severity; \
char *description; \
description = PixelGetIteratorException(pixel_iterator, &severity); \
if (description && strlen(description) == 0) { \
IMAGICK_FREE_MEMORY(char *, description); \
description = NULL; \
} \
if (!description) { \
zend_throw_exception(php_imagickpixeliterator_exception_class_entry, fallback, (long)code TSRMLS_CC); \
RETURN_NULL(); \
} else { \
zend_throw_exception(php_imagickpixeliterator_exception_class_entry, description, (long)severity TSRMLS_CC); \
IMAGICK_FREE_MEMORY(char *, description); \
PixelClearIteratorException(pixel_iterator); \
RETURN_NULL(); \
} \
} \
/* Borrowed from zip extension */
#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);
#define IMAGICK_CHECK_NOT_EMPTY(magick_wand, type, code)\
if(MagickGetNumberImages(magick_wand) == 0) { \
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Can not process empty Imagick object", (long)code); \
} \
#define IMAGICK_INITIALIZE_ZERO_ARGS(wand_type, intern)\
intern = (wand_type)zend_object_store_get_object(getThis() TSRMLS_CC);
#define IMAGICK_FREE_MEMORY(type, value)\
if (value != (type) NULL) { \
value = (type) MagickRelinquishMemory(value); \
value = (type)NULL; \
} \
#if defined(CHECKUID_CHECK_FILE_AND_DIR)
#define IMAGICK_SAFE_MODE_CHECK(filename_, status_) \
if (filename_) { \
if (strlen(filename_) > MAXPATHLEN) { \
status_ = IMAGICK_READ_WRITE_FILENAME_TOO_LONG; \
} \
if (PG(safe_mode) && (!php_checkuid_ex(filename_, NULL, CHECKUID_CHECK_FILE_AND_DIR, CHECKUID_NO_ERRORS))) { \
status_ = IMAGICK_READ_WRITE_SAFE_MODE_ERROR; \
} \
if (php_check_open_basedir_ex(filename_, 0 TSRMLS_CC)) { \
status_ = IMAGICK_READ_WRITE_OPEN_BASEDIR_ERROR; \
} \
}
#else
#define IMAGICK_SAFE_MODE_CHECK(filename_, status_)\
if (filename_) { \
if (strlen(filename_) > MAXPATHLEN) { \
status_ = IMAGICK_READ_WRITE_FILENAME_TOO_LONG; \
} \
if (php_check_open_basedir_ex(filename_, 0 TSRMLS_CC)) { \
status_ = IMAGICK_READ_WRITE_OPEN_BASEDIR_ERROR; \
} \
}
#endif
#define IMAGICK_HAS_FORMAT(buffer, magick_wand, free_buffer)\
buffer = MagickGetImageFormat(magick_wand);\
if(buffer == (char *)NULL || *buffer == '\0') {\
IMAGICK_FREE_MEMORY(char *, buffer); IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(IMAGICK_CLASS, "Image has no format", 1); \
} else { \
if (free_buffer) IMAGICK_FREE_MEMORY(char *, buffer); \
} \
#define IMAGICK_METHOD_DEPRECATED(class_name, method_name) \
php_error(E_STRICT, "%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_STRICT, "%s::%s is deprecated. %s::%s should be used instead", class_name, method_name, new_class, new_method);
#define IMAGICK_CHECK_READ_OR_WRITE_ERROR(intern, filename, error, free, message) \
switch (error) { \
case IMAGICK_READ_WRITE_NO_ERROR: \
/* No error */ \
break; \
case IMAGICK_READ_WRITE_SAFE_MODE_ERROR:\
zend_throw_exception_ex(php_imagick_exception_class_entry, 1 TSRMLS_CC, "Safe mode restricts user to read image: %s", filename); \
if (free == IMAGICK_FREE_FILENAME && filename) { \
efree(filename); \
} \
RETURN_NULL();\
break; \
case IMAGICK_READ_WRITE_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); \
if (free == IMAGICK_FREE_FILENAME && filename) { \
efree(filename); \
} \
RETURN_NULL(); \
break; \
default: \
case IMAGICK_READ_WRITE_UNDERLYING_LIBRARY: \
{ \
ExceptionType severity; \
char *description = MagickGetException(intern->magick_wand, &severity); \
if (strlen(description) == 0) { \
zend_throw_exception_ex(php_imagick_exception_class_entry, 1 TSRMLS_CC, message, filename);\
} else {\
zend_throw_exception(php_imagick_exception_class_entry, description, 1 TSRMLS_CC);\
IMAGICK_FREE_MEMORY(char *, description);\
MagickClearException(intern->magick_wand);\
description = (char *)NULL;\
}\
}\
if (free == IMAGICK_FREE_FILENAME && filename) { \
efree(filename); \
} \
RETURN_NULL();\
case IMAGICK_READ_WRITE_PERMISSION_DENIED:\
zend_throw_exception_ex(php_imagick_exception_class_entry, 1 TSRMLS_CC, "Permission denied to: %s", filename);\
if (free == IMAGICK_FREE_FILENAME && filename) { \
efree(filename); \
}\
RETURN_NULL();\
break;\
case IMAGICK_READ_WRITE_FILENAME_TOO_LONG:\
zend_throw_exception_ex(php_imagick_exception_class_entry, 1 TSRMLS_CC, "Filename too long: %s", filename);\
if (free == IMAGICK_FREE_FILENAME && filename) { \
efree(filename); \
}\
RETURN_NULL();\
break;\
case IMAGICK_READ_WRITE_PATH_DOES_NOT_EXIST:\
zend_throw_exception_ex(php_imagick_exception_class_entry, 1 TSRMLS_CC, "The path does not exist: %s", filename);\
if (free == IMAGICK_FREE_FILENAME && filename) { \
efree(filename); \
}\
RETURN_NULL();\
break;\
} \
#define IMAGICKDRAW_CHECK_READ_OR_WRITE_ERROR(internd, filename, error, free)\
switch (error) {\
default:\
case 0:\
/* No error */\
break;\
case 1:\
zend_throw_exception_ex(php_imagickdraw_exception_class_entry, 1 TSRMLS_CC, "Safe mode restricts user to read file: %s", filename);\
if (free == IMAGICK_FREE_FILENAME && filename) { \
efree(filename); \
}\
RETURN_NULL();\
break;\
case 2:\
zend_throw_exception_ex(php_imagickdraw_exception_class_entry, 1 TSRMLS_CC, "open_basedir restriction in effect. File(%s) is not within the allowed path(s)", filename);\
if (free == IMAGICK_FREE_FILENAME && filename) { \
efree(filename); \
}\
RETURN_NULL();\
break;\
case 3:\
IMAGICK_THROW_IMAGICKDRAW_EXCEPTION(internd->drawing_wand, "Unable to read file", 1);\
if (free == IMAGICK_FREE_FILENAME && filename) { \
efree(filename); \
}\
RETURN_NULL();\
break;\
} \
#define IMAGICK_CORRECT_ITERATOR_POSITION(intern)\
MagickSetLastIterator(intern->magick_wand);
#define IMAGICK_REPLACE_MAGICKWAND(intern, new_wand)\
if (intern->magick_wand == (MagickWand *)NULL) {\
intern->magick_wand = new_wand; \
} else { \
intern->magick_wand = (MagickWand *)DestroyMagickWand(intern->magick_wand); \
intern->magick_wand = new_wand; \
}
#define IMAGICKPIXEL_REPLACE_PIXELWAND(intern, new_wand)\
if(intern->pixel_wand != (PixelWand *)NULL && intern->initialized_via_iterator != 1) {\
intern->pixel_wand = (PixelWand *)DestroyPixelWand(intern->pixel_wand);\
intern->pixel_wand = new_wand;\
} else {\
intern->pixel_wand = new_wand;\
} \
#define IMAGICKDRAW_REPLACE_DRAWINGWAND(intern, new_wand) \
if (intern->drawing_wand == (DrawingWand *)NULL) { \
intern->drawing_wand = new_wand; \
} else { \
intern->drawing_wand = (DrawingWand *)DestroyDrawingWand(intern->drawing_wand); \
intern->drawing_wand = new_wand; \
} \
#define IMAGICK_CAST_PARAMETER_TO_COLOR(param, internp, caller) \
switch (Z_TYPE_P(param)) { \
case IS_STRING: \
{ \
zval *object; \
PixelWand *pixel_wand = NewPixelWand(); \
if (!PixelSetColor(pixel_wand, Z_STRVAL_P(param))) { \
pixel_wand = DestroyPixelWand(pixel_wand); \
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(caller, "Unrecognized color string", caller); \
return; \
} \
MAKE_STD_ZVAL(object); \
object_init_ex(object, php_imagickpixel_sc_entry); \
internp = (php_imagickpixel_object *)zend_object_store_get_object(object TSRMLS_CC); \
internp->initialized_via_iterator = 0; \
efree(object); \
IMAGICKPIXEL_REPLACE_PIXELWAND(internp, pixel_wand); \
} \
break; \
case IS_OBJECT: \
if (instanceof_function_ex(Z_OBJCE_P(param), php_imagickpixel_sc_entry, 0 TSRMLS_CC)) { \
internp = (php_imagickpixel_object *)zend_object_store_get_object(param TSRMLS_CC); \
} else { \
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(caller, "The parameter must be an instance of ImagickPixel or a string", (long)caller); \
} \
break; \
default: \
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(caller, "Invalid parameter provided", (long)caller); \
break; \
} \
#define IMAGICK_CAST_PARAMETER_TO_OPACITY(param, internp, caller) \
switch (Z_TYPE_P(param)) { \
case IS_LONG: \
case IS_DOUBLE: \
{ \
zval *object; \
PixelWand *pixel_wand = NewPixelWand(); \
PixelSetOpacity(pixel_wand, Z_DVAL_P(param)); \
MAKE_STD_ZVAL(object); \
object_init_ex(object, php_imagickpixel_sc_entry); \
internp = (php_imagickpixel_object *)zend_object_store_get_object(object TSRMLS_CC); \
internp->initialized_via_iterator = 0; \
efree(object); \
IMAGICKPIXEL_REPLACE_PIXELWAND(internp, pixel_wand); \
} \
break; \
case IS_OBJECT: \
if (instanceof_function_ex(Z_OBJCE_P(param), php_imagickpixel_sc_entry, 0 TSRMLS_CC)) { \
internp = (php_imagickpixel_object *)zend_object_store_get_object(param TSRMLS_CC); \
} else { \
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(caller, "The parameter must be an instance of ImagickPixel or a string", (long)caller); \
} \
break; \
default: \
IMAGICK_THROW_EXCEPTION_WITH_MESSAGE(caller, "Invalid parameter provided", (long)caller); \
break; \
}
#ifdef HAVE_LOCALE_H
#define IMAGICK_SET_LOCALE(old_locale, tmp, restore) \
if ((IMAGICK_G(locale_fix)) && \
(tmp = setlocale(LC_NUMERIC, NULL)) != NULL && \
(strcmp(tmp, IMAGICK_LC_NUMERIC_LOCALE) != 0)) { \
old_locale = estrdup(tmp); \
setlocale(LC_NUMERIC, IMAGICK_LC_NUMERIC_LOCALE); \
restore = 1; \
} else { \
restore = 0; \
} \
#define IMAGICK_RESTORE_LOCALE(old_locale, restore) \
if (restore && old_locale != NULL && (strcmp(old_locale, IMAGICK_LC_NUMERIC_LOCALE) != 0)) { \
setlocale(LC_NUMERIC, old_locale); \
efree(old_locale); \
} \
#else
#define IMAGICK_SET_LOCALE(old_locale, tmp, restore)
#define IMAGICK_RESTORE_LOCALE(old_locale, restore)
#endif
#if MagickLibVersion >= 0x635
#define IMAGICK_CLONE_PIXELWAND(source, target) \
target = ClonePixelWand(source);
#else
#define IMAGICK_CLONE_PIXELWAND(source, target) \
target = (PixelWand *)NewPixelWand(); \
PixelSetColorCount(target, PixelGetColorCount(source)); \
PixelSetRed(target, PixelGetRed(source)); \
PixelSetGreen(target, PixelGetGreen(source)); \
PixelSetBlue(target, PixelGetBlue(source)); \
PixelSetOpacity(target, PixelGetOpacity(source)); \
PixelSetAlpha(target, PixelGetAlpha(source));
#endif
#endif /* PHP_IMAGICK_MACROS_H */
imagick-3.1.2/php_imagick_shared.h 0000644 0000765 0000024 00000003403 12220473715 016073 0 ustar mikko staff /*
+----------------------------------------------------------------------+
| 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_
/* Only works with newer Imagick */
#ifndef IMAGICK_USE_NEW_HEADER
# define IMAGICK_USE_NEW_HEADER 1
#endif
#include "php_imagick.h"
#include "php_imagick_defs.h"
/*
Allow extensions to use the class entries
*/
MY_IMAGICK_EXPORTS zend_class_entry *php_imagick_get_class_entry();
MY_IMAGICK_EXPORTS zend_class_entry *php_imagickdraw_get_class_entry();
MY_IMAGICK_EXPORTS zend_class_entry *php_imagickpixel_get_class_entry();
#endif
imagick-3.1.2/php_imagick_file.h 0000644 0000765 0000024 00000005534 12220473715 015553 0 ustar mikko staff /*
+----------------------------------------------------------------------+
| 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 */
int php_imagick_read_file(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type TSRMLS_DC);
/* Write operations */
int php_imagick_write_file(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type, zend_bool adjoin TSRMLS_DC);
/* Handle streams */
int php_imagick_stream_handler(php_imagick_object *intern, php_stream *stream, ImagickOperationType type TSRMLS_DC);
#endif /* PHP_IMAGICK_FILE_H */ imagick-3.1.2/TODO 0000644 0000765 0000024 00000000000 12220473715 012577 0 ustar mikko staff imagick-3.1.2/INSTALL 0000644 0000765 0000024 00000000000 12220473715 013140 0 ustar mikko staff imagick-3.1.2/ChangeLog 0000644 0000765 0000024 00000053036 12220473715 013702 0 ustar mikko staff 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
imagick-3.1.2/LICENSE 0000644 0000765 0000024 00000006222 12220473715 013130 0 ustar mikko staff --------------------------------------------------------------------
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
.