wez             Fri Apr 13 05:00:12 2001 EDT

  Modified files:              
    /php4/ext/gd        config.m4 gd.c php_gd.h 
  Log:
  Added GD 2.0.1 support.
  
  
Index: php4/ext/gd/config.m4
diff -u php4/ext/gd/config.m4:1.54 php4/ext/gd/config.m4:1.55
--- php4/ext/gd/config.m4:1.54  Tue Mar 27 12:34:26 2001
+++ php4/ext/gd/config.m4       Fri Apr 13 05:00:12 2001
@@ -23,7 +23,32 @@
         ]) 
 ])
 
+AC_DEFUN(PHP_GD_PNG,[
+        AC_MSG_CHECKING([for libpng (needed by gd-2.0)])
+        AC_ARG_WITH(png-dir,
+        [  --with-png-dir[=DIR]   GD: png dir for gd-2.0+],[
+          AC_MSG_RESULT(yes)
+          if test "$withval" = "yes"; then
+            withval="/usr/local"
+          fi
+          jold_LIBS=$LIBS
+          LIBS="$LIBS -L$withval/lib"
+          AC_CHECK_LIB(png,png_info_init, [LIBS="$LIBS -lpng"],[AC_MSG_RESULT(no)],)
+          LIBS=$jold_LIBS
+          if test "$shared" = "yes"; then
+            GD_LIBS="$GD_LIBS -lpng"
+            GD_LFLAGS="$GD_LFLAGS -L$withval/lib"
+          else
+            PHP_ADD_LIBRARY_WITH_PATH(png, $withval/lib)
+          fi
+          LIBS="$LIBS -L$withval/lib -lpng"
+        ],[
+          AC_MSG_RESULT(no)
+          AC_MSG_WARN(If configure fails try --with-png-dir=<DIR>)
+        ]) 
+])
 
+
 AC_DEFUN(PHP_GD_XPM,[
         AC_MSG_CHECKING([for libXpm (needed by gd-1.8+)])
         AC_ARG_WITH(xpm-dir,
@@ -44,8 +69,31 @@
           AC_MSG_WARN(If configure fails try --with-xpm-dir=<DIR>)
         ]) 
 ])
-
 
+AC_DEFUN(PHP_GD_FREETYPE,[
+               AC_MSG_CHECKING([for freetype(2) (needed by gd 2.0+)])
+               AC_ARG_WITH(freetype-dir,
+               [  --with-freetype-dir[=DIR]    GD: freetype 2 dir for gd 2.0+],[
+                       for i in /usr /usr/local "$CHECK_FREETYPE" ; do
+                       if test -f "$i/include/freetype2/freetype/freetype.h"; then
+                               FREETYPE2_DIR="$i"
+                               FREETYPE2_INC_DIR="$i/include/freetype/freetype2"
+                       fi
+                       done
+                       if test -n "$FREETYPE2_DIR" ; then
+                               AC_DEFINE(HAVE_LIBFREETYPE,1,[ ])
+                               PHP_ADD_LIBRARY_WITH_PATH(freetype, $FREETYPE2_DIR/lib)
+                               PHP_ADD_INCLUDE($FREETYPE2_INC_DIR)
+                               AC_MSG_RESULT(yes)
+                       else
+                               AC_MSG_RESULT(no (freetype2 not found))
+                       fi
+               ],[
+                       AC_MSG_RESULT(no)
+                       AC_MSG_RESULT(If configure fails, try 
+--with-freetype2-dir=<DIR>)
+          ])
+])
+ 
 AC_DEFUN(PHP_GD_CHECK_VERSION,[
         AC_CHECK_LIB(z,  compress,      LIBS="-lz $LIBS",,)
         AC_CHECK_LIB(png,png_info_init, LIBS="-lpng $LIBS",,)
@@ -58,6 +106,9 @@
         AC_CHECK_LIB(gd, gdImageWBMP,            [AC_DEFINE(HAVE_GD_WBMP, 1, [ ])])
         AC_CHECK_LIB(gd, gdImageCreateFromJpeg,  [AC_DEFINE(HAVE_GD_JPG, 1, [ ])])
         AC_CHECK_LIB(gd, gdImageCreateFromXpm,   [AC_DEFINE(HAVE_GD_XPM, 1, [ ])])
+        AC_CHECK_LIB(gd, gdImageCreateTrueColor,   [AC_DEFINE(HAVE_LIBGD20, 1, [ ])])
+        AC_CHECK_LIB(gd, gdImageSetTile,                       
+[AC_DEFINE(HAVE_GD_IMAGESETTILE, 1, [ ])])
+        AC_CHECK_LIB(gd, gdImageSetBrush,                      
+[AC_DEFINE(HAVE_GD_IMAGESETBRUSH, 1, [ ])])
 ])
 
 
@@ -84,7 +135,9 @@
   PHP_WITH_SHARED
   old_withval=$withval
   PHP_GD_JPEG
+  PHP_GD_PNG
   PHP_GD_XPM
+  PHP_GD_FREETYPE
   withval=$old_withval
 
   AC_MSG_CHECKING(whether to include GD support)
@@ -183,6 +236,8 @@
 
 if test "$with_gd" != "no" && test "$ac_cv_lib_gd_gdImageLine" = "yes"; then
   CHECK_TTF="yes"
+
+ 
   AC_ARG_WITH(ttf,
   [  --with-ttf[=DIR]        GD: Include FreeType 1.x support],[
     if test $withval = "no" ; then
@@ -191,7 +246,7 @@
       CHECK_TTF="$withval"
     fi
   ])
-
+ 
   AC_MSG_CHECKING(whether to include FreeType 1.x support)
   if test -n "$CHECK_TTF" ; then
     for i in /usr /usr/local "$CHECK_TTF" ; do
Index: php4/ext/gd/gd.c
diff -u php4/ext/gd/gd.c:1.121 php4/ext/gd/gd.c:1.122
--- php4/ext/gd/gd.c:1.121      Fri Apr  6 11:01:52 2001
+++ php4/ext/gd/gd.c    Fri Apr 13 05:00:12 2001
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: gd.c,v 1.121 2001/04/06 18:01:52 sniper Exp $ */
+/* $Id: gd.c,v 1.122 2001/04/13 12:00:12 wez Exp $ */
 
 /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, 
    Cold Spring Harbor Labs. */
@@ -149,6 +149,24 @@
        PHP_FE(imagecopymerge,                                                  NULL)
        PHP_FE(imagecopyresized,                                                NULL)
        PHP_FE(imagecreate,                                                            
 NULL)
+
+       PHP_FE(imagecreatetruecolor,                                    NULL)
+       PHP_FE(imagetruecolortopalette,                         NULL)
+       PHP_FE(imagesetthickness,                                               NULL)
+       PHP_FE(imageellipse,                                                           
+ NULL)
+       PHP_FE(imagefilledellipse,                                              NULL)
+       PHP_FE(imagefilledarc,                                                  NULL)
+       PHP_FE(imagealphablending,                                              NULL)
+       PHP_FE(imagecolorresolvealpha,                          NULL)
+       PHP_FE(imagecolorclosestalpha,                          NULL)
+       PHP_FE(imagecolorexactalpha,                                    NULL)
+       PHP_FE(imagecopyresampled,                                              NULL)
+       PHP_FE(imagesettile,                                                           
+ NULL)
+
+       PHP_FE(imagesetbrush,                                                   NULL)
+       PHP_FE(imagesetstyle,                                                   NULL)
+       PHP_FE(imagecopymergegray,                                              NULL)
+
        PHP_FE(imagecreatefromstring,                                   NULL)
        PHP_FE(imagecreatefrompng,                                              NULL)
        PHP_FE(imagepng,                                                               
 NULL)
@@ -261,6 +279,21 @@
        REGISTER_LONG_CONSTANT("IMG_JPEG", 2, CONST_CS | CONST_PERSISTENT);
        REGISTER_LONG_CONSTANT("IMG_PNG", 4, CONST_CS | CONST_PERSISTENT);
        REGISTER_LONG_CONSTANT("IMG_WBMP", 8, CONST_CS | CONST_PERSISTENT);
+#ifdef gdTiled
+       /* special colours for gd */
+       REGISTER_LONG_CONSTANT("IMG_COLOR_TILED", gdTiled, CONST_CS | 
+CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("IMG_COLOR_STYLED", gdStyled, CONST_CS | 
+CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("IMG_COLOR_BRUSHED", gdBrushed, CONST_CS | 
+CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("IMG_COLOR_STYLEDBRUSHED", gdStyledBrushed, CONST_CS | 
+CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("IMG_COLOR_TRANSPARENT", gdTransparent, CONST_CS | 
+CONST_PERSISTENT);
+#endif
+#if HAVE_LIBGD20
+       /* for imagefilledarc */
+       REGISTER_LONG_CONSTANT("IMG_ARC_PIE", gdPie, CONST_CS | CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("IMG_ARC_CHORD", gdChord, CONST_CS | CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("IMG_ARC_NOFILL", gdNoFill, CONST_CS | 
+CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("IMG_ARC_EDGED", gdEdged, CONST_CS | CONST_PERSISTENT);
+#endif
        return SUCCESS;
 }
 
@@ -271,7 +304,9 @@
 
        /* need to use a PHPAPI function here because it is external module in windows 
*/
 
-#if HAVE_GDIMAGECOLORRESOLVE
+#if HAVE_LIBGD20
+       php_info_print_table_row(2, "GD Version", "2.0 or higher");
+#elif HAVE_GDIMAGECOLORRESOLVE
        php_info_print_table_row(2, "GD Version", "1.6.2 or higher");
 #elif HAVE_LIBGD13
        php_info_print_table_row(2, "GD Version", "between 1.3 and 1.6.1");
@@ -476,6 +511,440 @@
 }
 /* }}} */
 
+/* {{{ proto void imagesetstyle(resource im, array styles)
+       Set the line drawing styles for use with imageline and IMG_COLOR_STYLED. */
+PHP_FUNCTION(imagesetstyle)
+{
+       zval **IM, **dither, **styles;
+       gdImagePtr im;
+       int * stylearr;
+       int index;
+       HashPosition pos;
+       GDLS_FETCH();
+
+       if (ZEND_NUM_ARGS() != 2 ||     zend_get_parameters_ex(2, &IM, &styles) == 
+FAILURE) 
+       {
+               WRONG_PARAM_COUNT;
+       }
+
+       ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
+       convert_to_array_ex(dither);
+
+       /* copy the style values in the stylearr */
+       stylearr = emalloc(sizeof(int) * zend_hash_num_elements(HASH_OF(*styles)));
+
+       zend_hash_internal_pointer_reset_ex(HASH_OF(*styles), &pos);
+               
+       for (index=0;; zend_hash_move_forward_ex(HASH_OF(*styles), &pos))       {
+               zval ** item;
+
+               if (zend_hash_get_current_data_ex(HASH_OF(*styles), (void**)&item, 
+&pos) == FAILURE)
+                       break;
+
+               convert_to_long_ex(item);
+
+               stylearr[index++] = Z_LVAL_PP(item);
+       }
+       gdImageSetStyle(im, stylearr, index);
+
+       efree(stylearr);
+
+       RETURN_TRUE;
+}
+/* }}} */
+
+
+/* {{{ proto int imagecreatetruecolor(int x_size, int y_size)
+   Create a new true color image */
+PHP_FUNCTION(imagecreatetruecolor)
+{
+#if HAVE_LIBGD20
+       zval **x_size, **y_size;
+       gdImagePtr im;
+       GDLS_FETCH();
+
+       if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x_size, &y_size) == 
+FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       convert_to_long_ex(x_size);
+       convert_to_long_ex(y_size);
+
+       im = gdImageCreateTrueColor(Z_LVAL_PP(x_size), Z_LVAL_PP(y_size));
+
+       ZEND_REGISTER_RESOURCE(return_value, im, le_gd);
+#else
+       zend_error(E_ERROR, "%s(): requires GD 2.0 or later", 
+get_active_function_name());
+#endif
+}
+/* }}} */
+
+/* {{{ void ImageTrueColorToPalette(resource im, bool ditherFlag, int colorsWanted)
+       Convert a true colour image to a palette based image with a number of colours, 
+optionally using dithering. */
+PHP_FUNCTION(imagetruecolortopalette)
+{
+#if HAVE_LIBGD20
+       zval **IM, **dither, **ncolors;
+       gdImagePtr im;
+       GDLS_FETCH();
+
+       if (ZEND_NUM_ARGS() != 3 ||     zend_get_parameters_ex(3, &IM, &dither, 
+&ncolors) == FAILURE) 
+       {
+               WRONG_PARAM_COUNT;
+       }
+
+       ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
+       convert_to_boolean_ex(dither);
+       convert_to_long_ex(ncolors);
+               
+       gdImageTrueColorToPalette(im, Z_LVAL_PP(dither), Z_LVAL_PP(ncolors));
+
+       RETURN_TRUE;
+#else
+       zend_error(E_ERROR, "%s(): requires GD 2.0 or later", 
+get_active_function_name());
+#endif
+
+}
+/* }}} */
+
+/* {{{ proto void imagesetthickness(resource im, int thickness)
+       Set line thickness for drawing lines, ellipses, rectangles, polygons etc. */
+PHP_FUNCTION(imagesetthickness)
+{
+#if HAVE_LIBGD20
+       zval **IM, **thick;
+       gdImagePtr im;
+       GDLS_FETCH();
+
+       if (ZEND_NUM_ARGS() != 2 ||     zend_get_parameters_ex(2, &IM, &thick) == 
+FAILURE) 
+       {
+               WRONG_PARAM_COUNT;
+       }
+
+       ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
+       convert_to_boolean_ex(thick);
+               
+       gdImageSetThickness(im, Z_LVAL_PP(thick));
+
+       RETURN_TRUE;
+#else
+       zend_error(E_ERROR, "%s(): requires GD 2.0 or later", 
+get_active_function_name());
+#endif
+
+}
+/* }}} */
+
+/* {{{ proto void imageellipse(resource im, int cx, int cy, int w, int h, int color)
+       Draw an ellipse */
+PHP_FUNCTION(imageellipse)
+{
+#if 0 && HAVE_LIBGD20 /* this function is missing from GD 2.0.1 */
+       zval **IM, **cx, **cy, **w, **h, **color;
+       gdImagePtr im;
+       GDLS_FETCH();
+
+       if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &IM, &cx, &cy, &w, &h, 
+&color) == FAILURE) 
+       {
+               WRONG_PARAM_COUNT;
+       }
+       
+       ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
+
+       convert_to_long_ex(cx);
+       convert_to_long_ex(cy);
+       convert_to_long_ex(w);
+       convert_to_long_ex(h);
+       convert_to_long_ex(color);
+
+       gdImageEllipse(im, Z_LVAL_PP(cx), Z_LVAL_PP(cy), Z_LVAL_PP(w), Z_LVAL_PP(h), 
+Z_LVAL_PP(color));
+
+       RETURN_TRUE;
+#else
+       zend_error(E_ERROR, "%s(): requires GD 2.0 or later", 
+get_active_function_name());
+#endif
+}
+/* }}} */
+
+/* {{{ proto void imagefilledellipse(resource im, int cx, int cy, int w, int h, int 
+color)
+       Draw an ellipse */
+PHP_FUNCTION(imagefilledellipse)
+{
+#if HAVE_LIBGD20
+       zval **IM, **cx, **cy, **w, **h, **color;
+       gdImagePtr im;
+       GDLS_FETCH();
+
+       if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &IM, &cx, &cy, &w, &h, 
+&color) == FAILURE) 
+       {
+               WRONG_PARAM_COUNT;
+       }
+       
+       ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
+
+       convert_to_long_ex(cx);
+       convert_to_long_ex(cy);
+       convert_to_long_ex(w);
+       convert_to_long_ex(h);
+       convert_to_long_ex(color);
+
+       gdImageFilledEllipse(im, Z_LVAL_PP(cx), Z_LVAL_PP(cy), Z_LVAL_PP(w), 
+Z_LVAL_PP(h), Z_LVAL_PP(color));
+
+       RETURN_TRUE;
+#else
+       zend_error(E_ERROR, "%s(): requires GD 2.0 or later", 
+get_active_function_name());
+#endif
+}
+/* }}} */
+
+/* {{{ proto int imagefilledarc(int im, int cx, int cy, int w, int h, int s, int e, 
+int col, int style)
+   Draw a filled partial ellipse */
+PHP_FUNCTION(imagefilledarc)
+{
+#if HAVE_LIBGD20
+       zval **IM, **cx, **cy, **w, **h, **ST, **E, **col, **style;
+       gdImagePtr im;
+       int e,st;
+       GDLS_FETCH();
+
+       if (ZEND_NUM_ARGS() != 9 ||     zend_get_parameters_ex(9, &IM, &cx, &cy, &w, 
+&h, &ST, &E, &col, &style) == FAILURE)
+       {
+               WRONG_PARAM_COUNT;
+       }
+
+       ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
+
+       convert_to_long_ex(cx);
+       convert_to_long_ex(cy);
+       convert_to_long_ex(w);
+       convert_to_long_ex(h);
+       convert_to_long_ex(ST);
+       convert_to_long_ex(E);
+       convert_to_long_ex(col);
+       convert_to_long_ex(style);
+
+       e = Z_LVAL_PP(E);
+       st = Z_LVAL_PP(ST);
+
+       if (e < 0)   e %= 360;
+       if (st < 0) st %= 360;
+
+       
+gdImageFilledArc(im,Z_LVAL_PP(cx),Z_LVAL_PP(cy),Z_LVAL_PP(w),Z_LVAL_PP(h),st,e,Z_LVAL_PP(col),
+ Z_LVAL_PP(style));
+       RETURN_TRUE;
+#else
+       zend_error(E_ERROR, "%s(): requires GD 2.0 or later", 
+get_active_function_name());
+#endif
+}
+/* }}} */      
+
+/* {{{ proto void imagealphablending(resource im, bool on)
+   Turn alpha blending mode on or off for the given image */
+PHP_FUNCTION(imagealphablending)
+{
+#if HAVE_LIBGD20
+       zval **IM, **blend;
+       gdImagePtr im;
+       GDLS_FETCH();
+
+       if (ZEND_NUM_ARGS() != 2 ||     zend_get_parameters_ex(2, &IM, &blend) == 
+FAILURE) 
+       {
+               WRONG_PARAM_COUNT;
+       }
+
+       ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
+       convert_to_boolean_ex(blend);
+               
+       gdImageAlphaBlending(im, Z_LVAL_PP(blend));
+
+       RETURN_TRUE;
+#else
+       zend_error(E_ERROR, "%s(): requires GD 2.0 or later", 
+get_active_function_name());
+#endif
+}
+/* }}} */
+
+/* {{{ 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_FUNCTION(imagecolorresolvealpha)
+{
+#if HAVE_LIBGD20
+       zval **IM, ** red, **green, **blue, **alpha;
+       gdImagePtr im;
+       GDLS_FETCH();
+
+       if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &IM, &red, &green, 
+&blue, &alpha) == FAILURE) 
+       {
+               WRONG_PARAM_COUNT;
+       }
+       
+       ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
+
+       convert_to_long_ex(red);
+       convert_to_long_ex(green);
+       convert_to_long_ex(blue);
+       convert_to_long_ex(alpha);
+
+       RETURN_LONG(gdImageColorResolveAlpha(im, Z_LVAL_PP(red), Z_LVAL_PP(green), 
+Z_LVAL_PP(blue), Z_LVAL_PP(alpha)));
+#else
+       zend_error(E_ERROR, "%s(): requires GD 2.0 or later", 
+get_active_function_name());
+#endif
+
+}
+/* }}} */
+
+/* {{{ proto int imagecolorclosestalpha(resource im, int red, int green, int blue, 
+int alpha)
+       Find the closest matching colour with alpha transparency */
+PHP_FUNCTION(imagecolorclosestalpha)
+{
+#if HAVE_LIBGD20
+       zval **IM, ** red, **green, **blue, **alpha;
+       gdImagePtr im;
+       GDLS_FETCH();
+
+       if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &IM, &red, &green, 
+&blue, &alpha) == FAILURE) 
+       {
+               WRONG_PARAM_COUNT;
+       }
+       
+       ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
+
+       convert_to_long_ex(red);
+       convert_to_long_ex(green);
+       convert_to_long_ex(blue);
+       convert_to_long_ex(alpha);
+
+       RETURN_LONG(gdImageColorClosestAlpha(im, Z_LVAL_PP(red), Z_LVAL_PP(green), 
+Z_LVAL_PP(blue), Z_LVAL_PP(alpha)));
+#else
+       zend_error(E_ERROR, "%s(): requires GD 2.0 or later", 
+get_active_function_name());
+#endif
+}
+/* }}} */
+
+/* {{{ proto int imagecolorexactalpha(resource im, int red, int green, int blue, int 
+alpha)
+       Find exact match for colour with transparency */
+PHP_FUNCTION(imagecolorexactalpha)
+{
+#if HAVE_LIBGD20
+       zval **IM, **red, **green, **blue, **alpha;
+       gdImagePtr im;
+       GDLS_FETCH();
+
+       if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &IM, &red, &green, 
+&blue, &alpha) == FAILURE) 
+       {
+               WRONG_PARAM_COUNT;
+       }
+       
+       ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
+
+       convert_to_long_ex(red);
+       convert_to_long_ex(green);
+       convert_to_long_ex(blue);
+       convert_to_long_ex(alpha);
+       
+       RETURN_LONG(gdImageColorExactAlpha(im, Z_LVAL_PP(red), Z_LVAL_PP(green), 
+Z_LVAL_PP(blue), Z_LVAL_PP(alpha)));
+#else
+       zend_error(E_ERROR, "%s(): requires GD 2.0 or later", 
+get_active_function_name());
+#endif
+}
+/* }}} */
+
+/* {{{ proto int imagecopyresampled(int dst_im, int src_im, int dst_x, int dst_y, int 
+src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h)
+   Copy and resize part of an image using resampling to help ensure clarity */
+PHP_FUNCTION(imagecopyresampled)
+{
+#if HAVE_LIBGD20
+       zval **SIM, **DIM, **SX, **SY, **SW, **SH, **DX, **DY, **DW, **DH;
+       gdImagePtr im_dst, im_src;
+       int srcH, srcW, dstH, dstW, srcY, srcX, dstY, dstX;
+       GDLS_FETCH();
+
+       if (ZEND_NUM_ARGS() != 10 ||
+               zend_get_parameters_ex(10, &DIM, &SIM, &DX, &DY, &SX, &SY, &DW, &DH, 
+&SW, &SH) == FAILURE) 
+       {
+               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_long_ex(DX);
+       convert_to_long_ex(DY);
+       convert_to_long_ex(DW);
+       convert_to_long_ex(DH);
+
+       srcX = Z_LVAL_PP(SX);
+       srcY = Z_LVAL_PP(SY);
+       srcH = Z_LVAL_PP(SH);
+       srcW = Z_LVAL_PP(SW);
+       dstX = Z_LVAL_PP(DX);
+       dstY = Z_LVAL_PP(DY);
+       dstH = Z_LVAL_PP(DH);
+       dstW = Z_LVAL_PP(DW);
+
+       gdImageCopyResampled(im_dst, im_src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, 
+srcH);
+       RETURN_TRUE;
+#else
+       zend_error(E_ERROR, "%s(): requires GD 2.0 or later", 
+get_active_function_name());
+#endif
+}
+/* }}} */      
+
+/* {{{ proto int imagesettile(resource image, resource tile)
+       Set the tile image to $tile when filling $image with the "IMG_COLOR_TILED" 
+color */
+PHP_FUNCTION(imagesettile)
+{
+#if HAVE_GD_IMAGESETTILE
+       zval **IM, **TILE;
+       gdImagePtr im, tile;
+       GDLS_FETCH();
+
+       if (ZEND_NUM_ARGS() != 2 ||     zend_get_parameters_ex(2, &IM, &TILE) == 
+FAILURE) 
+       {
+               WRONG_PARAM_COUNT;
+       }
+
+       ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
+       ZEND_FETCH_RESOURCE(tile, gdImagePtr, TILE, -1, "Image", le_gd);
+
+       gdImageSetTile(im,tile);
+
+       RETURN_TRUE;
+#else
+       zend_error(E_ERROR, "%s(): requires a more recent version of GD", 
+get_active_function_name());
+#endif
+}
+/* }}} */
+
+/* {{{ proto int imagesetbrush(resource image, resource brush)
+       Set the brush image to $brush when filling $image with the "IMG_COLOR_BRUSHED" 
+color */
+PHP_FUNCTION(imagesetbrush)
+{
+#if HAVE_GD_IMAGESETBRUSH
+       zval **IM, **TILE;
+       gdImagePtr im, tile;
+       GDLS_FETCH();
+
+       if (ZEND_NUM_ARGS() != 2 ||     zend_get_parameters_ex(2, &IM, &TILE) == 
+FAILURE) 
+       {
+               WRONG_PARAM_COUNT;
+       }
+
+       ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
+       ZEND_FETCH_RESOURCE(tile, gdImagePtr, TILE, -1, "Image", le_gd);
+
+       gdImageSetBrush(im,tile);
+
+       RETURN_TRUE;
+#else
+       zend_error(E_ERROR, "%s(): requires a more recent version of GD", 
+get_active_function_name());
+#endif
+}
+/* }}} */
+
+
 /* {{{ proto int imagecreate(int x_size, int y_size)
    Create a new image */
 PHP_FUNCTION(imagecreate)
@@ -1987,6 +2456,52 @@
 }
 /* }}} */
 
+/* {{{ proto int imagecopymergegray(int src_im, int dst_im, int dst_x, int dst_y, int 
+src_x, int src_y, int src_w, int src_h, int pct)
+   Merge one part of an image with another */
+PHP_FUNCTION(imagecopymergegray)
+{
+#if HAVE_LIBGD15
+       zval **SIM, **DIM, **SX, **SY, **SW, **SH, **DX, **DY, **PCT;
+       gdImagePtr im_dst, im_src;
+       int srcH, srcW, srcY, srcX, dstY, dstX, pct;
+       GDLS_FETCH();
+
+       if (ZEND_NUM_ARGS() != 9 ||
+               zend_get_parameters_ex(9, &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH, 
+&PCT) == FAILURE) 
+       {
+               WRONG_PARAM_COUNT;
+       }
+
+       ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, "Image", le_gd);
+       ZEND_FETCH_RESOURCE(im_dst, gdImagePtr, DIM, -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_long_ex(DX);
+       convert_to_long_ex(DY);
+       convert_to_long_ex(PCT);
+
+       srcX = Z_LVAL_PP(SX);
+       srcY = Z_LVAL_PP(SY);
+       srcH = Z_LVAL_PP(SH);
+       srcW = Z_LVAL_PP(SW);
+       dstX = Z_LVAL_PP(DX);
+       dstY = Z_LVAL_PP(DY);
+       pct  = Z_LVAL_PP(PCT);
+
+       gdImageCopyMergeGray(im_dst, im_src, dstX, dstY, srcX, srcY, srcW, srcH, pct);
+       RETURN_TRUE;
+#else
+       php_error(E_WARNING, "%s(): was introduced in GD version 1.5", 
+get_active_function_name());
+       RETURN_FALSE;
+#endif
+}
+/* }}} */
+
+
+
 /* {{{ proto int imagecopyresized(int dst_im, int src_im, int dst_x, int dst_y, int 
src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h)
    Copy and resize part of an image */
 PHP_FUNCTION(imagecopyresized)
@@ -2143,7 +2658,11 @@
        fontname = (unsigned char *) Z_STRVAL_PP(FONTNAME);
 
 #ifdef USE_GD_IMGSTRTTF
+# if HAVE_LIBGD20 & HAVE_LIBFREETYPE
+       error = gdImageStringFT(im, brect, col, fontname, ptsize, angle, x, y, str);
+# else
        error = gdImageStringTTF(im, brect, col, fontname, ptsize, angle, x, y, str);
+# endif
 #else
        error = gdttf(im, brect, col, fontname, ptsize, angle, x, y, str);
 #endif
Index: php4/ext/gd/php_gd.h
diff -u php4/ext/gd/php_gd.h:1.26 php4/ext/gd/php_gd.h:1.27
--- php4/ext/gd/php_gd.h:1.26   Fri Apr  6 11:01:52 2001
+++ php4/ext/gd/php_gd.h        Fri Apr 13 05:00:12 2001
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_gd.h,v 1.26 2001/04/06 18:01:52 sniper Exp $ */
+/* $Id: php_gd.h,v 1.27 2001/04/13 12:00:12 wez Exp $ */
 
 #ifndef PHP_GD_H
 #define PHP_GD_H
@@ -95,6 +95,25 @@
 PHP_FUNCTION(imagecopyresized);
 PHP_FUNCTION(imagetypes);
 PHP_FUNCTION(imagecreate);
+
+PHP_FUNCTION(imagecreatetruecolor);
+PHP_FUNCTION(imagetruecolortopalette);
+PHP_FUNCTION(imagesetthickness);
+PHP_FUNCTION(imageellipse);
+PHP_FUNCTION(imagefilledellipse);
+PHP_FUNCTION(imagefilledarc);
+PHP_FUNCTION(imagealphablending);
+PHP_FUNCTION(imagecolorresolvealpha);
+PHP_FUNCTION(imagecolorclosestalpha);
+PHP_FUNCTION(imagecolorexactalpha);
+PHP_FUNCTION(imagecopyresampled);
+PHP_FUNCTION(imagesetthickness);
+PHP_FUNCTION(imagesettile);
+PHP_FUNCTION(imagecopymergegray);
+PHP_FUNCTION(imagesetbrush);
+PHP_FUNCTION(imagesettile);
+PHP_FUNCTION(imagesetstyle);
+
 PHP_FUNCTION(imagecreatefromstring);
 PHP_FUNCTION(imagecreatefromgif);
 PHP_FUNCTION(imagecreatefromjpeg);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to