Index: config.m4 =================================================================== RCS file: /repository/pecl/imagick/config.m4,v retrieving revision 1.12 diff -u -r1.12 config.m4 --- config.m4 28 Jun 2004 07:29:44 -0000 1.12 +++ config.m4 25 Feb 2007 18:32:48 -0000 @@ -13,11 +13,12 @@ if test "$PHP_IMAGICK_GM" != "no"; then GM_PATH="GraphicsMagick/" MAGICK_NAME="GraphicsMagick" - NEEDED_VERSION=1000000 - NEEDED_VERSION_STRING=1.0.0 + NEEDED_VERSION=1001000 + NEEDED_VERSION_STRING=1.1.0 CONFIG_NAME="GraphicsMagick-config" LIB_NAME="GraphicsMagick" AC_DEFINE(IMAGICK_BACKEND, "GraphicsMagick", [ ]) + AC_DEFINE(HAVE_GRAPHICSMAGICK, 1, [ ]) AC_MSG_RESULT(Building with GraphicsMagick as backend) else GM_PATH="" @@ -27,6 +28,7 @@ CONFIG_NAME="Magick-config" LIB_NAME="Magick" AC_DEFINE(IMAGICK_BACKEND, "ImageMagick", [ ]) + AC_DEFINE(HAVE_IMAGEMAGICK, 1, [ ]) AC_MSG_RESULT(Building with ImageMagick as backend) fi if test -r $PHP_IMAGICK/include/${GM_PATH}magick/magick.h; then @@ -92,12 +94,16 @@ ],[ $IMAGEMAGICK_LIBS -L$IMAGEMAGICK_DIR/lib $IMAGEMAGICK_LDFLAGS ]) - AC_MSG_CHECKING(if version 6.0.0 or later) - if test "$imagemagick_version" -ge 6000000; then + AC_MSG_CHECKING(if new ImageMagick API is needed) + if test "$MAGICK_NAME" = "ImageMagick" && test "$imagemagick_version" -ge 6000000; then AC_MSG_RESULT(yes. Adding compatibility options) AC_DEFINE(IMAGICK_NEEDS_WAND,1,[ ]) PHP_ADD_LIBRARY_WITH_PATH(Wand, $IMAGEMAGICK_DIR/lib, IMAGICK_SHARED_LIBADD) - else + elif test "$MAGICK_NAME" = "GraphicsMagick" && test "$imagemagick_version" -ge 1001000; then + AC_MSG_RESULT(yes. Adding compatibility options) + AC_DEFINE(IMAGICK_NEEDS_WAND,1,[ ]) + PHP_ADD_LIBRARY_WITH_PATH(GraphicsMagickWand, $IMAGEMAGICK_DIR/lib, IMAGICK_SHARED_LIBADD) + else AC_MSG_RESULT(no) fi PHP_EXTENSION(imagick, $ext_shared) Index: imagick.c =================================================================== RCS file: /repository/pecl/imagick/imagick.c,v retrieving revision 1.57 diff -u -r1.57 imagick.c --- imagick.c 22 Sep 2004 14:26:52 -0000 1.57 +++ imagick.c 25 Feb 2007 18:32:52 -0000 @@ -1247,7 +1247,7 @@ strlen( handle->exception.description ), 1 ) ; } - if ( handle->image->exception.description ) + if ( handle->image && handle->image->exception.description ) { RETURN_STRINGL( handle->image->exception.description, strlen( handle->image->exception.description ), @@ -2460,30 +2460,30 @@ if ( handle->draw_info && handle->image && !handle->draw_context ) { -#if MagickLibVersion < 0x557 +#if (defined(HAVE_GRAPHICSMAGICK) && MagickLibVersion >= 0x010000) || MagickLibVersion > 0x600 /* Graphics Magick 1.1+ or ImageMagick 6.0+ */ + handle->draw_context = DrawAllocateWand( handle->draw_info, + handle->image ) ; +#else handle->draw_context = DrawAllocateContext( handle->draw_info, handle->image ) ; -#else - handle->draw_context = DrawAllocateWand( handle->draw_info, - handle->image ) ; #endif if ( !handle->draw_context ) { -#if MagickLibVersion < 0x557 - php_error( E_ERROR, "%s(): DrawAllocateContext() did not properly allocate DrawContext structure", get_active_function_name( TSRMLS_C ) ) ; -#else +#if (defined(HAVE_GRAPHICSMAGICK) && MagickLibVersion >= 0x010000) || MagickLibVersion > 0x600 /* Graphics Magick 1.1+ or ImageMagick 6.0+ */ php_error( E_ERROR, "%s(): DrawAllocateWand() did not properly allocate DrawContext structure", get_active_function_name( TSRMLS_C ) ) ; +#else + php_error( E_ERROR, "%s(): DrawAllocateContext() did not properly allocate DrawContext structure", get_active_function_name( TSRMLS_C ) ) ; #endif RETURN_FALSE ; } } else { -#if MagickLibVersion < 0x557 - php_error( E_WARNING, "%s(): attempt to create draw_context with DrawAllocateContext() and empty draw_info or image", get_active_function_name( TSRMLS_C ) ) ; +#if (defined(HAVE_GRAPHICSMAGICK) && MagickLibVersion >= 0x010000) || MagickLibVersion > 0x600 /* Graphics Magick 1.1+ or ImageMagick 6.0+ */ + php_error( E_WARNING, "%s(): attempt to create draw_context with DrawAllocateWand() and empty draw_info or image", get_active_function_name( TSRMLS_C ) ) ; #else - php_error( E_WARNING, "%s(): attempt to create draw_context withDrawAllocateWand() and empty draw_info or image", get_active_function_name( TSRMLS_C ) ) ; + php_error( E_WARNING, "%s(): attempt to create draw_context withDrawAllocateContext() and empty draw_info or image", get_active_function_name( TSRMLS_C ) ) ; #endif } @@ -2828,6 +2828,8 @@ handle */ PixelPacket pixel_packet ; /* the struct containing the color information */ + PixelWand *pixel_wand; /* the struct for containing color + information, new API. */ if ( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "rs", &handle_id, &color, &color_len ) == FAILURE ) @@ -2858,7 +2860,12 @@ "color must be in the format \"#ffff00\"", NULL ) ; RETURN_FALSE ; } - +#if (defined(HAVE_GRAPHICSMAGICK) && MagickLibVersion >= 0x010000) || MagickLibVersion > 0x600 /* Graphics Magick 1.1+ or ImageMagick 6.0+ */ + pixel_wand = NewPixelWand(); + PixelSetColor( pixel_wand, color ); + DrawSetFillColor( handle->draw_context, pixel_wand ) ; + DestroyPixelWand( pixel_wand ); +#else QueryColorDatabase( color, &pixel_packet, &handle->exception ) ; if ( _php_imagick_is_error( handle ) ) { @@ -2866,6 +2873,7 @@ } DrawSetFillColor( handle->draw_context, &pixel_packet ) ; +#endif if ( _php_imagick_is_error( handle ) ) { RETURN_FALSE ; @@ -5663,10 +5671,10 @@ if ( handle->draw_context ) { -#if MagickLibVersion < 0x557 - DrawDestroyContext( handle->draw_context ) ; -#else +#if (defined(HAVE_GRAPHICSMAGICK) && MagickLibVersion >= 0x010000) || MagickLibVersion > 0x600 /* Graphics Magick 1.1+ or ImageMagick 6.0+ */ DestroyDrawingWand( handle->draw_context ) ; +#else + DestroyDrawingContext( handle->draw_context ) ; #endif } Index: imagick.h =================================================================== RCS file: /repository/pecl/imagick/imagick.h,v retrieving revision 1.17 diff -u -r1.17 imagick.h --- imagick.h 6 Jul 2004 21:52:37 -0000 1.17 +++ imagick.h 25 Feb 2007 18:32:52 -0000 @@ -54,9 +54,15 @@ DrawInfo* draw_info ; /* ImageMagick DrawInfo structure to use when allocating a DrawContext */ + #if (defined(HAVE_GRAPHICSMAGICK) && MagickLibVersion >= 0x010000) || MagickLibVersion > 0x600 /* Graphics Magick 1.1+ or ImageMagick 6.0+ */ + DrawingWand* draw_context ; /* ImageMagick DrawContext + structure for vector based + drawing with new API */ + #else DrawContext draw_context ; /* ImageMagick DrawContext structure for vector based drawing */ + #endif } imagick_t ; /*****