|
||||||||||
|
New in This Group cvs: gd /libgd/src gd_crop.c11/26/2008 1:43:45 PM cvs: gd /libgd/src CMakeLists.txt Makefile.am gd.c gd.h gd_color.c gd_color.h gd_crop.c /libgd/tests/gdimagecolorreplace gdimagecolorreplace.c11/23/2008 2:32:35 PM cvs: gd /libgd/src gd_color_map.h11/23/2008 2:26:55 PM cvs: gd /libgd/src gd.c gd.h /libgd/tests/gdimagecolorreplace gdimagecolorreplace.c11/20/2008 3:24:48 PM cvs: gd /libgd/src gd.c gd.h /libgd/tests CMakeLists.txt Makefile.am /libgd/tests/gdimagecolorreplace .cvsignore CMakeLists.txt Makefile.am gdimagecolorreplace.c11/16/2008 3:25:33 AM cvs: gd(GD_2_0) /libgd/src NEWS gd_gif_out.c /libgd/src/tests/gif CMakeLists.txt Makefile.am bug00181.c11/3/2008 1:33:02 PM cvs: gd /libgd NEWS /libgd/src gd_gif_out.c /libgd/tests/gif CMakeLists.txt Makefile.am bug00181.c11/3/2008 1:24:36 PM cvs: gd(GD_2_0) /libgd/src NEWS10/23/2008 10:04:24 AM cvs: gd(GD_2_0) /libgd/src configure.ac10/22/2008 8:16:38 AM cvs: gd(GD_2_0) /libgd/src NEWS9/28/2008 1:05:29 AM |
cvs: gd /libgd NEWS /libgd/src gd.c gd.h gd_jpeg.c gd_png.c gdhelpers.h /libgd/tests/jpeg CMakeLists.txt Makefile.am jpeg_resolution.c /libgd/tests/png CMakeLists.txt Makefile.am png_resolution.c
|
|||||||||
| Group: php.gd.cvs |
Subscribe
|
Posted:3/8/2009 9:16:04 AM | Replies:0 | Views:6 | Items(0) |
|
--tabe1236503764
Content-Type: text/plain tabe Sun Mar 8 09:16:04 2009 UTC Added files: /gd/libgd/tests/jpeg jpeg_resolution.c /gd/libgd/tests/png png_resolution.c Modified files: /gd/libgd NEWS /gd/libgd/src gd.c gd.h gd_jpeg.c gd_png.c gdhelpers.h /gd/libgd/tests/jpeg CMakeLists.txt Makefile.am /gd/libgd/tests/png CMakeLists.txt Makefile.am Log: ref FS#176: added support of variable resolution by Alan Boudreault. --tabe1236503764 Content-Type: text/plain Content-Disposition: attachment; filename="tabe-20090308091604.txt" http://cvs.php.net/viewvc.cgi/gd/libgd/NEWS?r1=1.5&r2=1.6&diff_format=u Index: gd/libgd/NEWS diff -u gd/libgd/NEWS:1.5 gd/libgd/NEWS:1.6 --- gd/libgd/NEWS:1.5 Sun Dec 21 09:08:11 2008 +++ gd/libgd/NEWS Sun Mar 8 09:16:04 2009 @@ -3,6 +3,7 @@ GD HEAD 169, gdColorMapLookup() answers the RGB values according to given color map (Takeshi Abe) +176, Added support of variable resolution by Alan Boudreault (Takeshi Abe) 184, new filter gdImagePixelate() by Kalle Sommer Nielsen (Takeshi Abe) GD 2.0.36 (2007-11-xx) http://cvs.php.net/viewvc.cgi/gd/libgd/src/gd.c?r1=1.80&r2=1.81&diff_format=u Index: gd/libgd/src/gd.c diff -u gd/libgd/src/gd.c:1.80 gd/libgd/src/gd.c:1.81 --- gd/libgd/src/gd.c:1.80 Sun Jan 18 12:46:38 2009 +++ gd/libgd/src/gd.c Sun Mar 8 09:16:04 2009 @@ -1,4 +1,4 @@ -/* $Id: gd.c,v 1.80 2009/01/18 12:46:38 tabe Exp $ */ +/* $Id: gd.c,v 1.81 2009/03/08 09:16:04 tabe Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -134,6 +134,8 @@ im->cy1 = 0; im->cx2 = im->sx - 1; im->cy2 = im->sy - 1; + im->res_x = GD_RESOLUTION; + im->res_y = GD_RESOLUTION; return im; } @@ -203,6 +205,8 @@ im->cy1 = 0; im->cx2 = im->sx - 1; im->cy2 = im->sy - 1; + im->res_x = GD_RESOLUTION; + im->res_y = GD_RESOLUTION; return im; } @@ -3650,6 +3654,12 @@ *y2P = im->cy2; } +BGD_DECLARE(void) gdImageSetResolution(gdImagePtr im, const unsigned int res_x, const unsigned int res_y) +{ + if (res_x > 0) im->res_x = res_x; + if (res_y > 0) im->res_y = res_y; +} + /* * Added on 2003/12 by Pierre-Alain Joye (pajoye@pearfr.org) * */ http://cvs.php.net/viewvc.cgi/gd/libgd/src/gd.h?r1=1.51&r2=1.52&diff_format=u Index: gd/libgd/src/gd.h diff -u gd/libgd/src/gd.h:1.51 gd/libgd/src/gd.h:1.52 --- gd/libgd/src/gd.h:1.51 Sun Dec 21 09:08:11 2008 +++ gd/libgd/src/gd.h Sun Mar 8 09:16:04 2009 @@ -224,6 +224,10 @@ int cy1; int cx2; int cy2; + + /* 2.1.0: allows to specify resolution in dpi */ + unsigned int res_x; + unsigned int res_y; } gdImage; @@ -376,6 +380,7 @@ int color); BGD_DECLARE(void) gdImageSetClip(gdImagePtr im, int x1, int y1, int x2, int y2); BGD_DECLARE(void) gdImageGetClip(gdImagePtr im, int *x1P, int *y1P, int *x2P, int *y2P); +BGD_DECLARE(void) gdImageSetResolution(gdImagePtr im, const unsigned int res_x, const unsigned int res_y); BGD_DECLARE(int) gdImageBoundsSafe (gdImagePtr im, int x, int y); BGD_DECLARE(void) gdImageChar (gdImagePtr im, gdFontPtr f, int x, int y, int c, int color); @@ -806,6 +811,9 @@ #define gdImagePalettePixel(im, x, y) (im)->pixels[(y)][(x)] #define gdImageTrueColorPixel(im, x, y) (im)->tpixels[(y)][(x)] +#define gdImageResolutionX(im) (im)->res_x +#define gdImageResolutionY(im) (im)->res_y + /* I/O Support routines. */ BGD_DECLARE(gdIOCtx *) gdNewFileCtx (FILE *); @@ -851,8 +859,7 @@ #define GD_CMP_INTERLACE 128 /* Interlaced setting */ #define GD_CMP_TRUECOLOR 256 /* Truecolor vs palette differs */ -/* resolution affects ttf font rendering, particularly hinting */ -#define GD_RESOLUTION 96 /* pixels per inch */ +#define GD_RESOLUTION 96 /* dots per inch */ #ifdef __cplusplus } http://cvs.php.net/viewvc.cgi/gd/libgd/src/gd_jpeg.c?r1=1.24&r2=1.25&diff_format=u Index: gd/libgd/src/gd_jpeg.c diff -u gd/libgd/src/gd_jpeg.c:1.24 gd/libgd/src/gd_jpeg.c:1.25 --- gd/libgd/src/gd_jpeg.c:1.24 Fri May 9 14:09:38 2008 +++ gd/libgd/src/gd_jpeg.c Sun Mar 8 09:16:04 2009 @@ -160,6 +160,10 @@ jpeg_set_defaults(&cinfo); + cinfo.density_unit = 1; + cinfo.X_density = im->res_x; + cinfo.Y_density = im->res_y; + if(quality >= 0) { jpeg_set_quality(&cinfo, quality, TRUE); } @@ -358,6 +362,18 @@ goto error; } + /* check if the resolution is specified */ + switch (cinfo.density_unit) { + case 1: + im->res_x = cinfo.X_density; + im->res_y = cinfo.Y_density; + break; + case 2: + im->res_x = DPCM2DPI(cinfo.X_density); + im->res_y = DPCM2DPI(cinfo.Y_density); + break; + } + /* 2.0.22: very basic support for reading CMYK colorspace files. Nice for * thumbnails but there's no support for fussy adjustment of the * assumed properties of inks and paper. http://cvs.php.net/viewvc.cgi/gd/libgd/src/gd_png.c?r1=1.26&r2=1.27&diff_format=u Index: gd/libgd/src/gd_png.c diff -u gd/libgd/src/gd_png.c:1.26 gd/libgd/src/gd_png.c:1.27 --- gd/libgd/src/gd_png.c:1.26 Sun Nov 18 14:46:45 2007 +++ gd/libgd/src/gd_png.c Sun Mar 8 09:16:04 2009 @@ -1,4 +1,4 @@ -/* $Id: gd_png.c,v 1.26 2007/11/18 14:46:45 pajoye Exp $ */ +/* $Id: gd_png.c,v 1.27 2009/03/08 09:16:04 tabe Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -127,8 +127,8 @@ png_byte sig[8]; png_structp png_ptr; png_infop info_ptr; - png_uint_32 width, height, rowbytes, w, h; - int bit_depth, color_type, interlace_type; + png_uint_32 width, height, rowbytes, w, h, res_x, res_y; + int bit_depth, color_type, interlace_type, unit_type; int num_palette, num_trans; png_colorp palette; png_color_16p trans_gray_rgb; @@ -232,6 +232,18 @@ } #endif + /* check if the resolution is specified */ + if (png_get_valid(png_ptr, info_ptr, PNG_INFO_pHYs)) { + if (png_get_pHYs(png_ptr, info_ptr, &res_x, &res_y, &unit_type)) { + switch (unit_type) { + case PNG_RESOLUTION_METER: + im->res_x = DPM2DPI(res_x); + im->res_y = DPM2DPI(res_y); + break; + } + } + } + switch (color_type) { case PNG_COLOR_TYPE_PALETTE: png_get_PLTE (png_ptr, info_ptr, &palette, &num_palette); @@ -559,6 +571,10 @@ /* 2.0.12: this is finally a parameter */ png_set_compression_level (png_ptr, level); + /* 2.1.0: specify the resolution */ + png_set_pHYs(png_ptr, info_ptr, DPI2DPM(im->res_x), DPI2DPM(im->res_y), + PNG_RESOLUTION_METER); + /* can set this to a smaller value without compromising compression if all * image data is 16K or less; will save some decoder memory [min == 8] */ /* png_set_compression_window_bits(png_ptr, 15); */ http://cvs.php.net/viewvc.cgi/gd/libgd/src/gdhelpers.h?r1=1.8&r2=1.9&diff_format=u Index: gd/libgd/src/gdhelpers.h diff -u gd/libgd/src/gdhelpers.h:1.8 gd/libgd/src/gdhelpers.h:1.9 --- gd/libgd/src/gdhelpers.h:1.8 Mon Apr 30 03:55:11 2007 +++ gd/libgd/src/gdhelpers.h Sun Mar 8 09:16:04 2009 @@ -58,6 +58,11 @@ #endif /* HAVE_PTHREAD */ #endif /* WIN32 */ +#define DPCM2DPI(dpcm) (unsigned int)((dpcm)*2.54 + 0.5) +#define DPM2DPI(dpm) (unsigned int)((dpm)*0.0254 + 0.5) +#define DPI2DPCM(dpi) (unsigned int)((dpi)/2.54 + 0.5) +#define DPI2DPM(dpi) (unsigned int)((dpi)/0.0254 + 0.5) + #endif /* GDHELPERS_H */ #ifdef __cplusplus http://cvs.php.net/viewvc.cgi/gd/libgd/tests/jpeg/CMakeLists.txt?r1=1.5&r2=1.6&diff_format=u Index: gd/libgd/tests/jpeg/CMakeLists.txt diff -u gd/libgd/tests/jpeg/CMakeLists.txt:1.5 gd/libgd/tests/jpeg/CMakeLists.txt:1.6 --- gd/libgd/tests/jpeg/CMakeLists.txt:1.5 Wed Jan 7 15:12:31 2009 +++ gd/libgd/tests/jpeg/CMakeLists.txt Sun Mar 8 09:16:04 2009 @@ -2,6 +2,7 @@ SET(TESTS_FILES jpeg_read jpeg_empty_file + jpeg_resolution ) FOREACH(test_name ${TESTS_FILES}) http://cvs.php.net/viewvc.cgi/gd/libgd/tests/jpeg/Makefile.am?r1=1.1&r2=1.2&diff_format=u Index: gd/libgd/tests/jpeg/Makefile.am diff -u gd/libgd/tests/jpeg/Makefile.am:1.1 gd/libgd/tests/jpeg/Makefile.am:1.2 --- gd/libgd/tests/jpeg/Makefile.am:1.1 Sat May 10 20:19:28 2008 +++ gd/libgd/tests/jpeg/Makefile.am Sun Mar 8 09:16:04 2009 @@ -1,3 +1,3 @@ ## Process this file with automake to produce Makefile.in -*-Makefile-*- -EXTRA_DIST = CMakeLists.txt conv_test_exp.png conv_test.jpeg empty.jpeg jpeg_empty_file.c jpeg_read.c +EXTRA_DIST = CMakeLists.txt conv_test_exp.png conv_test.jpeg empty.jpeg jpeg_empty_file.c jpeg_read.c jpeg_resolution.c http://cvs.php.net/viewvc.cgi/gd/libgd/tests/png/CMakeLists.txt?r1=1.6&r2=1.7&diff_format=u Index: gd/libgd/tests/png/CMakeLists.txt diff -u gd/libgd/tests/png/CMakeLists.txt:1.6 gd/libgd/tests/png/CMakeLists.txt:1.7 --- gd/libgd/tests/png/CMakeLists.txt:1.6 Wed Jan 7 15:12:31 2009 +++ gd/libgd/tests/png/CMakeLists.txt Sun Mar 8 09:16:04 2009 @@ -1,5 +1,6 @@ SET(TESTS_FILES + png_resolution bug00011 bug00033 bug00086 http://cvs.php.net/viewvc.cgi/gd/libgd/tests/png/Makefile.am?r1=1.1&r2=1.2&diff_format=u Index: gd/libgd/tests/png/Makefile.am diff -u gd/libgd/tests/png/Makefile.am:1.1 gd/libgd/tests/png/Makefile.am:1.2 --- gd/libgd/tests/png/Makefile.am:1.1 Sat May 10 20:19:28 2008 +++ gd/libgd/tests/png/Makefile.am Sun Mar 8 09:16:04 2009 @@ -1,3 +1,3 @@ ## Process this file with automake to produce Makefile.in -*-Makefile-*- -EXTRA_DIST = CMakeLists.txt bug00011.c bug00033.png bug00088_1_exp.png bug00088_2_exp.png bug00088.c bug00033.c bug00086.c bug00088_1.png bug00088_2.png emptyfile +EXTRA_DIST = CMakeLists.txt bug00011.c bug00033.png bug00088_1_exp.png bug00088_2_exp.png bug00088.c bug00033.c bug00086.c bug00088_1.png bug00088_2.png emptyfile png_resolution.c http://cvs.php.net/viewvc.cgi/gd/libgd/tests/jpeg/jpeg_resolution.c?view=markup&rev=1.1 Index: gd/libgd/tests/jpeg/jpeg_resolution.c +++ gd/libgd/tests/jpeg/jpeg_resolution.c #include "gd.h" #include <stdio.h> #include <stdlib.h> #include "gdtest.h" int main() { gdImagePtr im; void *data; int size, red; im = gdImageCreate(100, 100); gdImageSetResolution(im, 72, 300); red = gdImageColorAllocate(im, 0xFF, 0x00, 0x00); gdImageFilledRectangle(im, 0, 0, 99, 99, red); data = gdImageJpegPtr(im, &size, 10); gdImageDestroy(im); im = gdImageCreateFromJpegPtr(size, data); gdTestAssert(gdImageResolutionX(im) == 72); gdTestAssert(gdImageResolutionY(im) == 300); gdImageDestroy(im); return 0; } http://cvs.php.net/viewvc.cgi/gd/libgd/tests/png/png_resolution.c?view=markup&rev=1.1 Index: gd/libgd/tests/png/png_resolution.c +++ gd/libgd/tests/png/png_resolution.c #include "gd.h" #include <stdio.h> #include <stdlib.h> #include "gdtest.h" int main() { gdImagePtr im; void *data; int size, red; im = gdImageCreate(100, 100); gdImageSetResolution(im, 72, 300); red = gdImageColorAllocate(im, 0xFF, 0x00, 0x00); gdImageFilledRectangle(im, 0, 0, 99, 99, red); data = gdImagePngPtr(im, &size); gdImageDestroy(im); im = gdImageCreateFromPngPtr(size, data); gdTestAssert(gdImageResolutionX(im) == 72); gdTestAssert(gdImageResolutionY(im) == 300); gdImageDestroy(im); return 0; } --tabe1236503764-- |
t...@php.net ("Takeshi Abe") 3/8/2009 9:16:04 AM |
note 97095 added to soapclient.soapclient
note 97094 added to function.sqlite-changes
note 97093 added to function.sqlite-changes
note 97092 added to ref.xmlrpc
note 97091 added to function.var-export