[PHP-CVS] cvs: php4 /ext/gd gd.c php_gd.h

2003-03-31 Thread Jani Taskinen
sniper  Mon Mar 31 03:49:19 2003 EDT

  Modified files:  
/php4/ext/gdgd.c php_gd.h 
  Log:
  cleanup
  
Index: php4/ext/gd/gd.c
diff -u php4/ext/gd/gd.c:1.260 php4/ext/gd/gd.c:1.261
--- php4/ext/gd/gd.c:1.260  Wed Mar 26 01:30:45 2003
+++ php4/ext/gd/gd.cMon Mar 31 03:49:19 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: gd.c,v 1.260 2003/03/26 06:30:45 sebastian Exp $ */
+/* $Id: gd.c,v 1.261 2003/03/31 08:49:19 sniper Exp $ */
 
 /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
Cold Spring Harbor Labs. */
@@ -323,7 +323,11 @@
PHP_MINIT(gd),
NULL,
NULL,
+#if HAVE_LIBGD20  HAVE_GD_STRINGFT
PHP_RSHUTDOWN(gd),
+#else
+   NULL,
+#endif
PHP_MINFO(gd),
NO_VERSION_YET,
STANDARD_MODULE_PROPERTIES
@@ -426,13 +430,13 @@
 
 /* {{{ PHP_RSHUTDOWN_FUNCTION
  */
+#if HAVE_LIBGD20  HAVE_GD_STRINGFT
 PHP_RSHUTDOWN_FUNCTION(gd)
 {
-#if HAVE_LIBGD20  HAVE_GD_STRINGFT
gdFreeFontCache();
-#endif
return SUCCESS;
 }
+#endif
 /* }}} */
 
 /* {{{ PHP_MINFO_FUNCTION
Index: php4/ext/gd/php_gd.h
diff -u php4/ext/gd/php_gd.h:1.53 php4/ext/gd/php_gd.h:1.54
--- php4/ext/gd/php_gd.h:1.53   Tue Mar 18 07:05:59 2003
+++ php4/ext/gd/php_gd.hMon Mar 31 03:49:19 2003
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: php_gd.h,v 1.53 2003/03/18 12:05:59 ssb Exp $ */
+/* $Id: php_gd.h,v 1.54 2003/03/31 08:49:19 sniper Exp $ */
 
 #ifndef PHP_GD_H
 #define PHP_GD_H
@@ -58,7 +58,9 @@
 PHP_MINFO_FUNCTION(gd);
 PHP_MINIT_FUNCTION(gd);
 PHP_MSHUTDOWN_FUNCTION(gd);
+#if HAVE_LIBGD20  HAVE_GD_STRINGFT
 PHP_RSHUTDOWN_FUNCTION(gd);
+#endif
 
 PHP_FUNCTION(gd_info);
 PHP_FUNCTION(imagearc);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /ext/gd gd.c php_gd.h

2003-01-25 Thread Sara Golemon
pollita Sat Jan 25 20:15:03 2003 EDT

  Modified files:  
/php4/ext/gdphp_gd.h gd.c 
  Log:
  Feature Request #21784  Added: imagecolorallocatealpha 
([EMAIL PROTECTED],[EMAIL PROTECTED])
  
  
Index: php4/ext/gd/php_gd.h
diff -u php4/ext/gd/php_gd.h:1.50 php4/ext/gd/php_gd.h:1.51
--- php4/ext/gd/php_gd.h:1.50   Tue Dec 31 11:06:40 2002
+++ php4/ext/gd/php_gd.hSat Jan 25 20:15:02 2003
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: php_gd.h,v 1.50 2002/12/31 16:06:40 sebastian Exp $ */
+/* $Id: php_gd.h,v 1.51 2003/01/26 01:15:02 pollita Exp $ */
 
 #ifndef PHP_GD_H
 #define PHP_GD_H
@@ -62,6 +62,7 @@
 
 PHP_FUNCTION(gd_info);
 PHP_FUNCTION(imagearc);
+PHP_FUNCTION(imageellipse);
 PHP_FUNCTION(imagechar);
 PHP_FUNCTION(imagecharup);
 PHP_FUNCTION(imageistruecolor);
@@ -85,17 +86,19 @@
 PHP_FUNCTION(imageftbbox);
 PHP_FUNCTION(imagefttext);
 
+#ifdef HAVE_LIBGD20
 PHP_FUNCTION(imagecreatetruecolor);
 PHP_FUNCTION(imagetruecolortopalette);
 PHP_FUNCTION(imagesetthickness);
-PHP_FUNCTION(imageellipse);
 PHP_FUNCTION(imagefilledellipse);
 PHP_FUNCTION(imagefilledarc);
 PHP_FUNCTION(imagealphablending);
+PHP_FUNCTION(imagecolorallocatealpha);
 PHP_FUNCTION(imagecolorresolvealpha);
 PHP_FUNCTION(imagecolorclosestalpha);
 PHP_FUNCTION(imagecolorexactalpha);
 PHP_FUNCTION(imagecopyresampled);
+#endif
 
 #ifdef HAVE_GD_BUNDLED
 PHP_FUNCTION(imagerotate);
Index: php4/ext/gd/gd.c
diff -u php4/ext/gd/gd.c:1.248 php4/ext/gd/gd.c:1.249
--- php4/ext/gd/gd.c:1.248  Fri Jan 24 14:23:53 2003
+++ php4/ext/gd/gd.cSat Jan 25 20:15:02 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: gd.c,v 1.248 2003/01/24 19:23:53 iliaa Exp $ */
+/* $Id: gd.c,v 1.249 2003/01/26 01:15:02 pollita Exp $ */
 
 /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, 
Cold Spring Harbor Labs. */
@@ -188,6 +188,7 @@
PHP_FE(imagefilledarc,  NULL)
PHP_FE(imagefilledellipse,  NULL)
PHP_FE(imagealphablending,  NULL)
+   PHP_FE(imagecolorallocatealpha, NULL)
PHP_FE(imagecolorresolvealpha,  NULL)
PHP_FE(imagecolorclosestalpha,  NULL)
PHP_FE(imagecolorexactalpha,NULL)
@@ -971,6 +972,24 @@
 }
 /* }}} */
 #endif
+
+/* {{{ proto int imagecolorallocatealpha(resource im, int red, int green, int blue, 
+int alpha)
+   Allocate a color with an alpha level.  Works for true color and palette based 
+images */
+PHP_FUNCTION(imagecolorallocatealpha)
+{
+   zval *IM;
+   int red, green, blue, alpha;
+   gdImagePtr im;
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, z, IM, red, 
+green, blue, alpha) == FAILURE) {
+   RETURN_FALSE;
+   }
+
+   ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, Image, le_gd);
+
+   RETURN_LONG(gdImageColorAllocateAlpha(im, red, green, blue, alpha));
+}
+/* }}} */
 
 /* {{{ proto int imagecolorresolvealpha(resource im, int red, int green, int blue, 
int alpha)
Resolve/Allocate a colour with an alpha level.  Works for true colour and palette 
based images */



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-CVS] cvs: php4 /ext/gd gd.c php_gd.h

2002-12-11 Thread Adam Maccabee Trachtenberg
This patch, or at least this part:

-#ifdef HAVE_GD_XPM
+#if defined(HAVE_GD_XPM)  defined(HAVE_GD_BUNDLED)

Needs to be merged into the 4.3.0. Something in the build broke my GD
support between RC2 and RC3. This fixes it.

-adam

On Wed, 11 Dec 2002, Ilia Alshanetsky wrote:

 iliaa Wed Dec 11 17:25:24 2002 EDT
 
   Modified files:  
 /php4/ext/gd  gd.c php_gd.h 
   Log:
   Fixed build with non-bundled GD. Hidden the anti-alias functions when 
   non-bundled GD is used and made imagecreatefromxpm() unavailable because 
   of a bug in the external GD library.
   
   
 Index: php4/ext/gd/gd.c
 diff -u php4/ext/gd/gd.c:1.238 php4/ext/gd/gd.c:1.239
 --- php4/ext/gd/gd.c:1.238Wed Dec 11 15:44:44 2002
 +++ php4/ext/gd/gd.c  Wed Dec 11 17:25:22 2002
 @@ -18,7 +18,7 @@
 +--+
   */
  
 -/* $Id: gd.c,v 1.238 2002/12/11 20:44:44 pajoye Exp $ */
 +/* $Id: gd.c,v 1.239 2002/12/11 22:25:22 iliaa Exp $ */
  
  /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, 
 Cold Spring Harbor Labs. */
 @@ -224,7 +224,7 @@
  #ifdef HAVE_GD_XBM
   PHP_FE(imagecreatefromxbm,  NULL)
  #endif
 -#ifdef HAVE_GD_XPM
 +#if defined(HAVE_GD_XPM)  defined(HAVE_GD_BUNDLED)
   PHP_FE(imagecreatefromxpm,  NULL)
  #endif
   PHP_FE(imagecreatefromgd,   NULL)
 @@ -1441,7 +1441,7 @@
   case PHP_GDIMG_TYPE_GD2PART:
   im = (*func_p)(fp, Z_LVAL_PP(srcx), Z_LVAL_PP(srcy), 
Z_LVAL_PP(width), Z_LVAL_PP(height));
   break;
 -#ifdef HAVE_GD_XPM
 +#if defined(HAVE_GD_XPM)  defined(HAVE_GD_BUNDLED)
   case PHP_GDIMG_TYPE_XPM:
   im = gdImageCreateFromXpm(fn);
   break;
 @@ -1508,7 +1508,7 @@
  /* }}} */
  #endif /* HAVE_GD_XBM */
  
 -#ifdef HAVE_GD_XPM
 +#if defined(HAVE_GD_XPM)  defined(HAVE_GD_BUNDLED)
  /* {{{ proto int imagecreatefromxpm(string filename)
 Create a new image from XPM file or URL */
  PHP_FUNCTION(imagecreatefromxpm)
 @@ -2130,7 +2130,6 @@
  {
   zval **IM, **x1, **y1, **x2, **y2, **col;
   gdImagePtr im;
 - int antialias=0;
  
   if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, IM, x1, y1, x2, y2, 
col) == FAILURE) {
   ZEND_WRONG_PARAM_COUNT();
 @@ -2145,14 +2144,11 @@
   convert_to_long_ex(col);
  
  #ifdef HAVE_GD_BUNDLED
 - antialias = im-antialias;
 -#endif
 - if (antialias) {
 + if (im-antialias)
   gdImageAALine(im, Z_LVAL_PP(x1), Z_LVAL_PP(y1), Z_LVAL_PP(x2), 
Z_LVAL_PP(y2), Z_LVAL_PP(col));
 - } else {
 + else 
 +#endif   
   gdImageLine(im, Z_LVAL_PP(x1), Z_LVAL_PP(y1), Z_LVAL_PP(x2), 
Z_LVAL_PP(y2), Z_LVAL_PP(col));
 - }
 -  
   
   gdImageLine(im, Z_LVAL_PP(x1), Z_LVAL_PP(y1), Z_LVAL_PP(x2), Z_LVAL_PP(y2), 
Z_LVAL_PP(col));
   RETURN_TRUE;
 @@ -4074,7 +4070,7 @@
   }
  }
  /* }}} */
 -#endif
 +/* End section: Filters */
  
  /* {{{ proto imagesetantialias(int im, bool on)
  Should antialiased functions used or not*/
 @@ -4092,8 +4088,7 @@
   RETURN_TRUE;
  }
  /* }}} */
 -

 -/* End section: Filters */
 +#endif
  
  /*
   * Local variables:
 Index: php4/ext/gd/php_gd.h
 diff -u php4/ext/gd/php_gd.h:1.48 php4/ext/gd/php_gd.h:1.49
 --- php4/ext/gd/php_gd.h:1.48 Wed Dec 11 15:45:47 2002
 +++ php4/ext/gd/php_gd.h  Wed Dec 11 17:25:23 2002
 @@ -17,7 +17,7 @@
 +--+
  */
  
 -/* $Id: php_gd.h,v 1.48 2002/12/11 20:45:47 pajoye Exp $ */
 +/* $Id: php_gd.h,v 1.49 2002/12/11 22:25:23 iliaa Exp $ */
  
  #ifndef PHP_GD_H
  #define PHP_GD_H
 @@ -112,12 +112,14 @@
  PHP_FUNCTION(imagecreatefromgif);
  PHP_FUNCTION(imagecreatefromjpeg);
  PHP_FUNCTION(imagecreatefromxbm);
 -PHP_FUNCTION(imagecreatefromxpm);
  PHP_FUNCTION(imagecreatefrompng);
  PHP_FUNCTION(imagecreatefromwbmp);
  PHP_FUNCTION(imagecreatefromgd);
  PHP_FUNCTION(imagecreatefromgd2);
  PHP_FUNCTION(imagecreatefromgd2part);
 +#if defined(HAVE_GD_XPM)  defined(HAVE_GD_BUNDLED)
 +PHP_FUNCTION(imagecreatefromxpm);
 +#endif
  
  PHP_FUNCTION(imagegammacorrect);
  PHP_FUNCTION(imagedestroy);
 
 
 
 


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/gd gd.c php_gd.h

2002-12-05 Thread Pierre-Alain Joye
pajoye  Thu Dec  5 21:16:07 2002 EDT

  Modified files:  
/php4/ext/gdgd.c php_gd.h 
  Log:
  Add imageistruecolor
  
  
Index: php4/ext/gd/gd.c
diff -u php4/ext/gd/gd.c:1.234 php4/ext/gd/gd.c:1.235
--- php4/ext/gd/gd.c:1.234  Wed Dec  4 18:21:30 2002
+++ php4/ext/gd/gd.cThu Dec  5 21:16:06 2002
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: gd.c,v 1.234 2002/12/04 23:21:30 rasmus Exp $ */
+/* $Id: gd.c,v 1.235 2002/12/06 02:16:06 pajoye Exp $ */
 
 /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, 
Cold Spring Harbor Labs. */
@@ -156,12 +156,13 @@
PHP_FE(imageellipse,NULL)
PHP_FE(imagechar,  
 NULL)
PHP_FE(imagecharup,
 NULL)
+   PHP_FE(imagecolorat,NULL)
PHP_FE(imagecolorallocate,  NULL)
 #if HAVE_LIBGD15
PHP_FE(imagepalettecopy,NULL)
PHP_FE(imagecreatefromstring,   NULL)
 #endif
-   PHP_FE(imagecolorat,NULL)
+   PHP_FE(imageistruecolor,NULL)
PHP_FE(imagecolorclosest,   NULL)
 #if HAVE_COLORCLOSESTHWB
PHP_FE(imagecolorclosesthwb,NULL)
@@ -1747,6 +1748,23 @@
zend_list_delete(Z_LVAL_PP(IM));
 
RETURN_TRUE;
+}
+/* }}} */
+
+/* {{{ proto int imagecolorallocate(int im, int red, int green, int blue)
+   Allocate a color for an image */
+PHP_FUNCTION(imageistruecolor)
+{
+   zval **IM;
+   gdImagePtr im;
+
+   if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, IM) == FAILURE) {
+   ZEND_WRONG_PARAM_COUNT();
+   }
+   
+   ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, Image, le_gd);
+
+   RETURN_BOOL(im-trueColor);
 }
 /* }}} */
 
Index: php4/ext/gd/php_gd.h
diff -u php4/ext/gd/php_gd.h:1.46 php4/ext/gd/php_gd.h:1.47
--- php4/ext/gd/php_gd.h:1.46   Sat Nov 23 17:11:59 2002
+++ php4/ext/gd/php_gd.hThu Dec  5 21:16:06 2002
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: php_gd.h,v 1.46 2002/11/23 22:11:59 moriyoshi Exp $ */
+/* $Id: php_gd.h,v 1.47 2002/12/06 02:16:06 pajoye Exp $ */
 
 #ifndef PHP_GD_H
 #define PHP_GD_H
@@ -64,6 +64,7 @@
 PHP_FUNCTION(imagearc);
 PHP_FUNCTION(imagechar);
 PHP_FUNCTION(imagecharup);
+PHP_FUNCTION(imageistruecolor);
 PHP_FUNCTION(imagecolorallocate);
 PHP_FUNCTION(imagepalettecopy);
 PHP_FUNCTION(imagecolorat);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/gd gd.c php_gd.h

2002-11-12 Thread Marcus Boerger
helly   Tue Nov 12 06:49:12 2002 EDT

  Modified files:  
/php4/ext/gdgd.c php_gd.h 
  Log:
  new function gd_info() returns an associative array of gd support options. # The 
index names are those from the minfo function. Therefore it is 
  # easy to look into phpinfo() to see which index names are possible.
  
  
Index: php4/ext/gd/gd.c
diff -u php4/ext/gd/gd.c:1.220 php4/ext/gd/gd.c:1.221
--- php4/ext/gd/gd.c:1.220  Wed Oct 30 12:54:36 2002
+++ php4/ext/gd/gd.cTue Nov 12 06:49:11 2002
 -18,7 +18,7 
+--+
  */
 
-/* $Id: gd.c,v 1.220 2002/10/30 17:54:36 helly Exp $ */
+/* $Id: gd.c,v 1.221 2002/11/12 11:49:11 helly Exp $ */
 
 /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, 
Cold Spring Harbor Labs. */
 -117,6 +117,7 
 /* {{{ gd_functions[]
  */
 function_entry gd_functions[] = {
+   PHP_FE(gd_info, NULL)
PHP_FE(imagearc,   
 NULL)
PHP_FE(imageellipse,NULL)
PHP_FE(imagechar,  
 NULL)
 -415,6 +416,82 
php_info_print_table_row(2, XBM Support, enabled);
 #endif
php_info_print_table_end();
+}
+/* }}} */
+
+/* {{{ proto array gd_info()
+ */
+PHP_FUNCTION(gd_info)
+{
+   if (ZEND_NUM_ARGS()!=0) {
+   ZEND_WRONG_PARAM_COUNT();
+   RETURN_FALSE;
+   }
+
+   if (array_init(return_value) == FAILURE) {
+   php_error_docref(NULL TSRMLS_CC, E_ERROR, Unable to initialize 
+array);
+   RETURN_FALSE;
+   }
+#if HAVE_GD_BUNDLED
+   add_assoc_string(return_value, GD Version, bundled (2.0 compatible), 1);
+#elif HAVE_LIBGD20
+   add_assoc_string(return_value, GD Version, 2.0 or higher, 1);
+#elif HAVE_GDIMAGECOLORRESOLVE
+   add_assoc_string(return_value, GD Version, 1.6.2 or higher, 1);
+#elif HAVE_LIBGD13
+   add_assoc_string(return_value, GD Version, between 1.3 and 1.6.1, 1);
+#else
+   add_assoc_string(return_value, GD Version, 1.2, 1);
+#endif
+
+#ifdef ENABLE_GD_TTF
+   add_assoc_bool(return_value, FreeType Support, 1);
+#if HAVE_LIBFREETYPE
+   add_assoc_string(return_value, FreeType Linkage, with freetype, 1);
+#elif HAVE_LIBTTF
+   add_assoc_string(return_value, FreeType Linkage, with TTF library, 1);
+#else
+   add_assoc_string(return_value, FreeType Linkage, with unknown library, 1);
+#endif
+#else
+   add_assoc_bool(return_value, FreeType Support, 0);
+#endif
+
+#ifdef HAVE_LIBT1
+   add_assoc_bool(return_value, T1Lib Support, 1);
+#else
+   add_assoc_bool(return_value, T1Lib Support, 0);
+#endif
+#ifdef HAVE_GD_GIF_READ
+   add_assoc_bool(return_value, GIF Read Support, 1);
+#else
+   add_assoc_bool(return_value, GIF Read Support, 0);
+#endif
+#ifdef HAVE_GD_GIF_CREATE
+   add_assoc_bool(return_value, GIF Create Support, 1);
+#else
+   add_assoc_bool(return_value, GIF Create Support, 0);
+#endif
+#ifdef HAVE_GD_JPG
+   add_assoc_bool(return_value, JPG Support, 1);
+#else
+   add_assoc_bool(return_value, JPG Support, 0);
+#endif
+#ifdef HAVE_GD_PNG
+   add_assoc_bool(return_value, PNG Support, 1);
+#else
+   add_assoc_bool(return_value, PNG Support, 0);
+#endif
+#ifdef HAVE_GD_WBMP
+   add_assoc_bool(return_value, WBMP Support, 1);
+#else
+   add_assoc_bool(return_value, WBMP Support, 0);
+#endif
+#ifdef HAVE_GD_XBM
+   add_assoc_bool(return_value, XBM Support, 1);
+#else
+   add_assoc_bool(return_value, XBM Support, 0);
+#endif
 }
 /* }}} */
 
Index: php4/ext/gd/php_gd.h
diff -u php4/ext/gd/php_gd.h:1.43 php4/ext/gd/php_gd.h:1.44
--- php4/ext/gd/php_gd.h:1.43   Mon Oct 28 20:15:43 2002
+++ php4/ext/gd/php_gd.hTue Nov 12 06:49:11 2002
 -17,7 +17,7 
+--+
 */
 
-/* $Id: php_gd.h,v 1.43 2002/10/29 01:15:43 iliaa Exp $ */
+/* $Id: php_gd.h,v 1.44 2002/11/12 11:49:11 helly Exp $ */
 
 #ifndef PHP_GD_H
 #define PHP_GD_H
 -59,6 +59,7 
 PHP_MINIT_FUNCTION(gd);
 PHP_MSHUTDOWN_FUNCTION(gd);
 
+PHP_FUNCTION(gd_info);
 PHP_FUNCTION(imagearc);
 PHP_FUNCTION(imagechar);
 PHP_FUNCTION(imagecharup);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/gd gd.c php_gd.h /ext/gd/libgd gd.c gd.h

2002-10-28 Thread Ilia Alshanetsky
iliaa   Mon Oct 28 20:15:44 2002 EDT

  Modified files:  
/php4/ext/gdgd.c php_gd.h 
/php4/ext/gd/libgd  gd.c gd.h 
  Log:
  Added a patch by Pierre-Alain Joye [EMAIL PROTECTED], which implements the
  imagerotate() that allows rotation of images in gd.
  
  
Index: php4/ext/gd/gd.c
diff -u php4/ext/gd/gd.c:1.216 php4/ext/gd/gd.c:1.217
--- php4/ext/gd/gd.c:1.216  Fri Oct 11 09:09:48 2002
+++ php4/ext/gd/gd.cMon Oct 28 20:15:43 2002
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: gd.c,v 1.216 2002/10/11 13:09:48 derick Exp $ */
+/* $Id: gd.c,v 1.217 2002/10/29 01:15:43 iliaa Exp $ */
 
 /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, 
Cold Spring Harbor Labs. */
@@ -158,6 +158,10 @@
PHP_FE(imagecopyresampled,  NULL)
 #endif
 
+#ifdef HAVE_GD_BUNDLED
+   PHP_FE(imagerotate, NULL)
+#endif
+
 #if HAVE_GD_IMAGESETTILE
PHP_FE(imagesettile,NULL)
 #endif
@@ -912,6 +916,39 @@
 
gdImageCopyResampled(im_dst, im_src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, 
srcH);
RETURN_TRUE;
+
+}
+/* }}} */
+#endif
+
+#ifdef HAVE_GD_BUNDLED
+/* {{{ proto int imagerotate(int src_im, float angle, int bgdcolor)
+   Rotate an image using a custom angle */
+PHP_FUNCTION(imagerotate)
+{
+   zval **SIM, **ANGLE, **BGDCOLOR;
+   gdImagePtr im_dst, im_src;
+   double degrees;
+   long color;
+
+   if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, SIM, ANGLE, BGDCOLOR) 
+== FAILURE) {
+   ZEND_WRONG_PARAM_COUNT();
+   }
+
+   ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, Image, le_gd);
+
+   convert_to_long_ex(BGDCOLOR);
+   color = Z_LVAL_PP(BGDCOLOR);
+
+   convert_to_double_ex(ANGLE);
+   degrees = Z_DVAL_PP(ANGLE);
+   im_dst = gdImageRotate(im_src, degrees, color);
+
+   if (im_dst != NULL) {
+   ZEND_REGISTER_RESOURCE(return_value, im_dst, le_gd);
+   } else {
+   RETURN_FALSE;
+   }
 }
 /* }}} */
 #endif
Index: php4/ext/gd/php_gd.h
diff -u php4/ext/gd/php_gd.h:1.42 php4/ext/gd/php_gd.h:1.43
--- php4/ext/gd/php_gd.h:1.42   Thu Aug 22 03:28:25 2002
+++ php4/ext/gd/php_gd.hMon Oct 28 20:15:43 2002
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: php_gd.h,v 1.42 2002/08/22 07:28:25 ttoohey Exp $ */
+/* $Id: php_gd.h,v 1.43 2002/10/29 01:15:43 iliaa Exp $ */
 
 #ifndef PHP_GD_H
 #define PHP_GD_H
@@ -93,6 +93,11 @@
 PHP_FUNCTION(imagecolorclosestalpha);
 PHP_FUNCTION(imagecolorexactalpha);
 PHP_FUNCTION(imagecopyresampled);
+
+#ifdef HAVE_GD_BUNDLED
+PHP_FUNCTION(imagerotate);
+#endif
+
 PHP_FUNCTION(imagesetthickness);
 PHP_FUNCTION(imagesettile);
 PHP_FUNCTION(imagecopymergegray);
Index: php4/ext/gd/libgd/gd.c
diff -u php4/ext/gd/libgd/gd.c:1.20 php4/ext/gd/libgd/gd.c:1.21
--- php4/ext/gd/libgd/gd.c:1.20 Sun Oct  6 04:39:05 2002
+++ php4/ext/gd/libgd/gd.c  Mon Oct 28 20:15:44 2002
@@ -2191,6 +2191,439 @@
 }
 }
 
+
+#ifdef ROTATE_PI
+#undef ROTATE_PI
+#endif /* ROTATE_PI */
+
+#define ROTATE_DEG2RAD  3.1415926535897932384626433832795/180
+void gdImageSkewX (gdImagePtr dst, gdImagePtr src, int uRow, int iOffset, double 
+dWeight, int clrBack)
+{
+   typedef int (*FuncPtr)(gdImagePtr, int, int);
+   int i, r, g, b, a;
+   FuncPtr f;
+
+   int pxlOldLeft, pxlLeft, pxlSrc;
+
+   if (src-trueColor) {
+   f = gdImageGetTrueColorPixel;
+   } else {
+   f = gdImageGetPixel;
+   }
+
+   for (i = 0; i  iOffset; i++) {
+   gdImageSetPixel (dst, i, uRow, clrBack);
+   }
+
+   if (i  dst-sx) {
+   gdImageSetPixel (dst, i, uRow, pxlLeft);
+   }
+
+   pxlOldLeft  = clrBack;
+
+   for (i = 0; i  src-sx; i++) {
+   pxlSrc = f (src,i,uRow);
+
+   r = gdImageRed(src,pxlSrc) * dWeight;
+   g = gdImageGreen(src,pxlSrc) * dWeight;
+   b = gdImageBlue(src,pxlSrc) * dWeight;
+   a = gdImageAlpha(src,pxlSrc) * dWeight;
+
+   pxlLeft = gdImageColorAllocateAlpha(src, r, g, b, a);
+   
+   if (pxlLeft == -1) {
+   pxlLeft = gdImageColorClosestAlpha(src, r, g, b, a);
+   }
+   
+   r = gdImageRed(src,pxlSrc) - (gdImageRed(src,pxlLeft) - 
+gdImageRed(src,pxlOldLeft));
+   g = gdImageGreen(src,pxlSrc) - (gdImageGreen(src,pxlLeft) - 
+gdImageGreen(src,pxlOldLeft));
+   b = gdImageBlue(src,pxlSrc) - (gdImageBlue(src,pxlLeft) - 
+gdImageBlue(src,pxlOldLeft));
+   a = gdImageAlpha(src,pxlSrc) - (gdImageAlpha(src,pxlLeft) - 
+gdImageAlpha(src,pxlOldLeft));
+
+   if (r255) {
+