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

From: Date: Tue, 18 Feb 2003 17:16:46 +0000
Subject: cvs: pear /PECL/imagick TODO imagick.c package.xml php_imagick.h /PECL/imagick/examples mosaic.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-8945@lists.php.net to get a copy of this message
mcmontero Tue Feb 18 12:16:46 2003 EDT Added files: /pear/PECL/imagick/examples mosaic.php Modified files: /pear/PECL/imagick TODO imagick.c package.xml php_imagick.h Log: Added imagick_mosaic(). Index: pear/PECL/imagick/TODO diff -u pear/PECL/imagick/TODO:1.8 pear/PECL/imagick/TODO:1.9 --- pear/PECL/imagick/TODO:1.8 Mon Dec 16 13:52:40 2002 +++ pear/PECL/imagick/TODO Tue Feb 18 12:16:44 2003 @@ -9,5 +9,5 @@ o imagick_texture() => TextureImage() o imagick_querycolordatabase() => QueryColorDatabase() o imagick_querycolorname() => QueryColorName() -o imagick_mosaic() => MosaicImages() o imagick_signature() => SignatureImage() +0 imagick_montage() => MontageImages() Index: pear/PECL/imagick/imagick.c diff -u pear/PECL/imagick/imagick.c:1.33 pear/PECL/imagick/imagick.c:1.34 --- pear/PECL/imagick/imagick.c:1.33 Mon Feb 17 11:42:53 2003 +++ pear/PECL/imagick/imagick.c Tue Feb 18 12:16:44 2003 @@ -16,7 +16,7 @@ | Christian Stocker (chregu@bitflux.ch) | +----------------------------------------------------------------------+ - $Id: imagick.c,v 1.33 2003/02/17 16:42:53 mcmontero Exp $ + $Id: imagick.c,v 1.34 2003/02/18 17:16:44 mcmontero Exp $ */ #ifdef HAVE_CONFIG_H @@ -221,6 +221,7 @@ PHP_FE( imagick_profile, NULL ) PHP_FE( imagick_rgbtransform, NULL ) PHP_FE( imagick_transformrgb, NULL ) + PHP_FE( imagick_mosaic, NULL ) /***** @@ -4805,6 +4806,54 @@ RETURN_TRUE ; } +PHP_FUNCTION( imagick_mosaic ) +{ + zval* handle_id ; /* the handle identifier coming from + the PHP environment */ + imagick_t* handle ; /* the actual imagick_t struct for the + handle */ + imagick_t* mosaic_handle ; /* the new handle for the mosaic + 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 ) ; + + mosaic_handle = _php_imagick_alloc_handle() ; + if ( !mosaic_handle ) + { + RETURN_FALSE ; + } + mosaic_handle->id = zend_list_insert( mosaic_handle, + le_imagick_handle ) ; + + mosaic_handle->image = MosaicImages( handle->image, + &handle->exception ) ; + if ( _php_imagick_is_error( handle ) ) + { + RETURN_FALSE ; + } + + if ( _php_imagick_is_error( mosaic_handle ) ) + { + RETURN_FALSE ; + } + + RETURN_RESOURCE( mosaic_handle->id ) ; +} + /*****************************************************************************/ /****************************************************************************** @@ -5119,7 +5168,17 @@ static int _php_imagick_is_error( const imagick_t* handle ) { - if ( handle->exception.severity != UndefinedException || + if ( handle == ( imagick_t* )NULL ) + { + return 1 ; + } + + if ( handle->exception.severity != UndefinedException ) + { + return 1 ; + } + + if ( handle->image && handle->image->exception.severity != UndefinedException ) { return 1 ; Index: pear/PECL/imagick/package.xml diff -u pear/PECL/imagick/package.xml:1.41 pear/PECL/imagick/package.xml:1.42 --- pear/PECL/imagick/package.xml:1.41 Mon Feb 17 11:42:53 2003 +++ pear/PECL/imagick/package.xml Tue Feb 18 12:16:44 2003 @@ -30,8 +30,12 @@ imagick_newimagelist() imagick_pushlist() imagick_poplist() + imagick_mosaic() - 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. </notes> <state>beta</state> </release> Index: pear/PECL/imagick/php_imagick.h diff -u pear/PECL/imagick/php_imagick.h:1.21 pear/PECL/imagick/php_imagick.h:1.22 --- pear/PECL/imagick/php_imagick.h:1.21 Mon Feb 17 11:42:53 2003 +++ pear/PECL/imagick/php_imagick.h Tue Feb 18 12:16:45 2003 @@ -16,7 +16,7 @@ | Christian Stocker (chregu@bitflux.ch) | +----------------------------------------------------------------------+ - $Id: php_imagick.h,v 1.21 2003/02/17 16:42:53 mcmontero Exp $ + $Id: php_imagick.h,v 1.22 2003/02/18 17:16:45 mcmontero Exp $ */ #ifndef PHP_IMAGICK_H @@ -233,6 +233,7 @@ PHP_FUNCTION( imagick_profile ) ; PHP_FUNCTION( imagick_rgbtransform ) ; PHP_FUNCTION( imagick_transformrgb ) ; + PHP_FUNCTION( imagick_mosaic ) ; /***** Index: pear/PECL/imagick/examples/mosaic.php +++ pear/PECL/imagick/examples/mosaic.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 ; } $image_list = imagick_newimagelist() ; if ( !$image_list ) { print "Uh-Oh! Didn't get new image list.<BR>" ; exit ; } imagick_pushlist( $image_list, $handle ) ; $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 ; } imagick_pushlist( $image_list, $handle ) ; $mosaic_handle = imagick_mosaic( $image_list ) ; if ( !imagick_writeimage( $mosaic_handle, "./new_image.jpg" ) ) { $reason = imagick_failedreason( $mosaic_handle ) ; $description = imagick_faileddescription( $mosaic_handle ) ; print "imagick_writeimage() failed<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n" ; exit ; } print "Done!<BR>\n" ; ?>

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