Hi All,

This patch adds suport for imagecopyrotated() to the extension when using
gd>=2.0.0. For some reason this function is disabled even when you add
support for the GD library to PHP.

Thanks,
David Giffin
diff -ruN php-5.0.0b2/ext/gd/gd.c php-5.0.0b2.new/ext/gd/gd.c

--- php-5.0.0b2/ext/gd/gd.c     Mon Sep 15 02:27:18 2003

+++ php-5.0.0b2.new/ext/gd/gd.c Tue Nov 11 16:09:56 2003

@@ -201,6 +201,7 @@

        PHP_FE(imagecolorclosestalpha,                                  NULL)

        PHP_FE(imagecolorexactalpha,                                    NULL)

        PHP_FE(imagecopyresampled,                                              NULL)

+       PHP_FE(imagecopyrotated,                                                NULL)

 #endif

 

 #ifdef HAVE_GD_BUNDLED

@@ -1178,6 +1179,44 @@

        RETURN_TRUE;

 }

 /* }}} */

+

+/* {{{ proto int imagecopyrotated(int dst_im, int src_im, double dst_x, double dst_y, 
int src_x, int src_y, int src_w, int src_h, int angle)

+   Copy and rotate part of an image by an arbitrary number of integer degrees */

+PHP_FUNCTION(imagecopyrotated)

+{

+  zval **SIM, **DIM, **SX, **SY, **SW, **SH, **DX, **DY, **ANGLE;

+  gdImagePtr im_dst, im_src;

+  int srcH, srcW, srcY, srcX, angle;

+  double dstY, dstX;

+

+  if (ZEND_NUM_ARGS() != 9 ||

+     zend_get_parameters_ex(9, &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH, &ANGLE) == 
FAILURE) {

+     ZEND_WRONG_PARAM_COUNT();

+  }

+

+  ZEND_FETCH_RESOURCE(im_dst, gdImagePtr, DIM, -1, "Image", le_gd);

+  ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, "Image", le_gd);

+

+  convert_to_long_ex(SX);

+  convert_to_long_ex(SY);

+  convert_to_long_ex(SW);

+  convert_to_long_ex(SH);

+  convert_to_double_ex(DX);

+  convert_to_double_ex(DY);

+  convert_to_long_ex(ANGLE);

+

+  srcX = Z_LVAL_PP(SX);

+  srcY = Z_LVAL_PP(SY);

+  srcH = Z_LVAL_PP(SH);

+  srcW = Z_LVAL_PP(SW);

+  dstX = Z_DVAL_PP(DX);

+  dstY = Z_DVAL_PP(DY);

+  angle = Z_LVAL_PP(ANGLE);

+

+  gdImageCopyRotated(im_dst, im_src, dstX, dstY, srcX, srcY, srcW, srcH, angle);

+  RETURN_TRUE;

+}

+/* }}} */

 #endif

 

 #ifdef HAVE_GD_BUNDLED

diff -ruN php-5.0.0b2/ext/gd/php_gd.h php-5.0.0b2.new/ext/gd/php_gd.h

--- php-5.0.0b2/ext/gd/php_gd.h Sun Jun 15 15:00:08 2003

+++ php-5.0.0b2.new/ext/gd/php_gd.h     Tue Nov 11 15:52:54 2003

@@ -101,6 +101,7 @@

 PHP_FUNCTION(imagecolorclosestalpha);

 PHP_FUNCTION(imagecolorexactalpha);

 PHP_FUNCTION(imagecopyresampled);

+PHP_FUNCTION(imagecopyrotated);

 #endif

 

 #ifdef HAVE_GD_BUNDLED

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to