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

From: Date: Mon, 16 Dec 2002 18:52:41 +0000
Subject: cvs: pear /PECL/imagick TODO imagick.c package.xml php_imagick.h /PECL/imagick/examples isimagesequal.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-7904@lists.php.net to get a copy of this message
mcmontero Mon Dec 16 13:52:41 2002 EDT Added files: /pear/PECL/imagick/examples isimagesequal.php Modified files: /pear/PECL/imagick TODO imagick.c package.xml php_imagick.h Log: imagick_isimagesequal() added. Index: pear/PECL/imagick/TODO diff -u pear/PECL/imagick/TODO:1.7 pear/PECL/imagick/TODO:1.8 --- pear/PECL/imagick/TODO:1.7 Mon Dec 16 13:37:25 2002 +++ pear/PECL/imagick/TODO Mon Dec 16 13:52:40 2002 @@ -11,4 +11,3 @@ o imagick_querycolorname() => QueryColorName() o imagick_mosaic() => MosaicImages() o imagick_signature() => SignatureImage() -o imagich_isimagesequal() => IsImagesEqual() Index: pear/PECL/imagick/imagick.c diff -u pear/PECL/imagick/imagick.c:1.25 pear/PECL/imagick/imagick.c:1.26 --- pear/PECL/imagick/imagick.c:1.25 Mon Dec 16 13:37:26 2002 +++ pear/PECL/imagick/imagick.c Mon Dec 16 13:52:40 2002 @@ -16,7 +16,7 @@ | Christian Stocker (chregu@bitflux.ch) | +----------------------------------------------------------------------+ - $Id: imagick.c,v 1.25 2002/12/16 18:37:26 mcmontero Exp $ + $Id: imagick.c,v 1.26 2002/12/16 18:52:40 mcmontero Exp $ */ #ifdef HAVE_CONFIG_H @@ -78,6 +78,7 @@ PHP_FE( imagick_isopaqueimage, NULL ) PHP_FE( imagick_ispaletteimage, NULL ) PHP_FE( imagick_getimagetype, NULL ) + PHP_FE( imagick_isimagesequal, NULL ) /***** @@ -1437,6 +1438,63 @@ type = GetImageType( handle->image, &handle->exception ) ; RETURN_LONG( type ) ; +} + +PHP_FUNCTION( imagick_isimagesequal ) +{ + zval* handle_id ; /* the handle identifier coming from + the PHP environment */ + zval* ref_id ; /* the handle identifier coming from + the PHP environment for the + reference image */ + imagick_t* handle ; /* the actual imagick_t struct for the + handle */ + imagick_t* ref_handle ; /* the actual imagick_t struct for the + handle of the reference image */ + + if ( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "rr", + &handle_id, &ref_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 ; + } + + ref_handle = _php_imagick_get_handle_struct_from_list( &ref_id TSRMLS_CC ) ; + if ( !ref_handle ) + { + php_error( E_WARNING, "%s(): reference handle is invalid", + get_active_function_name( TSRMLS_C ) ) ; + RETURN_FALSE ; + } + + _php_imagick_clear_errors( handle ) ; + _php_imagick_clear_errors( ref_handle ) ; + + if ( handle->image == ( Image* )NULL || + ref_handle->image == ( Image* )NULL ) + { + RETURN_FALSE ; + } + + if ( !IsImagesEqual( handle->image, ref_handle->image ) ) + { + RETURN_FALSE ; + } + + if ( _php_imagick_is_error( handle ) || + _php_imagick_is_error( ref_handle ) ) + { + RETURN_FALSE ; + } + + RETURN_TRUE ; } /*****************************************************************************/ Index: pear/PECL/imagick/package.xml diff -u pear/PECL/imagick/package.xml:1.28 pear/PECL/imagick/package.xml:1.29 --- pear/PECL/imagick/package.xml:1.28 Mon Dec 16 13:37:26 2002 +++ pear/PECL/imagick/package.xml Mon Dec 16 13:52:41 2002 @@ -28,6 +28,7 @@ - functions added: imagick_zoom() imagick_getimagetype() + imagick_isimagesequal() - 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. Index: pear/PECL/imagick/php_imagick.h diff -u pear/PECL/imagick/php_imagick.h:1.13 pear/PECL/imagick/php_imagick.h:1.14 --- pear/PECL/imagick/php_imagick.h:1.13 Mon Dec 16 13:37:26 2002 +++ pear/PECL/imagick/php_imagick.h Mon Dec 16 13:52:41 2002 @@ -16,7 +16,7 @@ | Christian Stocker (chregu@bitflux.ch) | +----------------------------------------------------------------------+ - $Id: php_imagick.h,v 1.13 2002/12/16 18:37:26 mcmontero Exp $ + $Id: php_imagick.h,v 1.14 2002/12/16 18:52:41 mcmontero Exp $ */ #ifndef PHP_IMAGICK_H @@ -90,6 +90,7 @@ PHP_FUNCTION( imagick_isopaqueimage ) ; PHP_FUNCTION( imagick_ispaletteimage ) ; PHP_FUNCTION( imagick_getimagetype ) ; + PHP_FUNCTION( imagick_isimagesequal ) ; /***** Index: pear/PECL/imagick/examples/isimagesequal.php +++ pear/PECL/imagick/examples/isimagesequal.php <? $handle = imagick_readimage( "./image.jpg" ) ; if ( imagick_iserror( $handle ) ) { $reason = imagick_failedreason( $handle ) ; $description = imagick_faileddescription( $handle ) ; print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n" ; exit ; } $ref_handle = imagick_readimage( "./animated.gif" ) ; if ( imagick_iserror( $ref_handle ) ) { $reason = imagick_failedreason( $ref_handle ) ; $description = imagick_faileddescription( $ref_handle ) ; print "ref_handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n" ; exit ; } print "Read 2 images...<BR>\n" ; if ( imagick_isimagesequal( $handle, $ref_handle ) ) { print "They are equal!<BR>\n" ; } else { print "They are not equal!<BR>\n" ; } // // The above images are not equal. The 2 below are. // imagick_destroyhandle( $handle ) ; imagick_destroyhandle( $ref_handle ) ; $handle = imagick_readimage( "./image.jpg" ) ; if ( imagick_iserror( $handle ) ) { $reason = imagick_failedreason( $handle ) ; $description = imagick_faileddescription( $handle ) ; print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n" ; exit ; } $ref_handle = imagick_readimage( "./image.jpg" ) ; if ( imagick_iserror( $ref_handle ) ) { $reason = imagick_failedreason( $ref_handle ) ; $description = imagick_faileddescription( $ref_handle ) ; print "ref_handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n" ; exit ; } print "Read 2 images...<BR>\n" ; if ( imagick_isimagesequal( $handle, $ref_handle ) ) { print "They are equal!<BR>\n" ; } else { print "They are not equal!<BR>\n" ; } ?>

« previous php.pear.cvs (#7904) next »