pajoye Wed May 27 08:18:24 2009 UTC Added files: (Branch: PHP_5_3) /php-src/ext/gd/libgd gd_color.c
Modified files: /php-src/ext/gd config.m4 config.w32 gd.c php_gd.h /php-src/ext/gd/libgd gd_compat.h gd_topal.c Log: - [DOC] always enable imagecolormatch
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/config.m4?r1=1.154.2.1.2.6.2.7&r2=1.154.2.1.2.6.2.8&diff_format=u Index: php-src/ext/gd/config.m4 diff -u php-src/ext/gd/config.m4:1.154.2.1.2.6.2.7 php-src/ext/gd/config.m4:1.154.2.1.2.6.2.8 --- php-src/ext/gd/config.m4:1.154.2.1.2.6.2.7 Wed May 27 07:17:53 2009 +++ php-src/ext/gd/config.m4 Wed May 27 08:18:23 2009 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.154.2.1.2.6.2.7 2009/05/27 07:17:53 pajoye Exp $ +dnl $Id: config.m4,v 1.154.2.1.2.6.2.8 2009/05/27 08:18:23 pajoye Exp $ dnl dnl @@ -270,7 +270,7 @@ libgd/gdfontg.c libgd/gdtables.c libgd/gdft.c libgd/gdcache.c libgd/gdkanji.c \ libgd/wbmp.c libgd/gd_wbmp.c libgd/gdhelpers.c libgd/gd_topal.c libgd/gd_gif_in.c \ libgd/xbm.c libgd/gd_gif_out.c libgd/gd_security.c libgd/gd_filter.c \ - libgd/gd_pixelate.c libgd/gd_arc.c libgd/gd_rotate.c" + libgd/gd_pixelate.c libgd/gd_arc.c libgd/gd_rotate.c libgd/gd_color.c" dnl check for fabsf and floorf which are available since C99 AC_CHECK_FUNCS(fabsf floorf) @@ -343,7 +343,8 @@ if test "$PHP_GD" != "no"; then GD_MODULE_TYPE=external - extra_sources="gdcache.c libgd/gd_compat.c libgd/gd_filter.c libgd/gd_pixelate.c libgd/gd_arc.c libgd/gd_rotate.c" + extra_sources="gdcache.c libgd/gd_compat.c libgd/gd_filter.c libgd/gd_pixelate.c libgd/gd_arc.c \ + libgd/gd_rotate.c libgd/gd_color.c" dnl Various checks for GD features PHP_GD_ZLIB http://cvs.php.net/viewvc.cgi/php-src/ext/gd/config.w32?r1=1.10.4.4.2.14&r2=1.10.4.4.2.15&diff_format=u Index: php-src/ext/gd/config.w32 diff -u php-src/ext/gd/config.w32:1.10.4.4.2.14 php-src/ext/gd/config.w32:1.10.4.4.2.15 --- php-src/ext/gd/config.w32:1.10.4.4.2.14 Wed May 27 07:17:53 2009 +++ php-src/ext/gd/config.w32 Wed May 27 08:18:23 2009 @@ -1,4 +1,4 @@ -// $Id: config.w32,v 1.10.4.4.2.14 2009/05/27 07:17:53 pajoye Exp $ +// $Id: config.w32,v 1.10.4.4.2.15 2009/05/27 08:18:23 pajoye Exp $ // vim:ft=javascript ARG_WITH("gd", "Bundled GD support", "yes,shared"); @@ -34,7 +34,7 @@ gdft.c gd_gd2.c gd_gd.c gd_gif_in.c gd_gif_out.c gdhelpers.c gd_io.c gd_io_dp.c \ gd_io_file.c gd_io_ss.c gd_jpeg.c gdkanji.c gd_png.c gd_ss.c \ gdtables.c gd_topal.c gd_wbmp.c gdxpm.c wbmp.c xbm.c gd_security.c \ - gd_filter.c gd_pixelate.c gd_arc.c gd_rotate.c", "gd"); + gd_filter.c gd_pixelate.c gd_arc.c gd_rotate.c gd_color.c", "gd"); AC_DEFINE('HAVE_LIBGD', 1, 'GD support'); ADD_FLAG("CFLAGS_GD", " \ /D HAVE_GD_DYNAMIC_CTX_EX=1 \ http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.312.2.20.2.32.2.41&r2=1.312.2.20.2.32.2.42&diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.312.2.20.2.32.2.41 php-src/ext/gd/gd.c:1.312.2.20.2.32.2.42 --- php-src/ext/gd/gd.c:1.312.2.20.2.32.2.41 Wed May 27 07:17:53 2009 +++ php-src/ext/gd/gd.c Wed May 27 08:18:23 2009 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: gd.c,v 1.312.2.20.2.32.2.41 2009/05/27 07:17:53 pajoye Exp $ */ +/* $Id: gd.c,v 1.312.2.20.2.32.2.42 2009/05/27 08:18:23 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -195,12 +195,10 @@ ZEND_ARG_INFO(0, colorsWanted) ZEND_END_ARG_INFO() -#if HAVE_GD_BUNDLED ZEND_BEGIN_ARG_INFO(arginfo_imagecolormatch, 0) ZEND_ARG_INFO(0, im1) ZEND_ARG_INFO(0, im2) ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_INFO(arginfo_imagesetthickness, 0) ZEND_ARG_INFO(0, im) @@ -1038,9 +1036,11 @@ #endif #if HAVE_GD_BUNDLED PHP_FE(imagelayereffect, arginfo_imagelayereffect) - PHP_FE(imagecolormatch, arginfo_imagecolormatch) PHP_FE(imagexbm, arginfo_imagexbm) #endif + + PHP_FE(imagecolormatch, arginfo_imagecolormatch) + /* gd filters */ PHP_FE(imagefilter, arginfo_imagefilter) PHP_FE(imageconvolution, arginfo_imageconvolution) @@ -1674,7 +1674,6 @@ } /* }}} */ -#if HAVE_GD_BUNDLED /* {{{ proto bool imagecolormatch(resource im1, resource im2) Makes the colors of the palette version of an image more closely match the true color version */ PHP_FUNCTION(imagecolormatch) @@ -1713,7 +1712,6 @@ RETURN_TRUE; } /* }}} */ -#endif /* {{{ proto bool imagesetthickness(resource im, int thickness) Set line thickness for drawing lines, ellipses, rectangles, polygons etc. */ http://cvs.php.net/viewvc.cgi/php-src/ext/gd/php_gd.h?r1=1.59.2.3.2.5.2.8&r2=1.59.2.3.2.5.2.9&diff_format=u Index: php-src/ext/gd/php_gd.h diff -u php-src/ext/gd/php_gd.h:1.59.2.3.2.5.2.8 php-src/ext/gd/php_gd.h:1.59.2.3.2.5.2.9 --- php-src/ext/gd/php_gd.h:1.59.2.3.2.5.2.8 Wed May 27 07:17:54 2009 +++ php-src/ext/gd/php_gd.h Wed May 27 08:18:24 2009 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_gd.h,v 1.59.2.3.2.5.2.8 2009/05/27 07:17:54 pajoye Exp $ */ +/* $Id: php_gd.h,v 1.59.2.3.2.5.2.9 2009/05/27 08:18:24 pajoye Exp $ */ #ifndef PHP_GD_H #define PHP_GD_H @@ -190,9 +190,10 @@ PHP_FUNCTION(png2wbmp); PHP_FUNCTION(image2wbmp); +PHP_FUNCTION(imagecolormatch); + #if HAVE_GD_BUNDLED PHP_FUNCTION(imagelayereffect); -PHP_FUNCTION(imagecolormatch); PHP_FUNCTION(imagexbm); #endif http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd_compat.h?r1=1.1.2.4&r2=1.1.2.5&diff_format=u Index: php-src/ext/gd/libgd/gd_compat.h diff -u php-src/ext/gd/libgd/gd_compat.h:1.1.2.4 php-src/ext/gd/libgd/gd_compat.h:1.1.2.5 --- php-src/ext/gd/libgd/gd_compat.h:1.1.2.4 Wed May 27 07:17:54 2009 +++ php-src/ext/gd/libgd/gd_compat.h Wed May 27 08:18:24 2009 @@ -7,8 +7,6 @@ # include <gd.h> #endif - - const char * gdPngGetVersionString(); int gdJpegGetVersionString(); int gdJpegGetVersionInt(); @@ -55,5 +53,7 @@ gdImagePtr gdImageRotate (gdImagePtr src, double dAngle, int clrBack, int ignoretransparent); +int gdImageColorMatch (gdImagePtr im1, gdImagePtr im2); + #endif http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd_topal.c?r1=1.17.2.1.2.1&r2=1.17.2.1.2.1.2.1&diff_format=u Index: php-src/ext/gd/libgd/gd_topal.c diff -u php-src/ext/gd/libgd/gd_topal.c:1.17.2.1.2.1 php-src/ext/gd/libgd/gd_topal.c:1.17.2.1.2.1.2.1 --- php-src/ext/gd/libgd/gd_topal.c:1.17.2.1.2.1 Wed Apr 4 00:30:18 2007 +++ php-src/ext/gd/libgd/gd_topal.c Wed May 27 08:18:24 2009 @@ -2067,60 +2067,4 @@ } -/* bring the palette colors in im2 to be closer to im1 - * - */ -int gdImageColorMatch (gdImagePtr im1, gdImagePtr im2) -{ - unsigned long *buf; /* stores our calculations */ - unsigned long *bp; /* buf ptr */ - int color, rgb; - int x,y; - int count; - - if( !im1->trueColor ) { - return -1; /* im1 must be True Color */ - } - if( im2->trueColor ) { - return -2; /* im2 must be indexed */ - } - if( (im1->sx != im2->sx) || (im1->sy != im2->sy) ) { - return -3; /* the images are meant to be the same dimensions */ - } - if (im2->colorsTotal<1) { - return -4; /* At least 1 color must be allocated */ - } - - buf = (unsigned long *)safe_emalloc(sizeof(unsigned long), 5 * im2->colorsTotal, 0); - memset( buf, 0, sizeof(unsigned long) * 5 * im2->colorsTotal ); - - for (x=0; x<im1->sx; x++) { - for( y=0; y<im1->sy; y++ ) { - color = im2->pixels[y][x]; - rgb = im1->tpixels[y][x]; - bp = buf + (color * 5); - (*(bp++))++; - *(bp++) += gdTrueColorGetRed(rgb); - *(bp++) += gdTrueColorGetGreen(rgb); - *(bp++) += gdTrueColorGetBlue(rgb); - *(bp++) += gdTrueColorGetAlpha(rgb); - } - } - bp = buf; - for (color=0; color<im2->colorsTotal; color++) { - count = *(bp++); - if( count > 0 ) { - im2->red[color] = *(bp++) / count; - im2->green[color] = *(bp++) / count; - im2->blue[color] = *(bp++) / count; - im2->alpha[color] = *(bp++) / count; - } else { - bp += 4; - } - } - gdFree(buf); - return 0; -} - - #endif http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd_color.c?view=markup&rev=1.1 Index: php-src/ext/gd/libgd/gd_color.c +++ php-src/ext/gd/libgd/gd_color.c #if HAVE_GD_BUNDLED # include "gd.h" #else # include <gd.h> #endif #include "gd_intern.h" #include "php.h" /* bring the palette colors in im2 to be closer to im1 * */ int gdImageColorMatch (gdImagePtr im1, gdImagePtr im2) { unsigned long *buf; /* stores our calculations */ unsigned long *bp; /* buf ptr */ int color, rgb; int x,y; int count; if( !im1->trueColor ) { return -1; /* im1 must be True Color */ } if( im2->trueColor ) { return -2; /* im2 must be indexed */ } if( (im1->sx != im2->sx) || (im1->sy != im2->sy) ) { return -3; /* the images are meant to be the same dimensions */ } if (im2->colorsTotal<1) { return -4; /* At least 1 color must be allocated */ } buf = (unsigned long *)safe_emalloc(sizeof(unsigned long), 5 * im2->colorsTotal, 0); memset( buf, 0, sizeof(unsigned long) * 5 * im2->colorsTotal ); for (x=0; x<im1->sx; x++) { for( y=0; y<im1->sy; y++ ) { color = im2->pixels[y][x]; rgb = im1->tpixels[y][x]; bp = buf + (color * 5); (*(bp++))++; *(bp++) += gdTrueColorGetRed(rgb); *(bp++) += gdTrueColorGetGreen(rgb); *(bp++) += gdTrueColorGetBlue(rgb); *(bp++) += gdTrueColorGetAlpha(rgb); } } bp = buf; for (color=0; color<im2->colorsTotal; color++) { count = *(bp++); if( count > 0 ) { im2->red[color] = *(bp++) / count; im2->green[color] = *(bp++) / count; im2->blue[color] = *(bp++) / count; im2->alpha[color] = *(bp++) / count; } else { bp += 4; } } gdFree(buf); return 0; }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php