• R/O
  • SSH

thirdparty-pngdib: Commit

A repository containing pngdib, which is planned to be incorporated into WinDirStat.

Its original home is over at http://entropymine.com/jason/pngdib/


Commit MetaInfo

Révisionfbd43ef031740e822c190c69f4a3fefae60cbfd2 (tree)
l'heure2014-01-18 13:25:27
AuteurOliver Schneider <oliver@assa...>
CommiterOliver Schneider

Message de Log

Version 3.1.0 from ZIP at http://entropymine.com/jason/pngdib/

Change Summary

Modification

diff -r 01ac235d4a64 -r fbd43ef03174 bmp2png/bmp2png.vcproj
--- a/bmp2png/bmp2png.vcproj Sat Jan 18 04:24:47 2014 +0000
+++ b/bmp2png/bmp2png.vcproj Sat Jan 18 04:25:27 2014 +0000
@@ -66,7 +66,7 @@
6666 />
6767 <Tool
6868 Name="VCLinkerTool"
69- AdditionalDependencies="..\..\libpng-1.4.1\Release\libpng.lib ..\..\zlib-1.2.3\Release\zlib.lib ..\$(ConfigurationName)\pngdib.lib"
69+ AdditionalDependencies="..\..\libpng-1.4.3\Release\libpng.lib ..\..\zlib-1.2.5\Release\zlib.lib ..\$(ConfigurationName)\pngdib.lib"
7070 OutputFile="$(OutDir)/bmp2png.exe"
7171 LinkIncremental="1"
7272 SuppressStartupBanner="true"
@@ -146,7 +146,7 @@
146146 />
147147 <Tool
148148 Name="VCLinkerTool"
149- AdditionalDependencies="..\..\libpng-1.4.1\Debug\libpng.lib ..\..\zlib-1.2.3\Debug\zlib.lib ..\$(ConfigurationName)\pngdib.lib"
149+ AdditionalDependencies="..\..\libpng-1.4.3\Debug\libpng.lib ..\..\zlib-1.2.5\Debug\zlib.lib ..\$(ConfigurationName)\pngdib.lib"
150150 OutputFile="$(OutDir)/bmp2png.exe"
151151 LinkIncremental="2"
152152 SuppressStartupBanner="true"
@@ -227,7 +227,7 @@
227227 />
228228 <Tool
229229 Name="VCLinkerTool"
230- AdditionalDependencies="..\..\libpng-1.4.1\Debug\libpng.lib ..\..\zlib-1.2.3\Debug\zlib.lib ..\$(ConfigurationName)\pngdib.lib"
230+ AdditionalDependencies="..\..\libpng-1.4.3\Debug\libpng.lib ..\..\zlib-1.2.5\Debug\zlib.lib ..\$(ConfigurationName)\pngdib.lib"
231231 OutputFile="$(OutDir)/bmp2png.exe"
232232 LinkIncremental="2"
233233 SuppressStartupBanner="true"
@@ -308,7 +308,7 @@
308308 />
309309 <Tool
310310 Name="VCLinkerTool"
311- AdditionalDependencies="..\..\libpng-1.4.1\Release\libpng.lib ..\..\zlib-1.2.3\Release\zlib.lib ..\$(ConfigurationName)\pngdib.lib"
311+ AdditionalDependencies="..\..\libpng-1.4.3\Release\libpng.lib ..\..\zlib-1.2.5\Release\zlib.lib ..\$(ConfigurationName)\pngdib.lib"
312312 OutputFile="$(OutDir)/bmp2png.exe"
313313 LinkIncremental="1"
314314 SuppressStartupBanner="true"
diff -r 01ac235d4a64 -r fbd43ef03174 png2bmp/png2bmp.vcproj
--- a/png2bmp/png2bmp.vcproj Sat Jan 18 04:24:47 2014 +0000
+++ b/png2bmp/png2bmp.vcproj Sat Jan 18 04:25:27 2014 +0000
@@ -64,7 +64,7 @@
6464 />
6565 <Tool
6666 Name="VCLinkerTool"
67- AdditionalDependencies="..\..\libpng-1.4.1\Release\libpng.lib ..\..\zlib-1.2.3\Release\zlib.lib ..\$(ConfigurationName)\pngdib.lib"
67+ AdditionalDependencies="..\..\libpng-1.4.3\Release\libpng.lib ..\..\zlib-1.2.5\Release\zlib.lib ..\$(ConfigurationName)\pngdib.lib"
6868 OutputFile="$(OutDir)/png2bmp.exe"
6969 LinkIncremental="1"
7070 SuppressStartupBanner="true"
@@ -145,7 +145,7 @@
145145 />
146146 <Tool
147147 Name="VCLinkerTool"
148- AdditionalDependencies="..\..\libpng-1.4.1\Debug\libpng.lib ..\..\zlib-1.2.3\Debug\zlib.lib ..\$(ConfigurationName)\pngdib.lib"
148+ AdditionalDependencies="..\..\libpng-1.4.3\Debug\libpng.lib ..\..\zlib-1.2.5\Debug\zlib.lib ..\$(ConfigurationName)\pngdib.lib"
149149 OutputFile="$(OutDir)/png2bmp.exe"
150150 LinkIncremental="2"
151151 SuppressStartupBanner="true"
@@ -226,7 +226,7 @@
226226 />
227227 <Tool
228228 Name="VCLinkerTool"
229- AdditionalDependencies="..\..\libpng-1.4.1\Debug\libpng.lib ..\..\zlib-1.2.3\Debug\zlib.lib ..\$(ConfigurationName)\pngdib.lib"
229+ AdditionalDependencies="..\..\libpng-1.4.3\Debug\libpng.lib ..\..\zlib-1.2.5\Debug\zlib.lib ..\$(ConfigurationName)\pngdib.lib"
230230 OutputFile="$(OutDir)/png2bmp.exe"
231231 LinkIncremental="2"
232232 SuppressStartupBanner="true"
@@ -305,7 +305,7 @@
305305 />
306306 <Tool
307307 Name="VCLinkerTool"
308- AdditionalDependencies="..\..\libpng-1.4.1\Release\libpng.lib ..\..\zlib-1.2.3\Release\zlib.lib ..\$(ConfigurationName)\pngdib.lib"
308+ AdditionalDependencies="..\..\libpng-1.4.3\Release\libpng.lib ..\..\zlib-1.2.5\Release\zlib.lib ..\$(ConfigurationName)\pngdib.lib"
309309 OutputFile="$(OutDir)/png2bmp.exe"
310310 LinkIncremental="1"
311311 SuppressStartupBanner="true"
diff -r 01ac235d4a64 -r fbd43ef03174 pngdib.c
--- a/pngdib.c Sat Jan 18 04:24:47 2014 +0000
+++ b/pngdib.c Sat Jan 18 04:25:27 2014 +0000
@@ -14,33 +14,100 @@
1414
1515 #include <png.h>
1616
17-#define PNGDIB_INTERNALS
1817 #include "pngdib.h"
1918 #include <strsafe.h>
2019
21-#define PNGDIB_SRC_VERSION 30002
22-#define PNGDIB_SRC_VERSION_STRING _T("3.0.2")
20+#define PNGDIB_SRC_VERSION 30100
21+#define PNGDIB_SRC_VERSION_STRING _T("3.1.0")
2322
2423
2524 #if PNGDIB_SRC_VERSION != PNGDIB_HEADER_VERSION
2625 #error Wrong PNGDIB header file version
2726 #endif
2827
29-#if (PNG_LIBPNG_VER<10202) || \
30- (PNG_LIBPNG_VER==10202 && PNG_LIBPNG_BUILD_TYPE<2) || \
31- (PNG_LIBPNG_VER==10202 && PNG_LIBPNG_BUILD_TYPE==2 && PNG_LIBPNG_VER_BUILD<5)
32-#error libpng 1.2.2b5 or higher is recommended
33-/* You can comment out the previous line if you aren't using gamma
34- * correction, or don't care about a few obscure gamma correction
35- * problems that exist in earlier versions of libpng. */
36-#endif
37-
3828
3929 // This is basically a Windows-only utility with a simple-as-possible
4030 // interface, so I'm not too concerned about allowing a
4131 // user-configurable screen gamma.
4232 //static const double screen_gamma = 2.2;
4333
34+
35+#define PNGDIB_ERRMSG_MAX 200
36+
37+#ifndef PNGD_COLOR_STRUCT_DEFINED
38+struct PNGD_COLOR_struct {
39+ unsigned char red, green, blue, reserved;
40+};
41+#endif
42+
43+struct pngdib_common_struct {
44+ int structtype;
45+ void *userdata;
46+ TCHAR *errmsg;
47+ pngdib_malloc_cb_type malloc_function;
48+ pngdib_free_cb_type free_function;
49+ pngdib_realloc_cb_type realloc_function;
50+ pngdib_pngptrhook_cb_type pngptrhook_function;
51+ int dib_alpha32;
52+};
53+
54+#define PNGD_IO_METHOD_FILENAME 0
55+#define PNGD_IO_METHOD_MEMBLK 1
56+#define PNGD_IO_METHOD_CUSTOM 2
57+
58+struct d2p_struct {
59+ struct pngdib_common_struct common;
60+
61+ int output_method; // PNGD_IO_METHOD_*
62+ TCHAR* output_filename;
63+ pngdib_write_cb_type write_cb;
64+
65+ const BITMAPINFOHEADER* pdib;
66+ int dibsize;
67+ const void* pbits;
68+ int bitssize;
69+ int interlaced;
70+ char* software_id_string;
71+ int file_gamma_valid;
72+ double file_gamma;
73+};
74+
75+struct p2d_struct {
76+ struct pngdib_common_struct common;
77+
78+ int input_method; // PNGD_IO_METHOD_*
79+ TCHAR* input_filename;
80+ unsigned char* input_memblk;
81+ int input_memblk_size;
82+ int input_memblk_curpos;
83+ pngdib_read_cb_type read_cb;
84+
85+ int use_file_bg_flag;
86+ int use_custom_bg_flag;
87+ struct PNGD_COLOR_struct bgcolor;
88+ int gamma_correction; // should we gamma correct (using screen_gamma)?
89+ double screen_gamma;
90+
91+ BITMAPINFOHEADER* pdib;
92+ int dibsize;
93+ int palette_offs;
94+ int bits_offs;
95+ int bitssize;
96+ RGBQUAD* palette;
97+ int palette_colors;
98+ void* pbits;
99+ int color_type;
100+ int bits_per_sample;
101+ int bits_per_pixel;
102+ int interlace;
103+ int res_x,res_y;
104+ int res_units;
105+ int res_valid; // are res_x, res_y, res_units valid?
106+ double file_gamma;
107+ int gamma_returned; // set if we know the file gamma
108+ int bgcolor_returned;
109+};
110+
44111 struct errstruct {
45112 jmp_buf *jbufp;
46113 TCHAR *errmsg;
@@ -154,7 +221,7 @@
154221
155222 if(p2d->input_memblk_size>0) {
156223 if((int)length > (p2d->input_memblk_size - p2d->input_memblk_curpos)) {
157- png_error(png_ptr, "read error: unexpected end of file");
224+ png_error(png_ptr, "Read error: Unexpected end of file");
158225 return;
159226 }
160227 }
@@ -163,6 +230,21 @@
163230 p2d->input_memblk_curpos+=length;
164231 }
165232
233+// A callback function used with custom I/O.
234+static void my_png_read_fn_custom(png_structp png_ptr,
235+ png_bytep data, png_size_t length)
236+{
237+ struct p2d_struct *p2d;
238+ int ret;
239+
240+ p2d = (struct p2d_struct*)png_get_io_ptr(png_ptr);
241+ ret = p2d->read_cb(p2d->common.userdata,(void*)data,(int)length);
242+ if(ret < (int)length) {
243+ // This error message is just a guess. It might be nice to
244+ // have a way to get a real error message.
245+ png_error(png_ptr, "Read error: Unexpected end of file");
246+ }
247+}
166248
167249 // This function should perform identically to libpng's gamma correction.
168250 // I'd prefer to have libpng do all gamma correction itself,
@@ -283,7 +365,7 @@
283365 goto abort;
284366 }
285367
286- if(p2d->input_method==0) {
368+ if(p2d->input_method==PNGD_IO_METHOD_FILENAME) {
287369 // reading from a filename
288370 if(!p2d->input_filename) {
289371 StringCchPrintf(p2d->common.errmsg,PNGDIB_ERRMSG_MAX,_T("Input filename not set"));
@@ -296,11 +378,14 @@
296378 }
297379 png_init_io(png_ptr, fp);
298380 }
299- else if(p2d->input_method==1) {
381+ else if(p2d->input_method==PNGD_IO_METHOD_MEMBLK) {
300382 // reading from a memory block
301383 p2d->input_memblk_curpos=0;
302384 png_set_read_fn(png_ptr, (void*)p2d, my_png_read_fn);
303385 }
386+ else if(p2d->input_method==PNGD_IO_METHOD_CUSTOM) {
387+ png_set_read_fn(png_ptr, (void*)p2d, my_png_read_fn_custom);
388+ }
304389 else { goto abort; }
305390
306391 png_read_info(png_ptr, info_ptr);
@@ -645,7 +730,7 @@
645730 png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
646731 png_ptr=NULL;
647732
648- if(p2d->input_method==0) {
733+ if(p2d->input_method==PNGD_IO_METHOD_FILENAME) {
649734 fclose(fp);
650735 fp=NULL;
651736 }
@@ -682,7 +767,7 @@
682767 abort:
683768
684769 if(png_ptr) png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
685- if(p2d->input_method==0 && fp) fclose(fp);
770+ if(p2d->input_method==PNGD_IO_METHOD_FILENAME && fp) fclose(fp);
686771 if(row_pointers) free((void*)row_pointers);
687772 if(lpdib) {
688773 pngdib_p2d_free_dib((PNGDIB*)p2d,NULL);
@@ -723,6 +808,24 @@
723808 }
724809 }
725810
811+static void my_png_write_fn_custom(png_structp png_ptr, png_bytep data, png_size_t length)
812+{
813+ struct d2p_struct *d2p;
814+ int ret;
815+
816+ d2p = (struct d2p_struct*)png_get_io_ptr(png_ptr);
817+ ret = d2p->write_cb(d2p->common.userdata,(void*)data,(int)length);
818+ if(ret < (int)length) {
819+ // This error message is just a guess. It might be nice to
820+ // have a way to get a real error message.
821+ png_error(png_ptr, "Write error");
822+ }
823+}
824+
825+static void my_png_flush_fn_custom(png_structp png_ptr)
826+{
827+}
828+
726829 int PNGDIB_DECL pngdib_d2p_run(PNGDIB *qq)
727830 {
728831 struct d2p_struct *d2p;
@@ -771,7 +874,7 @@
771874
772875 StringCchCopy(d2p->common.errmsg,PNGDIB_ERRMSG_MAX,_T(""));
773876
774- if(!d2p->output_filename) {
877+ if(!d2p->output_filename && d2p->output_method!=PNGD_IO_METHOD_CUSTOM) {
775878 StringCchCopy(d2p->common.errmsg,PNGDIB_ERRMSG_MAX,_T("Output filename not set"));
776879 rv=PNGD_E_ERROR; goto abort;
777880 }
@@ -954,13 +1057,18 @@
9541057 goto abort;
9551058 }
9561059
957- fp= _tfopen(d2p->output_filename,_T("wb"));
958- if(!fp) {
959- rv=PNGD_E_WRITE;
960- goto abort;
1060+ if(d2p->output_method==PNGD_IO_METHOD_FILENAME) {
1061+ fp= _tfopen(d2p->output_filename,_T("wb"));
1062+ if(!fp) {
1063+ rv=PNGD_E_WRITE;
1064+ goto abort;
1065+ }
1066+
1067+ png_init_io(png_ptr, fp);
9611068 }
962-
963- png_init_io(png_ptr, fp);
1069+ else if(d2p->output_method==PNGD_IO_METHOD_CUSTOM) {
1070+ png_set_write_fn(png_ptr, (void*)d2p, my_png_write_fn_custom, my_png_flush_fn_custom);
1071+ }
9641072
9651073 if(dib_alpha32) {
9661074 png_color_type = PNG_COLOR_TYPE_RGB_ALPHA;
@@ -1192,9 +1300,18 @@
11921300 struct d2p_struct *d2p;
11931301 d2p=(struct d2p_struct*)qq;
11941302 d2p->output_filename = _tcsdup(fn);
1303+ d2p->output_method = PNGD_IO_METHOD_FILENAME;
11951304 return (d2p->output_filename)?1:0;
11961305 }
11971306
1307+void PNGDIB_DECL pngdib_d2p_set_png_write_fn(PNGDIB *qq, pngdib_write_cb_type writefunc)
1308+{
1309+ struct d2p_struct *d2p;
1310+ d2p=(struct d2p_struct*)qq;
1311+ d2p->write_cb = writefunc;
1312+ d2p->output_method = PNGD_IO_METHOD_CUSTOM;
1313+}
1314+
11981315 int PNGDIB_DECL pngdib_d2p_set_software_id(PNGDIB *qq, const TCHAR *s)
11991316 {
12001317 struct d2p_struct *d2p;
@@ -1285,7 +1402,7 @@
12851402 struct p2d_struct *p2d;
12861403 p2d=(struct p2d_struct*)qq;
12871404 p2d->input_filename = _tcsdup(fn);
1288- p2d->input_method = 0;
1405+ p2d->input_method = PNGD_IO_METHOD_FILENAME;
12891406 return (p2d->input_filename)?1:0;
12901407 }
12911408
@@ -1294,11 +1411,20 @@
12941411 struct p2d_struct *p2d;
12951412 p2d=(struct p2d_struct*)qq;
12961413 p2d->input_memblk = (unsigned char*)mem;
1297- p2d->input_method = 1;
1414+ p2d->input_method = PNGD_IO_METHOD_MEMBLK;
12981415 if(memsize>=0)
12991416 p2d->input_memblk_size = memsize;
13001417 }
13011418
1419+void PNGDIB_DECL pngdib_p2d_set_png_read_fn(PNGDIB *qq, pngdib_read_cb_type readfunc)
1420+{
1421+ struct p2d_struct *p2d;
1422+ p2d=(struct p2d_struct*)qq;
1423+
1424+ p2d->read_cb = readfunc;
1425+ p2d->input_method = PNGD_IO_METHOD_CUSTOM;
1426+}
1427+
13021428 void PNGDIB_DECL pngdib_p2d_set_use_file_bg(PNGDIB *qq, int flag)
13031429 {
13041430 struct p2d_struct *p2d;
diff -r 01ac235d4a64 -r fbd43ef03174 pngdib.h
--- a/pngdib.h Sat Jan 18 04:24:47 2014 +0000
+++ b/pngdib.h Sat Jan 18 04:25:27 2014 +0000
@@ -20,7 +20,7 @@
2020 #define PNGDIB_V2COMPATIBLE 1
2121 #endif
2222
23-#define PNGDIB_HEADER_VERSION 30002
23+#define PNGDIB_HEADER_VERSION 30100
2424
2525
2626 #define PNGDIB_DEFAULT_SCREEN_GAMMA 2.20000
@@ -45,16 +45,13 @@
4545 #define PNGD_E_READ 8 // couldn't read PNG file
4646 #define PNGD_E_WRITE 9 // couldn't write PNG file
4747
48-#if (PNGDIB_V2COMPATIBLE) || defined(PNGDIB_INTERNALS)
48+
49+#if PNGDIB_V2COMPATIBLE
4950
5051 struct PNGD_COLOR_struct {
5152 unsigned char red, green, blue, reserved;
5253 };
53-
54-#endif
55-
56-
57-#if PNGDIB_V2COMPATIBLE
54+#define PNGD_COLOR_STRUCT_DEFINED
5855
5956 typedef struct PNGD_D2PINFO_struct {
6057 DWORD structsize; // sizeof(PNGD_D2PINFO)
@@ -137,6 +134,10 @@
137134 typedef void* (PNGDIB_DECL *pngdib_realloc_cb_type)(void *userdata, void *memblk, int memblksize);
138135 typedef void (PNGDIB_DECL *pngdib_pngptrhook_cb_type)(void *userdata, void *pngptr);
139136
137+// Return 'nbytes' on success, < nbytes on failure.
138+typedef int (PNGDIB_DECL *pngdib_read_cb_type)(void *userdata, void *buf, int nbytes);
139+typedef int (PNGDIB_DECL *pngdib_write_cb_type)(void *userdata, const void *buf, int nbytes);
140+
140141 struct pngdib_common_struct;
141142 typedef struct pngdib_common_struct PNGDIB;
142143
@@ -144,76 +145,6 @@
144145 #define PNGD_ST_D2P 1
145146 #define PNGD_ST_P2D 2
146147
147-
148-#ifdef PNGDIB_INTERNALS
149-
150-// definitions for internal library use only
151-
152-#define PNGDIB_ERRMSG_MAX 200
153-
154-
155-struct pngdib_common_struct {
156- int structtype;
157- void *userdata;
158- TCHAR *errmsg;
159- pngdib_malloc_cb_type malloc_function;
160- pngdib_free_cb_type free_function;
161- pngdib_realloc_cb_type realloc_function;
162- pngdib_pngptrhook_cb_type pngptrhook_function;
163- int dib_alpha32;
164-};
165-
166-struct d2p_struct {
167- struct pngdib_common_struct common;
168-
169- const BITMAPINFOHEADER* pdib;
170- int dibsize;
171- const void* pbits;
172- int bitssize;
173- int interlaced;
174- TCHAR* output_filename;
175- char* software_id_string;
176- int file_gamma_valid;
177- double file_gamma;
178-};
179-
180-struct p2d_struct {
181- struct pngdib_common_struct common;
182-
183- int input_method; // 0=filename, 1=memory
184- TCHAR* input_filename;
185- unsigned char* input_memblk;
186- int input_memblk_size;
187- int input_memblk_curpos;
188-
189- int use_file_bg_flag;
190- int use_custom_bg_flag;
191- struct PNGD_COLOR_struct bgcolor;
192- int gamma_correction; // should we gamma correct (using screen_gamma)?
193- double screen_gamma;
194-
195- BITMAPINFOHEADER* pdib;
196- int dibsize;
197- int palette_offs;
198- int bits_offs;
199- int bitssize;
200- RGBQUAD* palette;
201- int palette_colors;
202- void* pbits;
203- int color_type;
204- int bits_per_sample;
205- int bits_per_pixel;
206- int interlace;
207- int res_x,res_y;
208- int res_units;
209- int res_valid; // are res_x, res_y, res_units valid?
210- double file_gamma;
211- int gamma_returned; // set if we know the file gamma
212- int bgcolor_returned;
213-};
214-
215-#endif // PNGDIB_INTERNALS
216-
217148 ///////////// d2p functions
218149
219150 #define pngdib_d2p_init() _pngdib_init(PNGD_ST_D2P,PNGDIB_HEADER_VERSION)
@@ -224,6 +155,7 @@
224155
225156 PNGDIB_EXT void PNGDIB_DECL pngdib_d2p_set_interlace(PNGDIB *d2p, int interlaced);
226157 PNGDIB_EXT int PNGDIB_DECL pngdib_d2p_set_png_filename(PNGDIB *d2p, const TCHAR *fn);
158+PNGDIB_EXT void PNGDIB_DECL pngdib_d2p_set_png_write_fn(PNGDIB *d2p, pngdib_write_cb_type writefunc);
227159 PNGDIB_EXT int PNGDIB_DECL pngdib_d2p_set_software_id(PNGDIB *d2p, const TCHAR *s);
228160 PNGDIB_EXT void PNGDIB_DECL pngdib_d2p_set_gamma_label(PNGDIB *d2p, int flag, double file_gamma);
229161
@@ -237,6 +169,7 @@
237169
238170 PNGDIB_EXT int PNGDIB_DECL pngdib_p2d_set_png_filename(PNGDIB *p2d, const TCHAR *fn);
239171 PNGDIB_EXT void PNGDIB_DECL pngdib_p2d_set_png_memblk(PNGDIB *p2d, const void *mem, int memsize);
172+PNGDIB_EXT void PNGDIB_DECL pngdib_p2d_set_png_read_fn(PNGDIB *p2d, pngdib_read_cb_type readfunc);
240173
241174 PNGDIB_EXT void PNGDIB_DECL pngdib_p2d_set_use_file_bg(PNGDIB *p2d, int flag);
242175 PNGDIB_EXT void PNGDIB_DECL pngdib_p2d_set_custom_bg(PNGDIB *p2d, unsigned char r,
diff -r 01ac235d4a64 -r fbd43ef03174 pngdib.vcproj
--- a/pngdib.vcproj Sat Jan 18 04:24:47 2014 +0000
+++ b/pngdib.vcproj Sat Jan 18 04:25:27 2014 +0000
@@ -43,7 +43,7 @@
4343 <Tool
4444 Name="VCCLCompilerTool"
4545 Optimization="2"
46- AdditionalIncludeDirectories="..\libpng-1.4.1,..\zlib-1.2.3"
46+ AdditionalIncludeDirectories="..\libpng-1.4.3,..\zlib-1.2.5"
4747 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
4848 RuntimeLibrary="0"
4949 WarningLevel="3"
@@ -109,7 +109,7 @@
109109 <Tool
110110 Name="VCCLCompilerTool"
111111 Optimization="0"
112- AdditionalIncludeDirectories="..\libpng-1.4.1,..\zlib-1.2.3"
112+ AdditionalIncludeDirectories="..\libpng-1.4.3,..\zlib-1.2.5"
113113 PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
114114 RuntimeLibrary="1"
115115 BrowseInformation="1"
@@ -177,7 +177,7 @@
177177 <Tool
178178 Name="VCCLCompilerTool"
179179 Optimization="0"
180- AdditionalIncludeDirectories="..\libpng-1.4.1,..\zlib-1.2.3"
180+ AdditionalIncludeDirectories="..\libpng-1.4.3,..\zlib-1.2.5"
181181 PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
182182 RuntimeLibrary="1"
183183 BrowseInformation="1"
@@ -245,7 +245,7 @@
245245 <Tool
246246 Name="VCCLCompilerTool"
247247 Optimization="2"
248- AdditionalIncludeDirectories="..\libpng-1.4.1,..\zlib-1.2.3"
248+ AdditionalIncludeDirectories="..\libpng-1.4.3,..\zlib-1.2.5"
249249 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
250250 RuntimeLibrary="0"
251251 WarningLevel="3"
diff -r 01ac235d4a64 -r fbd43ef03174 readme.html
--- a/readme.html Sat Jan 18 04:24:47 2014 +0000
+++ b/readme.html Sat Jan 18 04:25:27 2014 +0000
@@ -23,7 +23,7 @@
2323 <p>
2424 A DIB-PNG conversion library for Win32<br>
2525 By Jason Summers &lt;<a href="mailto:jason1@pobox.com">jason1@pobox.com</a>&gt;<br>
26-Version 3.0.2, Mar. 2010<br>
26+Version 3.1.0, Jul. 2010<br>
2727 Web site: &lt;<a href="http://entropymine.com/jason/pngdib/">http://entropymine.com/jason/pngdib/</a>&gt;
2828 </p>
2929
@@ -254,6 +254,14 @@
254254 1 = write an interlaced image.
255255 <dt>int <b>pngdib_d2p_set_png_filename</b>(PNGDIB *d2p, const TCHAR *fn);
256256 <dd>Pointer to null-terminated filename of the PNG file to write.
257+
258+<dt>void <b>pngdib_d2p_set_png_write_fn</b>(PNGDIB *d2p, pngdib_write_cb_type writefunc);
259+<dd>Use this instead of pngdib_d2p_set_png_filename to use a custom
260+<i>write</i> function. The pngdib_write_cb_type type is defined as:<br>
261+typedef int (PNGDIB_DECL *pngdib_write_cb_type)(void *userdata, const void *buf, int nbytes);<br>
262+Your <i>write</i> function must consume all the bytes supplied to it, and
263+return the number of bytes written ('nbytes').
264+
257265 <dt>int <b>pngdib_d2p_set_software_id</b>(PNGDIB *d2p, const TCHAR *s);
258266 <dd>Pointer to a brief NULL-terminated string
259267 identifying your application. Set to NULL (or don't call this function)
@@ -284,6 +292,14 @@
284292 You can set <i>memsize</i> to 0 if the size isn't known, but this
285293 could lead to buffer overruns if the image isn't a valid PNG file.
286294
295+<dt>void <b>pngdib_p2d_set_png_read_fn</b>(PNGDIB *p2d, pngdib_read_cb_type readfunc);
296+<dd>Use this instead of pngdib_p2d_set_png_filename to use a custom
297+<i>read</i> function. The pngdib_read_cb_type type is defined as:<br>
298+typedef int (PNGDIB_DECL *pngdib_read_cb_type)(void *userdata, void *buf, int nbytes);<br>
299+Your read function must try to fill the buffer with the number of bytes requested,
300+and return the number of bytes written to it. (If not enough bytes are available,
301+this indicates that the PNG file is invalid.)
302+
287303 <dt>void <b>pngdib_p2d_set_use_file_bg</b>(PNGDIB *p2d, int flag);
288304 <dd>Indicates whether the background color stored with the image
289305 should be applied to transparent areas. Set flag to 1 to use
@@ -385,13 +401,10 @@
385401 <p>Some changes I might conceivably make in some future version...
386402
387403 <ul>
388-<li>Internal support for uncompressing compressed DIBs.
389404 <li>Use CreateFile() and related functions instead of fopen(), etc.
390405 <li>The background-color (transparency) and gamma-correction code is too
391406 complicated. This is partly libpng's fault, but with some effort, one
392407 could probably make the PNGDIB code more readable.
393-<li>Implement one or more ways to create a PNG image without writing it
394-to disk.
395408 </ul>
396409
397410 </div>
@@ -402,6 +415,12 @@
402415 <div style="background-color:#ddf">
403416 <h2>History</h2>
404417
418+<h4>CHANGES in PNGDIB v3.1.0</h4>
419+<ul>
420+<li>New pngdib_d2p_set_png_write_fn() and pngdib_p2d_set_png_read_fn() functions
421+for custom I/O.
422+</ul>
423+
405424 <h4>CHANGES in PNGDIB v3.0.2</h4>
406425 <ul>
407426 <li>New pngdib_setcallback_pngptrhook() function.
@@ -457,7 +476,7 @@
457476 images, or parts of images, will look too light or too dark.</p>
458477
459478 <p>Save As PNG - Saves the visible image to a file.
460-IMPORTANT--- This saves the image as it is currently being displayed. The
479+This saves the image as it is currently being displayed. The
461480 saved image will not have any transparency, and the background color and
462481 gamma correction will be applied to the image, not saved as meta-data.
463482 This means that you can lose information by loading and then saving a PNG
@@ -472,13 +491,13 @@
472491 a very light gray color). Otherwise, no background color will be used at
473492 all, and transparency information in the image will be completely ignored.
474493 Some images will not look very good in this situation.
475-(A default background color -- usually white --
494+(A default background color &ndash; usually white &ndash;
476495 will be used for the window, but will not be applied to the
477496 image.)</p>
478497
479498 <p>Any time you make a change to the gamma or background color settings, the
480499 PNG file will be reloaded from disk. That's not the ideal thing to do, but
481-this _is_ just a demo program...</p>
500+this <i>is</i> just a demo program...</p>
482501
483502 </div>
484503
diff -r 01ac235d4a64 -r fbd43ef03174 smview/smview.c
--- a/smview/smview.c Sat Jan 18 04:24:47 2014 +0000
+++ b/smview/smview.c Sat Jan 18 04:25:27 2014 +0000
@@ -19,8 +19,8 @@
1919 #include <strsafe.h>
2020
2121 #define MYNAME _T("Simple PNG Image Viewer")
22-#define SMVIEW_VERS _T("3.0.2")
23-#define SMVIEW_DATE _T("3/2010")
22+#define SMVIEW_VERS _T("3.1.0")
23+#define SMVIEW_DATE _T("7/2010")
2424
2525 struct globals_struct {
2626 HINSTANCE hInst;
diff -r 01ac235d4a64 -r fbd43ef03174 smview/smview.rc
--- a/smview/smview.rc Sat Jan 18 04:24:47 2014 +0000
+++ b/smview/smview.rc Sat Jan 18 04:25:27 2014 +0000
@@ -128,8 +128,8 @@
128128 //
129129
130130 VS_VERSION_INFO VERSIONINFO
131- FILEVERSION 3,0,2,1
132- PRODUCTVERSION 3,0,2,1
131+ FILEVERSION 3,1,0,1
132+ PRODUCTVERSION 3,1,0,1
133133 FILEFLAGSMASK 0x3fL
134134 #ifdef _DEBUG
135135 FILEFLAGS 0x1L
@@ -147,14 +147,14 @@
147147 VALUE "Comments", "\0"
148148 VALUE "CompanyName", "Jason Summers\0"
149149 VALUE "FileDescription", "smview - a sample PNG image viewer\0"
150- VALUE "FileVersion", "3, 0, 2, 1\0"
150+ VALUE "FileVersion", "3, 1, 0, 1\0"
151151 VALUE "InternalName", "smview\0"
152152 VALUE "LegalCopyright", "-\0"
153153 VALUE "LegalTrademarks", "\0"
154154 VALUE "OriginalFilename", "smview.exe\0"
155155 VALUE "PrivateBuild", "\0"
156156 VALUE "ProductName", "smview\0"
157- VALUE "ProductVersion", "3, 0, 2, 1\0"
157+ VALUE "ProductVersion", "3, 1, 0, 1\0"
158158 VALUE "SpecialBuild", "\0"
159159 END
160160 END
diff -r 01ac235d4a64 -r fbd43ef03174 smview/smview.vcproj
--- a/smview/smview.vcproj Sat Jan 18 04:24:47 2014 +0000
+++ b/smview/smview.vcproj Sat Jan 18 04:25:27 2014 +0000
@@ -69,7 +69,7 @@
6969 />
7070 <Tool
7171 Name="VCLinkerTool"
72- AdditionalDependencies="..\..\libpng-1.4.1\Release\libpng.lib ..\..\zlib-1.2.3\Release\zlib.lib ..\$(ConfigurationName)\pngdib.lib"
72+ AdditionalDependencies="..\..\libpng-1.4.3\Release\libpng.lib ..\..\zlib-1.2.5\Release\zlib.lib ..\$(ConfigurationName)\pngdib.lib"
7373 OutputFile="$(OutDir)/smview.exe"
7474 LinkIncremental="1"
7575 SuppressStartupBanner="true"
@@ -154,7 +154,7 @@
154154 />
155155 <Tool
156156 Name="VCLinkerTool"
157- AdditionalDependencies="..\..\libpng-1.4.1\Debug\libpng.lib ..\..\zlib-1.2.3\Debug\zlib.lib ..\$(ConfigurationName)\pngdib.lib"
157+ AdditionalDependencies="..\..\libpng-1.4.3\Debug\libpng.lib ..\..\zlib-1.2.5\Debug\zlib.lib ..\$(ConfigurationName)\pngdib.lib"
158158 OutputFile="$(OutDir)/smview.exe"
159159 LinkIncremental="2"
160160 SuppressStartupBanner="true"
@@ -240,7 +240,7 @@
240240 />
241241 <Tool
242242 Name="VCLinkerTool"
243- AdditionalDependencies="..\..\libpng-1.4.1\Debug\libpng.lib ..\..\zlib-1.2.3\Debug\zlib.lib ..\$(ConfigurationName)\pngdib.lib"
243+ AdditionalDependencies="..\..\libpng-1.4.3\Debug\libpng.lib ..\..\zlib-1.2.5\Debug\zlib.lib ..\$(ConfigurationName)\pngdib.lib"
244244 OutputFile="$(OutDir)/smview.exe"
245245 LinkIncremental="2"
246246 SuppressStartupBanner="true"
@@ -324,7 +324,7 @@
324324 />
325325 <Tool
326326 Name="VCLinkerTool"
327- AdditionalDependencies="..\..\libpng-1.4.1\Release\libpng.lib ..\..\zlib-1.2.3\Release\zlib.lib ..\$(ConfigurationName)\pngdib.lib"
327+ AdditionalDependencies="..\..\libpng-1.4.3\Release\libpng.lib ..\..\zlib-1.2.5\Release\zlib.lib ..\$(ConfigurationName)\pngdib.lib"
328328 OutputFile="$(OutDir)/smview.exe"
329329 LinkIncremental="1"
330330 SuppressStartupBanner="true"
Afficher sur ancien navigateur de dépôt.