* updated kmousetool (21.12.1 -> 21.12.2), untested
[t2-trunk.git] / package / x11 / xv / xv.patch
blob221e5ac0d1787145760293e2f2f7996be7d29f88
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
3 #
4 # T2 SDE: package/.../xv/xv.patch
5 # Copyright (C) 2004 - 2005 The T2 SDE Project
6 # Copyright (C) 1998 - 2003 ROCK Linux Project
7 #
8 # More information can be found in the files COPYING and README.
9 #
10 # This patch file is dual-licensed. It is available under the license the
11 # patched project is licensed under, as long as it is an OpenSource license
12 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
13 # of the GNU General Public License as published by the Free Software
14 # Foundation; either version 2 of the License, or (at your option) any later
15 # version.
16 # --- T2-COPYRIGHT-NOTE-END ---
18 diff -uNr Makefile Makefile
19 --- ./Makefile Mon Jan 23 21:20:54 1995
20 +++ ./Makefile Tue Feb 20 17:48:33 2001
21 @@ -28,10 +28,10 @@
24 ### Installation locations
25 -BINDIR = /usr/local/bin
26 -MANDIR = /usr/local/man/man1
27 +BINDIR = /usr/bin
28 +MANDIR = /usr/man/man1
29 MANSUF = 1
30 -LIBDIR = /usr/local/lib
31 +LIBDIR = /usr/lib
34 buildit: all
35 @@ -45,26 +45,31 @@
36 ### if, for whatever reason, you're unable to get the JPEG library to compile
37 ### on your machine, *COMMENT OUT* the following lines
38 ###
39 -JPEG = -DDOJPEG
40 -JPEGDIR = jpeg
41 -JPEGINC = -I$(JPEGDIR)
42 -JPEGLIB = $(JPEGDIR)/libjpeg.a
43 -$(JPEGDIR)/jconfig.h:
44 - cd $(JPEGDIR) ; ./configure CC='$(CC)'
45 -$(JPEGLIB): $(JPEGDIR)/jconfig.h
46 - cd $(JPEGDIR) ; make
47 +JPEG = -DDOJPEG
48 +JPEGLIB = -ljpeg
51 +###
52 +### if, for whatever reason, you're unable to get the PNG library to compile
53 +### on your machine, *COMMENT OUT* the following lines
54 +###
55 +PNG = -DDOPNG
56 +PNGLIB = -lpng
59 +###
60 +### if, for whatever reason, you're unable to get the PNG library to compile
61 +### on your machine, *COMMENT OUT* the following lines
62 +###
63 +ZLIBLIB = -lz
66 ###
67 ### if, for whatever reason, you're unable to get the TIFF library to compile
68 ### on your machine, *COMMENT OUT* the following lines
69 ###
70 -TIFF = -DDOTIFF
71 -TIFFDIR = tiff
72 -TIFFINC = -I$(TIFFDIR)
73 -TIFFLIB = $(TIFFDIR)/libtiff.a
74 -$(TIFFLIB):
75 - ( cd $(TIFFDIR) ; make CC='$(CC)' )
76 +TIFF = -DDOTIFF
77 +TIFFLIB = -ltiff
80 ###
81 @@ -184,11 +189,11 @@
85 -CFLAGS = $(CCOPTS) $(JPEG) $(JPEGINC) $(TIFF) $(TIFFINC) $(PDS) \
86 +CFLAGS = $(CCOPTS) $(JPEG) $(TIFF) $(PDS) \
87 $(NODIRENT) $(VPRINTF) $(TIMERS) $(UNIX) $(BSDTYPES) $(RAND) \
88 - $(DXWM) $(MCHN)
89 + $(DXWM) $(MCHN) $(PNG)
91 -LIBS = -lX11 $(JPEGLIB) $(TIFFLIB) -lm
92 +LIBS = -lX11 -L/usr/X11/lib $(JPEGLIB) $(TIFFLIB) $(PNGLIB) $(ZLIBLIB) -lm
94 OBJS = xv.o xvevent.o xvroot.o xvmisc.o xvimage.o xvcolor.o xvsmooth.o \
95 xv24to8.o xvgif.o xvpm.o xvinfo.o xvctrl.o xvscrl.o xvalg.o \
96 @@ -196,7 +201,7 @@
97 xvdial.o xvgraf.o xvsunras.o xvjpeg.o xvps.o xvpopup.o xvdflt.o \
98 xvtiff.o xvtiffwr.o xvpds.o xvrle.o xviris.o xvgrab.o vprintf.o \
99 xvbrowse.o xvtext.o xvpcx.o xviff.o xvtarga.o xvxpm.o xvcut.o \
100 - xvxwd.o xvfits.o
101 + xvxwd.o xvfits.o xvpng.o
103 MISC = README INSTALL CHANGELOG IDEAS
105 @@ -206,10 +211,10 @@
109 -all: $(JPEGLIB) $(TIFFLIB) xv bggen vdcomp xcmap xvpictoppm
110 +all: xv bggen vdcomp xcmap xvpictoppm
113 -xv: $(OBJS) $(JPEGLIB) $(TIFFLIB)
114 +xv: $(OBJS)
115 $(CC) -o xv $(CFLAGS) $(OBJS) $(LIBS)
117 bggen: bggen.c
118 @@ -267,7 +272,7 @@
119 xvbrowse.o: bits/br_pcx bits/br_jfif bits/br_tiff bits/br_pds
120 xvbrowse.o: bits/br_ps bits/br_iff bits/br_targa bits/br_xpm
121 xvbrowse.o: bits/br_trash bits/fcurs bits/fccurs bits/fdcurs bits/fcursm
122 -xvbrowse.o: bits/br_xwd
123 +xvbrowse.o: bits/br_xwd bits/br_png
125 xvbutt.o: bits/cboard50 bits/rb_frame bits/rb_frame1 bits/rb_top
126 xvbutt.o: bits/rb_bot bits/rb_dtop bits/rb_dbot bits/rb_body
127 diff -uNr Makefile.std Makefile.std
128 --- ./Makefile.std Tue Jan 24 02:06:26 1995
129 +++ ./Makefile.std Tue Feb 20 17:04:44 2001
130 @@ -56,6 +56,25 @@
134 +### if, for whatever reason, you're unable to get the PNG library to compile
135 +### on your machine, *COMMENT OUT* the following lines
136 +###
137 +PNG = -DDOPNG
138 +PNGDIR = /usr/local/src/libpng
139 +PNGINC = -I$(PNGDIR)
140 +PNGLIB = -L$(PNGDIR) -lpng
143 +###
144 +### if, for whatever reason, you're unable to get the PNG library to compile
145 +### on your machine, *COMMENT OUT* the following lines
146 +###
147 +ZLIBDIR = /usr/local/src/zlib
148 +ZLIBINC = -I$(ZLIBDIR)
149 +ZLIBLIB = -L$(ZLIBDIR) -lz
152 +###
153 ### if, for whatever reason, you're unable to get the TIFF library to compile
154 ### on your machine, *COMMENT OUT* the following lines
156 @@ -186,9 +205,9 @@
158 CFLAGS = $(CCOPTS) $(JPEG) $(JPEGINC) $(TIFF) $(TIFFINC) $(PDS) \
159 $(NODIRENT) $(VPRINTF) $(TIMERS) $(UNIX) $(BSDTYPES) $(RAND) \
160 - $(DXWM) $(MCHN)
161 + $(DXWM) $(MCHN) $(PNG) $(PNGINC) $(ZLIBINC)
163 -LIBS = -lX11 $(JPEGLIB) $(TIFFLIB) -lm
164 +LIBS = -lX11 $(JPEGLIB) $(TIFFLIB) $(PNGLIB) $(ZLIBLIB) -lm
166 OBJS = xv.o xvevent.o xvroot.o xvmisc.o xvimage.o xvcolor.o xvsmooth.o \
167 xv24to8.o xvgif.o xvpm.o xvinfo.o xvctrl.o xvscrl.o xvalg.o \
168 @@ -196,7 +215,7 @@
169 xvdial.o xvgraf.o xvsunras.o xvjpeg.o xvps.o xvpopup.o xvdflt.o \
170 xvtiff.o xvtiffwr.o xvpds.o xvrle.o xviris.o xvgrab.o vprintf.o \
171 xvbrowse.o xvtext.o xvpcx.o xviff.o xvtarga.o xvxpm.o xvcut.o \
172 - xvxwd.o xvfits.o
173 + xvxwd.o xvfits.o xvpng.o
175 MISC = README INSTALL CHANGELOG IDEAS
177 @@ -267,7 +286,7 @@
178 xvbrowse.o: bits/br_pcx bits/br_jfif bits/br_tiff bits/br_pds
179 xvbrowse.o: bits/br_ps bits/br_iff bits/br_targa bits/br_xpm
180 xvbrowse.o: bits/br_trash bits/fcurs bits/fccurs bits/fdcurs bits/fcursm
181 -xvbrowse.o: bits/br_xwd
182 +xvbrowse.o: bits/br_xwd bits/br_png
184 xvbutt.o: bits/cboard50 bits/rb_frame bits/rb_frame1 bits/rb_top
185 xvbutt.o: bits/rb_bot bits/rb_dtop bits/rb_dbot bits/rb_body
186 diff -uNr bits/br_png bits/br_png
187 --- ./bits/br_png Thu Jan 1 01:00:00 1970
188 +++ ./bits/br_png Thu Jun 13 23:32:08 1996
189 @@ -0,0 +1,28 @@
190 +#define br_png_width 48
191 +#define br_png_height 48
192 +static unsigned char br_png_bits[] = {
193 + 0xe0, 0xff, 0xff, 0xff, 0x01, 0x00, 0x20, 0x00, 0x00, 0x00, 0x03, 0x00,
194 + 0x20, 0x00, 0x00, 0x00, 0x05, 0x00, 0x20, 0x00, 0x00, 0x00, 0x09, 0x00,
195 + 0x20, 0x00, 0x00, 0x00, 0x11, 0x00, 0x20, 0x00, 0x00, 0x00, 0x21, 0x00,
196 + 0x20, 0x00, 0x00, 0x00, 0x41, 0x00, 0x20, 0x00, 0x00, 0x00, 0x81, 0x00,
197 + 0x20, 0x00, 0x00, 0x00, 0x01, 0x01, 0x20, 0x00, 0x00, 0x00, 0xff, 0x03,
198 + 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
199 + 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0xff, 0xff, 0xff, 0x3f, 0x02,
200 + 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0xff, 0xff, 0xff, 0x3f, 0x02,
201 + 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
202 + 0x20, 0xf8, 0x19, 0xc3, 0x07, 0x02, 0x20, 0x18, 0x3b, 0x63, 0x0c, 0x02,
203 + 0x20, 0x18, 0x3b, 0x33, 0x00, 0x02, 0x20, 0x18, 0x5b, 0x33, 0x00, 0x02,
204 + 0x20, 0xf8, 0x59, 0x33, 0x0f, 0x02, 0x20, 0x18, 0x98, 0x33, 0x0c, 0x02,
205 + 0x20, 0x18, 0x98, 0x33, 0x0c, 0x02, 0x20, 0x18, 0x18, 0x63, 0x0c, 0x02,
206 + 0x20, 0x18, 0x18, 0xc3, 0x0b, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
207 + 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
208 + 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0xff, 0xff, 0xff, 0x3f, 0x02,
209 + 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0xff, 0xff, 0xff, 0x3f, 0x02,
210 + 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
211 + 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
212 + 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
213 + 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
214 + 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
215 + 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02,
216 + 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x03,
217 + };
218 diff -uNr config.h config.h
219 --- ./config.h Thu Jan 5 19:49:21 1995
220 +++ ./config.h Tue Feb 20 17:07:25 2001
221 @@ -13,13 +13,13 @@
222 * definition appropriately. (use 'which gunzip' to find if you have gunzip,
223 * and where it lives)
225 -#undef USE_GUNZIP
226 +#define USE_GUNZIP
228 #ifdef USE_GUNZIP
229 # ifdef VMS
230 # define GUNZIP "UNCOMPRESS"
231 # else
232 -# define GUNZIP "/usr/local/bin/gunzip -q"
233 +# define GUNZIP "/bin/gunzip -q"
234 # endif
235 #endif
237 @@ -88,9 +88,9 @@
238 * should not need to be changed
241 -/* #define GS_PATH "/usr/local/bin/gs" */
242 -/* #define GS_LIB "." */
243 -/* #define GS_DEV "ppmraw" */
244 +#define GS_PATH "/usr/bin/gs"
245 +#define GS_LIB "."
246 +#define GS_DEV "ppmraw"
249 /***************************************************************************
250 diff -uNr xcmap.c xcmap.c
251 --- ./xcmap.c Tue Jan 3 22:14:52 1995
252 +++ ./xcmap.c Tue Feb 20 17:04:13 2001
253 @@ -140,8 +140,13 @@
254 nxcells = nycells = 8;
255 else if (dispcells>4)
256 nxcells = nycells = 4;
257 - else
258 + else if (dispcells>2)
259 nxcells = nycells = 2;
260 + else
262 + nxcells = 2;
263 + nycells = 1;
266 /**************** Create/Open X Resources ***************/
267 if ((mfinfo = XLoadQueryFont(theDisp,FONT))==NULL) {
268 @@ -267,18 +272,25 @@
270 x=y=w=h=1;
271 i=XParseGeometry(geom,&x,&y,&w,&h);
272 - if (i&WidthValue) WIDE = (int) w;
273 - if (i&HeightValue) HIGH = (int) h;
275 - if (i&XValue || i&YValue) hints.flags = USPosition;
276 - else hints.flags = PPosition;
278 - hints.flags |= USSize;
280 - if (i&XValue && i&XNegative)
281 - x = XDisplayWidth(theDisp,theScreen)-WIDE-abs(x);
282 - if (i&YValue && i&YNegative)
283 - y = XDisplayHeight(theDisp,theScreen)-HIGH-abs(y);
284 + if (i&WidthValue)
286 + WIDE = (int) w;
287 + hints.flags |= USSize;
289 + if (i&HeightValue)
291 + HIGH = (int) h;
292 + hints.flags |= USSize;
295 + if (i&XValue || i&YValue)
297 + if (i&XNegative)
298 + x = XDisplayWidth(theDisp,theScreen)-WIDE-abs(x);
299 + if (i&YNegative)
300 + y = XDisplayHeight(theDisp,theScreen)-HIGH-abs(y);
301 + hints.flags |= USPosition;
304 hints.x=x; hints.y=y;
305 hints.width = WIDE; hints.height = HIGH;
306 diff -uNr xv.c xv.c
307 --- ./xv.c Thu Jan 19 19:08:43 1995
308 +++ ./xv.c Tue Feb 20 17:04:44 2001
309 @@ -277,6 +277,10 @@
310 tiffW = (Window) NULL; tiffUp = 0;
311 #endif
313 +#ifdef HAVE_PNG
314 + pngW = (Window) NULL; pngUp = 0;
315 +#endif
317 imap = ctrlmap = gmap = browmap = cmtmap = 0;
319 ch_offx = ch_offy = p_offx = p_offy = 0;
320 @@ -782,6 +786,10 @@
321 XSetTransientForHint(theDisp, tiffW, dirW);
322 #endif
324 +#ifdef HAVE_PNG
325 + CreatePNGW();
326 + XSetTransientForHint(theDisp, pngW, dirW);
327 +#endif
329 LoadFishCursors();
330 SetCursors(-1);
331 @@ -2611,6 +2619,11 @@
332 (magicno[0]=='I' && magicno[1]=='I')) rv = RFT_TIFF;
333 #endif
335 +#ifdef HAVE_PNG
336 + else if (magicno[0]==0x89 && magicno[1]=='P' &&
337 + magicno[2]=='N' && magicno[3]=='G') rv = RFT_PNG;
338 +#endif
340 #ifdef HAVE_PDS
341 else if (strncmp((char *) magicno, "NJPL1I00", (size_t) 8)==0 ||
342 strncmp((char *) magicno+2,"NJPL1I", (size_t) 6)==0 ||
343 @@ -2669,6 +2682,10 @@
345 #ifdef HAVE_TIFF
346 case RFT_TIFF: rv = LoadTIFF (fname, pinfo); break;
347 +#endif
349 +#ifdef HAVE_PNG
350 + case RFT_PNG: rv = LoadPNG (fname, pinfo); break;
351 #endif
353 #ifdef HAVE_PDS
354 diff -uNr xv.h xv.h
355 --- ./xv.h Mon Jan 23 21:22:23 1995
356 +++ ./xv.h Tue Feb 20 17:10:11 2001
357 @@ -8,8 +8,8 @@
358 #include "config.h"
361 -#define REVDATE "Version 3.10a Rev: 12/29/94"
362 -#define VERSTR "3.10a"
363 +#define REVDATE "Version 3.10a Rev: 12/29/94 (PNG patch 1.2)"
364 +#define VERSTR "3.10a(PNG)"
367 * uncomment the following, and modify for your site, but only if you've
368 @@ -116,7 +116,7 @@
369 # include <errno.h>
370 extern int errno; /* SHOULD be in errno.h, but often isn't */
371 # ifndef __NetBSD__
372 - extern char *sys_errlist[]; /* this too... */
373 +// extern char *sys_errlist[]; /* this too... */
374 # endif
375 #endif
377 @@ -327,6 +327,10 @@
378 #define HAVE_TIFF
379 #endif
381 +#ifdef DOPNG
382 +#define HAVE_PNG
383 +#endif
385 #ifdef DOPDS
386 #define HAVE_PDS
387 #endif
388 @@ -458,24 +462,31 @@
389 #define F_TIFINC 0
390 #endif
392 +#ifdef HAVE_PNG
393 +#define F_PNGINC 1
394 +#else
395 +#define F_PNGINC 0
396 +#endif
399 #define F_GIF 0
400 #define F_JPEG ( 0 + F_JPGINC)
401 #define F_TIFF ( 0 + F_JPGINC + F_TIFINC)
402 -#define F_PS ( 1 + F_JPGINC + F_TIFINC)
403 -#define F_PBMRAW ( 2 + F_JPGINC + F_TIFINC)
404 -#define F_PBMASCII ( 3 + F_JPGINC + F_TIFINC)
405 -#define F_XBM ( 4 + F_JPGINC + F_TIFINC)
406 -#define F_XPM ( 5 + F_JPGINC + F_TIFINC)
407 -#define F_BMP ( 6 + F_JPGINC + F_TIFINC)
408 -#define F_SUNRAS ( 7 + F_JPGINC + F_TIFINC)
409 -#define F_IRIS ( 8 + F_JPGINC + F_TIFINC)
410 -#define F_TARGA ( 9 + F_JPGINC + F_TIFINC)
411 -#define F_FITS (10 + F_JPGINC + F_TIFINC)
412 -#define F_PM (11 + F_JPGINC + F_TIFINC)
413 -#define F_DELIM1 (12 + F_JPGINC + F_TIFINC) /* ----- */
414 -#define F_FILELIST (13 + F_JPGINC + F_TIFINC)
415 -#define F_MAXFMTS (14 + F_JPGINC + F_TIFINC) /* 15, normally */
416 +#define F_PNG ( 0 + F_JPGINC + F_TIFINC + F_PNGINC)
417 +#define F_PS ( 1 + F_JPGINC + F_TIFINC + F_PNGINC)
418 +#define F_PBMRAW ( 2 + F_JPGINC + F_TIFINC + F_PNGINC)
419 +#define F_PBMASCII ( 3 + F_JPGINC + F_TIFINC + F_PNGINC)
420 +#define F_XBM ( 4 + F_JPGINC + F_TIFINC + F_PNGINC)
421 +#define F_XPM ( 5 + F_JPGINC + F_TIFINC + F_PNGINC)
422 +#define F_BMP ( 6 + F_JPGINC + F_TIFINC + F_PNGINC)
423 +#define F_SUNRAS ( 7 + F_JPGINC + F_TIFINC + F_PNGINC)
424 +#define F_IRIS ( 8 + F_JPGINC + F_TIFINC + F_PNGINC)
425 +#define F_TARGA ( 9 + F_JPGINC + F_TIFINC + F_PNGINC)
426 +#define F_FITS (10 + F_JPGINC + F_TIFINC + F_PNGINC)
427 +#define F_PM (11 + F_JPGINC + F_TIFINC + F_PNGINC)
428 +#define F_DELIM1 (12 + F_JPGINC + F_TIFINC + F_PNGINC) /* ----- */
429 +#define F_FILELIST (13 + F_JPGINC + F_TIFINC + F_PNGINC)
430 +#define F_MAXFMTS (14 + F_JPGINC + F_TIFINC + F_PNGINC) /* 17, normally */
434 @@ -505,6 +516,7 @@
435 #define RFT_XPM 17
436 #define RFT_XWD 18
437 #define RFT_FITS 19
438 +#define RFT_PNG 20
440 /* definitions for page up/down, arrow up/down list control */
441 #define LS_PAGEUP 0
442 @@ -765,9 +777,10 @@
443 typedef struct { Window win; /* window ID */
444 int x,y,w,h; /* window coords in parent */
445 int active; /* true if can do anything*/
446 - int min,max; /* min/max values 'pos' can take */
447 - int val; /* 'value' of dial */
448 - int page; /* amt val change on pageup/pagedown */
449 + double min,max; /* min/max values 'pos' can take */
450 + double val; /* 'value' of dial */
451 + double inc; /* amt val change on up/down */
452 + double page; /* amt val change on pageup/pagedown */
453 char *title; /* title for this guage */
454 char *units; /* string appended to value */
455 u_long fg,bg,hi,lo; /* colors */
456 @@ -1154,6 +1167,13 @@
457 #endif
460 +#ifdef HAVE_PNG
461 +/* stuff used for 'png' box */
462 +WHERE Window pngW;
463 +WHERE int pngUp; /* is pngW mapped, or what? */
464 +#endif
467 #undef WHERE
470 @@ -1465,12 +1485,12 @@
473 /*************************** XVDIAL.C ***************************/
474 -void DCreate PARM((DIAL *, Window, int, int, int, int, int,
475 - int, int, int, u_long, u_long, u_long,
476 - u_long, char *, char *));
477 +void DCreate PARM((DIAL *, Window, int, int, int, int, double,
478 + double, double, double, double, u_long,
479 + u_long, u_long, u_long, char *, char *));
481 -void DSetRange PARM((DIAL *, int, int, int, int));
482 -void DSetVal PARM((DIAL *, int));
483 +void DSetRange PARM((DIAL *, double,double,double,double,double));
484 +void DSetVal PARM((DIAL *, double));
485 void DSetActive PARM((DIAL *, int));
486 void DRedraw PARM((DIAL *));
487 int DTrack PARM((DIAL *, int, int));
488 @@ -1612,6 +1632,13 @@
489 void TIFFDialog PARM((int));
490 int TIFFCheckEvent PARM((XEvent *));
491 void TIFFSaveParams PARM((char *, int));
493 +/**************************** XVPNG.C ***************************/
494 +int LoadPNG PARM((char *, PICINFO *));
495 +void CreatePNGW PARM((void));
496 +void PNGDialog PARM((int));
497 +int PNGCheckEvent PARM((XEvent *));
498 +void PNGSaveParams PARM((char *, int));
500 /**************************** XVPDS.C ***************************/
501 int LoadPDS PARM((char *, PICINFO *));
502 diff -uNr xvbrowse.c xvbrowse.c
503 --- ./xvbrowse.c Thu Jan 19 18:49:17 1995
504 +++ ./xvbrowse.c Tue Feb 20 17:04:44 2001
505 @@ -55,6 +55,7 @@
506 #include "bits/br_xpm"
507 #include "bits/br_xwd"
508 #include "bits/br_fits"
509 +#include "bits/br_png"
511 #include "bits/br_trash"
512 #include "bits/fcurs"
513 @@ -94,7 +95,8 @@
514 #define BF_XPM 25
515 #define BF_XWD 26
516 #define BF_FITS 27
517 -#define BF_MAX 28 /* # of built-in icons */
518 +#define BF_PNG 28
519 +#define BF_MAX 29 /* # of built-in icons */
521 #define ISLOADABLE(ftyp) (ftyp!=BF_DIR && ftyp!=BF_CHR && ftyp!=BF_BLK && \
522 ftyp!=BF_SOCK && ftyp!=BF_FIFO)
523 @@ -524,6 +526,7 @@
524 bfIcons[BF_XPM] =MakePix1(br->win,br_xpm_bits, br_xpm_width, br_xpm_height);
525 bfIcons[BF_XWD] =MakePix1(br->win,br_xwd_bits, br_xwd_width, br_xwd_height);
526 bfIcons[BF_FITS]=MakePix1(br->win,br_fits_bits,br_fits_width,br_fits_height);
527 + bfIcons[BF_PNG]=MakePix1(br->win,br_png_bits,br_png_width,br_png_height);
530 /* check that they all got built */
531 @@ -3020,6 +3023,7 @@
532 case RFT_XPM: bf->ftype = BF_XPM; break;
533 case RFT_XWD: bf->ftype = BF_XWD; break;
534 case RFT_FITS: bf->ftype = BF_FITS; break;
535 + case RFT_PNG: bf->ftype = BF_PNG; break;
539 @@ -3567,6 +3571,7 @@
540 case RFT_XPM: strcat(str,"XPM file"); break;
541 case RFT_XWD: strcat(str,"XWD file"); break;
542 case RFT_FITS: strcat(str,"FITS file"); break;
543 + case RFT_PNG: strcat(str,"PNG file"); break;
544 default: strcat(str,"file of unknown type"); break;
547 diff -uNr xvdial.c xvdial.c
548 --- ./xvdial.c Tue Jan 3 22:20:31 1995
549 +++ ./xvdial.c Tue Feb 20 17:04:44 2001
550 @@ -41,20 +41,21 @@
553 /* local functions */
554 -static int whereInDial PARM((DIAL *, int, int));
555 -static void drawArrow PARM((DIAL *));
556 -static void drawValStr PARM((DIAL *));
557 -static void drawButt PARM((DIAL *, int, int));
558 -static int computeDialVal PARM((DIAL *, int, int));
559 -static void dimDial PARM((DIAL *));
560 +static int whereInDial PARM((DIAL *, int, int));
561 +static void drawArrow PARM((DIAL *));
562 +static void drawValStr PARM((DIAL *));
563 +static void drawButt PARM((DIAL *, int, int));
564 +static double computeDialVal PARM((DIAL *, int, int));
565 +static void dimDial PARM((DIAL *));
568 /***************************************************/
569 -void DCreate(dp, parent, x, y, w, h, minv, maxv, curv, page,
570 +void DCreate(dp, parent, x, y, w, h, minv, maxv, curv, inc, page,
571 fg, bg, hi, lo, title, units)
572 DIAL *dp;
573 Window parent;
574 -int x,y,w,h,minv,maxv,curv,page;
575 +int x,y,w,h;
576 +double minv,maxv,curv,inc,page;
577 unsigned long fg,bg,hi,lo;
578 char *title, *units;
580 @@ -98,18 +99,18 @@
581 1,fg,bg);
582 if (!dp->win) FatalError("can't create dial window");
584 - DSetRange(dp, minv, maxv, curv, page);
585 + DSetRange(dp, minv, maxv, curv, inc, page);
586 XSelectInput(theDisp, dp->win, ExposureMask | ButtonPressMask);
590 /***************************************************/
591 -void DSetRange(dp, minv, maxv, curv, page)
592 -DIAL *dp;
593 -int minv, maxv, curv, page;
594 +void DSetRange(dp, minv, maxv, curv, inc, page)
595 +DIAL *dp;
596 +double minv, maxv, curv, inc, page;
598 if (maxv<minv) maxv=minv;
599 - dp->min = minv; dp->max = maxv; dp->page = page;
600 + dp->min = minv; dp->max = maxv; dp->inc = inc; dp->page = page;
601 dp->active = (minv < maxv);
603 DSetVal(dp, curv);
604 @@ -118,8 +119,8 @@
606 /***************************************************/
607 void DSetVal(dp, curv)
608 -DIAL *dp;
609 -int curv;
610 +DIAL *dp;
611 +double curv;
613 RANGE(curv, dp->min, dp->max); /* make sure curv is in-range */
615 @@ -129,7 +130,7 @@
616 XSetForeground(theDisp, theGC, dp->bg);
617 drawArrow(dp);
619 - dp->val = curv;
620 + dp->val = (double)((int)(curv / dp->inc + (curv > 0 ? 0.5 : -0.5))) * dp->inc;
622 /* draw new arrow and string */
623 XSetForeground(theDisp, theGC, dp->fg);
624 @@ -202,7 +203,8 @@
625 int mx,my;
627 Window rW,cW;
628 - int rx,ry, x,y, ipos, pos, lit, i, origval;
629 + int rx, ry, x, y, ipos, pos, lit;
630 + double origval;
631 unsigned int mask;
633 lit = 0;
634 @@ -224,9 +226,9 @@
635 if (ipos != INDIAL) {
636 drawButt(dp, ipos, 1);
637 switch (ipos) {
638 - case INCW1: if (dp->val < dp->max) DSetVal(dp, dp->val+1); break;
639 + case INCW1: if (dp->val < dp->max) DSetVal(dp, dp->val+dp->inc); break;
640 case INCW2: if (dp->val < dp->max) DSetVal(dp, dp->val+dp->page); break;
641 - case INCCW1: if (dp->val > dp->min) DSetVal(dp, dp->val-1); break;
642 + case INCCW1: if (dp->val > dp->min) DSetVal(dp, dp->val-dp->inc); break;
643 case INCCW2: if (dp->val > dp->min) DSetVal(dp, dp->val-dp->page); break;
645 if (dp->drawobj != NULL) (dp->drawobj)();
646 @@ -235,8 +237,9 @@
649 else {
650 - i = computeDialVal(dp, mx, my);
651 - DSetVal(dp, i);
652 + double v;
653 + v = computeDialVal(dp, mx, my);
654 + DSetVal(dp, v);
655 if (dp->drawobj != NULL) (dp->drawobj)();
658 @@ -246,11 +249,11 @@
659 if (!(mask & Button1Mask)) break; /* button released */
661 if (ipos == INDIAL) {
662 - int j;
663 - i = computeDialVal(dp, x, y);
664 - j = dp->val;
665 - DSetVal(dp, i);
666 - if (j != dp->val) {
667 + double v, w;
668 + v = computeDialVal(dp, x, y);
669 + w = dp->val;
670 + DSetVal(dp, v);
671 + if (w != dp->val) {
672 /* track whatever dial controls */
673 if (dp->drawobj != NULL) (dp->drawobj)();
675 @@ -266,11 +269,11 @@
677 if (lit) {
678 switch (ipos) {
679 - case INCW1: if (dp->val < dp->max) DSetVal(dp, dp->val+1);
680 + case INCW1: if (dp->val < dp->max) DSetVal(dp, dp->val+dp->inc);
681 break;
682 case INCW2: if (dp->val < dp->max) DSetVal(dp, dp->val+dp->page);
683 break;
684 - case INCCW1: if (dp->val > dp->min) DSetVal(dp, dp->val-1);
685 + case INCCW1: if (dp->val > dp->min) DSetVal(dp, dp->val-dp->inc);
686 break;
687 case INCCW2: if (dp->val > dp->min) DSetVal(dp, dp->val-dp->page);
688 break;
689 @@ -320,19 +323,20 @@
690 static void drawArrow(dp)
691 DIAL *dp;
693 - int i, rad, cx, cy;
694 + int rad, cx, cy;
695 + double v;
696 XPoint arrow[4];
698 rad = dp->rad; cx = dp->cx; cy = dp->cy;
700 /* map pos (range minv..maxv) into degrees (range 240..-60) */
701 - i = 240 + (-300 * (dp->val - dp->min)) / (dp->max - dp->min);
702 - arrow[0].x = cx + (int) ((double) rad * .80 * cos(i * DEG2RAD));
703 - arrow[0].y = cy - (int) ((double) rad * .80 * sin(i * DEG2RAD));
704 - arrow[1].x = cx + (int) ((double) rad * .33 * cos((i+160) * DEG2RAD));
705 - arrow[1].y = cy - (int) ((double) rad * .33 * sin((i+160) * DEG2RAD));
706 - arrow[2].x = cx + (int) ((double) rad * .33 * cos((i-160) * DEG2RAD));
707 - arrow[2].y = cy - (int) ((double) rad * .33 * sin((i-160) * DEG2RAD));
708 + v = 240 + (-300 * (dp->val - dp->min)) / (dp->max - dp->min);
709 + arrow[0].x = cx + (int) ((double) rad * .80 * cos(v * DEG2RAD));
710 + arrow[0].y = cy - (int) ((double) rad * .80 * sin(v * DEG2RAD));
711 + arrow[1].x = cx + (int) ((double) rad * .33 * cos((v+160) * DEG2RAD));
712 + arrow[1].y = cy - (int) ((double) rad * .33 * sin((v+160) * DEG2RAD));
713 + arrow[2].x = cx + (int) ((double) rad * .33 * cos((v-160) * DEG2RAD));
714 + arrow[2].y = cy - (int) ((double) rad * .33 * sin((v-160) * DEG2RAD));
715 arrow[3].x = arrow[0].x;
716 arrow[3].y = arrow[0].y;
717 XDrawLines(theDisp, dp->win, theGC, arrow, 4, CoordModeOrigin);
718 @@ -343,23 +347,37 @@
719 static void drawValStr(dp)
720 DIAL *dp;
722 - int i, x1, x2;
723 + int tot, i, x1, x2;
724 char foo[60], foo1[60];
726 /* compute longest string necessary so we can right-align this thing */
727 - sprintf(foo,"%d",dp->min); x1 = strlen(foo);
728 - sprintf(foo,"%d",dp->max); x2 = strlen(foo);
729 + sprintf(foo,"%d",(int)dp->min); x1 = strlen(foo);
730 + sprintf(foo,"%d",(int)dp->max); x2 = strlen(foo);
731 if (dp->min < 0 && dp->max > 0) x2++; /* put '+' at beginning */
732 i = x1; if (x2>x1) i = x2;
733 if (dp->units) i += strlen(dp->units);
735 - if (dp->min < 0 && dp->max > 0) sprintf(foo,"%+d", dp->val);
736 - else sprintf(foo,"%d", dp->val);
737 + sprintf(foo,"%g",dp->inc); /* space for decimal values */
738 + tot = i + strlen(foo) - 1; /* Take away the 0 from the beginning */
740 + if (dp->min < 0.0 && dp->max > 0.0) sprintf(foo,"%+g", dp->val);
741 + else sprintf(foo,"%g", dp->val);
743 + if (dp->inc < 1.0)
745 + int j;
747 + if (dp->val == (double)((int)dp->val))
748 + strcat(foo,".");
750 + for (j = strlen(foo); j < tot; j++)
751 + strcat(foo,"0");
754 if (dp->units) strcat(foo,dp->units);
755 foo1[0] = '\0';
756 if (strlen(foo) < (size_t) i) {
757 - for (i = i - strlen(foo); i>0; i--) strcat(foo1," ");
758 + for (i-=strlen(foo);i>0;i--) strcat(foo1," ");
760 strcat(foo1, foo);
762 @@ -411,12 +429,13 @@
765 /***************************************************/
766 -static int computeDialVal(dp, x, y)
767 +static double computeDialVal(dp, x, y)
768 DIAL *dp;
769 int x, y;
771 - int dx, dy, val;
772 - double angle;
773 + int dx, dy;
775 + double angle, val;
777 /* compute dx, dy (distance from cx, cy). Note: +dy is *up* */
778 dx = x - dp->cx; dy = dp->cy - y;
779 @@ -436,8 +455,10 @@
780 if (angle > 270.0) angle -= 360.0;
781 if (angle < -90.0) angle += 360.0;
783 - val = (int) ((dp->max - dp->min) * (240.0 - angle) / 300.0) + dp->min;
784 + val = ((dp->max - dp->min) * (240.0 - angle) / 300.0) + dp->min;
786 + /* round value to be an even multiple of dp->inc */
787 + val = (double)((int)(val / dp->inc + 0.5)) * dp->inc;
788 return val;
791 diff -uNr xvdir.c xvdir.c
792 --- ./xvdir.c Tue Jan 3 22:21:39 1995
793 +++ ./xvdir.c Tue Feb 20 17:04:44 2001
794 @@ -62,6 +62,9 @@
795 #ifdef HAVE_TIFF
796 "TIFF",
797 #endif
798 +#ifdef HAVE_PNG
799 + "PNG",
800 +#endif
801 "PostScript",
802 "PBM/PGM/PPM (raw)",
803 "PBM/PGM/PPM (ascii)",
804 @@ -1115,6 +1118,15 @@
806 #endif
808 +#ifdef HAVE_PNG
809 + else if (fmt == F_PNG) { /* PNG */
810 + PNGSaveParams(fullname, col);
811 + PNGDialog(1); /* open PNG Dialog box */
812 + dbut[S_BOK].lit = 0; BTRedraw(&dbut[S_BOK]);
813 + return 0; /* always 'succeeds' */
815 +#endif
820 @@ -1168,7 +1180,8 @@
822 case F_XPM:
823 rv = WriteXPM (fp, thepic, ptype, w, h, rp, gp, bp, nc, col,
824 - fullname, picComments);
825 + fullname, picComments);
826 + break;
827 case F_FITS:
828 rv = WriteFITS (fp, thepic, ptype, w, h, rp, gp, bp, nc, col,
829 picComments);
830 @@ -1380,14 +1393,21 @@
831 (strcmp(lowsuf,"eps" )==0) ||
832 (strcmp(lowsuf,"rgb" )==0) ||
833 (strcmp(lowsuf,"tga" )==0) ||
834 - (strcmp(lowsuf,"xpm" )==0) ||
835 (strcmp(lowsuf,"fits")==0) ||
836 (strcmp(lowsuf,"fts" )==0) ||
837 +#ifdef HAVE_JPEG
838 (strcmp(lowsuf,"jpg" )==0) ||
839 (strcmp(lowsuf,"jpeg")==0) ||
840 (strcmp(lowsuf,"jfif")==0) ||
841 +#endif
842 +#ifdef HAVE_TIFF
843 (strcmp(lowsuf,"tif" )==0) ||
844 - (strcmp(lowsuf,"tiff")==0)) {
845 + (strcmp(lowsuf,"tiff")==0) ||
846 +#endif
847 +#ifdef HAVE_PNG
848 + (strcmp(lowsuf,"png" )==0) ||
849 +#endif
850 + (strcmp(lowsuf,"xpm" )==0)) {
852 /* found one. set lowsuf = to the new suffix, and tack on to filename */
854 @@ -1422,6 +1442,10 @@
856 #ifdef HAVE_TIFF
857 case F_TIFF: strcpy(lowsuf,"tif"); break;
858 +#endif
860 +#ifdef HAVE_PNG
861 + case F_PNG: strcpy(lowsuf,"png"); break;
862 #endif
865 diff -uNr xvevent.c xvevent.c
866 --- ./xvevent.c Tue Jan 24 00:20:24 1995
867 +++ ./xvevent.c Tue Feb 20 17:04:44 2001
868 @@ -154,7 +154,7 @@
869 int *donep;
871 static int wasInfoUp=0, wasCtrlUp=0, wasDirUp=0, wasGamUp=0, wasPsUp=0;
872 - static int wasJpegUp=0, wasTiffUp=0;
873 + static int wasJpegUp=0, wasTiffUp=0, wasPngUp=0;
875 static int mainWKludge=0; /* force first mainW expose after a mainW config
876 to redraw all of mainW */
877 @@ -233,6 +233,10 @@
878 if (TIFFCheckEvent(event)) break; /* event has been processed */
879 #endif
881 +#ifdef HAVE_PNG
882 + if (PNGCheckEvent (event)) break; /* event has been processed */
883 +#endif
885 if (GamCheckEvent (event)) break; /* event has been processed */
886 if (BrowseCheckEvent (event, &retval, &done)) break; /* event eaten */
887 if (TextCheckEvent (event, &retval, &done)) break; /* event eaten */
888 @@ -359,6 +363,10 @@
889 else if (client_event->window == tiffW) TIFFDialog(0);
890 #endif
892 +#ifdef HAVE_PNG
893 + else if (client_event->window == pngW) PNGDialog(0);
894 +#endif
896 else if (client_event->window == mainW) Quit(0);
899 @@ -538,6 +546,10 @@
900 #ifdef HAVE_TIFF
901 if (wasTiffUp) { TIFFDialog(wasTiffUp); wasTiffUp=0; }
902 #endif
904 +#ifdef HAVE_PNG
905 + if (wasPngUp) { PNGDialog(wasJpegUp); wasPngUp=0; }
906 +#endif
910 @@ -576,6 +588,10 @@
911 #ifdef HAVE_TIFF
912 if (tiffUp) { wasTiffUp = tiffUp; TIFFDialog(0); }
913 #endif
915 +#ifdef HAVE_PNG
916 + if (pngUp) { wasPngUp = pngUp; PNGDialog(0); }
917 +#endif
921 @@ -1147,6 +1163,10 @@
922 if (TIFFCheckEvent(event)) break;
923 #endif
925 +#ifdef HAVE_PNG
926 + if (PNGCheckEvent (event)) break;
927 +#endif
929 if (GamCheckEvent (event)) break;
930 if (BrowseCheckEvent (event, &retval, &done)) break;
931 if (TextCheckEvent (event, &retval, &done)) break;
932 @@ -1366,6 +1386,10 @@
933 if (TIFFCheckEvent(event)) break;
934 #endif
936 +#ifdef HAVE_PNG
937 + if (PNGCheckEvent (event)) break;
938 +#endif
940 if (GamCheckEvent (event)) break;
941 if (BrowseCheckEvent (event, &retval, &done)) break;
942 if (TextCheckEvent (event, &retval, &done)) break;
943 @@ -2370,6 +2394,10 @@
945 #ifdef HAVE_TIFF
946 if (tiffUp) TIFFDialog(0); /* close tiff window */
947 +#endif
949 +#ifdef HAVE_PNG
950 + if (pngUp) PNGDialog(0); /* close png window */
951 #endif
953 ClosePopUp();
954 diff -uNr xvgam.c xvgam.c
955 --- ./xvgam.c Fri Jan 13 20:51:14 1995
956 +++ ./xvgam.c Tue Feb 20 17:04:44 2001
957 @@ -265,11 +265,11 @@
958 BTCreate(&gbut[G_BRNDCOL], cmapF, 5 + 66 + 67 + 2, 189, 66, BUTTH,
959 "Random", infofg, infobg, hicol, locol);
961 - DCreate(&rhDial, cmapF, 5, 215, 66, 100, 0,360,180, 5,
962 + DCreate(&rhDial, cmapF, 5, 215, 66, 100, 0.0, 360.0, 180.0, 1.0, 5.0,
963 infofg, infobg, hicol, locol, "Hue", NULL);
964 - DCreate(&gsDial, cmapF, 72, 215, 66, 100, 0,360,180, 5,
965 + DCreate(&gsDial, cmapF, 72, 215, 66, 100, 0.0, 360.0, 180.0, 1.0, 5.0,
966 infofg, infobg, hicol, locol, "Sat.", NULL);
967 - DCreate(&bvDial, cmapF, 139, 215, 66, 100, 0,360,180, 5,
968 + DCreate(&bvDial, cmapF, 139, 215, 66, 100, 0.0, 360.0, 180.0, 1.0, 5.0,
969 infofg, infobg, hicol, locol, "Value", NULL);
971 rhDial.drawobj = gsDial.drawobj = bvDial.drawobj = dragEditColor;
972 @@ -359,7 +359,7 @@
974 srcHD.drawobj = dstHD.drawobj = whtHD.drawobj = dragHueDial;
976 - DCreate(&satDial, hsvF, 100, 199, 100, 121, -100, 100, 0, 5,
977 + DCreate(&satDial, hsvF, 100, 199, 100, 121, -100.0, 100.0, 0.0, 1.0, 5.0,
978 infofg, infobg,hicol,locol, "Saturation", "%");
980 hueRB = RBCreate(NULL, hsvF, 7, 153, "1",
981 @@ -722,7 +722,7 @@
983 if (whtHD.enabCB.val && whtHD.satval) hsvnonlinear++;
985 - if (satDial.val != 0) hsvnonlinear++;
986 + if (satDial.val != 0.0) hsvnonlinear++;
988 /* check intensity graf */
989 for (i=0; i<256 && intGraf.func[i]==i; i++);
990 @@ -1291,14 +1291,14 @@
991 rgb2hsv(rcmap[editColor], gcmap[editColor], bcmap[editColor], &h, &s, &v);
992 if (h<0) h = 0;
994 - DSetVal(&rhDial, (int) h);
995 - DSetVal(&gsDial, (int) (s*100));
996 - DSetVal(&bvDial, (int) (v*100));
997 + DSetVal(&rhDial, h);
998 + DSetVal(&gsDial, s*100);
999 + DSetVal(&bvDial, v*100);
1001 else {
1002 - DSetVal(&rhDial, rcmap[editColor]);
1003 - DSetVal(&gsDial, gcmap[editColor]);
1004 - DSetVal(&bvDial, bcmap[editColor]);
1005 + DSetVal(&rhDial, (double)rcmap[editColor]);
1006 + DSetVal(&gsDial, (double)gcmap[editColor]);
1007 + DSetVal(&bvDial, (double)bcmap[editColor]);
1011 @@ -1310,16 +1310,15 @@
1013 if (hsvmode) {
1014 int rv, gv, bv;
1015 - hsv2rgb((double) rhDial.val, ((double) gsDial.val) / 100.0,
1016 - ((double) bvDial.val) / 100.0, &rv, &gv, &bv);
1017 + hsv2rgb(rhDial.val, gsDial.val / 100.0, bvDial.val / 100.0, &rv, &gv, &bv);
1018 rcmap[editColor] = rv;
1019 gcmap[editColor] = gv;
1020 bcmap[editColor] = bv;
1022 else {
1023 - rcmap[editColor] = rhDial.val;
1024 - gcmap[editColor] = gsDial.val;
1025 - bcmap[editColor] = bvDial.val;
1026 + rcmap[editColor] = (int)rhDial.val;
1027 + gcmap[editColor] = (int)gsDial.val;
1028 + bcmap[editColor] = (int)bvDial.val;
1032 @@ -1561,9 +1560,9 @@
1033 gsDial.title = "Green";
1034 bvDial.title = "Blue";
1036 - DSetRange(&rhDial, 0, 255, rcmap[editColor], 16);
1037 - DSetRange(&gsDial, 0, 255, gcmap[editColor], 16);
1038 - DSetRange(&bvDial, 0, 255, bcmap[editColor], 16);
1039 + DSetRange(&rhDial, 0.0, 255.0, (double)rcmap[editColor], 1.0, 16.0);
1040 + DSetRange(&gsDial, 0.0, 255.0, (double)gcmap[editColor], 1.0, 16.0);
1041 + DSetRange(&bvDial, 0.0, 255.0, (double)bcmap[editColor], 1.0, 16.0);
1043 XClearWindow(theDisp, rhDial.win); DRedraw(&rhDial);
1044 XClearWindow(theDisp, gsDial.win); DRedraw(&gsDial);
1045 @@ -1581,9 +1580,9 @@
1046 &h, &s, &v);
1048 if (h<0.0) h = 0.0;
1049 - DSetRange(&rhDial, 0, 360, (int) h, 5);
1050 - DSetRange(&gsDial, 0, 100, (int) (s*100), 5);
1051 - DSetRange(&bvDial, 0, 100, (int) (v*100), 5);
1052 + DSetRange(&rhDial, 0.0, 360.0, h, 1.0, 5.0);
1053 + DSetRange(&gsDial, 0.0, 100.0, s*100, 1.0, 5.0);
1054 + DSetRange(&bvDial, 0.0, 100.0, v*100, 1.0, 5.0);
1056 XClearWindow(theDisp, rhDial.win); DRedraw(&rhDial);
1057 XClearWindow(theDisp, gsDial.win); DRedraw(&gsDial);
1058 @@ -1891,7 +1890,7 @@
1061 /* apply satDial value to s */
1062 - s = s + ((double) satDial.val) / 100.0;
1063 + s = s + satDial.val / 100.0;
1064 if (s<0.0) s = 0.0;
1065 if (s>1.0) s = 1.0;
1067 @@ -2007,7 +2006,7 @@
1069 gs->hueRBnum = RBWhich(hueRB);
1071 - gs->satval = satDial.val;
1072 + gs->satval = (int)satDial.val;
1073 GetGrafState(&intGraf,&gs->istate);
1074 GetGrafState(&rGraf, &gs->rstate);
1075 GetGrafState(&gGraf, &gs->gstate);
1076 @@ -2064,8 +2063,8 @@
1077 changed++;
1080 - if (gs->satval != satDial.val) {
1081 - DSetVal(&satDial,gs->satval);
1082 + if (gs->satval != (int)satDial.val) {
1083 + DSetVal(&satDial,(double)gs->satval);
1084 changed++;
1087 @@ -3200,7 +3199,7 @@
1089 if (whtHD.enabCB.val && whtHD.satval) hsvmod++;
1091 - if (satDial.val != 0) hsvmod++;
1092 + if (satDial.val != 0.0) hsvmod++;
1094 /* check intensity graf */
1095 for (i=0; i<256; i++) {
1096 @@ -3284,7 +3283,7 @@
1099 /* apply satDial value to s */
1100 - s = s + satDial.val;
1101 + s = s + (int)satDial.val;
1102 if (s< 0) s = 0;
1103 if (s>100) s = 100;
1105 diff -uNr xvjpeg.c xvjpeg.c
1106 --- ./xvjpeg.c Thu Jan 5 09:17:13 1995
1107 +++ ./xvjpeg.c Tue Feb 20 17:49:14 2001
1108 @@ -12,8 +12,8 @@
1110 #include <setjmp.h>
1112 -#include "jpeglib.h"
1113 -#include "jerror.h"
1114 +#include <jpeglib.h>
1115 +#include <jerror.h>
1117 #define CREATOR_STR "CREATOR: "
1119 @@ -51,11 +51,11 @@
1120 static void clickJD PARM((int, int));
1121 static void doCmd PARM((int));
1122 static void writeJPEG PARM((void));
1123 -METHODDEF void xv_error_exit PARM((j_common_ptr));
1124 -METHODDEF void xv_error_output PARM((j_common_ptr));
1125 -METHODDEF void xv_prog_meter PARM((j_common_ptr));
1126 +METHODDEF(void) xv_error_exit PARM((j_common_ptr));
1127 +METHODDEF(void) xv_error_output PARM((j_common_ptr));
1128 +METHODDEF(void) xv_prog_meter PARM((j_common_ptr));
1129 static unsigned int j_getc PARM((j_decompress_ptr));
1130 -METHODDEF boolean xv_process_comment PARM((j_decompress_ptr));
1131 +METHODDEF(boolean) xv_process_comment PARM((j_decompress_ptr));
1132 static int writeJFIF PARM((FILE *, byte *, int,int,int));
1135 @@ -87,10 +87,10 @@
1137 XSelectInput(theDisp, jpegW, ExposureMask | ButtonPressMask | KeyPressMask);
1139 - DCreate(&qDial, jpegW, 10, 10, 80, 100, 1, 100, 75, 5,
1140 + DCreate(&qDial, jpegW, 10, 10, 80, 100, 1.0, 100.0, 75.0, 1.0, 5.0,
1141 infofg, infobg, hicol, locol, "Quality", "%");
1143 - DCreate(&smDial, jpegW, 120, 10, 80, 100, 0, 100, 0, 5,
1144 + DCreate(&smDial, jpegW, 120, 10, 80, 100, 0.0, 100.0, 0.0, 1.0, 5.0,
1145 infofg, infobg, hicol, locol, "Smoothing", "%");
1147 BTCreate(&jbut[J_BOK], jpegW, JWIDE-180-1, JHIGH-10-BUTTH-1, 80, BUTTH,
1148 @@ -400,7 +400,7 @@
1151 /**************************************************/
1152 -METHODDEF void xv_error_exit(cinfo)
1153 +METHODDEF (void) xv_error_exit(cinfo)
1154 j_common_ptr cinfo;
1156 my_error_ptr myerr;
1157 @@ -412,7 +412,7 @@
1160 /**************************************************/
1161 -METHODDEF void xv_error_output(cinfo)
1162 +METHODDEF (void) xv_error_output(cinfo)
1163 j_common_ptr cinfo;
1165 my_error_ptr myerr;
1166 @@ -426,7 +426,7 @@
1169 /**************************************************/
1170 -METHODDEF void xv_prog_meter(cinfo)
1171 +METHODDEF (void) xv_prog_meter(cinfo)
1172 j_common_ptr cinfo;
1174 struct jpeg_progress_mgr *prog;
1175 @@ -671,7 +671,7 @@
1178 /**************************************************/
1179 -METHODDEF boolean xv_process_comment(cinfo)
1180 +METHODDEF (boolean) xv_process_comment(cinfo)
1181 j_decompress_ptr cinfo;
1183 int length, hasnull;
1184 @@ -759,8 +759,8 @@
1187 jpeg_set_defaults(&cinfo);
1188 - jpeg_set_quality(&cinfo, qDial.val, TRUE);
1189 - cinfo.smoothing_factor = smDial.val;
1190 + jpeg_set_quality(&cinfo, (int)qDial.val, TRUE);
1191 + cinfo.smoothing_factor = (int)smDial.val;
1194 jpeg_start_compress(&cinfo, TRUE);
1195 @@ -769,7 +769,7 @@
1196 /*** COMMENT HANDLING ***/
1198 sprintf(xvcmt, "%sXV %s Quality = %d, Smoothing = %d\n",
1199 - CREATOR_STR, REVDATE, qDial.val, smDial.val);
1200 + CREATOR_STR, REVDATE, (int)qDial.val, (int)smDial.val);
1202 if (picComments) { /* append XV comment */
1203 char *sp, *sp1; int done;
1204 diff -uNr xvmisc.c xvmisc.c
1205 --- ./xvmisc.c Sat Jan 14 00:41:34 1995
1206 +++ ./xvmisc.c Tue Feb 20 17:04:44 2001
1207 @@ -520,6 +520,10 @@
1208 if (tiffW) XDestroyWindow(theDisp, tiffW);
1209 #endif
1211 +#ifdef HAVE_PNG
1212 + if (pngW) XDestroyWindow(theDisp, pngW);
1213 +#endif
1215 /* if NOT using stdcmap for images, free stdcmap */
1216 if (colorMapMode != CM_STDCMAP) {
1217 int j;
1218 @@ -715,6 +719,10 @@
1220 #ifdef HAVE_TIFF
1221 if (tiffW) XDefineCursor(theDisp, tiffW, otherc);
1222 +#endif
1224 +#ifdef HAVE_PNG
1225 + if (pngW) XDefineCursor(theDisp, pngW, otherc);
1226 #endif
1229 diff -uNr xvpng.c xvpng.c
1230 --- ./xvpng.c Thu Jan 1 01:00:00 1970
1231 +++ ./xvpng.c Tue Feb 20 17:49:44 2001
1232 @@ -0,0 +1,965 @@
1234 + * xvpng.c - load and write routines for 'PNG' format pictures
1236 + * callable functions
1238 + * CreatePNGW()
1239 + * PNGDialog(vis)
1240 + * PNGCheckEvent(xev)
1241 + * PNGSaveParams(fname, col)
1242 + * LoadPNG(fname, pinfo)
1243 + */
1245 +/*#include "copyright.h"*/
1246 +/* (c) 1995 by Alexander Lehmann <lehmann@mathematik.th-darmstadt.de>
1247 + * this file is a suplement to xv and is supplied under the same copying
1248 + * conditions (except the shareware part)
1249 + * Modified by Andreas Dilger <adilger@enel.ucalgary.ca> to fix
1250 + * error handling for bad PNGs, add dialogs for interlacing and
1251 + * compression selection, and upgrade to libpng-0.89
1252 + * The copyright will be passed on to JB at some future point if he
1253 + * so desires.
1254 + */
1256 +#include "xv.h"
1258 +#ifdef HAVE_PNG
1260 +#include <png.h>
1262 +/*** Stuff for PNG Dialog box ***/
1263 +#define PWIDE 318
1264 +#define PHIGH 215
1266 +#define DISPLAY_GAMMA 2.20 /* Default display gamma */
1267 +/* Default zlib compression level
1268 +#define COMPRESSION Z_BEST_COMPRESSION
1270 +#define COMPRESSION 6
1272 +#define DWIDE 86
1273 +#define DHIGH 104
1274 +#define PFX PWIDE-93
1275 +#define PFY 44
1276 +#define PFH 20
1278 +#define P_BOK 0
1279 +#define P_BCANC 1
1280 +#define P_NBUTTS 2
1282 +#define BUTTH 24
1284 +/*** local functions ***/
1285 +static void drawPD PARM((int, int, int, int));
1286 +static void clickPD PARM((int, int));
1287 +static void doCmd PARM((int));
1288 +static void writePNG PARM((void));
1289 +static int WritePNG PARM((FILE *, byte *, int, int, int,
1290 + byte *, byte *, byte *, int));
1292 +static void png_xv_error PARM((png_struct *png_ptr, char *message));
1293 +static void png_xv_warning PARM((png_struct *png_ptr, char *message));
1295 +/*** local variables ***/
1296 +static char *filename;
1297 +static char *fbasename;
1298 +static int colorType;
1299 +static int read_anything;
1300 +static double Display_Gamma = DISPLAY_GAMMA;
1302 +static DIAL cDial, gDial;
1303 +static BUTT pbut[P_NBUTTS];
1304 +static CBUTT interCB;
1305 +static CBUTT FdefCB, FnoneCB, FsubCB, FupCB, FavgCB, FPaethCB;
1307 +/**************************************************************************/
1308 +/* PNG SAVE DIALOG ROUTINES ***********************************************/
1309 +/**************************************************************************/
1312 +/*******************************************/
1313 +void CreatePNGW()
1315 + pngW = CreateWindow("xv png", "XVPNG", NULL,
1316 + PWIDE, PHIGH, infofg, infobg, 0);
1317 + if (!pngW) FatalError("can't create PNG window!");
1319 + XSelectInput(theDisp, pngW, ExposureMask | ButtonPressMask | KeyPressMask);
1321 + DCreate(&cDial, pngW, 12, 25, DWIDE, DHIGH, (double)Z_NO_COMPRESSION,
1322 + (double)Z_BEST_COMPRESSION, COMPRESSION, 1.0, 2.0,
1323 + infofg, infobg, hicol, locol, "Compression", NULL);
1325 + DCreate(&gDial, pngW, DWIDE+27, 25, DWIDE, DHIGH, 1.0, 3.5,DISPLAY_GAMMA,0.01,0.2,
1326 + infofg, infobg, hicol, locol, "Disp. Gamma", NULL);
1328 + CBCreate(&interCB, pngW, DWIDE+30, DHIGH+3*LINEHIGH+2, "interlace",
1329 + infofg, infobg, hicol, locol);
1331 + CBCreate(&FdefCB, pngW, PFX, PFY, "Default",
1332 + infofg, infobg, hicol, locol);
1333 + FdefCB.val = 1;
1335 + CBCreate(&FnoneCB, pngW, PFX, FdefCB.y + PFH + 4, "none",
1336 + infofg, infobg, hicol, locol);
1337 + CBCreate(&FsubCB, pngW, PFX, FnoneCB.y + PFH, "sub",
1338 + infofg, infobg, hicol, locol);
1339 + CBCreate(&FupCB, pngW, PFX, FsubCB.y + PFH, "up",
1340 + infofg, infobg, hicol, locol);
1341 + CBCreate(&FavgCB, pngW, PFX, FupCB.y + PFH, "average",
1342 + infofg, infobg, hicol, locol);
1343 + CBCreate(&FPaethCB, pngW, PFX, FavgCB.y + PFH, "Paeth",
1344 + infofg, infobg, hicol, locol);
1346 + FnoneCB.val = FsubCB.val = FupCB.val = FavgCB.val = FPaethCB.val = 1;
1347 + CBSetActive(&FnoneCB, !FdefCB.val);
1348 + CBSetActive(&FsubCB, !FdefCB.val);
1349 + CBSetActive(&FupCB, !FdefCB.val);
1350 + CBSetActive(&FavgCB, !FdefCB.val);
1351 + CBSetActive(&FPaethCB, !FdefCB.val);
1353 + BTCreate(&pbut[P_BOK], pngW, PWIDE-180-1, PHIGH-10-BUTTH-1, 80, BUTTH,
1354 + "Ok", infofg, infobg, hicol, locol);
1355 + BTCreate(&pbut[P_BCANC], pngW, PWIDE-90-1, PHIGH-10-BUTTH-1, 80, BUTTH,
1356 + "Cancel", infofg, infobg, hicol, locol);
1358 + XMapSubwindows(theDisp, pngW);
1362 +/*******************************************/
1363 +void PNGDialog(vis)
1364 + int vis;
1366 + if (vis) {
1367 + CenterMapWindow(pngW, pbut[P_BOK].x + (int) pbut[P_BOK].w/2,
1368 + pbut[P_BOK].y + (int) pbut[P_BOK].h/2,
1369 + PWIDE, PHIGH);
1371 + else XUnmapWindow(theDisp, pngW);
1372 + pngUp = vis;
1376 +/*******************************************/
1377 +int PNGCheckEvent(xev)
1378 + XEvent *xev;
1380 + /* check event to see if it's for one of our subwindows. If it is,
1381 + deal accordingly, and return '1'. Otherwise, return '0' */
1383 + int rv;
1384 + rv = 1;
1386 + if (!pngUp) return 0;
1388 + if (xev->type == Expose) {
1389 + int x,y,w,h;
1390 + XExposeEvent *e = (XExposeEvent *) xev;
1391 + x = e->x; y = e->y; w = e->width; h = e->height;
1393 + /* throw away excess expose events for 'dumb' windows */
1394 + if (e->count > 0 && (e->window == cDial.win)) {}
1396 + else if (e->window == pngW) drawPD(x, y, w, h);
1397 + else if (e->window == cDial.win) DRedraw(&cDial);
1398 + else if (e->window == gDial.win) DRedraw(&gDial);
1399 + else rv = 0;
1402 + else if (xev->type == ButtonPress) {
1403 + XButtonEvent *e = (XButtonEvent *) xev;
1404 + int x,y;
1405 + x = e->x; y = e->y;
1407 + if (e->button == Button1) {
1408 + if (e->window == pngW) clickPD(x,y);
1409 + else if (e->window == cDial.win) DTrack(&cDial,x,y);
1410 + else if (e->window == gDial.win) DTrack(&gDial,x,y);
1411 + else rv = 0;
1412 + } /* button1 */
1413 + else rv = 0;
1414 + } /* button press */
1416 + else if (xev->type == KeyPress) {
1417 + XKeyEvent *e = (XKeyEvent *) xev;
1418 + char buf[128]; KeySym ks;
1419 + int stlen;
1421 + stlen = XLookupString(e,buf,128,&ks,(XComposeStatus *) NULL);
1422 + buf[stlen] = '\0';
1424 + RemapKeyCheck(ks, buf, &stlen);
1426 + if (e->window == pngW) {
1427 + if (stlen) {
1428 + if (buf[0] == '\r' || buf[0] == '\n') { /* enter */
1429 + FakeButtonPress(&pbut[P_BOK]);
1431 + else if (buf[0] == '\033') { /* ESC */
1432 + FakeButtonPress(&pbut[P_BCANC]);
1436 + else rv = 0;
1438 + else rv = 0;
1440 + if (rv==0 && (xev->type == ButtonPress || xev->type == KeyPress)) {
1441 + XBell(theDisp, 50);
1442 + rv = 1; /* eat it */
1445 + return rv;
1449 +/*******************************************/
1450 +void PNGSaveParams(fname, col)
1451 + char *fname;
1452 + int col;
1454 + filename = fname;
1455 + colorType = col;
1459 +/*******************************************/
1460 +static void drawPD(x, y, w, h)
1461 + int x, y, w, h;
1463 + char *title = "Save PNG file...";
1465 + char ctitle1[20];
1466 + char *ctitle2 = "Useful range";
1467 + char *ctitle3 = "is 2 - 7.";
1468 + char *ctitle4 = "Uncompressed = 0";
1470 + char *ftitle = "Row Filters:";
1472 + char gtitle[20];
1474 + int i;
1475 + XRectangle xr;
1477 + xr.x = x; xr.y = y; xr.width = w; xr.height = h;
1478 + XSetClipRectangles(theDisp, theGC, 0,0, &xr, 1, Unsorted);
1480 + XSetForeground(theDisp, theGC, infofg);
1481 + XSetBackground(theDisp, theGC, infobg);
1483 + for (i=0; i<P_NBUTTS; i++) BTRedraw(&pbut[i]);
1485 + DrawString(pngW, 15, 6+ASCENT, title);
1487 + sprintf(ctitle1, "Default = %d", COMPRESSION);
1488 + DrawString(pngW, 18, 6+DHIGH+cDial.y+ASCENT, ctitle1);
1489 + DrawString(pngW, 17, 6+DHIGH+cDial.y+ASCENT+LINEHIGH, ctitle2);
1490 + DrawString(pngW, 17, 6+DHIGH+cDial.y+ASCENT+2*LINEHIGH, ctitle3);
1491 + DrawString(pngW, 17, 6+DHIGH+cDial.y+ASCENT+3*LINEHIGH, ctitle4);
1493 + sprintf(gtitle, "Default = %g", DISPLAY_GAMMA);
1494 + DrawString(pngW, DWIDE+30, 6+DHIGH+gDial.y+ASCENT, gtitle);
1496 + ULineString(pngW, FdefCB.x, FdefCB.y-3-DESCENT, ftitle);
1497 + XDrawRectangle(theDisp, pngW, theGC, FdefCB.x-11, FdefCB.y-LINEHIGH-3,
1498 + 93, 8*LINEHIGH+15);
1499 + CBRedraw(&FdefCB);
1500 + XDrawLine(theDisp, pngW, theGC, FdefCB.x-11, FdefCB.y+LINEHIGH+4,
1501 + FdefCB.x+82, FdefCB.y+LINEHIGH+4);
1503 + CBRedraw(&FnoneCB);
1504 + CBRedraw(&FupCB);
1505 + CBRedraw(&FsubCB);
1506 + CBRedraw(&FavgCB);
1507 + CBRedraw(&FPaethCB);
1509 + CBRedraw(&interCB);
1511 + XSetClipMask(theDisp, theGC, None);
1515 +/*******************************************/
1516 +static void clickPD(x,y)
1517 + int x,y;
1519 + int i;
1520 + BUTT *bp;
1522 + /* check BUTTs */
1524 + for (i=0; i<P_NBUTTS; i++) {
1525 + bp = &pbut[i];
1526 + if (PTINRECT(x, y, bp->x, bp->y, bp->w, bp->h)) break;
1529 + if (i<P_NBUTTS) { /* found one */
1530 + if (BTTrack(bp)) doCmd(i);
1533 + /* check CBUTTs */
1535 + else if (CBClick(&FdefCB,x,y)) {
1536 + int oldval = FdefCB.val;
1538 + CBTrack(&FdefCB);
1540 + if (oldval != FdefCB.val)
1542 + CBSetActive(&FnoneCB, !FdefCB.val);
1543 + CBSetActive(&FsubCB, !FdefCB.val);
1544 + CBSetActive(&FupCB, !FdefCB.val);
1545 + CBSetActive(&FavgCB, !FdefCB.val);
1546 + CBSetActive(&FPaethCB, !FdefCB.val);
1548 + CBRedraw(&FnoneCB);
1549 + CBRedraw(&FupCB);
1550 + CBRedraw(&FsubCB);
1551 + CBRedraw(&FavgCB);
1552 + CBRedraw(&FPaethCB);
1555 + else if (CBClick(&FnoneCB,x,y)) CBTrack(&FnoneCB);
1556 + else if (CBClick(&FsubCB,x,y)) CBTrack(&FsubCB);
1557 + else if (CBClick(&FupCB,x,y)) CBTrack(&FupCB);
1558 + else if (CBClick(&FavgCB,x,y)) CBTrack(&FavgCB);
1559 + else if (CBClick(&FPaethCB,x,y)) CBTrack(&FPaethCB);
1560 + else if (CBClick(&interCB,x,y)) CBTrack(&interCB);
1564 +/*******************************************/
1565 +static void doCmd(cmd)
1566 + int cmd;
1568 + switch (cmd) {
1569 + case P_BOK: {
1570 + char *fullname;
1572 + writePNG();
1573 + PNGDialog(0);
1575 + fullname = GetDirFullName();
1576 + if (!ISPIPE(fullname[0])) {
1577 + XVCreatedFile(fullname);
1578 + StickInCtrlList(0);
1581 + break;
1583 + case P_BCANC: PNGDialog(0); break;
1585 + default: break;
1590 +/*******************************************/
1591 +static void writePNG()
1593 + FILE *fp;
1594 + int w, h, nc, rv, ptype, pfree;
1595 + byte *inpix, *rmap, *gmap, *bmap;
1597 + fp = OpenOutFile(filename);
1598 + if (!fp) return;
1600 + fbasename = BaseName(filename);
1602 + WaitCursor();
1603 + inpix = GenSavePic(&ptype, &w, &h, &pfree, &nc, &rmap, &gmap, &bmap);
1605 + rv = WritePNG(fp, inpix, ptype, w, h, rmap, gmap, bmap, nc);
1607 + SetCursors(-1);
1609 + if (CloseOutFile(fp, filename, rv) == 0) DirBox(0);
1611 + if (pfree) free(inpix);
1615 +/*******************************************/
1616 +int WritePNG(fp, pic, ptype, w, h, rmap, gmap, bmap, numcols)
1617 + FILE *fp;
1618 + byte *pic;
1619 + int ptype, w, h;
1620 + byte *rmap, *gmap, *bmap;
1621 + int numcols;
1623 + png_struct *png_ptr;
1624 + png_info *info_ptr;
1625 + png_color palette[256];
1626 + png_textp text;
1627 + byte remap[256];
1628 + int i, filter, linesize = 0, pass;
1629 + byte *p, *png_line;
1630 + char software[256];
1631 + char *savecmnt = NULL;
1633 + if ((png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL,
1634 + png_xv_error, png_xv_warning)) == NULL) {
1635 + FatalError("malloc failure in WritePNG");
1638 + if ((info_ptr = png_create_info_struct(png_ptr)) == NULL)
1640 + png_destroy_write_struct(&png_ptr, &info_ptr);
1641 + FatalError("malloc failure in WritePNG");
1644 + if (setjmp(png_ptr->jmpbuf)) {
1645 + png_destroy_write_struct(&png_ptr, &info_ptr);
1646 + return -1;
1649 + png_init_io(png_ptr, fp);
1651 + png_set_compression_level(png_ptr, (int)cDial.val);
1653 + /* Don't bother filtering if we aren't compressing the image */
1654 + if (FdefCB.val)
1656 + if ((int)cDial.val == 0)
1657 + png_set_filter(png_ptr, 0, PNG_FILTER_NONE);
1659 + else
1661 + filter = FnoneCB.val ? PNG_FILTER_NONE : 0;
1662 + filter |= FsubCB.val ? PNG_FILTER_SUB : 0;
1663 + filter |= FupCB.val ? PNG_FILTER_UP : 0;
1664 + filter |= FavgCB.val ? PNG_FILTER_AVG : 0;
1665 + filter |= FPaethCB.val ? PNG_FILTER_PAETH : 0;
1667 + png_set_filter(png_ptr, 0, filter);
1670 + info_ptr->width = w;
1671 + info_ptr->height = h;
1673 + info_ptr->interlace_type = interCB.val ? 1 : 0;
1675 + if (colorType == F_FULLCOLOR || colorType == F_REDUCED) {
1676 + if(ptype == PIC24) {
1677 + linesize = 3*w;
1678 + info_ptr->color_type = PNG_COLOR_TYPE_RGB;
1679 + info_ptr->bit_depth = 8;
1680 + } else {
1681 + linesize = w;
1682 + info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;
1683 + if(numcols <= 2)
1684 + info_ptr->bit_depth = 1;
1685 + else
1686 + if(numcols <= 4)
1687 + info_ptr->bit_depth = 2;
1688 + else
1689 + if(numcols <= 16)
1690 + info_ptr->bit_depth = 4;
1691 + else
1692 + info_ptr->bit_depth = 8;
1694 + for(i = 0; i < numcols; i++) {
1695 + palette[i].red = rmap[i];
1696 + palette[i].green = gmap[i];
1697 + palette[i].blue = bmap[i];
1699 + info_ptr->num_palette = numcols;
1700 + info_ptr->palette = palette;
1701 + info_ptr->valid |= PNG_INFO_PLTE;
1705 + else if(colorType == F_GREYSCALE || colorType == F_BWDITHER) {
1706 + info_ptr->color_type = PNG_COLOR_TYPE_GRAY;
1707 + if(colorType == F_BWDITHER) {
1708 + /* shouldn't happen */
1709 + if (ptype == PIC24) FatalError("PIC24 and B/W Stipple in WritePNG()");
1711 + info_ptr->bit_depth = 1;
1712 + if(MONO(rmap[0], gmap[0], bmap[0]) > MONO(rmap[1], gmap[1], bmap[1])) {
1713 + remap[0] = 1;
1714 + remap[1] = 0;
1716 + else {
1717 + remap[0] = 0;
1718 + remap[1] = 1;
1720 + linesize = w;
1722 + else {
1723 + if(ptype == PIC24) {
1724 + linesize = w*3;
1725 + info_ptr->bit_depth = 8;
1727 + else {
1728 + int low_presc;
1730 + linesize = w;
1732 + for(i = 0; i < numcols; i++)
1733 + remap[i] = MONO(rmap[i], gmap[i], bmap[i]);
1735 + for(; i < 256; i++)
1736 + remap[i]=0;
1738 + info_ptr->bit_depth = 8;
1740 + /* Note that this fails most of the time because of gamma */
1741 + /* try to adjust to 4 bit prescision grayscale */
1743 + low_presc=1;
1745 + for(i = 0; i < numcols; i++) {
1746 + if((remap[i] & 0x0f) * 0x11 != remap[i]) {
1747 + low_presc = 0;
1748 + break;
1752 + if(low_presc) {
1753 + for(i = 0; i < numcols; i++) {
1754 + remap[i] &= 0xf;
1756 + info_ptr->bit_depth = 4;
1758 + /* try to adjust to 2 bit prescision grayscale */
1760 + for(i = 0; i < numcols; i++) {
1761 + if((remap[i] & 0x03) * 0x05 != remap[i]) {
1762 + low_presc = 0;
1763 + break;
1768 + if(low_presc) {
1769 + for(i = 0; i < numcols; i++) {
1770 + remap[i] &= 3;
1772 + info_ptr->bit_depth = 2;
1774 + /* try to adjust to 1 bit prescision grayscale */
1776 + for(i = 0; i < numcols; i++) {
1777 + if((remap[i] & 0x01) * 0x03 != remap[i]) {
1778 + low_presc = 0;
1779 + break;
1784 + if(low_presc) {
1785 + for(i = 0; i < numcols; i++) {
1786 + remap[i] &= 1;
1788 + info_ptr->bit_depth = 1;
1794 + else
1795 + png_error(png_ptr, "Unknown colorstyle in WritePNG");
1797 + if ((text = (png_textp)malloc(sizeof(png_text)))) {
1798 + sprintf(software, "XV %s", REVDATE);
1800 + text->compression = -1;
1801 + text->key = "Software";
1802 + text->text = software;
1803 + text->text_length = strlen(text->text);
1805 + info_ptr->max_text = 1;
1806 + info_ptr->num_text = 1;
1807 + info_ptr->text = text;
1810 + Display_Gamma = gDial.val; /* Save the current gamma for loading */
1812 + info_ptr->gamma = 1.0/gDial.val;
1813 + info_ptr->valid |= PNG_INFO_gAMA;
1815 + png_write_info(png_ptr, info_ptr);
1817 + if(info_ptr->bit_depth < 8)
1818 + png_set_packing(png_ptr);
1820 + pass=png_set_interlace_handling(png_ptr);
1822 + if((png_line = malloc(linesize)) == NULL)
1823 + png_error(png_ptr, "cannot allocate temp image line");
1825 + for(i = 0; i < pass; i++) {
1826 + int j;
1827 + p = pic;
1828 + for(j = 0; j < h; j++) {
1829 + fflush(stdout);
1830 + if(info_ptr->color_type == PNG_COLOR_TYPE_GRAY) {
1831 + int k;
1832 + for(k = 0; k < w; k++)
1833 + png_line[k] = ptype==PIC24 ? MONO(p[k*3], p[k*3+1], p[k*3+2]) :
1834 + remap[p[k]];
1835 + png_write_row(png_ptr, png_line);
1836 + } else /* rbg or palette */
1837 + png_write_row(png_ptr, p);
1838 + if((j & 0x1f) == 0) WaitCursor();
1839 + p += linesize;
1843 + free(png_line);
1845 + if (text)
1847 + if (picComments && strlen(picComments) &&
1848 + (savecmnt = (char *)malloc((strlen(picComments) + 1)*sizeof(char)))) {
1849 + png_textp tp;
1850 + char *comment, *key;
1852 + strcpy(savecmnt, picComments);
1853 + key = savecmnt;
1854 + tp = text;
1855 + info_ptr->num_text = 0;
1857 + comment = strchr(key, ':');
1859 + do {
1860 + /* Allocate a larger structure for comments if necessary */
1861 + if (info_ptr->num_text >= info_ptr->max_text)
1863 + if ((tp =
1864 + realloc(text, (info_ptr->num_text + 2)*sizeof(png_text))) == NULL)
1866 + break;
1868 + else
1870 + text = tp;
1871 + tp = &text[info_ptr->num_text];
1872 + info_ptr->max_text += 2;
1876 + /* See if it looks like a PNG keyword from LoadPNG */
1877 + if(comment && comment[1] == ':' && comment - key <= 80) {
1878 + *(comment++) = '\0';
1879 + *(comment++) = '\0';
1881 + /* If the comment is the 'Software' chunk XV writes, we remove it,
1882 + since we have already stored one */
1883 + if (strcmp(key, "Software") == 0 && strncmp(comment, "XV", 2) == 0) {
1884 + key = strchr(comment, '\n');
1885 + if(key)
1886 + key++; /* skip \n */
1887 + comment = strchr(key, ':');
1889 + /* We have another keyword and/or comment to write out */
1890 + else {
1891 + tp->key = key;
1892 + tp->text = comment;
1894 + /* We have to find the end of this comment, and the next keyword
1895 + if there is one */
1896 + do {
1897 + key = comment = strchr(comment, ':');
1898 + } while (key && key[1] != ':');
1900 + /* It looks like another keyword, go backward to the beginning */
1901 + if (key) {
1902 + while(key > tp->text && *key != '\n')
1903 + key--;
1905 + if (key > tp->text && comment - key <= 80) {
1906 + *key = '\0';
1907 + key++;
1911 + tp->text_length = strlen(tp->text);
1913 + /* We don't have another keyword, so remove the last newline */
1914 + if (!key && tp->text[tp->text_length - 1] == '\n')
1916 + tp->text[tp->text_length] = '\0';
1917 + tp->text_length--;
1920 + tp->compression = tp->text_length > 640 ? 0 : -1;
1921 + info_ptr->num_text++;
1922 + tp++;
1925 + /* It is just a generic comment */
1926 + else {
1927 + tp->key = "Comment";
1928 + tp->text = key;
1929 + tp->text_length = strlen(tp->text);
1930 + tp->compression = tp->text_length > 750 ? 0 : -1;
1931 + info_ptr->num_text++;
1932 + key = NULL;
1934 + } while (key && *key);
1936 + else
1938 + info_ptr->num_text = 0;
1941 + info_ptr->text = text;
1943 + png_convert_from_time_t(&(info_ptr->mod_time), time(NULL));
1944 + info_ptr->valid |= PNG_INFO_tIME;
1946 + png_write_end(png_ptr, info_ptr);
1947 + png_destroy_write_struct(&png_ptr, &info_ptr);
1949 + if (text)
1951 + free(text);
1952 + if (savecmnt)
1953 + free(savecmnt);
1956 + return 0;
1960 +/*******************************************/
1961 +int LoadPNG(fname, pinfo)
1962 + char *fname;
1963 + PICINFO *pinfo;
1964 +/*******************************************/
1966 + /* returns '1' on success */
1968 + FILE *fp;
1969 + png_struct *png_ptr;
1970 + png_info *info_ptr;
1971 + png_color_16 my_background;
1972 + int i,j;
1973 + int linesize;
1974 + int filesize;
1975 + int pass;
1976 + size_t commentsize;
1978 + fbasename = BaseName(fname);
1980 + pinfo->pic = (byte *) NULL;
1981 + pinfo->comment = (char *) NULL;
1983 + read_anything=0;
1985 + /* open the file */
1986 + fp = xv_fopen(fname,"r");
1987 + if (!fp)
1989 + SetISTR(ISTR_WARNING,"%s: can't open file", fname);
1990 + return 0;
1993 + /* find the size of the file */
1994 + fseek(fp, 0L, 2);
1995 + filesize = ftell(fp);
1996 + fseek(fp, 0L, 0);
1998 + png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL,
1999 + png_xv_error, png_xv_warning);
2000 + if(!png_ptr) {
2001 + fclose(fp);
2002 + FatalError("malloc failure in LoadPNG");
2005 + info_ptr = png_create_info_struct(png_ptr);
2007 + if(!info_ptr) {
2008 + fclose(fp);
2009 + png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL);
2010 + FatalError("malloc failure in LoadPNG");
2013 + if(setjmp(png_ptr->jmpbuf)) {
2014 + fclose(fp);
2015 + png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
2016 + if(!read_anything) {
2017 + if(pinfo->pic) {
2018 + free(pinfo->pic);
2019 + pinfo->pic = NULL;
2021 + if(pinfo->comment) {
2022 + free(pinfo->comment);
2023 + pinfo->comment = NULL;
2026 + return read_anything;
2029 + png_init_io(png_ptr, fp);
2030 + png_read_info(png_ptr, info_ptr);
2032 + pinfo->w = pinfo->normw = info_ptr->width;
2033 + pinfo->h = pinfo->normh = info_ptr->height;
2035 + pinfo->frmType = F_PNG;
2037 + sprintf(pinfo->fullInfo, "PNG, %d bit ",
2038 + info_ptr->bit_depth * info_ptr->channels);
2040 + switch(info_ptr->color_type) {
2041 + case PNG_COLOR_TYPE_PALETTE:
2042 + strcat(pinfo->fullInfo, "palette color");
2043 + break;
2045 + case PNG_COLOR_TYPE_GRAY:
2046 + strcat(pinfo->fullInfo, "grayscale");
2047 + break;
2049 + case PNG_COLOR_TYPE_GRAY_ALPHA:
2050 + strcat(pinfo->fullInfo, "grayscale+alpha");
2051 + break;
2053 + case PNG_COLOR_TYPE_RGB:
2054 + strcat(pinfo->fullInfo, "truecolor");
2055 + break;
2057 + case PNG_COLOR_TYPE_RGB_ALPHA:
2058 + strcat(pinfo->fullInfo, "truecolor+alpha");
2059 + break;
2062 + sprintf(pinfo->fullInfo + strlen(pinfo->fullInfo),
2063 + ", %sinterlaced. (%d bytes)",
2064 + info_ptr->interlace_type ? "" : "non-", filesize);
2066 + sprintf(pinfo->shrtInfo, "%dx%d PNG", info_ptr->width, info_ptr->height);
2068 + if (info_ptr->bit_depth < 8)
2069 + png_set_packing(png_ptr);
2071 + if (info_ptr->valid & PNG_INFO_gAMA)
2072 + png_set_gamma(png_ptr, Display_Gamma, info_ptr->gamma);
2073 + else
2074 + png_set_gamma(png_ptr, Display_Gamma, 0.45);
2076 + if (info_ptr->valid & PNG_INFO_bKGD)
2077 + png_set_background(png_ptr, &info_ptr->background,
2078 + PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
2079 + else {
2080 + my_background.red = my_background.green = my_background.blue =
2081 + my_background.gray = 0;
2082 + png_set_background(png_ptr, &my_background, PNG_BACKGROUND_GAMMA_SCREEN,
2083 + 0, Display_Gamma);
2086 + if (info_ptr->bit_depth == 16)
2087 + png_set_strip_16(png_ptr);
2089 + if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY ||
2090 + info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
2092 + if (info_ptr->bit_depth == 1)
2093 + pinfo->colType = F_BWDITHER;
2094 + else
2095 + pinfo->colType = F_GREYSCALE;
2096 + png_set_expand(png_ptr);
2099 + pass=png_set_interlace_handling(png_ptr);
2101 + png_read_update_info(png_ptr, info_ptr);
2103 + if(info_ptr->color_type == PNG_COLOR_TYPE_RGB ||
2104 + info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
2105 + linesize = pinfo->w * 3;
2106 + pinfo->colType = F_FULLCOLOR;
2107 + pinfo->type = PIC24;
2108 + } else {
2109 + linesize = pinfo->w;
2110 + pinfo->type = PIC8;
2111 + if(info_ptr->color_type == PNG_COLOR_TYPE_GRAY ||
2112 + info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
2113 + for(i = 0; i < 256; i++)
2114 + pinfo->r[i] = pinfo->g[i] = pinfo->b[i] = i;
2115 + } else {
2116 + pinfo->colType = F_FULLCOLOR;
2117 + for(i = 0; i < info_ptr->num_palette; i++) {
2118 + pinfo->r[i] = info_ptr->palette[i].red;
2119 + pinfo->g[i] = info_ptr->palette[i].green;
2120 + pinfo->b[i] = info_ptr->palette[i].blue;
2124 + pinfo->pic = calloc((size_t)(linesize*pinfo->h), (size_t)1);
2126 + if(!pinfo->pic) {
2127 + png_error(png_ptr, "can't allocate space for PNG image");
2130 + png_start_read_image(png_ptr);
2132 + for(i = 0; i < pass; i++) {
2133 + byte *p = pinfo->pic;
2134 + for(j = 0; j < pinfo->h; j++) {
2135 + png_read_row(png_ptr, p, NULL);
2136 + read_anything = 1;
2137 + if((j & 0x1f) == 0) WaitCursor();
2138 + p += linesize;
2142 + png_read_end(png_ptr, info_ptr);
2144 + if(info_ptr->num_text > 0) {
2145 + commentsize = 1;
2147 + for(i = 0; i < info_ptr->num_text; i++)
2148 + commentsize += strlen(info_ptr->text[i].key) + 1 +
2149 + info_ptr->text[i].text_length + 2;
2151 + if((pinfo->comment = malloc(commentsize)) == NULL) {
2152 + png_warning(png_ptr,"can't allocate comment string");
2154 + else {
2155 + pinfo->comment[0] = '\0';
2156 + for(i = 0; i < info_ptr->num_text; i++) {
2157 + strcat(pinfo->comment, info_ptr->text[i].key);
2158 + strcat(pinfo->comment, "::");
2159 + strcat(pinfo->comment, info_ptr->text[i].text);
2160 + strcat(pinfo->comment, "\n");
2165 + png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
2167 + fclose(fp);
2169 + return 1;
2173 +/*******************************************/
2174 +static void
2175 +png_xv_error(png_ptr, message)
2176 + png_struct *png_ptr;
2177 + char *message;
2179 + SetISTR(ISTR_WARNING,"%s: libpng error: %s", fbasename, message);
2181 + longjmp(png_ptr->jmpbuf, 1);
2185 +/*******************************************/
2186 +static void
2187 +png_xv_warning(png_ptr, message)
2188 + png_struct *png_ptr;
2189 + char *message;
2191 + if (!png_ptr)
2192 + return;
2194 + SetISTR(ISTR_WARNING,"%s: libpng warning: %s", fbasename, message);
2197 +#endif
2198 diff -uNr xvpopup.c xvpopup.c
2199 --- ./xvpopup.c Thu Jan 19 19:09:31 1995
2200 +++ ./xvpopup.c Tue Feb 20 17:04:44 2001
2201 @@ -200,14 +200,14 @@
2203 if (!padHaveDooDads) {
2204 DCreate(&padWDial, popW, 16, puhigh-16-100-1,75,100,
2205 - 1, 2048, pWIDE, 10,
2206 + 1.0, 2048.0, (double)pWIDE, 1.0, 10.0,
2207 infofg, infobg, hicol, locol, "Width", NULL);
2208 DCreate(&padHDial, popW, 16+1+75, puhigh-16-100-1,75,100,
2209 - 1, 2048, pHIGH, 10,
2210 + 1.0, 2048.0, (double)pHIGH, 1.0, 10.0,
2211 infofg, infobg, hicol, locol, "Height", NULL);
2213 DCreate(&padODial, popW, 16+1+75+75+9, puhigh-16-100-1,75,100,
2214 - 0, 100, 100, 10,
2215 + 0.0, 100.0, 100.0, 1.0, 10.0,
2216 infofg, infobg, hicol, locol, "Opaque", NULL);
2218 MBCreate(&padMthdMB, popW, 100-2+44, 10, 140, 19, NULL,
2219 @@ -258,9 +258,9 @@
2220 else if (poptyp == ISPAD) {
2221 BTSetActive(&bts[0], (int) strlen(gsBuf));
2222 i = pWIDE * 3; RANGE(i,2048,9999);
2223 - DSetRange(&padWDial, 1, i, padWDial.val, 10);
2224 + DSetRange(&padWDial, 1.0, (double)i, padWDial.val, 1.0, 10.0);
2225 i = pHIGH * 3; RANGE(i,2048,9999);
2226 - DSetRange(&padHDial, 1, i, padHDial.val, 10);
2227 + DSetRange(&padHDial, 1.0, (double)i, padHDial.val, 1.0, 10.0);
2229 DSetActive(&padWDial, (padMode!=PAD_LOAD)); /* DSetRange activates dial */
2230 DSetActive(&padHDial, (padMode!=PAD_LOAD));
2231 @@ -465,9 +465,9 @@
2232 changedGSBuf(); /* careful! popW doesn't exist yet! */
2234 if (padHaveDooDads) {
2235 - oldW = padWDial.val;
2236 - oldH = padHDial.val;
2237 - oldO = padODial.val;
2238 + oldW = (int)padWDial.val;
2239 + oldH = (int)padHDial.val;
2240 + oldO = (int)padODial.val;
2242 else { oldW = pWIDE; oldH = pHIGH; oldO = 100; }
2244 @@ -486,9 +486,9 @@
2247 if (rv == 1) { /* cancelled: restore normal values */
2248 - DSetVal(&padWDial, oldW);
2249 - DSetVal(&padHDial, oldH);
2250 - DSetVal(&padODial, oldO);
2251 + DSetVal(&padWDial, (double)oldW);
2252 + DSetVal(&padHDial, (double)oldH);
2253 + DSetVal(&padODial, (double)oldO);
2256 XUnmapWindow(theDisp, padWDial.win);
2257 @@ -498,9 +498,9 @@
2258 /* load up return values */
2259 *pMode = padMode;
2260 *pStr = padBuf;
2261 - *pWide = padWDial.val;
2262 - *pHigh = padHDial.val;
2263 - *pOpaque = padODial.val;
2264 + *pWide = (int)padWDial.val;
2265 + *pHigh = (int)padHDial.val;
2266 + *pOpaque = (int)padODial.val;
2267 *pOmode = padOMode;
2269 return rv;
2270 @@ -972,8 +972,8 @@
2271 else if (popUp == ISPAD) {
2272 if (PTINRECT(x, y, padDButt.x, padDButt.y, padDButt.w, padDButt.h)) {
2273 if (BTTrack(&padDButt)) {
2274 - DSetVal(&padWDial, pWIDE);
2275 - DSetVal(&padHDial, pHIGH);
2276 + DSetVal(&padWDial, (double)pWIDE);
2277 + DSetVal(&padHDial, (double)pHIGH);
2281 diff -uNr xvps.c xvps.c
2282 --- ./xvps.c Thu Dec 22 23:34:42 1994
2283 +++ ./xvps.c Tue Feb 20 17:04:44 2001
2284 @@ -139,9 +139,9 @@
2285 CBCreate(&encapsCB, psW, 240, 7, "preview", infofg, infobg, hicol, locol);
2286 CBCreate(&pscompCB, psW, 331, 7, "compress", infofg, infobg, hicol, locol);
2288 - DCreate(&xsDial, psW, 240, 30, 80, 100, 10, 800, 100, 5,
2289 + DCreate(&xsDial, psW, 240, 30, 80, 100, 10.0, 800.0, 100.0, 0.5, 5.0,
2290 infofg, infobg, hicol, locol, "Width", "%");
2291 - DCreate(&ysDial, psW, 331, 30, 80, 100, 10, 800, 100, 5,
2292 + DCreate(&ysDial, psW, 331, 30, 80, 100, 10.0, 800.0, 100.0, 0.5, 5.0,
2293 infofg, infobg, hicol, locol, "Height", "%");
2294 xsDial.drawobj = changedScale;
2295 ysDial.drawobj = changedScale;
2296 @@ -236,10 +236,10 @@
2298 if (rd_int("psres")) { /* xv.psres: default paper resolution */
2299 if (def_int >= 10 && def_int <= 720) {
2300 - int i = (int) ((PIX2INCH * 100) / def_int);
2301 + double v = (PIX2INCH * 100) / def_int;
2303 - DSetVal(&xsDial, i);
2304 - DSetVal(&ysDial, i);
2305 + DSetVal(&xsDial, v);
2306 + DSetVal(&ysDial, v);
2310 @@ -836,7 +836,7 @@
2311 if (scx < scy) { sz_iny = h * scx; }
2312 else { sz_inx = w * scy; }
2314 - DSetVal(&xsDial, (int) ((100 * (sz_inx * PIX2INCH) / w) + .5));
2315 + DSetVal(&xsDial, 100 * (sz_inx * PIX2INCH) / w);
2316 DSetVal(&ysDial, xsDial.val);
2318 sz_inx = (double) w / PIX2INCH * (xsDial.val / 100.0);
2319 diff -uNr xvtiff.c xvtiff.c
2320 --- ./xvtiff.c Fri Jan 13 20:53:34 1995
2321 +++ ./xvtiff.c Tue Feb 20 17:50:02 2001
2322 @@ -12,7 +12,7 @@
2324 #ifdef HAVE_TIFF
2326 -#include "tiffio.h" /* has to be after xv.h, as it needs varargs/stdarg */
2327 +#include <tiffio.h> /* has to be after xv.h, as it needs varargs/stdarg */
2330 static byte *loadPalette PARM((TIFF *, uint32, uint32, int, int, PICINFO *));
2331 @@ -186,7 +186,7 @@
2332 break;
2335 - sprintf(pinfo->shrtInfo, "%ux%u TIFF.",w,h);
2336 + sprintf(pinfo->shrtInfo, "%lux%lu TIFF.",w,h);
2338 pic8 = (byte *) malloc((size_t) w*h);
2339 if (!pic8) FatalError("loadPalette() - couldn't malloc 'pic8'");
2340 @@ -214,7 +214,7 @@
2341 "???"),
2342 filesize);
2344 - sprintf(pinfo->shrtInfo, "%ux%u TIFF.",w,h);
2345 + sprintf(pinfo->shrtInfo, "%lux%lu TIFF.",w,h);
2347 /* allocate 24-bit image */
2348 pic24 = (byte *) malloc((size_t) w*h*3);
2349 @@ -301,10 +301,10 @@
2350 static byte **BWmap;
2351 static byte **PALmap;
2353 -typedef void (*tileContigRoutine) PARM((byte*, u_char*, RGBvalue*,
2354 +typedef void (*xvtileContigRoutine) PARM((byte*, u_char*, RGBvalue*,
2355 uint32, uint32, int, int));
2357 -typedef void (*tileSeparateRoutine) PARM((byte*, u_char*, u_char*, u_char*,
2358 +typedef void (*xvtileSeparateRoutine) PARM((byte*, u_char*, u_char*, u_char*,
2359 RGBvalue*, uint32, uint32, int, int));
2362 @@ -366,8 +366,8 @@
2363 static void putcontig8bitYCbCrtile PARM((byte *, u_char *, RGBvalue *,
2364 uint32, uint32, int, int));
2366 -static tileContigRoutine pickTileContigCase PARM((RGBvalue *));
2367 -static tileSeparateRoutine pickTileSeparateCase PARM((RGBvalue *));
2368 +static xvtileContigRoutine pickTileContigCase PARM((RGBvalue *));
2369 +static xvtileSeparateRoutine pickTileSeparateCase PARM((RGBvalue *));
2372 /*******************************************/
2373 @@ -641,7 +641,7 @@
2374 u_char *buf;
2375 int fromskew, toskew;
2376 u_int nrow;
2377 - tileContigRoutine put;
2378 + xvtileContigRoutine put;
2380 put = pickTileContigCase(Map);
2381 if (put == 0) return (0);
2382 @@ -708,7 +708,7 @@
2383 int tilesize;
2384 int fromskew, toskew;
2385 u_int nrow;
2386 - tileSeparateRoutine put;
2387 + xvtileSeparateRoutine put;
2389 put = pickTileSeparateCase(Map);
2390 if (put == 0) return (0);
2391 @@ -779,7 +779,7 @@
2393 uint32 row, y, nrow;
2394 u_char *buf;
2395 - tileContigRoutine put;
2396 + xvtileContigRoutine put;
2397 uint32 rowsperstrip;
2398 uint32 imagewidth;
2399 int scanline;
2400 @@ -832,7 +832,7 @@
2401 u_char *r, *g, *b;
2402 uint32 row, y, nrow;
2403 int scanline;
2404 - tileSeparateRoutine put;
2405 + xvtileSeparateRoutine put;
2406 uint32 rowsperstrip;
2407 uint32 imagewidth;
2408 u_int stripsize;
2409 @@ -1065,7 +1065,7 @@
2410 int fromskew, toskew;
2412 while (h-- > 0) {
2413 - UNROLL8(w,0, *cp++ = PALmap[*pp++][0]);
2414 + UNROLL8(w,, *cp++ = PALmap[*pp++][0]);
2415 cp += toskew;
2416 pp += fromskew;
2418 @@ -1262,7 +1262,7 @@
2420 } else {
2421 while (h-- > 0) {
2422 - UNROLL8(w,0,
2423 + UNROLL8(w,,
2424 *cp++ = pp[0];
2425 *cp++ = pp[1];
2426 *cp++ = pp[2];
2427 @@ -1335,7 +1335,7 @@
2429 } else {
2430 while (h-- > 0) {
2431 - UNROLL8(w,0,
2432 + UNROLL8(w,,
2433 *cp++ = *r++;
2434 *cp++ = *g++;
2435 *cp++ = *b++;
2436 @@ -1489,16 +1489,16 @@
2438 * Select the appropriate conversion routine for packed data.
2440 -static tileContigRoutine pickTileContigCase(Map)
2441 +static xvtileContigRoutine pickTileContigCase(Map)
2442 RGBvalue* Map;
2444 - tileContigRoutine put = 0;
2445 + xvtileContigRoutine put = 0;
2447 switch (photometric) {
2448 case PHOTOMETRIC_RGB:
2449 switch (bitspersample) {
2450 - case 8: put = (tileContigRoutine) putRGBcontig8bittile; break;
2451 - case 16: put = (tileContigRoutine) putRGBcontig16bittile; break;
2452 + case 8: put = putRGBcontig8bittile; break;
2453 + case 16: put = (xvtileContigRoutine)putRGBcontig16bittile; break;
2455 break;
2457 @@ -1540,16 +1540,16 @@
2458 * NB: we assume that unpacked single channel data is directed
2459 * to the "packed routines.
2461 -static tileSeparateRoutine pickTileSeparateCase(Map)
2462 +static xvtileSeparateRoutine pickTileSeparateCase(Map)
2463 RGBvalue* Map;
2465 - tileSeparateRoutine put = 0;
2466 + xvtileSeparateRoutine put = 0;
2468 switch (photometric) {
2469 case PHOTOMETRIC_RGB:
2470 switch (bitspersample) {
2471 - case 8: put = (tileSeparateRoutine) putRGBseparate8bittile; break;
2472 - case 16: put = (tileSeparateRoutine) putRGBseparate16bittile; break;
2473 + case 8: put = (xvtileSeparateRoutine) putRGBseparate8bittile; break;
2474 + case 16: put = (xvtileSeparateRoutine) putRGBseparate16bittile; break;
2476 break;
2478 diff -uNr xvtiffwr.c xvtiffwr.c
2479 --- ./xvtiffwr.c Tue Jan 3 22:28:13 1995
2480 +++ ./xvtiffwr.c Tue Feb 20 17:50:12 2001
2481 @@ -9,7 +9,7 @@
2483 #ifdef HAVE_TIFF
2485 -#include "tiffio.h" /* has to be after xv.h, as it needs varargs/stdarg */
2486 +#include <tiffio.h> /* has to be after xv.h, as it needs varargs/stdarg */
2489 #define ALLOW_JPEG 0 /* set to '1' to allow 'JPEG' choice in dialog box */