cvs: pear /PECL/imagick imagick.c imagick.h package.xml php_imagick.h /PECL/imagick/examples flatten.php

From: Date: Thu, 02 Jan 2003 22:02:57 +0000
Subject: cvs: pear /PECL/imagick imagick.c imagick.h package.xml php_imagick.h /PECL/imagick/examples flatten.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-8054@lists.php.net to get a copy of this message
mcmontero Thu Jan 2 17:02:57 2003 EDT Added files: /pear/PECL/imagick/examples flatten.php Modified files: /pear/PECL/imagick imagick.c imagick.h package.xml php_imagick.h Log: - functions added: imagick_flatten() - 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. James Huston will be testing imagick_flatten() for us.

Index: pear/PECL/imagick/imagick.c diff -u pear/PECL/imagick/imagick.c:1.28 pear/PECL/imagick/imagick.c:1.29 --- pear/PECL/imagick/imagick.c:1.28 Thu Dec 26 10:05:36 2002 +++ pear/PECL/imagick/imagick.c Thu Jan 2 17:02:56 2003 @@ -16,7 +16,7 @@ | Christian Stocker (chregu@bitflux.ch) | +----------------------------------------------------------------------+ - $Id: imagick.c,v 1.28 2002/12/26 15:05:36 mcmontero Exp $ + $Id: imagick.c,v 1.29 2003/01/02 22:02:56 mcmontero Exp $ */ #ifdef HAVE_CONFIG_H @@ -186,6 +186,7 @@ PHP_FE( imagick_spread, NULL ) PHP_FE( imagick_threshold, NULL ) PHP_FE( imagick_unsharpmask, NULL ) + PHP_FE( imagick_flatten, NULL ) /***** @@ -3384,6 +3385,8 @@ { DestroyImage( new_image ) ; } + + RETURN_FALSE ; } DestroyImage( handle->image ) ; @@ -3427,6 +3430,8 @@ { DestroyImage( new_image ) ; } + + RETURN_FALSE ; } DestroyImage( handle->image ) ; @@ -3471,6 +3476,8 @@ { DestroyImage( new_image ) ; } + + RETURN_FALSE ; } DestroyImage( handle->image ) ; @@ -3510,6 +3517,8 @@ { DestroyImage( new_image ) ; } + + RETURN_FALSE ; } DestroyImage( handle->image ) ; @@ -3557,6 +3566,8 @@ { DestroyImage( new_image ) ; } + + RETURN_FALSE ; } DestroyImage( handle->image ) ; @@ -3599,6 +3610,8 @@ { DestroyImage( new_image ) ; } + + RETURN_FALSE ; } DestroyImage( handle->image ) ; @@ -3645,6 +3658,8 @@ { DestroyImage( new_image ) ; } + + RETURN_FALSE ; } DestroyImage( handle->image ) ; @@ -3687,6 +3702,8 @@ { DestroyImage( new_image ) ; } + + RETURN_FALSE ; } DestroyImage( handle->image ) ; @@ -3731,6 +3748,8 @@ { DestroyImage( new_image ) ; } + + RETURN_FALSE ; } DestroyImage( handle->image ) ; @@ -3776,6 +3795,8 @@ { DestroyImage( new_image ) ; } + + RETURN_FALSE ; } DestroyImage( handle->image ) ; @@ -3817,6 +3838,8 @@ { DestroyImage( new_image ) ; } + + RETURN_FALSE ; } DestroyImage( handle->image ) ; @@ -3832,7 +3855,6 @@ double threshold ; /* define the threshold value */ imagick_t* handle ; /* the actual imagick_t struct for the handle */ - if ( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "rd", &handle_id, &threshold ) == FAILURE ) { @@ -3877,7 +3899,6 @@ handle */ Image* new_image ; /* the new image */ - if ( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "rdddd", &handle_id, &radius, &sigma, &amount, &threshold ) == FAILURE ) @@ -3903,6 +3924,49 @@ { DestroyImage( new_image ) ; } + + RETURN_FALSE ; + } + + DestroyImage( handle->image ) ; + handle->image = new_image ; + + RETURN_TRUE ; +} + +PHP_FUNCTION( imagick_flatten ) +{ + zval* handle_id ; /* the handle identifier coming from + the PHP environment */ + imagick_t* handle ; /* the actual imagick_t struct for the + handle */ + Image* new_image ; /* the new image */ + + if ( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "r", + &handle_id ) == FAILURE ) + { + return ; + } + + handle = _php_imagick_get_handle_struct_from_list( &handle_id TSRMLS_CC ) ; + if ( !handle ) + { + php_error( E_WARNING, "%s(): handle is invalid", + get_active_function_name( TSRMLS_C ) ) ; + RETURN_FALSE ; + } + + _php_imagick_clear_errors( handle ) ; + + new_image = FlattenImages( handle->image, &handle->exception ) ; + if ( _php_imagick_is_error( handle ) ) + { + if ( new_image ) + { + DestroyImage( new_image ) ; + } + + RETURN_FALSE ; } DestroyImage( handle->image ) ; Index: pear/PECL/imagick/imagick.h diff -u pear/PECL/imagick/imagick.h:1.7 pear/PECL/imagick/imagick.h:1.8 --- pear/PECL/imagick/imagick.h:1.7 Mon Dec 30 11:37:33 2002 +++ pear/PECL/imagick/imagick.h Thu Jan 2 17:02:56 2003 @@ -16,7 +16,7 @@ | Christian Stocker (chregu@bitflux.ch) | +----------------------------------------------------------------------+ - $Id: imagick.h,v 1.7 2002/12/30 16:37:33 mcmontero Exp $ + $Id: imagick.h,v 1.8 2003/01/02 22:02:56 mcmontero Exp $ */ #ifndef IMAGICKH @@ -24,7 +24,7 @@ #include <magick/api.h> - #define IMAGICK_VERSION "0.9.3" + #define IMAGICK_VERSION "0.9.4" #define IMAGICK_TURN_OFF_ERRORS_TO_STDERR 1 #define IMAGICK_FILTER_UNKNOWN -1 #define IMAGICK_DEPCREATED() php_error( E_WARNING, "%s(): this function is deprecated and will be removed soon", get_active_function_name( TSRMLS_C ) ) ; Index: pear/PECL/imagick/package.xml diff -u pear/PECL/imagick/package.xml:1.33 pear/PECL/imagick/package.xml:1.34 --- pear/PECL/imagick/package.xml:1.33 Mon Dec 30 11:39:13 2002 +++ pear/PECL/imagick/package.xml Thu Jan 2 17:02:56 2003 @@ -22,6 +22,31 @@ </maintainer> <license>PHP License</license> <release> + <version>0.9.4</version> + <date>2003-01-xx</date> + <notes> + - functions added: + imagick_flatten() + - 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. + </notes> + <state>beta</state> + </release> + <release> <version>0.9.3</version> <date>2002-12-30</date> <notes> Index: pear/PECL/imagick/php_imagick.h diff -u pear/PECL/imagick/php_imagick.h:1.16 pear/PECL/imagick/php_imagick.h:1.17 --- pear/PECL/imagick/php_imagick.h:1.16 Thu Dec 26 10:05:36 2002 +++ pear/PECL/imagick/php_imagick.h Thu Jan 2 17:02:56 2003 @@ -16,7 +16,7 @@ | Christian Stocker (chregu@bitflux.ch) | +----------------------------------------------------------------------+ - $Id: php_imagick.h,v 1.16 2002/12/26 15:05:36 mcmontero Exp $ + $Id: php_imagick.h,v 1.17 2003/01/02 22:02:56 mcmontero Exp $ */ #ifndef PHP_IMAGICK_H @@ -198,6 +198,7 @@ PHP_FUNCTION( imagick_spread ) ; PHP_FUNCTION( imagick_threshold ) ; PHP_FUNCTION( imagick_unsharpmask ) ; + PHP_FUNCTION( imagick_flatten ) ; /***** Index: pear/PECL/imagick/examples/flatten.php +++ pear/PECL/imagick/examples/flatten.php <? $handle = imagick_readimage( "./animated.gif" ) ; if ( imagick_iserror( $handle ) ) { $reason = imagick_failedreason( $handle ) ; $description = imagick_faileddescription( $handle ) ; print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n" ; exit ; } if ( !imagick_flatten( $handle ) ) { $reason = imagick_failedreason( $handle ) ; $description = imagick_faileddescription( $handle ) ; print "imagick_flatten() failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n" ; exit ; } if ( !imagick_writeimage( $handle, "./new_image.jpg" ) ) { $reason = imagick_failedreason( $handle ) ; $description = imagick_faileddescription( $handle ) ; print "imagick_writeimage() failed<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n" ; exit ; } header( "Location: images_jpg.html" ) ; ?>
« previous php.pear.cvs (#8054) next »