cvs: pear /PECL/imagick imagick.c package.xml php_imagick.h /PECL/imagick/examples transformrgb.php
| From: | Michael C. Montero | Date: | Thu, 26 Dec 2002 15:05:37 +0000 |
| Subject: | cvs: pear /PECL/imagick imagick.c package.xml php_imagick.h /PECL/imagick/examples transformrgb.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-7961@lists.php.net to get a copy of this message | ||
mcmontero Thu Dec 26 10:05:37 2002 EDT
Added files:
/pear/PECL/imagick/examples transformrgb.php
Modified files:
/pear/PECL/imagick imagick.c package.xml php_imagick.h
Log:
imagick_transformrgb(): added, being tested by James Huston.
Index: pear/PECL/imagick/imagick.c
diff -u pear/PECL/imagick/imagick.c:1.27 pear/PECL/imagick/imagick.c:1.28
--- pear/PECL/imagick/imagick.c:1.27 Mon Dec 23 11:08:57 2002
+++ pear/PECL/imagick/imagick.c Thu Dec 26 10:05:36 2002
@@ -16,7 +16,7 @@
| Christian Stocker (chregu@bitflux.ch) |
+----------------------------------------------------------------------+
- $Id: imagick.c,v 1.27 2002/12/23 16:08:57 mcmontero Exp $
+ $Id: imagick.c,v 1.28 2002/12/26 15:05:36 mcmontero Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -214,6 +214,7 @@
PHP_FE( imagick_roll, NULL )
PHP_FE( imagick_profile, NULL )
PHP_FE( imagick_rgbtransform, NULL )
+ PHP_FE( imagick_transformrgb, NULL )
/*****
@@ -4525,6 +4526,40 @@
_php_imagick_clear_errors( handle ) ;
RGBTransformImage( handle->image, ( ColorspaceType )colorspace ) ;
+ if ( _php_imagick_is_error( handle ) )
+ {
+ RETURN_FALSE ;
+ }
+
+ RETURN_TRUE ;
+}
+
+PHP_FUNCTION( imagick_transformrgb )
+{
+ zval* handle_id ; /* the handle identifier coming from
+ the PHP environment */
+ long colorspace ; /* the colorspace to transform the
+ image to */
+ imagick_t* handle ; /* the actual imagick_t struct for the
+ handle */
+
+ if ( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "rl",
+ &handle_id, &colorspace ) == 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 ) ;
+
+ TransformRGBImage( handle->image, ( ColorspaceType )colorspace ) ;
if ( _php_imagick_is_error( handle ) )
{
RETURN_FALSE ;
Index: pear/PECL/imagick/package.xml
diff -u pear/PECL/imagick/package.xml:1.31 pear/PECL/imagick/package.xml:1.32
--- pear/PECL/imagick/package.xml:1.31 Mon Dec 23 11:08:57 2002
+++ pear/PECL/imagick/package.xml Thu Dec 26 10:05:36 2002
@@ -30,6 +30,7 @@
imagick_getimagetype()
imagick_isimagesequal()
imagick_rgbtransform()
+ imagick_transformrgb()
- 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.15 pear/PECL/imagick/php_imagick.h:1.16
--- pear/PECL/imagick/php_imagick.h:1.15 Mon Dec 23 11:08:57 2002
+++ pear/PECL/imagick/php_imagick.h Thu Dec 26 10:05:36 2002
@@ -16,7 +16,7 @@
| Christian Stocker (chregu@bitflux.ch) |
+----------------------------------------------------------------------+
- $Id: php_imagick.h,v 1.15 2002/12/23 16:08:57 mcmontero Exp $
+ $Id: php_imagick.h,v 1.16 2002/12/26 15:05:36 mcmontero Exp $
*/
#ifndef PHP_IMAGICK_H
@@ -226,6 +226,7 @@
PHP_FUNCTION( imagick_roll ) ;
PHP_FUNCTION( imagick_profile ) ;
PHP_FUNCTION( imagick_rgbtransform ) ;
+ PHP_FUNCTION( imagick_transformrgb ) ;
/*****
Index: pear/PECL/imagick/examples/transformrgb.php
+++ pear/PECL/imagick/examples/transformrgb.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 ;
}
if ( !imagick_transformrgb( $handle, IMAGICK_COLORSPACE_RGB ) )
{
$reason = imagick_failedreason( $handle ) ;
$description = imagick_faileddescription( $handle ) ;
print "imagick_shear() 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 ;
}
print "Done!<BR>\n" ;
?>