diff options
author | Dirk Meyer <dinoex@FreeBSD.org> | 2023-11-26 15:04:03 +0000 |
---|---|---|
committer | Dirk Meyer <dinoex@FreeBSD.org> | 2023-11-26 15:04:03 +0000 |
commit | c2069505c56276c241be5551055b82d82067c5b7 (patch) | |
tree | cbe7dee57d4bc7003dec756e9eaeaa246542009f | |
parent | 5576d8df9bdebba07845a6006d28cf750172237c (diff) | |
download | ports-c2069505c56276c241be5551055b82d82067c5b7.tar.gz ports-c2069505c56276c241be5551055b82d82067c5b7.zip |
graphics/xv: update to 4.2.0
-rw-r--r-- | graphics/xv/Makefile | 58 | ||||
-rw-r--r-- | graphics/xv/distinfo | 9 | ||||
-rw-r--r-- | graphics/xv/files/patch-Imakefile | 126 | ||||
-rw-r--r-- | graphics/xv/files/patch-config.h | 63 | ||||
-rw-r--r-- | graphics/xv/files/patch-xv.h | 10 | ||||
-rw-r--r-- | graphics/xv/files/patch-xvevent.c | 6 | ||||
-rw-r--r-- | graphics/xv/files/patch-xvgif.c | 12 | ||||
-rw-r--r-- | graphics/xv/files/patch-xvinfo.c | 11 | ||||
-rw-r--r-- | graphics/xv/files/patch-xvjp2k.c | 2377 | ||||
-rw-r--r-- | graphics/xv/files/patch-xvjpeg.c | 9 | ||||
-rw-r--r-- | graphics/xv/files/patch-xvmisc.c | 9 | ||||
-rw-r--r-- | graphics/xv/files/patch-xvpng.c | 509 | ||||
-rw-r--r-- | graphics/xv/files/patch-xvtext.c | 6 | ||||
-rw-r--r-- | graphics/xv/files/patch-xvvd.c | 14 | ||||
-rw-r--r-- | graphics/xv/pkg-descr | 2 | ||||
-rw-r--r-- | graphics/xv/pkg-plist | 290 |
16 files changed, 334 insertions, 3177 deletions
diff --git a/graphics/xv/Makefile b/graphics/xv/Makefile index eacddcdec1cb..ead1b403f35f 100644 --- a/graphics/xv/Makefile +++ b/graphics/xv/Makefile @@ -1,27 +1,24 @@ PORTNAME= xv -PORTVERSION= 3.10a -PORTREVISION= 22 +PORTVERSION= 4.2.0 +DISTVERSIONPREFIX= v +PORTREVISION= 0 CATEGORIES+= graphics -MASTER_SITES= ftp://ftp.cis.upenn.edu/pub/xv/:base \ - SF/png-mng/XV%20jumbo%20patches/20070520 - -DISTFILES= ${DISTNAME}${EXTRACT_SUFX}:base \ - ${DISTNAME}-jumbo-patches-20070520.tar.gz DIST_SUBDIR= ${PORTNAME} -PATCH_SITES= http://www.gregroelofs.com/code/ -PATCHFILES= xv-3.10a-enhancements.20070520-20081216.diff - MAINTAINER?= dinoex@FreeBSD.org COMMENT?= X11 program that displays images of various formats WWW= http://www.trilon.com/xv/ LIB_DEPENDS= libtiff.so:graphics/tiff \ libpng.so:graphics/png \ - libjasper.so:graphics/jasper + libjasper.so:graphics/jasper \ + libwebp.so:graphics/webp + +USES= cpe localbase cmake jpeg xorg +USE_XORG= xext x11 xt ice sm -USES= cpe imake jpeg xorg -USE_XORG= xext x11 xt +USE_GITHUB= yes +GH_ACCOUNT= jasper-software CPE_VENDOR= xv_project @@ -30,43 +27,22 @@ M17N_DESC= build with Multilingualization support .include <bsd.port.options.mk> -.if defined(CC) && ${CC:T:Mclang} -# Optimizer crashes with -# Assertion failed: (isPtrIV == IndVar->getType()->isPointerTy() && "IndVar type must match IVInit type") -CFLAGS:= ${CFLAGS:S/-O2//g} -.endif - .if ${PORT_OPTIONS:MM17N} -MAKE_ENV= LOCALE_EXTENSION=-DTV_MULTILINGUAL +CFLAGS+= -DTV_MULTILINGUAL DESCR= ${FILESDIR}/pkg-descr CONFLICTS_INSTALL= xv .else CONFLICTS_INSTALL= xv-m17n .endif -pre-patch: - ${PATCH} -d ${PATCH_WRKSRC} ${PATCH_ARGS} -p1 < ${WRKDIR}/xv-3.10a-jumbo-fix-enh-patch-20070520.txt +XV_DOCS= README.md src/docs/help -post-patch: - ${REINPLACE_CMD} -e "s@%%LOCALBASE%%@${LOCALBASE}@" \ - ${WRKSRC}/config.h -.for i in bggen.1 vdcomp.1 xcmap.1 xv.1 xvp2p.1 - ${CP} ${WRKSRC}/docs/${i:R}.man ${WRKSRC} +do-install-DOCS-on: +.for i in ${XV_DOCS} + ${INSTALL_DATA} ${WRKSRC}/${i} ${STAGEDIR}${DOCSDIR}/ .endfor -post-install: -.if ${PORT_OPTIONS:MDOCS} - ${MKDIR} ${STAGEDIR}${DOCSDIR} - ${INSTALL_DATA} ${WRKSRC}/README ${STAGEDIR}${DOCSDIR}/ - ${INSTALL_DATA} ${WRKSRC}/README.jumbo ${STAGEDIR}${DOCSDIR}/ - ${INSTALL_DATA} ${WRKSRC}/README.pcd ${STAGEDIR}${DOCSDIR}/ - ${INSTALL_DATA} ${WRKSRC}/docs/epsf.ps ${STAGEDIR}${DOCSDIR}/ - ${INSTALL_DATA} ${WRKSRC}/docs/xpm.ps ${STAGEDIR}${DOCSDIR}/ - ${INSTALL_DATA} ${WRKSRC}/docs/xvdocs.ps ${STAGEDIR}${DOCSDIR}/ - ${INSTALL_DATA} ${WRKSRC}/docs/xvtitle.ps ${STAGEDIR}${DOCSDIR}/ - ${INSTALL_DATA} ${WRKSRC}/docs/help ${STAGEDIR}${DOCSDIR}/ - ${INSTALL_DATA} ${WRKSRC}/docs/bmp.doc ${STAGEDIR}${DOCSDIR}/ - ${INSTALL_DATA} ${WRKSRC}/docs/gif* ${STAGEDIR}${DOCSDIR}/ -.endif +do-install-DOCS-off: + ${RM} -fr ${STAGEDIR}${DOCSDIR}/ .include <bsd.port.mk> diff --git a/graphics/xv/distinfo b/graphics/xv/distinfo index b592830be19a..c11f79e98b2d 100644 --- a/graphics/xv/distinfo +++ b/graphics/xv/distinfo @@ -1,6 +1,3 @@ -SHA256 (xv/xv-3.10a.tar.gz) = 03eb26b1e8f315c3093f4ae794862ba46637d16c055e8efbe5e3beb5d40fc451 -SIZE (xv/xv-3.10a.tar.gz) = 2259124 -SHA256 (xv/xv-3.10a-jumbo-patches-20070520.tar.gz) = 221ec89fdf0772bd09c845cbb337aecf411a1aee215140b676717f49e9e65c80 -SIZE (xv/xv-3.10a-jumbo-patches-20070520.tar.gz) = 1363802 -SHA256 (xv/xv-3.10a-enhancements.20070520-20081216.diff) = c47aa52b7dbf2e09896d3eba6411d78a56162a4b966197e40115c14d88c2e1eb -SIZE (xv/xv-3.10a-enhancements.20070520-20081216.diff) = 8847 +TIMESTAMP = 1700942420 +SHA256 (xv/jasper-software-xv-v4.2.0_GH0.tar.gz) = 2871338c517a7444fc9d6a3d146bc2c5c7bd98b50c83369b24d24ad49fa0ab87 +SIZE (xv/jasper-software-xv-v4.2.0_GH0.tar.gz) = 5381969 diff --git a/graphics/xv/files/patch-Imakefile b/graphics/xv/files/patch-Imakefile deleted file mode 100644 index dfdd490eb661..000000000000 --- a/graphics/xv/files/patch-Imakefile +++ /dev/null @@ -1,126 +0,0 @@ ---- Imakefile.orig 2009-05-17 15:02:50.000000000 +0200 -+++ Imakefile 2009-05-17 15:05:52.000000000 +0200 -@@ -6,13 +6,15 @@ - /* if, for whatever reason, you're unable to get the JPEG library to compile - * on your machine, *COMMENT OUT* the following line - */ --#define HaveJpeg -+/* #define HaveJpeg */ -+#define UseInstalledJpeg - - - /* if, for whatever reason, you're unable to get the TIFF library to compile - * on your machine, *COMMENT OUT* the following line - */ --#define HaveTiff -+/* #define HaveTiff */ -+#define UseInstalledTiff - - - /* if, for whatever reason, you're unable to get the PDS/VICAR support -@@ -124,20 +126,48 @@ - JPEG = -DDOJPEG - JPEGDIR = jpeg - LIBJPEG = $(JPEGDIR)/libjpeg.a -+DEPLIBJPEG = $(LIBJPEG) - JPEGINCLUDE = -I$(JPEGDIR) - #endif - -+#ifdef UseInstalledJpeg -+JPEG = -DDOJPEG -+LIBJPEG = -L${LOCALBASE}/lib -ljpeg -+JPEGINCLUDE = -I${LOCALBASE}/include -+#endif -+ - #ifdef HaveTiff - TIFF = -DDOTIFF - TIFFDIR = tiff - LIBTIFF = $(TIFFDIR)/libtiff.a -+DEPLIBTIFF = $(LIBTIFF) - TIFFINCLUDE = -I$(TIFFDIR) - #endif - -+#ifdef UseInstalledTiff -+TIFF = -DDOTIFF -DUSE_TILED_TIFF_BOTLEFT_FIX -DOG3 -+LIBTIFF = -L${LOCALBASE}/lib -ltiff -+TIFFINCLUDE = -I${LOCALBASE}/include -+#endif -+ - #ifdef HavePDS - PDS = -DDOPDS - #endif - -+PNG = -DDOPNG -+PNGINC = -I${LOCALBASE}/include -+PNGLIB = -L${LOCALBASE}/lib -lpng -+ -+JP2K = -DDOJP2K -+JP2KINC = -I${LOCALBASE}/include -+JP2KLIB = -L${LOCALBASE}/lib -ljasper -+ -+ZLIBDIR = /usr -+ZLIBINC = -I$(ZLIBDIR)/include -+ZLIBLIB = -L$(ZLIBDIR)/lib -lz -+ -+DOCDIR = -L${PREFIX}/share/doc/xv -+SYSCONFDIR = ${PREFIX}/etc/ - - #if defined(SCOArchitecture) - SCO= -Dsco -DPOSIX -DNO_RANDOM -@@ -149,14 +179,17 @@ - #endif - - --DEPLIBS = $(LIBJPEG) $(LIBTIFF) --LOCAL_LIBRARIES = $(XLIB) $(DEPLIBS) -+DEPLIBS = $(DEPLIBJPEG) $(DEPLIBTIFF) -+LOCAL_LIBRARIES = $(XLIB) $(LIBJPEG) $(LIBTIFF) ${PNGLIB} ${JP2KLIB} ${ZLIBLIB} - - DEFINES= $(SCO) $(UNIX) $(NODIRENT) $(VPRINTF) $(TIMERS) \ - $(HPUX7) $(JPEG) $(TIFF) $(PDS) $(DXWM) $(RAND) \ -- $(BACKING_STORE) $(BSDTYPES) $(SGI) $(MGCSFX) -+ ${PNG} ${JP2K} $(TVL10N) \ -+ -DDOCDIR=\"$(DOCDIR)\" \ -+ -DSYSCONFDIR=\"$(SYSCONFDIR)\" \ -+ $(BACKING_STORE) $(BSDTYPES) $(SGI) $(MGCSFX) $(LOCALE_EXTENSION) - --INCLUDES = $(JPEGINCLUDE) $(TIFFINCLUDE) -+INCLUDES = $(JPEGINCLUDE) $(TIFFINCLUDE) ${PNGINC} ${JP2KINC} ${ZLIBINC} - - SRCS1 = xv.c xvevent.c xvroot.c xvmisc.c xvimage.c xvcolor.c xvsmooth.c \ - xv24to8.c xvgif.c xvpm.c xvinfo.c xvctrl.c xvscrl.c xvalg.c \ -@@ -166,7 +199,7 @@ - xvbrowse.c xvtext.c xvpcx.c xviff.c xvtarga.c xvxpm.c xvcut.c \ - xvxwd.c xvfits.c xvpng.c xvzx.c xvwbmp.c xvpcd.c \ - xvmag.c xvpic.c xvmaki.c xvpi.c xvpic2.c xvvd.c xvmgcsfx.c \ -- xvml.c -+ xvml.c xvjp2k.c xvhips.c - - OBJS1 = xv.o xvevent.o xvroot.o xvmisc.o xvimage.o xvcolor.o xvsmooth.o \ - xv24to8.o xvgif.o xvpm.o xvinfo.o xvctrl.o xvscrl.o xvalg.o \ -@@ -176,7 +209,7 @@ - xvbrowse.o xvtext.o xvpcx.o xviff.o xvtarga.o xvxpm.o xvcut.o \ - xvxwd.o xvfits.o xvpng.o xvzx.o xvwbmp.o xvpcd.o \ - xvmag.o xvpic.o xvmaki.o xvpi.o xvpic2.o xvvd.o xvmgcsfx.o \ -- xvml.o -+ xvml.o xvjp2k.o xvhips.o - - SRCS2= bggen.c - OBJS2= bggen.o -@@ -271,11 +304,11 @@ - #endif - - --InstallManPageLong(docs/xv,$(MANDIR),xv) --InstallManPageLong(docs/bggen,$(MANDIR),bggen) --InstallManPageLong(docs/xcmap,$(MANDIR),xcmap) --InstallManPageLong(docs/xvp2p,$(MANDIR),xvpictoppm) --InstallManPageLong(docs/vdcomp,$(MANDIR),vdcomp) -+InstallManPage(xv,$(MANDIR)) -+InstallManPage(bggen,$(MANDIR)) -+InstallManPage(xcmap,$(MANDIR)) -+InstallManPage(xvp2p,$(MANDIR)) -+InstallManPage(vdcomp,$(MANDIR)) - - InstallNonExecFile(xv_mgcsfx.sample,$(MGCSFXDIR)) - diff --git a/graphics/xv/files/patch-config.h b/graphics/xv/files/patch-config.h index 5d36a12b5046..c53959ab6589 100644 --- a/graphics/xv/files/patch-config.h +++ b/graphics/xv/files/patch-config.h @@ -1,20 +1,6 @@ ---- config.h.orig Thu Aug 27 04:50:47 1998 -+++ config.h Thu Aug 27 04:51:05 1998 -@@ -103,10 +103,9 @@ - * should not need to be changed - */ - --/* #define GS_PATH "/usr/local/bin/gs" */ --#define GS_PATH "gs" --/* #define GS_LIB "." */ --/* #define GS_DEV "ppmraw" */ -+#define GS_PATH "%%LOCALBASE%%/bin/gs" -+#define GS_LIB "%%LOCALBASE%%/lib/ghostscript" -+#define GS_DEV "ppmraw" - - - /*************************************************************************** -@@ -159,7 +159,7 @@ +--- src/config.h.orig 2023-07-17 01:25:42 UTC ++++ src/config.h +@@ -191,7 +191,7 @@ * in the following line. */ @@ -23,7 +9,7 @@ /*************************************************************************** -@@ -175,8 +175,8 @@ +@@ -207,8 +207,8 @@ * is read-only), change 'undef' to 'define' the VIRTUAL_TD line. */ @@ -32,27 +18,9 @@ +#define AUTO_EXPAND +#define VIRTUAL_TD - #if !defined(AUTO_EXPAND) && defined(VIRTUAL_TD) + #if defined(VIRTUAL_TD) && !defined(AUTO_EXPAND) # undef VIRTUAL_TD -@@ -190,7 +190,7 @@ - * Shunauzer, change 'undef' to 'define' in the following line. - */ - --#undef VS_ADJUST -+#define VS_ADJUST - - - /*************************************************************************** -@@ -216,7 +216,7 @@ - * 'undef' to 'define' in the following line. - */ - --#undef TV_L10N -+/* #undef TV_L10N */ - - #ifdef TV_L10N - /* -@@ -259,7 +259,7 @@ +@@ -291,7 +291,7 @@ * magic number or suffix in "~/.xv_mgcsfx" . * To enable this feature, change 'undef' to 'define' in the following line. */ @@ -61,24 +29,7 @@ #ifdef HAVE_MGCSFX /* -@@ -285,14 +285,14 @@ - * WARNING : If you decide to use preprocessor, you must not write - * '# <comment>' style comment in startup file. Because, - * preprocessor can't recognize. */ --# undef USE_MGCSFX_PREPROCESSOR -+# define USE_MGCSFX_PREPROCESSOR - - # ifdef USE_MGCSFX_PREPROCESSOR - /* - * This is used like "system("MGCSFX_PREPROCESSOR MGCSFX_RC > tmp_name");", - * and read tmp_name instead of MGCSFX_RC. - */ --# define MGCSFX_PREPROCESSOR "/usr/lib/cpp" -+# define MGCSFX_PREPROCESSOR "/usr/bin/cpp" - /* # define MGCSFX_PREPROCESSOR "cc -E" */ - - # endif /* USE_MGCSFX_PREPROCESSOR */ -@@ -325,7 +325,7 @@ +@@ -352,7 +352,7 @@ * 'undef' to 'define' in the following line. */ diff --git a/graphics/xv/files/patch-xv.h b/graphics/xv/files/patch-xv.h index 631f2cc5515e..8795af429413 100644 --- a/graphics/xv/files/patch-xv.h +++ b/graphics/xv/files/patch-xv.h @@ -1,11 +1,11 @@ ---- xv.h.orig 2009-05-17 12:01:21.000000000 +0200 -+++ xv.h 2009-05-17 12:02:58.000000000 +0200 -@@ -158,7 +159,7 @@ +--- src/xv.h.orig 2023-07-17 01:25:42 UTC ++++ src/xv.h +@@ -183,7 +183,7 @@ #ifndef VMS # include <errno.h> -# ifndef __NetBSD__ +# if !defined(__NetBSD__) && !defined(__FreeBSD__) - # if !(defined __GLIBC__ && __GLIBC__ >= 2) + # if !(defined(__GLIBC__) && __GLIBC__ >= 2) && !defined(__OpenBSD__) extern int errno; /* SHOULD be in errno.h, but often isn't */ - extern char *sys_errlist[]; /* this too... */ + # ifndef XV_HAVE_SYSERRLISTDECL diff --git a/graphics/xv/files/patch-xvevent.c b/graphics/xv/files/patch-xvevent.c index 5ce5d4faeec8..8245b11534ba 100644 --- a/graphics/xv/files/patch-xvevent.c +++ b/graphics/xv/files/patch-xvevent.c @@ -1,6 +1,6 @@ ---- xvevent.c.orig 2009-05-22 07:21:18.000000000 +0200 -+++ xvevent.c 2009-05-22 07:21:48.000000000 +0200 -@@ -814,7 +814,7 @@ +--- src/xvevent.c.orig 2023-07-17 01:25:42 UTC ++++ src/xvevent.c +@@ -828,7 +828,7 @@ int HandleEvent(event, donep) debkludge_offy = eHIGH-xwa.height+p_offy; } diff --git a/graphics/xv/files/patch-xvgif.c b/graphics/xv/files/patch-xvgif.c index 9c769565196c..e9d6c25122be 100644 --- a/graphics/xv/files/patch-xvgif.c +++ b/graphics/xv/files/patch-xvgif.c @@ -1,7 +1,7 @@ ---- xvgif.c.orig 2009-05-17 08:25:07.000000000 +0200 -+++ xvgif.c 2009-05-17 09:37:28.000000000 +0200 -@@ -169,8 +169,12 @@ - +--- src/xvgif.c.orig 2023-07-17 01:25:42 UTC ++++ src/xvgif.c +@@ -186,8 +186,12 @@ int LoadGIF(fname, pinfo) + aspect = NEXTBYTE; if (aspect) { +#if 0 @@ -11,5 +11,5 @@ + normaspect = (float) (aspect + 15) / 64.0; /* gif89 aspect ratio */ +#endif if (DEBUG) fprintf(stderr,"GIF89 aspect = %f\n", normaspect); - } - + /* FIXME: apparently this _should_ apply to all frames in a multi-image + * GIF (i.e., PgUp/PgDn), but it doesn't */ diff --git a/graphics/xv/files/patch-xvinfo.c b/graphics/xv/files/patch-xvinfo.c deleted file mode 100644 index 05547a174ff0..000000000000 --- a/graphics/xv/files/patch-xvinfo.c +++ /dev/null @@ -1,11 +0,0 @@ ---- xvinfo.c.orig 1994-12-22 22:34:41 UTC -+++ xvinfo.c -@@ -26,7 +26,7 @@ - #define INFOHIGH 270 - - /* max length of an Info String */ --#define ISTRLEN 80 -+#define ISTRLEN 256 - - /* baseline of top line of text */ - #define TOPBASE (36 + penn_height/2 + 4 + 8 + ASCENT) diff --git a/graphics/xv/files/patch-xvjp2k.c b/graphics/xv/files/patch-xvjp2k.c deleted file mode 100644 index 2f84d53a8c16..000000000000 --- a/graphics/xv/files/patch-xvjp2k.c +++ /dev/null @@ -1,2377 +0,0 @@ -diff -ur ./xvjp2k.c /home/src/master/GIT/xv/src/xvjp2k.c ---- ./xvjp2k.c 2022-02-20 20:18:25.590840000 +0100 -+++ /home/src/master/GIT/xv/src/xvjp2k.c 2022-02-20 20:39:26.277883000 +0100 -@@ -2,20 +2,20 @@ - * xvjp2k.c - I/O subroutines for JPEG 2000 format pictures - * - * This module is a "shim" between XV and a JPEG 2000 CODEC in the open-source -- * JasPer Library created by Michael D. Adams; for more information, see the URL -- * "http://www.ece.uvic.ca/~mdadams/jasper". We don't use most of the other -- * facilities in this library, so it's better to link XV with a UNIX "archive" -- * representation of it, not a DLL. -+ * JasPer Library created by Michael D. Adams; for more information, see the -+ * URL "http://www.ece.uvic.ca/~mdadams/jasper". We don't use most of the -+ * other facilities in this library, so it's better to link XV with a UNIX -+ * "archive" representation of it, not a DLL. - * - * JPEG 2000 files can be represented in either of two general ways: The - * simplest representation is a "code stream", which often has a ".jpc" file - * name suffix and is organized much like a classical JPEG file, except that - * unfortunately, JPEG 2000 code streams indicate the no. of colors in an image - * but no longer give any clues about its color space (e.g., RGB or YCbCr). -- * Instead, there is now a semantically higher-level representation, which often -- * has a ".jp2" file name suffix and encapsulates a "code stream" with (possibly -- * a lot of) color-space information, optionally including things like ICC -- * correction tables. -+ * Instead, there is now a semantically higher-level representation, which -+ * often has a ".jp2" file name suffix and encapsulates a "code stream" with -+ * (possibly a lot of) color-space information, optionally including things -+ * like ICC correction tables. - * - * Compared to the IJG JPEG Library used in file "xvjpeg.c", one must solve - * several problems for color images when marrying JasPer to XV. -@@ -25,9 +25,9 @@ - * normal "X Windows" display, so we must carefully check a decoded image's - * parameters in order to reject anything that we can't handle gracefully. - * -- * 2. JasPer prefers to decode/encode images using color-plane "slices", instead -- * of interleaved pixels needed by "X Windows", so we must (de)interleave -- * copies of the image buffer here. -+ * 2. JasPer prefers to decode/encode images using color-plane "slices", -+ * instead of interleaved pixels needed by "X Windows", so we must -+ * (de)interleave copies of the image buffer here. - * - * XXX Things to do: - * -@@ -42,599 +42,419 @@ - * - * --Scott Marovich <marovich@hpl.hp.com>, Hewlett-Packard Laboratories, - * January 2005. -+ * -+ * Michael Aadams <mdadams@ece.uvic.ca>, University of Victoria, January 2022. -+ * The original code needed to be almost entirely rewritten due to its -+ * insistence on bypassing the JasPer library API and violating many -+ * preconditions in the usage of the API (which, of course, caused -+ * many problems as the JasPer library evolved over time). -+ * - */ - #include "copyright.h" - --#define NEEDSARGS -+#define NEEDSARGS - #include "xv.h" - - #ifdef HAVE_JP2K - - #include <jasper/jasper.h> --/* missing prototype in 1.701.0, sigh: */ --jas_stream_t *jas_stream_freopen PARM((const char *, const char *, FILE *)); - --static const char *fbasename, /* File's base name, for error/warning msgs */ -- bad_samp[] = "%s: can't read %d-plane %s file!", -- fmode[] = "rb", -- full_msg[] = "%s %s. (%ld bytes)", -- jp2_kind[] = "JP2", -- jpc_kind[] = "JPEG 2000", -- load_msg[] = "Loading %dx%d %s %s (%ld bytes)...", -- no_mem[] = "%s: can't read %s file - out of memory", -- pixel_size[] = "%s: can't display %d-bit pixels!", -- shrt_msg[] = "%dx%d %s %s. ", -- truncated[] = "%s: Unexpected end of %s file", -- read_err[] = "%s: I/O error reading %s file", -- bad_dims[] = "%s: error in JPEG-2000 header (bad image size)"; -+#define GIBI (1024ULL * 1024ULL * 1024ULL) - --/* We only want to override the JasPer Library's "jas_eprintf()" subroutine in -- order to make it a "wrapper" around XV's own error-reporting subroutine, but -- because of the way the former is currently packaged in JasPer Library Version -- 1.701, we must override everything else packaged in the "jas_debug.o" module -- with it, otherwise we get "duplicate definition" messages from the linker. --*/ --int jas_getdbglevel(void) {return 0;} --int jas_setdbglevel(int n) {return 0;} --int jas_memdump(FILE *fp,void *data,size_t len) {return 0;} -+static const char *fbasename, /* File's base name, for error/warning msgs */ -+ bad_samp[] = "%s: can't read %d-plane %s file!", fmode[] = "rb", -+ full_msg[] = "%s %s. (%ld bytes)", jp2_kind[] = "JP2", -+ jpc_kind[] = "JPEG 2000", load_msg[] = "Loading %dx%d %s %s (%ld bytes)...", -+ no_mem[] = "%s: can't read %s file - out of memory", -+ pixel_size[] = "%s: can't display %d-bit pixels!", -+ shrt_msg[] = "%dx%d %s %s. ", -+ truncated[] = "%s: Unexpected end of %s file", -+ read_err[] = "%s: I/O error reading %s file", -+ bad_dims[] = "%s: error in JPEG-2000 header (bad image size)"; - --int jas_eprintf(const char *fmt,...) /* Handle JasPer Library message */ -+static int get_debug_level(void) - { -- static char error[] = "error: ", warning[]= "warning: "; -- va_list ap; -- int kind = ISTR_WARNING; -- char buffer[512]; -- register char *p; -- -- /* Unlike the IJG JPEG Library, the JasPer Library current has no graceful way -- for an application (= us!) to intercept its diagnostic messages and output -- them using our own subroutines, so this ugly replacement for its output -- subroutine will have to suffice. At Version 1.701, lthough the library's -- own "jas_eprintf()" is a varargs subroutine, all calls currently pass just -- 1 string with a Line Feed at the end and no "printf(3C)" arguments. Most -- strings begin with "error: " or "warning: ", although a few have neither. -- We try to translate these into the format preferred by XV, trimming any -- trailing Line Feed character (ugh!). -- */ -- va_start(ap, fmt); -- vsnprintf(p = buffer,512,fmt,ap); -- va_end(ap); -- while (*p++); -- if (p[-2] == '\n') p[-2] = '\0'; -- p = buffer; -- if (strncmp(p,error,sizeof error) == 0) /* "error: ... " */ -- { -- kind = ISTR_WARNING; -- p += sizeof error; -- } -- else /* "warning: ... " */ -- if (strncmp(p,warning,sizeof warning) == 0) -- { -- kind = ISTR_INFO; -- p += sizeof warning; -- }; -- SetISTR(kind,"%s: %s",fbasename,p); -- return strlen(fmt); -+ int debug_level = 0; -+ const char *cp; -+ if ((cp = getenv("XV_JASPER_DEBUG_LEVEL"))) { -+ debug_level = atoi(cp); -+ } -+ return debug_level; - } - --static char *SetBuf(FILE *f) --{ -- char *buf; -- register char *p; -+#if (JAS_VERSION_MAJOR >= 3) -+static int print_log(jas_logtype_t type, const char *format, va_list ap) { -+ const int buffer_size = 512; -+ char buffer[buffer_size]; -+ int count; - -- /* JPEG 2000 image files are apt to be large, but the buffer size allocated by -- most implementations of the "C" Standard I/O Library is still ridiculously -- small, typically 1 KB. We want to allocate a much larger buffer for higher -- I/O efficiency, but the details are unfortunately a bit platform-specific. -- Under UNIX systems with virtual memory, we want to encourage its internal -- "physio()" subroutine by making the buffer an integral number of pages, -- aligned on a page-multiple memory address boundary. Under HP-UX 11.1+ and -- perhaps other operating-systems, a Standard I/O buffer is preceded by a -- header whose size must also be taken into account. -- */ --# ifndef IOBUFSIZ --# define IOBUFSIZ 65536 --# endif /* IOBUFSIZ */ --# ifdef __hpux --# define OVERHEAD sizeof(mbstate_t) --# endif /* __hpux */ --# ifndef OVERHEAD --# define OVERHEAD 0 --# endif /* OVERHEAD */ -+ int log_class = jas_logtype_getclass(type); -+ int kind; -+ switch (log_class) { -+ case JAS_LOGTYPE_CLASS_INFO: -+ kind = ISTR_INFO; -+ break; -+ case JAS_LOGTYPE_CLASS_WARN: -+ case JAS_LOGTYPE_CLASS_ERROR: -+ default: -+ kind = ISTR_WARNING; -+ break; -+ } - --# ifdef NBPG -- if (!(buf = p = malloc(NBPG+OVERHEAD+IOBUFSIZ))) return 0; -- p = (char *)((unsigned long)p+NBPG-1 & ~(NBPG-1)); -- p -= OVERHEAD; --# else /* not NBPG */ -- if (!(buf = p = malloc(OVERHEAD+IOBUFSIZ))) return 0; -- p += OVERHEAD; --# endif /* NBPG */ -- setvbuf(f,p,_IOFBF,OVERHEAD+IOBUFSIZ); -- return buf; --# undef OVERHEAD --# undef IOBUFSIZ -+ count = vsnprintf(buffer, buffer_size, format, ap); -+ -+ if (log_class == JAS_LOGTYPE_CLASS_WARN || -+ log_class == JAS_LOGTYPE_CLASS_ERROR) { -+ if (get_debug_level() >= 1) { -+ jas_eprintf("%s", buffer); -+ } else { -+ int i; -+ for (i = 0; i < count; ++i) { -+ if (buffer[i] == '\n') { -+ buffer[i] = ' '; -+ } -+ } -+ SetISTR(kind, "%s: %s", fbasename, buffer); -+ } -+ } else { -+ jas_eprintf("%s", buffer); -+ } -+ return count; - } -+#endif - --int LoadJPC(char *fname,register PICINFO *pinfo,int quick) --{ -- jas_image_t *img; -- jas_stream_t *str; -- FILE *fp; -- char *iobuf; -- const char *s; -- unsigned long filesize; -- long w, h, npixels, bufsize; -- int ok = 0, vstride; -- register int i; -+static int LoadJP2K(char *fname, register PICINFO *pinfo, int quick, -+ bool jpc_format) { -+ jas_image_t *img = 0; -+ jas_stream_t *str = 0; -+ FILE *fp; -+ const char *s; -+ unsigned long filesize; -+ long w, h, npixels, bufsize; -+ int vstride; -+ register int i; -+ jas_matrix_t *data = 0; - -- /* Load a JPEG 2000 "code stream" image file into a pixel buffer for XV. -- Unlike classical JPEG files, they have no clue about the image's color -- space, so we check for 8-bit data samples but make no effort to check or -- convert color spaces, and "what you see is what you get". For now, ignore -- the "quick" option to return a reduced-resolution or -size image. Return 1 -- on success, or 0 on failure. -- */ -- if (!(fp = xv_fopen(fname,fmode))) return 0; -- fbasename = BaseName(fname); /* Input file's base name, for message(s) */ -- if (!(iobuf = SetBuf(fp))) -- { -- (void)fclose(fp); -- SetISTR(ISTR_WARNING,no_mem,fbasename,jpc_kind); -- goto L3; -- } -+ int ret = 1; - -- /* Before telling the JasPer Library about this file, get its size for display -- purposes. Non-UNIX systems don't necessarily simulate "stat(2)", so do it -- crudely but portably by seeking to the end, then back to the beginning. -- */ -- fseek(fp,0L,2); -- filesize = ftell(fp); -- fseek(fp,0L,0); -+ int debug_level = get_debug_level(); -+#if (JAS_VERSION_MAJOR >= 3) -+ size_t max_mem = jas_get_total_mem_size(); -+ if (!max_mem) { -+ max_mem = GIBI; -+ } -+ jas_conf_clear(); -+ jas_conf_set_max_mem_usage(max_mem); -+ jas_init_library(); -+ jas_init_thread(); -+ jas_set_vlogmsgf(print_log); -+#else -+ jas_init(); -+#endif -+#if (JAS_VERSION_MAJOR >= 3) -+ jas_set_debug_level(debug_level); -+#else -+ jas_setdbglevel(debug_level); -+#endif - -- /* "jas_stream_close()" will eventually close the input file, so only do it -- explicitly if no stream can be created: -- */ -- if (!(str = jas_stream_freopen(fname,fmode,fp))) /* nice if prototype... */ -- { -- (void)fclose(fp); -- goto L3; -- } -+ if (!(fp = xv_fopen(fname, fmode))) { -+ return 0; -+ } -+ /* Input file's base name, for message(s) */ -+ fbasename = BaseName(fname); - -- /* It's not clear to me whether the following represents a JasPer Library "bug" -- but it sure looks goofy: Unless a stream buffer is marked "read only", -- which only happens when the stream's "fillbuf" method is called, even though -- our buffers are always "read only", the library will try to flush out buffer -- contents when the stream is destroyed, which makes it die a horrible death. -- So, mark the stream buffer proactively: -- */ -- str->bufmode_ |= JAS_STREAM_RDBUF; /* We will only read the stream buffer */ -- if (!(img = jpc_decode(str,0))) goto L2; -- if ((vstride = jas_image_numcmpts(img))) /* num. color planes */ -- { -+ /* Compute file size is portable way. */ -+ fseek(fp, 0L, 2); -+ filesize = ftell(fp); -+ fseek(fp, 0L, 0); - -- /* After the image-component streams created, they are left in a "write" -- state with the streams' cursors positioned at their ends, so "seek" in -- order to "read" each stream from its beginning. -- */ -- i = vstride; -- while (--i >= 0) -- if (jas_stream_seek(img->cmpts_[i]->stream_,0L,0)) -- { -- SetISTR(ISTR_WARNING,read_err,fbasename,jpc_kind); -- goto L1; -- } -- } -- w = jas_image_width(img); -- h = jas_image_height(img); -+#if (JAS_VERSION_MAJOR >= 3) -+ /* -+ This approach will not work in JasPer prior to 3.0.0 due to a bug in -+ the stream code. -+ */ -+ if (!(str = jas_stream_freopen(fname,fmode,fp))) { -+ fclose(fp); -+ ret = 0; -+ goto done; -+ } - -- /* avoid buffer overflow */ -- npixels = w * h; -- bufsize = vstride * npixels; -- if (w <= 0 || h <= 0 || npixels/w != h || bufsize/vstride != npixels) -- { -- (void)fclose(fp); -- SetISTR(ISTR_WARNING,bad_dims,fbasename); -- goto L1; -- } -- pinfo->normw = pinfo->w = w; -- pinfo->normh = pinfo->h = h; -+ /* It's not clear to me whether the following represents a JasPer Library -+ "bug" but it sure looks goofy: Unless a stream buffer is marked "read -+ only", which only happens when the stream's "fillbuf" method is called, -+ even though our buffers are always "read only", the library will try to -+ flush out buffer contents when the stream is destroyed, which makes it -+ die a horrible death. So, mark the stream buffer proactively: -+ */ -+ str->bufmode_ |= JAS_STREAM_RDBUF; /* We will only read the stream buffer */ -+#else -+ { -+ if (!(str = jas_stream_memopen(0, 0))) { -+ ret = 0; -+ goto done; -+ } -+ const size_t buffer_size = 1024; -+ char buffer[buffer_size]; -+ for (;;) { -+ size_t count; -+ count = fread(buffer, 1, buffer_size, fp); -+ if (!count) { -+ if (!feof(fp)) { -+ ret = 0; -+ goto done; -+ } -+ break; -+ } -+ if (jas_stream_write(str, buffer, count) != count) { -+ ret = 0; -+ goto done; -+ } -+ } -+ jas_stream_rewind(str); -+ } -+#endif - -- /* Sanity-check the image's color space and no. of colors. For now, accept -- only "generic" color spaces, not files needing image-specific color -- correction, but fix that someday... -- */ -- switch (vstride) -- { -- default: -- SetISTR(ISTR_WARNING,bad_samp,fbasename,vstride,jpc_kind); -- goto L1; -- case 1: -- if ((i = jas_image_cmptprec(img,0)) != 8) /* not 8-bit pixels */ -- { -- SetISTR(ISTR_WARNING,pixel_size,fbasename,i); -- goto L1; -- } -- s = "Greyscale"; -- pinfo->type = PIC8; -- pinfo->colType = F_GREYSCALE; -- i = 256; /* Return fake indexed-color "map" */ -- while (--i >= 0) pinfo->r[i] = pinfo->g[i] = pinfo->b[i] = i; -- break; -- case 3: -+ const jas_image_fmtinfo_t *fmtinfo = jas_image_lookupfmtbyname( -+ jpc_format ? "jpc" : "jp2"); -+ assert(fmtinfo); -+ if (!(img = jas_image_decode(str, fmtinfo->id, 0))) { -+ ret = 0; -+ goto done; -+ } - -- /* BEWARE OF KLUDGE: If the image's color space is RGB, assume that the -- data-sample precision for all color planes is the -- same. If the color space is YCbCr, assume the luminance (Y = 0th) -- component has the greatest precision, although the chrominance -- (Cr = 1st, Cb = 2nd) components are usually sub-sampled. -- */ -- if ((i = jas_image_cmptprec(img,0)) != 8) /* not 24-bit pixels */ -- { -- SetISTR(ISTR_WARNING,pixel_size,fbasename,i*3); -- goto L1; -- } -- s = "Color"; -- pinfo->type = PIC24; -- pinfo->colType = F_FULLCOLOR; -+ w = jas_image_width(img); -+ h = jas_image_height(img); -+ vstride = jas_image_numcmpts(img); - -- /* XXX Unlike the IJG JPEG Library, the JasPer Library is apparently -- unable to quantize colors or tell us whether the image's colors -- were quantized by its creator, so it seems that we can't return a -- color map for XV to potentially use 8-bit indexed color. If there -- *is* an easy way to do it that escapes me, put the code here someday. -- */ -- } -- if (!(pinfo->pic = (byte *)malloc(bufsize))) /* image buffer for XV */ -- { -- SetISTR(ISTR_WARNING,no_mem,fbasename,jpc_kind); -- goto L1; -- } -- pinfo->frmType = F_JPC; -- sprintf(pinfo->fullInfo,full_msg,s,jpc_kind,filesize); -- sprintf(pinfo->shrtInfo,shrt_msg,pinfo->w,pinfo->h,s,jpc_kind); -- SetISTR(ISTR_INFO,load_msg,pinfo->normw,pinfo->normh,s,jpc_kind,filesize); -- if (vstride == 1) /* gray-scale image */ -- { register jas_stream_t *c = img->cmpts_[0]->stream_; -- register byte *p = pinfo->pic; -+ /* avoid buffer overflow */ -+ npixels = w * h; -+ bufsize = vstride * npixels; -+ if (w <= 0 || h <= 0 || npixels / w != h || bufsize / vstride != npixels) { -+ (void)fclose(fp); -+ SetISTR(ISTR_WARNING, bad_dims, fbasename); -+ ret = 0; -+ goto done; -+ } -+ pinfo->normw = pinfo->w = w; -+ pinfo->normh = pinfo->h = h; - -- /* Since this is a 1-plane image, avoid a lot of errant nonsense in the -- JasPer Library by sequentially reading all of the data into our buffer -- directly. -- */ -- do if ((i = (*c->ops_->read_)(c->obj_,(char *)p,bufsize)) <= 0) -- { -- SetISTR(ISTR_WARNING,i < 0 ? read_err : truncated,fbasename, -- jpc_kind); -- goto L1; -- } -- while ((p += i),(bufsize -= i) > 0); -- } -- else /* RGB color image */ -- { -+ /* Sanity-check the image's color space and no. of colors. For now, accept -+ only "generic" color spaces, not files needing image-specific color -+ correction, but fix that someday... -+ */ -+ switch (vstride) { -+ static char color_space[] = {"%s: invalid color space!"}; - -- /* Reading color images is inefficient because JPEG 2000 wants to partition -- file data into separate image planes (colors), while XV wants data -- samples from each plane to be interleaved as 3-byte pixels. Apparently -- the fastest method consists of 3 passes through the XV image buffer, -- into which we insert the bytes of each component. -- */ -- i = 0; -- do /* each color component */ -- { long npix = npixels; -- register jas_stream_t *c = img->cmpts_[i]->stream_; -- register byte *p = pinfo->pic + i; -+ default: -+ SetISTR(ISTR_WARNING, bad_samp, fbasename, vstride, jp2_kind); -+ ret = 0; -+ goto done; -+ case 1: -+ if (!jas_clrspc_isunknown(i = jas_image_clrspc(img)) && -+ jas_clrspc_fam(i) != JAS_CLRSPC_FAM_GRAY) { -+ SetISTR(ISTR_WARNING, color_space, fbasename); -+ ret = 0; -+ goto done; -+ } -+ if ((i = jas_image_cmptprec(img, 0)) != 8) /* not 8-bit pixels */ -+ { -+ SetISTR(ISTR_WARNING, pixel_size, fbasename, i); -+ ret = 0; -+ goto done; -+ } -+ s = "Greyscale"; -+ pinfo->type = PIC8; -+ pinfo->colType = F_GREYSCALE; -+ i = 256; /* Return fake indexed-color "map" */ -+ while (--i >= 0) -+ pinfo->r[i] = pinfo->g[i] = pinfo->b[i] = i; -+ break; -+ case 3: -+ if (jas_clrspc_isunknown(i = jas_image_clrspc(img))) { -+ SetISTR(ISTR_WARNING, color_space, fbasename); -+ ret = 0; -+ goto done; -+ } -+ if (jas_clrspc_fam(i) != JAS_CLRSPC_FAM_RGB) { -+ jas_image_t *oimg; -+ jas_cmprof_t *profile; - -- do /* each pixel */ -- { register int b; -+ /* Here's where the JasPer Library really shines. The only color -+ space that XV handles is RGB, so if that's not what our image -+ uses, then to quote Capt. Kirk: "Make it so!" -+ */ -+ if (!(profile = jas_cmprof_createfromclrspc(JAS_CLRSPC_SRGB))) { -+ SetISTR(ISTR_WARNING, "%s: can't create RGB profile", -+ fbasename); -+ ret = 0; -+ goto done; -+ } -+ img = -+ jas_image_chclrspc(oimg = img, profile, JAS_CMXFORM_INTENT_PER); -+ jas_cmprof_destroy(profile); -+ if (!img) /* Oops! We failed, so restore original image */ -+ { -+ img = oimg; -+ SetISTR(ISTR_WARNING, "%s: can't convert to RGB", fbasename); -+ ret = 0; -+ goto done; -+ } -+ jas_image_destroy(oimg); -+ } - -- if ((b = jas_stream_getc(c)) < 0) -- { -- SetISTR(ISTR_WARNING, -- (c->flags_ & JAS_STREAM_EOF) ? truncated : read_err, -- fbasename,jpc_kind); -- goto L1; -- } -- *p = b; -- } -- while ((p += 3),--npix > 0); -- } -- while (++i <= 2); -- } -- ok = 1; /* Success! */ --L1: jas_image_destroy(img); --L2: (void)jas_stream_close(str); -- free(iobuf); --L3: return ok; --} -+ /* BEWARE OF KLUDGE: If the image's color space is RGB, assume that the -+ data-sample precision for all color planes is the -+ same. If the color space is YCbCr, assume the luminance (Y = 0th) -+ component has the greatest precision, although the chrominance -+ (Cr = 1st, Cb = 2nd) components are usually sub-sampled. -+ */ -+ if ((i = jas_image_cmptprec(img, 0)) != 8) /* not 24-bit pixels */ -+ { -+ SetISTR(ISTR_WARNING, pixel_size, fbasename, i * 3); -+ ret = 0; -+ goto done; -+ } -+ s = "Color"; -+ pinfo->type = PIC24; -+ pinfo->colType = F_FULLCOLOR; - --int LoadJP2(char *fname,register PICINFO *pinfo,int quick) --{ -- jas_image_t *img; -- jas_stream_t *str; -- FILE *fp; -- char *iobuf; -- const char *s; -- unsigned long filesize; -- long w, h, npixels, bufsize; -- int ok = 0, vstride; -- register int i; -+ /* XXX Unlike the IJG JPEG Library, the JasPer Library is apparently -+ unable to quantize colors or tell us whether the image's colors -+ were quantized by its creator, so it seems that we can't return a -+ color map for XV to potentially use 8-bit indexed color. If there -+ *is* an easy way to do it that escapes me, put the code here someday. -+ */ -+ } - -- /* Load a JPEG 2000 JP2 image file into a pixel buffer for XV, doing any -- necessary color-space conversion to end up with 8-bit gray scale or 24-bit -- RGB. For now, ignore the "quick" option to return a reduced-resolution -- or -size image. Return 1 on success, or 0 on failure. -- */ -- if (!(fp = xv_fopen(fname,fmode))) return 0; -- fbasename = BaseName(fname); /* Input file's base name, for message(s) */ -- if (!(iobuf = SetBuf(fp))) -- { -- (void)fclose(fp); -- SetISTR(ISTR_WARNING,no_mem,fbasename,jpc_kind); -- goto L3; -- } -+ /* image buffer for XV */ -+ if (!(pinfo->pic = (byte *)malloc(bufsize))) -+ { -+ SetISTR(ISTR_WARNING, no_mem, fbasename, jp2_kind); -+ ret = 0; -+ goto done; -+ } -+ pinfo->frmType = F_JP2; -+ sprintf(pinfo->fullInfo, full_msg, s, jp2_kind, filesize); -+ sprintf(pinfo->shrtInfo, shrt_msg, pinfo->w, pinfo->h, s, jp2_kind); -+ SetISTR(ISTR_INFO, load_msg, pinfo->normw, pinfo->normh, s, jp2_kind, -+ filesize); - -- /* Before telling the JasPer Library about this file, get its size for display -- purposes. Non-UNIX systems don't necessarily simulate "stat(2)", so do it -- crudely but portably by seeking to the end, then back to the beginning. -- */ -- fseek(fp,0L,2); -- filesize = ftell(fp); -- fseek(fp,0L,0); -+ /* Copy the sample data from the JasPer image to the xv image. */ -+ { -+ int num_comps = vstride; -+ int width = w; -+ int height = h; -+ int comp_ind; -+ data = jas_matrix_create(height, width); -+ assert(data); -+ for (comp_ind = 0; comp_ind < num_comps; ++comp_ind) { -+ if (jas_image_readcmpt(img, comp_ind, 0, 0, width, height, data)) { -+ ret = 0; -+ goto done; -+ } -+ unsigned char *buffer; -+ jas_seqent_t *src; -+ unsigned char *dst; -+ int xx, yy; -+ dst = pinfo->pic + comp_ind; -+ for (yy = 0; yy < height; ++yy) { -+ src = jas_matrix_getvref(data, yy); -+ for (xx = 0; xx < width; ++xx) { -+ *dst = *src; -+ ++src; -+ dst += num_comps; -+ } -+ } -+ } -+ } - -- /* "jas_stream_close()" will eventually close the input file, so only do it -- explicitly if no stream can be created: -- */ -- if (!(str = jas_stream_freopen(fname,fmode,fp))) -- { -- (void)fclose(fp); -- goto L3; -- } -+ /* Success! */ -+ ret = 1; - -- /* It's not clear to me whether the following represents a JasPer Library "bug" -- but it sure looks goofy: Unless a stream buffer is marked "read only", -- which only happens when the stream's "fillbuf" method is called, even though -- our buffers are always "read only", the library will try to flush out buffer -- contents when the stream is destroyed, which makes it die a horrible death. -- So, mark the stream buffer proactively: -- */ -- str->bufmode_ |= JAS_STREAM_RDBUF; /* We will only read the stream buffer */ -- if (!(img = jp2_decode(str,0))) goto L2; -- if ((vstride = jas_image_numcmpts(img))) /* num. color planes */ -- { -+done: -+ if (data) { -+ jas_matrix_destroy(data); -+ } -+ if (img) { -+ jas_image_destroy(img); -+ } -+ if (str) { -+ jas_stream_close(str); -+ } -+#if (JAS_VERSION_MAJOR >= 3) -+ jas_cleanup_thread(); -+ jas_cleanup_library(); -+#else -+ jas_cleanup(); -+#endif -+ return ret; -+} - -- /* After the image-component streams created, they are left in a "write" -- state with the streams' cursors positioned at their ends, so "seek" in -- order to "read" each stream from its beginning. -- */ -- i = vstride; -- while (--i >= 0) -- if (jas_stream_seek(img->cmpts_[i]->stream_,0L,0)) -- { -- SetISTR(ISTR_WARNING,read_err,fbasename,jp2_kind); -- goto L1; -- } -- } -- w = jas_image_width(img); -- h = jas_image_height(img); -+int LoadJP2(char *fname, register PICINFO *pinfo, int quick) { -+ return LoadJP2K(fname, pinfo, quick, false); -+} - -- /* avoid buffer overflow */ -- npixels = w * h; -- bufsize = vstride * npixels; -- if (w <= 0 || h <= 0 || npixels/w != h || bufsize/vstride != npixels) -- { -- (void)fclose(fp); -- SetISTR(ISTR_WARNING,bad_dims,fbasename); -- goto L1; -- } -- pinfo->normw = pinfo->w = w; -- pinfo->normh = pinfo->h = h; -- -- /* Sanity-check the image's color space and no. of colors. For now, accept -- only "generic" color spaces, not files needing image-specific color -- correction, but fix that someday... -- */ -- switch (vstride) -- { static char color_space[]={"%s: invalid color space!"}; -- -- default: -- SetISTR(ISTR_WARNING,bad_samp,fbasename,vstride,jp2_kind); -- goto L1; -- case 1: -- if ( !jas_clrspc_isunknown(i = jas_image_clrspc(img)) -- && jas_clrspc_fam(i) != JAS_CLRSPC_FAM_GRAY -- ) -- { -- SetISTR(ISTR_WARNING,color_space,fbasename); -- goto L1; -- } -- if ((i = jas_image_cmptprec(img,0)) != 8) /* not 8-bit pixels */ -- { -- SetISTR(ISTR_WARNING,pixel_size,fbasename,i); -- goto L1; -- } -- s = "Greyscale"; -- pinfo->type = PIC8; -- pinfo->colType = F_GREYSCALE; -- i = 256; /* Return fake indexed-color "map" */ -- while (--i >= 0) pinfo->r[i] = pinfo->g[i] = pinfo->b[i] = i; -- break; -- case 3: -- if (jas_clrspc_isunknown(i = jas_image_clrspc(img))) -- { -- SetISTR(ISTR_WARNING,color_space,fbasename); -- goto L1; -- } -- if (jas_clrspc_fam(i) != JAS_CLRSPC_FAM_RGB) -- { jas_image_t *oimg; -- jas_cmprof_t *profile; -- -- /* Here's where the JasPer Library really shines. The only color -- space that XV handles is RGB, so if that's not what our image -- uses, then to quote Capt. Kirk: "Make it so!" -- */ -- if (!(profile = jas_cmprof_createfromclrspc(JAS_CLRSPC_SRGB))) -- { -- SetISTR(ISTR_WARNING,"%s: can't create RGB profile", -- fbasename); -- goto L1; -- } -- img = jas_image_chclrspc( oimg = img -- , profile -- , JAS_CMXFORM_INTENT_PER -- ); -- jas_cmprof_destroy(profile); -- if (!img) /* Oops! We failed, so restore original image */ -- { -- img = oimg; -- SetISTR(ISTR_WARNING,"%s: can't convert to RGB",fbasename); -- goto L1; -- } -- jas_image_destroy(oimg); -- } -- -- /* BEWARE OF KLUDGE: If the image's color space is RGB, assume that the -- data-sample precision for all color planes is the -- same. If the color space is YCbCr, assume the luminance (Y = 0th) -- component has the greatest precision, although the chrominance -- (Cr = 1st, Cb = 2nd) components are usually sub-sampled. -- */ -- if ((i = jas_image_cmptprec(img,0)) != 8) /* not 24-bit pixels */ -- { -- SetISTR(ISTR_WARNING,pixel_size,fbasename,i*3); -- goto L1; -- } -- s = "Color"; -- pinfo->type = PIC24; -- pinfo->colType = F_FULLCOLOR; -- -- /* XXX Unlike the IJG JPEG Library, the JasPer Library is apparently -- unable to quantize colors or tell us whether the image's colors -- were quantized by its creator, so it seems that we can't return a -- color map for XV to potentially use 8-bit indexed color. If there -- *is* an easy way to do it that escapes me, put the code here someday. -- */ -- } -- if (!(pinfo->pic = (byte *)malloc(bufsize))) /* image buffer for XV */ -- { -- SetISTR(ISTR_WARNING,no_mem,fbasename,jp2_kind); -- goto L1; -- } -- pinfo->frmType = F_JP2; -- sprintf(pinfo->fullInfo,full_msg,s,jp2_kind,filesize); -- sprintf(pinfo->shrtInfo,shrt_msg,pinfo->w,pinfo->h,s,jp2_kind); -- SetISTR(ISTR_INFO,load_msg,pinfo->normw,pinfo->normh,s,jp2_kind,filesize); -- if (vstride == 1) /* gray-scale image */ -- { register jas_stream_t *c = img->cmpts_[0]->stream_; -- register byte *p = pinfo->pic; -- -- /* Since this is a 1-plane image, avoid a lot of errant nonsense in the -- JasPer Library by sequentially reading all of the data into our buffer -- directly. -- */ -- do if ((i = (*c->ops_->read_)(c->obj_,(char *)p,bufsize)) <= 0) -- { -- SetISTR(ISTR_WARNING,i < 0 ? read_err : truncated,fbasename, -- jp2_kind); -- goto L1; -- } -- while ((p += i),(bufsize -= i) > 0); -- } -- else /* RGB color image */ -- { -- -- /* Reading color images is inefficient because JPEG 2000 wants to partition -- file data into separate image planes (colors), while XV wants data -- samples from each plane to be interleaved as 3-byte pixels. Apparently -- the fastest method consists of 3 passes through the XV image buffer, -- into which we insert the bytes of each component. -- */ -- i = 0; -- do /* each color component */ -- { long npix = npixels; -- register jas_stream_t *c = img->cmpts_[i]->stream_; -- register byte *p = pinfo->pic + i; -- -- do /* each pixel */ -- { register int b; -- -- if ((b = jas_stream_getc(c)) < 0) -- { -- SetISTR(ISTR_WARNING, -- (c->flags_ & JAS_STREAM_EOF) ? truncated : read_err, -- fbasename,jp2_kind); -- goto L1; -- } -- *p = b; -- } -- while ((p += 3),--npix > 0); -- } -- while (++i <= 2); -- } -- ok = 1; /* Success! */ --L1: jas_image_destroy(img); --L2: (void)jas_stream_close(str); -- free(iobuf); --L3: return ok; -+int LoadJPC(char *fname, register PICINFO *pinfo, int quick) { -+ return LoadJP2K(fname, pinfo, quick, true); - } - - /* The following variables and subroutines are used when writing a JPEG 2000 - file, which is done mainly using call-backs from "X Windows" widgets. The - most complicated part of this interface is: managing interactions with a -- window to request the boat-loads of options that the JasPer Library supports. -- Start by defining subwindow sizes, plus indices into several arrays of -- corresponding widget-state variables. -+ window to request the boat-loads of options that the JasPer Library -+ supports. Start by defining subwindow sizes, plus indices into several -+ arrays of corresponding widget-state variables. - - IMPLEMENTATION NOTES: The following dimensions create a tall, thin window -- which appears to have considerable empty space at the -+ which appears to have considerable empty space at the - bottom. Before you complain, click the Precinct Height menu button in order -- to the tall pop-up subwindow that it generates. If the parent window is made -- shorter, then this pop-up will be clipped, which is an ugly nuisance. I -+ to the tall pop-up subwindow that it generates. If the parent window is -+ made shorter, then this pop-up will be clipped, which is an ugly nuisance. I - don't know how to make the pop-up visible outside its parent's borders; do -- you? If there's some way to make "X Windows" do this, then we might consider -- making the parent shorter. -+ you? If there's some way to make "X Windows" do this, then we might -+ consider making the parent shorter. - - Note that there is currently no mechanism to program the no. of intermediate - layers used by the encoder, or their rates. This is potentially a large and - complicated data-entry problem, and perhaps someday we can invent a clever - solution using the rest of the parent window's space. - */ --# define JP2KW 275 /* Window width, in pixels */ --# define JP2KH 400 /* Window height, in pixels */ --# define BUTTW 51 /* Button width, in pixels (odd for half-toning) */ --# define BUTTH 20 /* Button height, in pixels */ --# define MENUW 75 /* Menu-button width, in pixels (odd for half-toning) */ --# define MENUH 24 /* Menu-button height, in pixels */ --# define RBUTH 20 /* Radio button height, in pixels */ --# define RBUTW 51 /* Radio button width, in pixels (odd for half-toning) */ --# define TEXTH (LINEHIGH+5) /* Text subwindow height, in pixels */ --# define TEXTW 75 /* Text subwindow width, in pixels */ -+#define JP2KW 275 /* Window width, in pixels */ -+#define JP2KH 400 /* Window height, in pixels */ -+#define BUTTW 51 /* Button width, in pixels (odd for half-toning) */ -+#define BUTTH 20 /* Button height, in pixels */ -+#define MENUW 75 /* Menu-button width, in pixels (odd for half-toning) */ -+#define MENUH 24 /* Menu-button height, in pixels */ -+#define RBUTH 20 /* Radio button height, in pixels */ -+#define RBUTW 51 /* Radio button width, in pixels (odd for half-toning) */ -+#define TEXTH (LINEHIGH + 5) /* Text subwindow height, in pixels */ -+#define TEXTW 75 /* Text subwindow width, in pixels */ - --# define J_BOK 0 /* Boolean "Ok" button */ --# define J_BCANC 1 /* Boolean "Cancel" button */ --# define J_NBUTT 2 /* No. of regular button widgets */ -+#define J_BOK 0 /* Boolean "Ok" button */ -+#define J_BCANC 1 /* Boolean "Cancel" button */ -+#define J_NBUTT 2 /* No. of regular button widgets */ - --# define J_CSOP 0 /* Boolean encoding-style option buttons */ --# define J_CEPH 1 --# define J_CLAZY 2 --# define J_CTERM 3 --# define J_CSEGS 4 --# define J_CVCAU 5 --# define J_CPTRM 6 --# define J_CRSTP 7 --# define J_NCHKB 8 /* No. of check-box button widgets */ -+#define J_CSOP 0 /* Boolean encoding-style option buttons */ -+#define J_CEPH 1 -+#define J_CLAZY 2 -+#define J_CTERM 3 -+#define J_CSEGS 4 -+#define J_CVCAU 5 -+#define J_CPTRM 6 -+#define J_CRSTP 7 -+#define J_NCHKB 8 /* No. of check-box button widgets */ - --# define J_MCBXW 0 /* 1-of-N menu-selection buttons */ --# define J_MCBXH 1 --# define J_MPREW 2 --# define J_MPREH 3 --# define J_MPROG 4 --# define J_NMENU 5 /* No. of menu-button widgets */ -+#define J_MCBXW 0 /* 1-of-N menu-selection buttons */ -+#define J_MCBXH 1 -+#define J_MPREW 2 -+#define J_MPREH 3 -+#define J_MPROG 4 -+#define J_NMENU 5 /* No. of menu-button widgets */ - --# define J_TGBIT 0 /* (Unsigned numeric) string subwindows */ --# define J_TRES 1 --# define J_TRATE 2 --# define J_NTEXT 3 /* No. of text subwindows */ -+#define J_TGBIT 0 /* (Unsigned numeric) string subwindows */ -+#define J_TRES 1 -+#define J_TRATE 2 -+#define J_NTEXT 3 /* No. of text subwindows */ - - static BUTT button[J_NBUTT]; - static CBUTT chkbut[J_NCHKB]; -@@ -642,685 +462,757 @@ - static RBUTT *radio; - static Window text[J_NTEXT]; - static int colorType, format, textval[J_NTEXT]; --static const char *ProgList[]={"lrcp","rlcp","rpcl","pcrl","cprl"}; -+static const char *ProgList[] = {"lrcp", "rlcp", "rpcl", "pcrl", "cprl"}; - --void CreateJP2KW(void) --{ -- static const char EXP2_0[] ={ "1"}, /* Successive powers of 2 */ -- EXP2_1[] ={ "2"}, -- EXP2_2[] ={ "4"}, -- EXP2_3[] ={ "8"}, -- EXP2_4[] ={ "16"}, -- EXP2_5[] ={ "32"}, -- EXP2_6[] ={ "64"}, -- EXP2_7[] ={ "128"}, -- EXP2_8[] ={ "256"}, -- EXP2_9[] ={ "512"}, -- EXP2_10[]={ "1024"}, -- EXP2_11[]={ "2048"}, -- EXP2_12[]={ "4096"}, -- EXP2_13[]={ "8192"}, -- EXP2_14[]={"16384"}, -- EXP2_15[]={"32768"}; -- static const char *CBoxList[]= -- { -- EXP2_1 ,EXP2_2 ,EXP2_3 ,EXP2_4 ,EXP2_5,EXP2_6 ,EXP2_7 ,EXP2_8 ,EXP2_9, -- EXP2_10,EXP2_11 -- }; -- static const char *PrecList[]= -- { -- EXP2_0,EXP2_1,EXP2_2 ,EXP2_3 ,EXP2_4 ,EXP2_5 ,EXP2_6 ,EXP2_7 , -- EXP2_8,EXP2_9,EXP2_10,EXP2_11,EXP2_12,EXP2_13,EXP2_14,EXP2_15 -- }; -- static const char hstr[]={"Height"}, wstr[]={"Width"}; -+void CreateJP2KW(void) { -+ static const char EXP2_0[] = {"1"}, /* Successive powers of 2 */ -+ EXP2_1[] = {"2"}, EXP2_2[] = {"4"}, EXP2_3[] = {"8"}, EXP2_4[] = {"16"}, -+ EXP2_5[] = {"32"}, EXP2_6[] = {"64"}, EXP2_7[] = {"128"}, -+ EXP2_8[] = {"256"}, EXP2_9[] = {"512"}, -+ EXP2_10[] = {"1024"}, EXP2_11[] = {"2048"}, -+ EXP2_12[] = {"4096"}, EXP2_13[] = {"8192"}, -+ EXP2_14[] = {"16384"}, EXP2_15[] = {"32768"}; -+ static const char *CBoxList[] = {EXP2_1, EXP2_2, EXP2_3, EXP2_4, -+ EXP2_5, EXP2_6, EXP2_7, EXP2_8, -+ EXP2_9, EXP2_10, EXP2_11}; -+ static const char *PrecList[] = { -+ EXP2_0, EXP2_1, EXP2_2, EXP2_3, EXP2_4, EXP2_5, EXP2_6, EXP2_7, -+ EXP2_8, EXP2_9, EXP2_10, EXP2_11, EXP2_12, EXP2_13, EXP2_14, EXP2_15}; -+ static const char hstr[] = {"Height"}, wstr[] = {"Width"}; - -- if (!(jp2kW = CreateWindow( "xvjp2k" -- , "XVjp2k" -- , 0 -- , JP2KW -- , JP2KH -- , infofg -- , infobg -- , 0 -- ) -- ) -- ) FatalError("can't create JPEG 2000 window!"); -- XSelectInput(theDisp,jp2kW,ExposureMask|ButtonPressMask|KeyPressMask); -+ if (!(jp2kW = CreateWindow("xvjp2k", "XVjp2k", 0, JP2KW, JP2KH, infofg, -+ infobg, 0))) -+ FatalError("can't create JPEG 2000 window!"); -+ XSelectInput(theDisp, jp2kW, ExposureMask | ButtonPressMask | KeyPressMask); - -- /* Create a row of 2 boolean-valued, regular buttons ("Ok" and "Cancel") in the -- window's bottom right corner. -- */ -- BTCreate(&button[J_BOK ],jp2kW, -- JP2KW-2*BUTTW-20,JP2KH-10-BUTTH-1,BUTTW,BUTTH, -- "Ok" ,infofg,infobg,hicol,locol); -- BTCreate(&button[J_BCANC],jp2kW, -- JP2KW- BUTTW-10,JP2KH-10-BUTTH-1,BUTTW,BUTTH, -- "Cancel",infofg,infobg,hicol,locol); -+ /* Create a row of 2 boolean-valued, regular buttons ("Ok" and "Cancel") in -+ the window's bottom right corner. -+ */ -+ BTCreate(&button[J_BOK], jp2kW, JP2KW - 2 * BUTTW - 20, -+ JP2KH - 10 - BUTTH - 1, BUTTW, BUTTH, "Ok", infofg, infobg, hicol, -+ locol); -+ BTCreate(&button[J_BCANC], jp2kW, JP2KW - BUTTW - 10, -+ JP2KH - 10 - BUTTH - 1, BUTTW, BUTTH, "Cancel", infofg, infobg, -+ hicol, locol); - -- /* Create a vertical column of 8 boolean-valued, check-box buttons (for -- encoding-style options) down the window's left side. -- */ -- CBCreate(&chkbut[J_CSOP] ,jp2kW, -- 10,10+ASCENT+SPACING+2*LINEHIGH+0*BUTTH, -- "sop" ,infofg,infobg,hicol,locol); -- CBCreate(&chkbut[J_CEPH] ,jp2kW, -- 10,10+ASCENT+SPACING+2*LINEHIGH+1*BUTTH, -- "eph" ,infofg,infobg,hicol,locol); -- CBCreate(&chkbut[J_CLAZY],jp2kW, -- 10,10+ASCENT+SPACING+2*LINEHIGH+2*BUTTH, -- "lazy" ,infofg,infobg,hicol,locol); -- CBCreate(&chkbut[J_CTERM],jp2kW, -- 10,10+ASCENT+SPACING+2*LINEHIGH+3*BUTTH, -- "termall" ,infofg,infobg,hicol,locol); -- CBCreate(&chkbut[J_CSEGS],jp2kW, -- 10,10+ASCENT+SPACING+2*LINEHIGH+4*BUTTH, -- "segsym" ,infofg,infobg,hicol,locol); -- CBCreate(&chkbut[J_CVCAU],jp2kW, -- 10,10+ASCENT+SPACING+2*LINEHIGH+5*BUTTH, -- "vcausal" ,infofg,infobg,hicol,locol); -- CBCreate(&chkbut[J_CPTRM],jp2kW, -- 10,10+ASCENT+SPACING+2*LINEHIGH+6*BUTTH, -- "pterm" ,infofg,infobg,hicol,locol); -- CBCreate(&chkbut[J_CRSTP],jp2kW, -- 10,10+ASCENT+SPACING+2*LINEHIGH+7*BUTTH, -- "resetprob",infofg,infobg,hicol,locol); -- /* Create text subwindows for unsigned decimal integer values. */ -+ /* Create a vertical column of 8 boolean-valued, check-box buttons (for -+ encoding-style options) down the window's left side. -+ */ -+ CBCreate(&chkbut[J_CSOP], jp2kW, 10, -+ 10 + ASCENT + SPACING + 2 * LINEHIGH + 0 * BUTTH, "sop", infofg, -+ infobg, hicol, locol); -+ CBCreate(&chkbut[J_CEPH], jp2kW, 10, -+ 10 + ASCENT + SPACING + 2 * LINEHIGH + 1 * BUTTH, "eph", infofg, -+ infobg, hicol, locol); -+ CBCreate(&chkbut[J_CLAZY], jp2kW, 10, -+ 10 + ASCENT + SPACING + 2 * LINEHIGH + 2 * BUTTH, "lazy", infofg, -+ infobg, hicol, locol); -+ CBCreate(&chkbut[J_CTERM], jp2kW, 10, -+ 10 + ASCENT + SPACING + 2 * LINEHIGH + 3 * BUTTH, "termall", -+ infofg, infobg, hicol, locol); -+ CBCreate(&chkbut[J_CSEGS], jp2kW, 10, -+ 10 + ASCENT + SPACING + 2 * LINEHIGH + 4 * BUTTH, "segsym", infofg, -+ infobg, hicol, locol); -+ CBCreate(&chkbut[J_CVCAU], jp2kW, 10, -+ 10 + ASCENT + SPACING + 2 * LINEHIGH + 5 * BUTTH, "vcausal", -+ infofg, infobg, hicol, locol); -+ CBCreate(&chkbut[J_CPTRM], jp2kW, 10, -+ 10 + ASCENT + SPACING + 2 * LINEHIGH + 6 * BUTTH, "pterm", infofg, -+ infobg, hicol, locol); -+ CBCreate(&chkbut[J_CRSTP], jp2kW, 10, -+ 10 + ASCENT + SPACING + 2 * LINEHIGH + 7 * BUTTH, "resetprob", -+ infofg, infobg, hicol, locol); -+ /* Create text subwindows for unsigned decimal integer values. */ - -- text[J_TGBIT] = XCreateSimpleWindow(theDisp,jp2kW, -- JP2KW-TEXTW-10,10+ASCENT+SPACING+2*LINEHIGH+3*MENUH+0*TEXTH,TEXTW,TEXTH, -- 1,infofg,infobg); -- XSelectInput(theDisp,text[J_TGBIT],ExposureMask|KeyPressMask); -- text[J_TRES ] = XCreateSimpleWindow(theDisp,jp2kW, -- JP2KW-TEXTW-10,10+ASCENT+SPACING+2*LINEHIGH+3*MENUH+1*TEXTH,TEXTW,TEXTH, -- 1,infofg,infobg); -- XSelectInput(theDisp,text[J_TRES ],ExposureMask|KeyPressMask); -- text[J_TRATE] = XCreateSimpleWindow(theDisp,jp2kW, -- JP2KW-TEXTW-10,10+ASCENT+SPACING+2*LINEHIGH+3*MENUH+2*TEXTH,TEXTW,TEXTH, -- 1,infofg,infobg); -- XSelectInput(theDisp,text[J_TRATE],ExposureMask|KeyPressMask); -+ text[J_TGBIT] = XCreateSimpleWindow(theDisp, jp2kW, JP2KW - TEXTW - 10, -+ 10 + ASCENT + SPACING + 2 * LINEHIGH + -+ 3 * MENUH + 0 * TEXTH, -+ TEXTW, TEXTH, 1, infofg, infobg); -+ XSelectInput(theDisp, text[J_TGBIT], ExposureMask | KeyPressMask); -+ text[J_TRES] = XCreateSimpleWindow(theDisp, jp2kW, JP2KW - TEXTW - 10, -+ 10 + ASCENT + SPACING + 2 * LINEHIGH + -+ 3 * MENUH + 1 * TEXTH, -+ TEXTW, TEXTH, 1, infofg, infobg); -+ XSelectInput(theDisp, text[J_TRES], ExposureMask | KeyPressMask); -+ text[J_TRATE] = XCreateSimpleWindow(theDisp, jp2kW, JP2KW - TEXTW - 10, -+ 10 + ASCENT + SPACING + 2 * LINEHIGH + -+ 3 * MENUH + 2 * TEXTH, -+ TEXTW, TEXTH, 1, infofg, infobg); -+ XSelectInput(theDisp, text[J_TRATE], ExposureMask | KeyPressMask); - -- /* Create a row of 2 boolean-valued radio buttons (for the "Rate" subwindow -- value's unit of measure). The 1st button is "selected" by default. -- */ -- radio = RBCreate(0,jp2kW, -- JP2KW-19*RBUTW/8-10,10+ASCENT+SPACING+2*LINEHIGH+3*MENUH+3*TEXTH+4, -- "Percent",infofg,infobg,hicol,locol); -- (void)RBCreate(radio,jp2kW, -- JP2KW-1*RBUTW-10 ,10+ASCENT+SPACING+2*LINEHIGH+3*MENUH+3*TEXTH+4, -- "Bytes",infofg,infobg,hicol,locol); -+ /* Create a row of 2 boolean-valued radio buttons (for the "Rate" subwindow -+ value's unit of measure). The 1st button is "selected" by default. -+ */ -+ radio = RBCreate(0, jp2kW, JP2KW - 19 * RBUTW / 8 - 10, -+ 10 + ASCENT + SPACING + 2 * LINEHIGH + 3 * MENUH + -+ 3 * TEXTH + 4, -+ "Percent", infofg, infobg, hicol, locol); -+ (void)RBCreate(radio, jp2kW, JP2KW - 1 * RBUTW - 10, -+ 10 + ASCENT + SPACING + 2 * LINEHIGH + 3 * MENUH + -+ 3 * TEXTH + 4, -+ "Bytes", infofg, infobg, hicol, locol); - -- /* Create pop-up menu-selection buttons after mapping the above subwindows, -- since we don't want the pop-up menus mapped unless the corresponding button -- is selected. -- */ -- XMapSubwindows(theDisp,jp2kW); -- MBCreate(&menu[J_MCBXW],jp2kW, -- JP2KW-2*MENUW-10,10+ASCENT+SPACING+2*LINEHIGH+0*MENUH,MENUW,MENUH, -- wstr ,CBoxList,sizeof CBoxList/sizeof *CBoxList,infofg,infobg, -- hicol,locol); -- MBCreate(&menu[J_MCBXH],jp2kW, -- JP2KW-2*MENUW-10,10+ASCENT+SPACING+2*LINEHIGH+1*MENUH,MENUW,MENUH, -- hstr ,CBoxList,sizeof CBoxList/sizeof *CBoxList,infofg,infobg, -- hicol,locol); -- MBCreate(&menu[J_MPREW],jp2kW, -- JP2KW-1*MENUW-10,10+ASCENT+SPACING+2*LINEHIGH+0*MENUH,MENUW,MENUH, -- wstr ,PrecList,sizeof PrecList/sizeof *PrecList,infofg,infobg, -- hicol,locol); -- MBCreate(&menu[J_MPREH],jp2kW, -- JP2KW-1*MENUW-10,10+ASCENT+SPACING+2*LINEHIGH+1*MENUH,MENUW,MENUH, -- hstr ,PrecList,sizeof PrecList/sizeof *PrecList,infofg,infobg, -- hicol,locol); -- MBCreate(&menu[J_MPROG],jp2kW, -- JP2KW-1*MENUW-10,10+ASCENT+SPACING+2*LINEHIGH+2*MENUH,MENUW,MENUH, -- "Order",ProgList,sizeof ProgList/sizeof *ProgList,infofg,infobg, -- hicol,locol); -+ /* Create pop-up menu-selection buttons after mapping the above subwindows, -+ since we don't want the pop-up menus mapped unless the corresponding -+ button is selected. -+ */ -+ XMapSubwindows(theDisp, jp2kW); -+ MBCreate(&menu[J_MCBXW], jp2kW, JP2KW - 2 * MENUW - 10, -+ 10 + ASCENT + SPACING + 2 * LINEHIGH + 0 * MENUH, MENUW, MENUH, -+ wstr, CBoxList, sizeof CBoxList / sizeof *CBoxList, infofg, infobg, -+ hicol, locol); -+ MBCreate(&menu[J_MCBXH], jp2kW, JP2KW - 2 * MENUW - 10, -+ 10 + ASCENT + SPACING + 2 * LINEHIGH + 1 * MENUH, MENUW, MENUH, -+ hstr, CBoxList, sizeof CBoxList / sizeof *CBoxList, infofg, infobg, -+ hicol, locol); -+ MBCreate(&menu[J_MPREW], jp2kW, JP2KW - 1 * MENUW - 10, -+ 10 + ASCENT + SPACING + 2 * LINEHIGH + 0 * MENUH, MENUW, MENUH, -+ wstr, PrecList, sizeof PrecList / sizeof *PrecList, infofg, infobg, -+ hicol, locol); -+ MBCreate(&menu[J_MPREH], jp2kW, JP2KW - 1 * MENUW - 10, -+ 10 + ASCENT + SPACING + 2 * LINEHIGH + 1 * MENUH, MENUW, MENUH, -+ hstr, PrecList, sizeof PrecList / sizeof *PrecList, infofg, infobg, -+ hicol, locol); -+ MBCreate(&menu[J_MPROG], jp2kW, JP2KW - 1 * MENUW - 10, -+ 10 + ASCENT + SPACING + 2 * LINEHIGH + 2 * MENUH, MENUW, MENUH, -+ "Order", ProgList, sizeof ProgList / sizeof *ProgList, infofg, -+ infobg, hicol, locol); - -- /* Initialize values represented by widgets, which should correspond to default -- compiled into the JasPer Library. Unfortunately, as of Version 1.701 there -- is no easy way for an application to extract these from the library, so the -- following code might get out of sync over time: -- */ -- menu[J_MCBXW].hascheck = 1; menu[J_MCBXW].flags[ 5] = 1; -- menu[J_MCBXH].hascheck = 1; menu[J_MCBXH].flags[ 5] = 1; -- menu[J_MPREW].hascheck = 1; menu[J_MPREW].flags[15] = 1; -- menu[J_MPREH].hascheck = 1; menu[J_MPREH].flags[15] = 1; -- menu[J_MPROG].hascheck = 1; menu[J_MPROG].flags[ 0] = 1; -- textval[J_TGBIT] = 2; /* No. of guard bits */ -- textval[J_TRES ] = 6; /* Max. no. of resolution levels */ -- textval[J_TRATE] = 100; /* Rate = 100% */ -+ /* Initialize values represented by widgets, which should correspond to -+ default compiled into the JasPer Library. Unfortunately, as of -+ Version 1.701 there is no easy way for an application to extract these -+ from the library, so the following code might get out of sync over time: -+ */ -+ menu[J_MCBXW].hascheck = 1; -+ menu[J_MCBXW].flags[5] = 1; -+ menu[J_MCBXH].hascheck = 1; -+ menu[J_MCBXH].flags[5] = 1; -+ menu[J_MPREW].hascheck = 1; -+ menu[J_MPREW].flags[15] = 1; -+ menu[J_MPREH].hascheck = 1; -+ menu[J_MPREH].flags[15] = 1; -+ menu[J_MPROG].hascheck = 1; -+ menu[J_MPROG].flags[0] = 1; -+ textval[J_TGBIT] = 2; /* No. of guard bits */ -+ textval[J_TRES] = 6; /* Max. no. of resolution levels */ -+ textval[J_TRATE] = 100; /* Rate = 100% */ - } - --void JP2KSaveParams(int fmt,char *fname,int col) /* Save output-file parms */ -+void JP2KSaveParams(int fmt, char *fname, int col) /* Save output-file parms */ - { -- format = fmt; /* Desired file format: F_JPC|F_JP2 */ -- fbasename = fname; /* ->Output file path */ -- colorType = col; /* Desired color space: F_GREYSCALE|... */ -+ format = fmt; /* Desired file format: F_JPC|F_JP2 */ -+ fbasename = fname; /* ->Output file path */ -+ colorType = col; /* Desired color space: F_GREYSCALE|... */ - } - --static void StoreJP2K(char *options) --{ -- static jas_image_cmptparm_t parm[3]= /* Image parameters */ -- {{0,0,1,1,0,0,8,0},{0,0,1,1,0,0,8,0},{0,0,1,1,0,0,8,0}}; -- static char nomem[]={"StoreJP2K: out of memory\n"}, -- write[]={"w"}; -- jas_image_t *img; -- jas_stream_t *str; -- FILE *fp, *fp2; -- byte *pic, *r, *g, *b; -- const char *filename; -- char *iobuf = 0; -- unsigned long imagesize; -- jas_clrspc_t color_space; -- int nc, w, h, pfree, ptype, error = 1; -- register int i; -+static void StoreJP2K(char *options) { -+ static jas_image_cmptparm_t parm[3] = /* Image parameters */ -+ {{0, 0, 1, 1, 0, 0, 8, 0}, -+ {0, 0, 1, 1, 0, 0, 8, 0}, -+ {0, 0, 1, 1, 0, 0, 8, 0}}; -+ static char nomem[] = {"StoreJP2K: out of memory\n"}, write[] = {"w"}; -+ jas_image_t *img = 0; -+ jas_stream_t *str = 0; -+ FILE *fp = 0; -+ FILE *fp2 = 0; -+ byte *pic, *r, *g, *b; -+ const char *filename; -+ unsigned long imagesize; -+ jas_clrspc_t color_space; -+ int nc, w, h; -+ int pfree, ptype; -+ int error = 1; -+ register int i; -+ jas_matrix_t *data = 0; -+ int debug_level = get_debug_level(); - -- /* This is a generic subroutine for writing JPEG 2000 image files using the -- JasPer Library. Our argument is an ASCII string, containing a Space (" ")- -- separated sequence of encoder options that currently aren't well documented. -- Most of the work is identical for both ".jpc" and ".jp2" files. Start by -- verifying that the output file can be opened, then get an image buffer from -- XV and begin crunching it into a suitable form for the JasPer Library. -- */ -- if (!(fp = OpenOutFile(filename = fbasename))) return; /* Oops! */ -- setbuf(fp,0); /* We don't really use this file pointer for I/O; see below */ -- fbasename = BaseName(filename); -- WaitCursor(); -- pic = GenSavePic(&ptype,&w,&h,&pfree,&nc,&r,&g,&b); -- imagesize = w*h; -- if (ptype == PIC24) imagesize *= 3; -+#if (JAS_VERSION_MAJOR >= 3) -+ size_t max_mem = jas_get_total_mem_size(); -+ if (!max_mem) { -+ max_mem = GIBI; -+ } -+ jas_conf_clear(); -+ jas_conf_set_max_mem_usage(max_mem); -+ jas_init_library(); -+ jas_init_thread(); -+ jas_set_vlogmsgf(print_log); -+ jas_set_debug_level(debug_level); -+#else -+ jas_init(); -+ jas_setdbglevel(debug_level); -+#endif - -- /* As an optimization to save file space, even if our user didn't ask to store -- a gray-scale image, check whether we could and, if so, do it anyway. -- */ -- if (colorType != F_GREYSCALE) /* can we force a gray-scale image? */ -- { -- if (ptype == PIC8) -- { -- i = nc; -- while (--i >= 0 && r[i] == g[i] && r[i] == b[i]); -- } -- else /* PIC24 */ -- { register byte *p = pic + imagesize; -+ /* This is a generic subroutine for writing JPEG 2000 image files using the -+ JasPer Library. Our argument is an ASCII string, containing a Space (" -+ ")- separated sequence of encoder options that currently aren't well -+ documented. Most of the work is identical for both ".jpc" and ".jp2" -+ files. Start by verifying that the output file can be opened, then get an -+ image buffer from XV and begin crunching it into a suitable form for the -+ JasPer Library. -+ */ -+ if (!(fp = OpenOutFile(filename = fbasename))) -+ return; /* Oops! */ -+ setbuf(fp, -+ 0); /* We don't really use this file pointer for I/O; see below */ -+ fbasename = BaseName(filename); -+ WaitCursor(); -+ pic = GenSavePic(&ptype, &w, &h, &pfree, &nc, &r, &g, &b); -+ assert(ptype == PIC8 || ptype == PIC24); -+ imagesize = w * h; -+ if (ptype == PIC24) -+ imagesize *= 3; - -- while ((p -= 3) >= pic && p[0] == p[1] && p[0] == p[2]); -- i = p-pic; -- }; -- if (i < 0) colorType = F_GREYSCALE; /* We made it all the way through */ -- }; -+ assert(colorType == F_GREYSCALE || colorType == F_FULLCOLOR); -+#if 1 -+ /* As an optimization to save file space, even if our user didn't ask to -+ store a gray-scale image, check whether we could and, if so, do it -+ anyway. -+ */ -+ if (colorType != F_GREYSCALE) /* can we force a gray-scale image? */ -+ { -+ if (ptype == PIC8) { -+ i = nc; -+ while (--i >= 0 && r[i] == g[i] && r[i] == b[i]) {} -+ } else { -+ assert(ptype == PIC24); -+ /* PIC24 */ -+ byte *p = pic + imagesize; -+ while ((p -= 3) >= pic && p[0] == p[1] && p[0] == p[2]) {} -+ i = p - pic; -+ }; -+ if (i < 0) { -+ colorType = F_GREYSCALE; /* We made it all the way through */ -+ } -+ }; -+#endif - -- /* If XV is currently color-mapping the image, make a color-mapped copy so that -- the map needn't be transmitted in the output file. -- */ -- if ((i = (colorType != F_GREYSCALE) << 1 | (ptype != PIC8)) != 3) -- { byte *tmp = pic, *last = pic + imagesize; -- register byte *from = tmp, *to = pic; -+ /* Now comes a egregious hack: The JasPer Library will eventually want to -+ close the output file that it writes, but since XV opened the file, XV -+ also thinks it has the right to close the file! In order to pacify them -+ both, we duplicate the file pointer and let the JasPer Library have it, -+ while we retain the original for XV. - -- if (!(pic = (byte *)malloc(imagesize))) FatalError(nomem); -- switch (i) -- { -+ XXX This code is very UNIX-specific; what's an equivalent hack for -+ Windows? -+ */ -+ { -+ int fd = dup(fileno(fp)); -+ if (fd < 0) { -+ FatalError("StoreJP2K: can't duplicate output file pointer\n"); -+ } -+ if (!(fp2 = fdopen(fd, write))) { -+ FatalError("StoreJP2K: can't duplicate output file pointer\n"); -+ } -+ } - -- /* Color-map 8->8 bit image. */ -+ /* Hand our output file to the JasPer Library and create an image object. -+ "jas_stream_close()" will eventually close our output file, so only do it -+ explicitly if no stream can be created. If everything looks copacetic, -+ then write our buffer contents to the image components' streams. -+ */ -+ if (!(str = jas_stream_freopen(filename, write, fp2))) { -+ (void)fclose(fp2); -+ FatalError("StoreJP2K: can't open output stream\n"); -+ }; -+ fp2 = 0; - -- case 0: do -- { -- i = *from; -- *to++ = MONO(r[i],g[i],b[i]); -- } -- while (++from < last); -- break; -+ int num_comps = (colorType == F_GREYSCALE) ? 1 : 3; -+ int comp_ind; -+ if (num_comps == 3) { -+ color_space = JAS_CLRSPC_SRGB; -+ } else { -+ color_space = JAS_CLRSPC_SGRAY; -+ } -+ for (comp_ind = 0; comp_ind < num_comps; ++comp_ind) { -+ parm[comp_ind].tlx = 0; -+ parm[comp_ind].tly = 0; -+ parm[comp_ind].hstep = 1; -+ parm[comp_ind].vstep = 1; -+ parm[comp_ind].width = w; -+ parm[comp_ind].height = h; -+ parm[comp_ind].prec = 8; -+ parm[comp_ind].sgnd = 0; -+ } -+ if (!(img = jas_image_create(num_comps, parm, color_space))) { -+ goto L2; -+ } -+ if (get_debug_level() >= 1) { -+ fprintf(stderr, "num_comps %d width %d height %d\n", num_comps, w, h); -+ fprintf(stderr, "colorType %d\n", colorType); -+ fprintf(stderr, "ptype %d\n", ptype); -+ } - -- /* Color-map 24->8 bit image. */ -+ { -+ int comp_ind; -+ if (!(data = jas_matrix_create(h, w))) { -+ goto done; -+ } -+ if (num_comps == 3) { -+ for (comp_ind = 0; comp_ind < num_comps; ++comp_ind) { -+ int comp_type; -+ switch (comp_ind) { -+ case 0: -+ comp_type = JAS_IMAGE_CT_RGB_R; -+ break; -+ case 1: -+ comp_type = JAS_IMAGE_CT_RGB_G; -+ break; -+ case 2: -+ comp_type = JAS_IMAGE_CT_RGB_B; -+ break; -+ } -+ jas_image_setcmpttype(img, comp_ind, comp_type); -+ unsigned char *buffer; -+ unsigned char *src; -+ jas_seqent_t *dst; -+ int x, y; -+ src = pic + comp_ind; -+ for (y = 0; y < h; ++y) { -+ dst = jas_matrix_getvref(data, y); -+ for (x = 0; x < w; ++x) { -+ *dst = *src; -+ ++dst; -+ src += num_comps; -+ } -+ } -+ if (jas_image_writecmpt(img, comp_ind, 0, 0, w, h, data)) { -+ goto L1; -+ } -+ } -+ } else { -+ int mode = (ptype == PIC8) ? 0 : 1; -+ assert(num_comps == 1); -+ jas_image_setcmpttype(img, 0, JAS_IMAGE_CT_GRAY_Y); -+ unsigned char *buffer; -+ unsigned char *src; -+ jas_seqent_t *dst; -+ int x, y; -+ src = pic; -+ for (y = 0; y < h; ++y) { -+ dst = jas_matrix_getvref(data, y); -+ for (x = 0; x < w; ++x) { -+ int v; -+ if (mode == 0) { -+ v = *src; -+ v = MONO(r[v], g[v], b[v]); -+ } else if (mode == 1) { -+ v = MONO(src[0], src[1], src[2]); -+ } -+ *dst = v; -+ ++dst; -+ ++src; -+ } -+ } -+ if (jas_image_writecmpt(img, 0, 0, 0, w, h, data)) { -+ goto L1; -+ } -+ } -+ } - -- case 1: do *to++ = MONO(from[0],from[1],from[2]); -- while ((from += 3) < last); -- break; -+ const jas_image_fmtinfo_t *fmtinfo = -+ jas_image_lookupfmtbyname(((format == F_JPC) ? "jpc" : "jp2")); -+ if (!jas_image_encode(img, str, fmtinfo->id, options) && -+ jas_stream_flush(str) >= 0) { -+ error = 0; /* Success! */ -+ } - -- /* Color-map 8->24 bit image. */ -+done: -+ if (data) { -+ jas_matrix_destroy(data); -+ } -+L1: -+ if (img) { -+ jas_image_destroy(img); -+ } -+L2: -+ if (str) { -+ jas_stream_close(str); -+ } -+ if (pfree) { -+ free(pic); -+ } -+ if (!CloseOutFile(fp, filename, error)) { -+ DirBox(0); -+ } -+ SetCursors(-1); - -- case 2: do -- { -- i = *from; -- *to++ = r[i]; *to++ = g[i]; *to++ = b[i]; -- } -- while (++from < last); -- break; -- }; -- if (pfree) free(tmp); /* Release the original image buffer if we can */ -- pfree = 1; /* Let the modified buffer be released later */ -- }; -- -- /* Initialize various image-file parameter variables. */ -- -- parm[0].width = w; -- parm[0].height = h; -- if (colorType == F_GREYSCALE) /* gray-scale image */ -- { -- ptype = 1; /* No. of color planes */ -- color_space = JAS_CLRSPC_SGRAY; -- } -- else /* RGB color image */ -- { -- ptype = 3; /* No. of color planes */ -- color_space = JAS_CLRSPC_SRGB; -- parm[2].width = parm[1].width = parm[0].width; -- parm[2].height = parm[1].height = parm[0].height; -- }; -- -- /* Now comes a egregious hack: The JasPer Library will eventually want to -- close the output file that it writes, but since XV opened the file, XV also -- thinks it has the right to close the file! In order to pacify them both, -- we duplicate the file pointer and let the JasPer Library have it, while we -- retain the original for XV. -- -- XXX This code is very UNIX-specific; what's an equivalent hack for Windows? -- */ -- if (!(fp2 = (i = dup(fileno(fp))) >= 0 ? fdopen(i,write) : 0)) -- FatalError("StoreJP2K: can't duplicate output file pointer\n"); -- if (!(iobuf = SetBuf(fp2))) -- { -- (void)fclose(fp2); -- FatalError(nomem); -- }; -- -- /* Hand our output file to the JasPer Library and create an image object. -- "jas_stream_close()" will eventually close our output file, so only do it -- explicitly if no stream can be created. If everything looks copacetic, -- then write our buffer contents to the image components' streams. -- */ -- if (!(str = jas_stream_freopen(filename,write,fp2))) -- { -- (void)fclose(fp2); -- FatalError("StoreJP2K: can't open output stream\n"); -- }; -- if (!(img = jas_image_create(ptype,parm,color_space))) goto L2; -- if (ptype == 1) -- { register jas_stream_t *c = img->cmpts_[0]->stream_; -- register byte *p = pic; -- -- /* Since this is a 1-plane image, avoid a lot of errant nonsense in the -- JasPer Library by sequentially writing all of the data directly from our -- buffer. -- */ -- jas_image_setcmpttype(img,0,JAS_IMAGE_CT_GRAY_Y); -- img->cmpts_[0]->type_ = JAS_IMAGE_CT_GRAY_Y; -- do if ((i = (*c->ops_->write_)(c->obj_,(char *)p,imagesize)) <= 0) -- goto L1; -- while ((p += i),(imagesize -= i) > 0); -- if (jas_stream_flush(c) < 0) goto L1; -- } -- else /* RGB color image */ -- { -- -- /* Writing color images is inefficient because JPEG 2000 wants to partition -- file data into separate image planes (colors), while XV wants data -- samples from each plane to be interleaved as 3-byte pixels. Apparently -- the fastest method consists of 3 passes through the XV image buffer, -- from which we extract the bytes of each component. -- */ -- i = 0; -- do /* each color component */ -- { long npix = imagesize/3; -- register jas_stream_t *c = img->cmpts_[i]->stream_; -- register byte *p = pic + i; -- -- jas_image_setcmpttype(img,i,i+JAS_IMAGE_CT_RGB_R); -- do if (jas_stream_putc(c,*p) < 0) goto L1; -- while ((p += 3),--npix > 0); -- if (jas_stream_flush(c) < 0) goto L1; -- } -- while (++i <= 2); -- }; -- if ( (*(format == F_JPC ? jpc_encode : jp2_encode))(img,str,options) >= 0 -- && jas_stream_flush(str) >= 0 -- ) error = 0; /* Success! */ --L1: jas_image_destroy(img); --L2: (void)jas_stream_close(str); -- if (iobuf) free(iobuf); -- if (pfree) free(pic); -- if (!CloseOutFile(fp,filename,error)) DirBox(0); -- SetCursors(-1); -+#if (JAS_VERSION_MAJOR >= 3) -+ jas_cleanup_thread(); -+ jas_cleanup_library(); -+#else -+ jas_cleanup(); -+#endif - } - --void JP2KDialog(int vis) --{ -- if ((jp2kUp = vis)) CenterMapWindow(jp2kW,0,0,JP2KW,JP2KH); -- else XUnmapWindow(theDisp,jp2kW); -+void JP2KDialog(int vis) { -+ if ((jp2kUp = vis)) -+ CenterMapWindow(jp2kW, 0, 0, JP2KW, JP2KH); -+ else -+ XUnmapWindow(theDisp, jp2kW); - } - --static void TWRedraw(Window w,unsigned int val) --{ -- char buf[11]; -- register int i; -+static void TWRedraw(Window w, unsigned int val) { -+ char buf[11]; -+ register int i; - -- /* Draw a 1-line numeric text string in the specified window, representing the -- argument value as a left-justified unsigned decimal integer, followed by a -- "cursor" icon. -- */ -- sprintf(buf,"%u",val); -- if (ctrlColor) XClearArea(theDisp,w,2,2,TEXTW-4,TEXTH-4,False); -- else XClearWindow(theDisp,w); -- Draw3dRect(w,0,0,TEXTW-1,TEXTH-1,R3D_IN,2,hicol,locol,infobg); -- XSetForeground(theDisp,theGC,infofg); -- XDrawString(theDisp,w,theGC,3,ASCENT+3,buf,i = strlen(buf)); -+ /* Draw a 1-line numeric text string in the specified window, representing -+ the argument value as a left-justified unsigned decimal integer, followed -+ by a "cursor" icon. -+ */ -+ sprintf(buf, "%u", val); -+ if (ctrlColor) -+ XClearArea(theDisp, w, 2, 2, TEXTW - 4, TEXTH - 4, False); -+ else -+ XClearWindow(theDisp, w); -+ Draw3dRect(w, 0, 0, TEXTW - 1, TEXTH - 1, R3D_IN, 2, hicol, locol, infobg); -+ XSetForeground(theDisp, theGC, infofg); -+ XDrawString(theDisp, w, theGC, 3, ASCENT + 3, buf, i = strlen(buf)); - -- /* Draw a "cursor" icon after the numeric string. */ -+ /* Draw a "cursor" icon after the numeric string. */ - -- i = XTextWidth(mfinfo,buf,i); -- XDrawLine(theDisp,w,theGC,i+3,2 ,i+3,2+CHIGH+1); -- XDrawLine(theDisp,w,theGC,i+3,2+CHIGH+1,i+5,2+CHIGH+3); -- XDrawLine(theDisp,w,theGC,i+3,2+CHIGH+1,i+1,2+CHIGH+3); -+ i = XTextWidth(mfinfo, buf, i); -+ XDrawLine(theDisp, w, theGC, i + 3, 2, i + 3, 2 + CHIGH + 1); -+ XDrawLine(theDisp, w, theGC, i + 3, 2 + CHIGH + 1, i + 5, 2 + CHIGH + 3); -+ XDrawLine(theDisp, w, theGC, i + 3, 2 + CHIGH + 1, i + 1, 2 + CHIGH + 3); - } - --int JP2KCheckEvent(register XEvent *xev) --{ -- int ok = 0; -+int JP2KCheckEvent(register XEvent *xev) { -+ int ok = 0; - -- /* Check whether the argument "X Windows" event is for one of our subwindows. -- If it is, handle the event and return 1; otherwise, return 0. -- */ -- if (!jp2kUp) return 0; -- switch (xev->type) -- { KeySym ks; -- int len; -- char buf[128]; -- register int i; -+ /* Check whether the argument "X Windows" event is for one of our -+ subwindows. If it is, handle the event and return 1; otherwise, return 0. -+ */ -+ if (!jp2kUp) -+ return 0; -+ switch (xev->type) { -+ KeySym ks; -+ int len; -+ char buf[128]; -+ register int i; - -- /* Throw away excess "expose" events for "dumb" windows. */ -+ /* Throw away excess "expose" events for "dumb" windows. */ - -- case Expose : --# define E ((XExposeEvent *)xev) -- if (E->window == jp2kW) -- { XRectangle rect; -+ case Expose: -+#define E ((XExposeEvent *)xev) -+ if (E->window == jp2kW) { -+ XRectangle rect; - -- rect.x = E->x ; rect.y = E->y ; -- rect.width = E->width; rect.height = E->height; -- XSetClipRectangles(theDisp,theGC,0,0,&rect,1,Unsorted); -- XSetForeground(theDisp,theGC,infofg); -- XSetBackground(theDisp,theGC,infobg); -- i = sizeof button/sizeof *button; -- while (--i >= 0) BTRedraw(&button[i]); -- i = sizeof chkbut/sizeof *chkbut; -- while (--i >= 0) CBRedraw(&chkbut[i]); -- i = sizeof menu/sizeof *menu; -- while (--i >= 0) MBRedraw(&menu[i]); -- RBRedraw(radio,-1); -- DrawString(jp2kW,10,10+ASCENT,"Save JPEG 2000 File..."); -- DrawString(jp2kW,10,10+ASCENT+2*LINEHIGH,"Style options:"); -- DrawString(jp2kW,JP2KW-2*MENUW-10,10+ASCENT+2*LINEHIGH, -- "Coding Blk"); -- DrawString(jp2kW,JP2KW-1*MENUW-10,10+ASCENT+2*LINEHIGH, -- " Precinct"); -- DrawString(jp2kW, -- JP2KW-2*MENUW-10,10+ASCENT+SPACING+3*LINEHIGH+2*MENUH, -- "Progression:"); -- DrawString(jp2kW, -- JP2KW-2*TEXTW-10,10+ASCENT+SPACING+3*LINEHIGH+3*MENUH+0*TEXTH, -- "Guard bits:"); -- DrawString(jp2kW, -- JP2KW-2*TEXTW-10,10+ASCENT+SPACING+3*LINEHIGH+3*MENUH+1*TEXTH, -- "Res levels:"); -- DrawString(jp2kW, -- JP2KW-2*TEXTW-10,10+ASCENT+SPACING+3*LINEHIGH+3*MENUH+2*TEXTH, -- "Rate:"); -- XSetClipMask(theDisp,theGC,None); -- ok = 1; -- break; -- }; -- i = sizeof text/sizeof *text; -- while (--i >= 0 && E->window != text[i]); -- if (i >= 0) -- { -- TWRedraw(E->window,textval[i]); -- ok = 1; -- }; -- break; --# undef E -+ rect.x = E->x; -+ rect.y = E->y; -+ rect.width = E->width; -+ rect.height = E->height; -+ XSetClipRectangles(theDisp, theGC, 0, 0, &rect, 1, Unsorted); -+ XSetForeground(theDisp, theGC, infofg); -+ XSetBackground(theDisp, theGC, infobg); -+ i = sizeof button / sizeof *button; -+ while (--i >= 0) -+ BTRedraw(&button[i]); -+ i = sizeof chkbut / sizeof *chkbut; -+ while (--i >= 0) -+ CBRedraw(&chkbut[i]); -+ i = sizeof menu / sizeof *menu; -+ while (--i >= 0) -+ MBRedraw(&menu[i]); -+ RBRedraw(radio, -1); -+ DrawString(jp2kW, 10, 10 + ASCENT, "Save JPEG 2000 File..."); -+ DrawString(jp2kW, 10, 10 + ASCENT + 2 * LINEHIGH, "Style options:"); -+ DrawString(jp2kW, JP2KW - 2 * MENUW - 10, -+ 10 + ASCENT + 2 * LINEHIGH, "Coding Blk"); -+ DrawString(jp2kW, JP2KW - 1 * MENUW - 10, -+ 10 + ASCENT + 2 * LINEHIGH, " Precinct"); -+ DrawString(jp2kW, JP2KW - 2 * MENUW - 10, -+ 10 + ASCENT + SPACING + 3 * LINEHIGH + 2 * MENUH, -+ "Progression:"); -+ DrawString(jp2kW, JP2KW - 2 * TEXTW - 10, -+ 10 + ASCENT + SPACING + 3 * LINEHIGH + 3 * MENUH + -+ 0 * TEXTH, -+ "Guard bits:"); -+ DrawString(jp2kW, JP2KW - 2 * TEXTW - 10, -+ 10 + ASCENT + SPACING + 3 * LINEHIGH + 3 * MENUH + -+ 1 * TEXTH, -+ "Res levels:"); -+ DrawString(jp2kW, JP2KW - 2 * TEXTW - 10, -+ 10 + ASCENT + SPACING + 3 * LINEHIGH + 3 * MENUH + -+ 2 * TEXTH, -+ "Rate:"); -+ XSetClipMask(theDisp, theGC, None); -+ ok = 1; -+ break; -+ }; -+ i = sizeof text / sizeof *text; -+ while (--i >= 0 && E->window != text[i]) -+ ; -+ if (i >= 0) { -+ TWRedraw(E->window, textval[i]); -+ ok = 1; -+ }; -+ break; -+#undef E - -- /* Check whether the user pressed one of our buttons. */ -+ /* Check whether the user pressed one of our buttons. */ - -- case ButtonPress: --# define E ((XButtonEvent *)xev) -- if (E->button == Button1 && E->window == jp2kW) -- { register int j; -+ case ButtonPress: -+#define E ((XButtonEvent *)xev) -+ if (E->button == Button1 && E->window == jp2kW) { -+ register int j; - -- ok = 1; /* Check whether a regular button was pressed */ -- i = sizeof button/sizeof *button; -- while ( --i >= 0 -- && !PTINRECT(E->x,E->y,button[i].x,button[i].y,button[i].w,button[i].h) -- ); -- if (i >= 0) /* our button was pressed */ -- { char options[1024]; -- register char *p; -- register const char *q; -+ ok = 1; /* Check whether a regular button was pressed */ -+ i = sizeof button / sizeof *button; -+ while (--i >= 0 && !PTINRECT(E->x, E->y, button[i].x, button[i].y, -+ button[i].w, button[i].h)) -+ ; -+ if (i >= 0) /* our button was pressed */ -+ { -+ char options[1024]; -+ register char *p; -+ register const char *q; - -- if (!BTTrack(&button[i])) break; /* Ignore it */ -- if (i != J_BOK) /* must be "Cancel" button */ -- { -- JP2KDialog(0); -- break; -- }; -+ if (!BTTrack(&button[i])) -+ break; /* Ignore it */ -+ if (i != J_BOK) /* must be "Cancel" button */ -+ { -+ JP2KDialog(0); -+ break; -+ }; - -- /* Our user hit the "Ok" button. At this point, we have an ugly -- job to do: JasPer Library encoder options must be specified -- as an ASCII string of Space (" ")-separated <tag>[=<value>] -- entries, so we must collect the values of all of our widgets -- and subwindows, determine whether our user has requested any -- non-default values, then build the string only for the JasPer -- Library to immediately tear it apart again. Yechh! -- */ -- if ((unsigned)textval[J_TGBIT]-1 > 7) -- { -- OpenAlert("No. of guard bits must be 1-8"); -- sleep(3); -- CloseAlert(); -- break; -- }; -- if ((unsigned)textval[J_TRES ] <= 0) -- { -- OpenAlert("Maximum resolution levels must be >= 1"); -- sleep(3); -- CloseAlert(); -- break; -- }; -+ /* Our user hit the "Ok" button. At this point, we have an ugly -+ job to do: JasPer Library encoder options must be specified -+ as an ASCII string of Space (" ")-separated <tag>[=<value>] -+ entries, so we must collect the values of all of our widgets -+ and subwindows, determine whether our user has requested any -+ non-default values, then build the string only for the JasPer -+ Library to immediately tear it apart again. Yechh! -+ */ -+ if ((unsigned)textval[J_TGBIT] - 1 > 7) { -+ OpenAlert("No. of guard bits must be 1-8"); -+ sleep(3); -+ CloseAlert(); -+ break; -+ }; -+ if ((unsigned)textval[J_TRES] <= 0) { -+ OpenAlert("Maximum resolution levels must be >= 1"); -+ sleep(3); -+ CloseAlert(); -+ break; -+ }; - -- /* XXX Should we check and complain if the rate is zero? -- JasPer Library Version 1.701 apparently accepts that -- value, even though it seems kinda weird. -- */ -- p = options; -- i = 0; -- do if ((j = MBWhich(&menu[i])) != 5) -- { static const char *parm[2] = -- {"cblkwidth=%u", "cblkheight=%u"}; -+ /* XXX Should we check and complain if the rate is zero? -+ JasPer Library Version 1.701 apparently accepts that -+ value, even though it seems kinda weird. -+ */ -+ p = options; -+ i = 0; -+ do -+ if ((j = MBWhich(&menu[i])) != 5) { -+ static const char *parm[2] = {"cblkwidth=%u", -+ "cblkheight=%u"}; - -- if (p > options) *p++ = ' '; -- sprintf(p,parm[i-J_MCBXW],++j); -- while (*++p); -- } -- while (++i <= J_MCBXH); -- do if ((j = MBWhich(&menu[i])) < 15) -- { static const char *parm[2] = -- {"prcwidth=%u", "prcheight=%u"}; -+ if (p > options) -+ *p++ = ' '; -+ sprintf(p, parm[i - J_MCBXW], ++j); -+ while (*++p) -+ ; -+ } -+ while (++i <= J_MCBXH); -+ do -+ if ((j = MBWhich(&menu[i])) < 15) { -+ static const char *parm[2] = {"prcwidth=%u", -+ "prcheight=%u"}; - -- if (p > options) *p++ = ' '; -- sprintf(p,parm[i-J_MPREW],j); -- while (*++p); -- } -- while (++i <= J_MPREH); -- if ((j = MBWhich(&menu[i]))) -- { -- if (p > options) *p++ = ' '; -- *p++ = 'p'; *p++ = 'r'; *p++ = 'g'; *p = '='; -- q = ProgList[j]; -- while ((*++p = *q++)); -- }; -- if ((i = textval[J_TRES ]) != 6) -- { -- if (p > options) *p++ = ' '; -- sprintf(p,"numrlvls=%u",i); -- while (*++p); -- }; -- i = 0; -- do if (chkbut[i].val) /* append this encoding option */ -- { -- if (p > options) *p++ = ' '; -- q = chkbut[i].str; -- while ((*p++ = *q++)); -- *--p = '\000'; -- } -- while (++i < sizeof chkbut/sizeof *chkbut); -- if ((i = textval[J_TGBIT]) != 2) -- { -- if (p > options) *p++ = ' '; -- sprintf(p,"numgbits=%u",i); -- while (*++p); -- }; -- if ((i = textval[J_TRATE]) != 100) -- { -- if (p > options) *p++ = ' '; -- *p++ = 'r'; *p++ = 'a'; *p++ = 't'; *p++ = 'e'; -- *p++ = '='; -- if (i) /* non-zero rate */ -- { -- if (RBWhich(radio)) sprintf(p,"%uB",i); /* # Bytes */ -- else /* the value is a percentage */ -- { -- if (i > 100) i = 200; /* => Raw size + 1 */ -- sprintf(p,"%u.%.2u",i/100,i%100); -- } -- while (*++p); -- } -- else /* rate = 0 */ -- { -+ if (p > options) -+ *p++ = ' '; -+ sprintf(p, parm[i - J_MPREW], j); -+ while (*++p) -+ ; -+ } -+ while (++i <= J_MPREH); -+ if ((j = MBWhich(&menu[i]))) { -+ if (p > options) -+ *p++ = ' '; -+ *p++ = 'p'; -+ *p++ = 'r'; -+ *p++ = 'g'; -+ *p = '='; -+ q = ProgList[j]; -+ while ((*++p = *q++)) -+ ; -+ }; -+ if ((i = textval[J_TRES]) != 6) { -+ if (p > options) -+ *p++ = ' '; -+ sprintf(p, "numrlvls=%u", i); -+ while (*++p) -+ ; -+ }; -+ i = 0; -+ do -+ if (chkbut[i].val) /* append this encoding option */ -+ { -+ if (p > options) -+ *p++ = ' '; -+ q = chkbut[i].str; -+ while ((*p++ = *q++)) -+ ; -+ *--p = '\000'; -+ } -+ while (++i < sizeof chkbut / sizeof *chkbut); -+ if ((i = textval[J_TGBIT]) != 2) { -+ if (p > options) -+ *p++ = ' '; -+ sprintf(p, "numgbits=%u", i); -+ while (*++p) -+ ; -+ }; -+ if ((i = textval[J_TRATE]) != 100) { -+ if (p > options) -+ *p++ = ' '; -+ *p++ = 'r'; -+ *p++ = 'a'; -+ *p++ = 't'; -+ *p++ = 'e'; -+ *p++ = '='; -+ if (i) /* non-zero rate */ -+ { -+ if (RBWhich(radio)) -+ sprintf(p, "%uB", i); /* # Bytes */ -+ else /* the value is a percentage */ -+ { -+ if (i > 100) -+ i = 200; /* => Raw size + 1 */ -+ sprintf(p, "%u.%.2u", i / 100, i % 100); -+ } -+ while (*++p) -+ ; -+ } else /* rate = 0 */ -+ { - -- /* XXX This is apparently valid, since JasPer Library -- Version 1.701 doesn't complain about it. -- */ -- *p++ = '0'; -- *p = '\000'; -- } -- }; -- StoreJP2K(options); /* Finally, do the *real* work! */ -- JP2KDialog(0); -- p = GetDirFullName(); -- if (!ISPIPE(*p)) -- { -- XVCreatedFile(p); -- StickInCtrlList(0); -- }; -- break; -- }; -+ /* XXX This is apparently valid, since JasPer Library -+ Version 1.701 doesn't complain about it. -+ */ -+ *p++ = '0'; -+ *p = '\000'; -+ } -+ }; -+ StoreJP2K(options); /* Finally, do the *real* work! */ -+ JP2KDialog(0); -+ p = GetDirFullName(); -+ if (!ISPIPE(*p)) { -+ XVCreatedFile(p); -+ StickInCtrlList(0); -+ }; -+ break; -+ }; - -- /* See whether a check-box button was pressed. */ -+ /* See whether a check-box button was pressed. */ - -- i = sizeof chkbut/sizeof *chkbut; -- while (--i >= 0 && !CBClick(&chkbut[i],E->x,E->y)); -- if (i >= 0) /* our button was pressed */ -- { -- (void)CBTrack(&chkbut[i]); -- break; -- }; -+ i = sizeof chkbut / sizeof *chkbut; -+ while (--i >= 0 && !CBClick(&chkbut[i], E->x, E->y)) -+ ; -+ if (i >= 0) /* our button was pressed */ -+ { -+ (void)CBTrack(&chkbut[i]); -+ break; -+ }; - -- /* See whether a menu button was pressed. */ -+ /* See whether a menu button was pressed. */ - -- i = sizeof menu/sizeof *menu; -- while (--i >= 0 && !MBClick(&menu[i],E->x,E->y)); -- if (i >= 0) /* our button was pressed */ -- { register int j; -+ i = sizeof menu / sizeof *menu; -+ while (--i >= 0 && !MBClick(&menu[i], E->x, E->y)) -+ ; -+ if (i >= 0) /* our button was pressed */ -+ { -+ register int j; - -- if ((j = MBTrack(&menu[i])) >= 0) -- { -- switch (i) -- { -+ if ((j = MBTrack(&menu[i])) >= 0) { -+ switch (i) { - -- /* The JasPer Library constrains a coding box's area -- (width x height) to be <= 4096 pixels, so if this -- button-press would violate that condition, then -- quietly limit the box's orthogonal dimension by just -- enough to compensate. -- */ -- case J_MCBXH: -- case J_MCBXW: if (MBWhich(&menu[!i]) + j >= 10) -- MBSelect(&menu[!i],10 - j); -- }; -- MBSelect(&menu[i],j); -- MBSetActive(&menu[i],1); -- }; -- break; -- }; -+ /* The JasPer Library constrains a coding box's area -+ (width x height) to be <= 4096 pixels, so if this -+ button-press would violate that condition, then -+ quietly limit the box's orthogonal dimension by just -+ enough to compensate. -+ */ -+ case J_MCBXH: -+ case J_MCBXW: -+ if (MBWhich(&menu[!i]) + j >= 10) -+ MBSelect(&menu[!i], 10 - j); -+ }; -+ MBSelect(&menu[i], j); -+ MBSetActive(&menu[i], 1); -+ }; -+ break; -+ }; - -- /* See whether a radio button was pressed. */ -+ /* See whether a radio button was pressed. */ - -- if ( (i = RBClick(radio,E->x,E->y)) >= 0 /* button pressed */ -- && RBTrack(radio,i) -- ) -- { -- RBSelect(radio,i); -- RBSetActive(radio,i,1); -- }; -- break; -- }; -- XBell(theDisp,50); -- break; --# undef E -+ if ((i = RBClick(radio, E->x, E->y)) >= 0 /* button pressed */ -+ && RBTrack(radio, i)) { -+ RBSelect(radio, i); -+ RBSetActive(radio, i, 1); -+ }; -+ break; -+ }; -+ XBell(theDisp, 50); -+ break; -+#undef E - -- /* Translate a few key-press events into simulated button events. */ -+ /* Translate a few key-press events into simulated button events. */ - -- case KeyPress : --# define E ((XKeyEvent *)xev) -- buf[len = XLookupString(E,buf,sizeof buf,&ks,0)] = '\000'; -- RemapKeyCheck(ks,buf,&len); -- if (E->window == jp2kW) -- { -- ok = 1; -- if (len > 0) -- switch (buf[0]) -- { -- case '\r' : -- case '\n' : FakeButtonPress(&button[J_BOK ]); -- break; -- case '\033': FakeButtonPress(&button[J_BCANC]); -- }; -- break; -- }; -- i = sizeof text/sizeof *text; -- while (--i >= 0 && E->window != text[i]); -- if (i >= 0) /* a key was pressed in our text window */ -- { int oldval = textval[i]; /* Save this subwindow's old value */ -- register int c, j = 0; -+ case KeyPress: -+#define E ((XKeyEvent *)xev) -+ buf[len = XLookupString(E, buf, sizeof buf, &ks, 0)] = '\000'; -+ RemapKeyCheck(ks, buf, &len); -+ if (E->window == jp2kW) { -+ ok = 1; -+ if (len > 0) -+ switch (buf[0]) { -+ case '\r': -+ case '\n': -+ FakeButtonPress(&button[J_BOK]); -+ break; -+ case '\033': -+ FakeButtonPress(&button[J_BCANC]); -+ }; -+ break; -+ }; -+ i = sizeof text / sizeof *text; -+ while (--i >= 0 && E->window != text[i]) -+ ; -+ if (i >= 0) /* a key was pressed in our text window */ -+ { -+ int oldval = textval[i]; /* Save this subwindow's old value */ -+ register int c, j = 0; - -- /* This is a *very* simple text-input editing loop that assembles an -- an unsigned integer from successive ASCII decimal digits, typed -- into one of our 1-line subwindows. For convenience, the only -- character recognized is Backspace. -- */ -- ok = 1; -- L: if (j >= len) break; -- if ((unsigned)(c = buf[j++] - '0') <= 9) -- { -- TWRedraw(text[i],textval[i] = textval[i]*10 + c); -- goto L; -- }; -- if ((c += '0') == '\b') -- { -- TWRedraw(text[i],textval[i] = textval[i]/10); -- goto L; -- }; -- textval[i] = oldval; -- }; -- XBell(theDisp,50); --# undef E -- }; -- return ok; -+ /* This is a *very* simple text-input editing loop that assembles an -+ an unsigned integer from successive ASCII decimal digits, typed -+ into one of our 1-line subwindows. For convenience, the only -+ character recognized is Backspace. -+ */ -+ ok = 1; -+ L: -+ if (j >= len) -+ break; -+ if ((unsigned)(c = buf[j++] - '0') <= 9) { -+ TWRedraw(text[i], textval[i] = textval[i] * 10 + c); -+ goto L; -+ }; -+ if ((c += '0') == '\b') { -+ TWRedraw(text[i], textval[i] = textval[i] / 10); -+ goto L; -+ }; -+ textval[i] = oldval; -+ }; -+ XBell(theDisp, 50); -+#undef E -+ }; -+ return ok; - } - -- - /*******************************************/ --void --VersionInfoJP2K() /* GRR 20070304 */ -+void VersionInfoJP2K() /* GRR 20070304 */ - { -- fprintf(stderr, " Compiled with libjasper %s; using libjasper %s.\n", -- JAS_VERSION, jas_getversion()); -+ fprintf(stderr, " Compiled with libjasper %s; using libjasper %s.\n", -+ JAS_VERSION, jas_getversion()); - } - - #endif /* HAVE_JP2K */ diff --git a/graphics/xv/files/patch-xvjpeg.c b/graphics/xv/files/patch-xvjpeg.c index ebbf966d0863..44fcd6566080 100644 --- a/graphics/xv/files/patch-xvjpeg.c +++ b/graphics/xv/files/patch-xvjpeg.c @@ -1,7 +1,6 @@ -$OpenBSD$ ---- xvjpeg.c.orig Fri Aug 28 13:41:30 2009 -+++ xvjpeg.c Fri Aug 28 18:58:46 2009 -@@ -696,7 +696,7 @@ L2: +--- src/xvjpeg.c.orig 2023-07-17 01:25:42 UTC ++++ src/xvjpeg.c +@@ -699,7 +699,7 @@ L2: if ((cmy = *q++ - k) < 0) cmy = 0; *p++ = cmy; /* R */ if ((cmy = *q++ - k) < 0) cmy = 0; *p++ = cmy; /* G */ if ((cmy = *q++ - k) < 0) cmy = 0; *p++ = cmy; /* B */ @@ -10,7 +9,7 @@ $OpenBSD$ } else { /* assume normal data */ register byte *q = pic; -@@ -707,7 +707,7 @@ L2: +@@ -710,7 +710,7 @@ L2: if ((cmy = k - *q++) < 0) cmy = 0; *p++ = cmy; /* R */ if ((cmy = k - *q++) < 0) cmy = 0; *p++ = cmy; /* G */ if ((cmy = k - *q++) < 0) cmy = 0; *p++ = cmy; /* B */ diff --git a/graphics/xv/files/patch-xvmisc.c b/graphics/xv/files/patch-xvmisc.c index 38cf152e6c68..08b2abd0cb14 100644 --- a/graphics/xv/files/patch-xvmisc.c +++ b/graphics/xv/files/patch-xvmisc.c @@ -1,6 +1,6 @@ ---- xvmisc.c.orig 2010-02-11 14:29:41.000000000 +0100 -+++ xvmisc.c 2010-02-11 15:25:03.000000000 +0100 -@@ -504,6 +504,7 @@ +--- src/xvmisc.c.orig 2023-07-17 01:25:42 UTC ++++ src/xvmisc.c +@@ -504,6 +504,7 @@ void FatalError (identifier) } @@ -8,7 +8,7 @@ /***********************************/ void Quit(i) int i; -@@ -601,7 +619,8 @@ +@@ -597,6 +598,7 @@ void Quit(i) } } @@ -16,4 +16,3 @@ XSync(theDisp, False); exit(i); } - diff --git a/graphics/xv/files/patch-xvpng.c b/graphics/xv/files/patch-xvpng.c deleted file mode 100644 index 82076f94ced5..000000000000 --- a/graphics/xv/files/patch-xvpng.c +++ /dev/null @@ -1,509 +0,0 @@ ---- xvpng.c.orig 2007-05-14 00:53:28 UTC -+++ xvpng.c -@@ -31,6 +31,7 @@ - - #ifdef HAVE_PNG - -+#include "zlib.h" - #include "png.h" - - /*** Stuff for PNG Dialog box ***/ -@@ -41,7 +42,9 @@ - #define COMPRESSION 6 /* default zlib compression level, not max - (Z_BEST_COMPRESSION) */ - --#define HAVE_tRNS (info_ptr->valid & PNG_INFO_tRNS) -+/* old -+#define HAVE_tRNS (info_ptr->valid & PNG_INFO_tRNS) */ -+#define HAVE_tRNS png_get_valid(png_ptr,info_ptr,PNG_INFO_tRNS) - - #define DWIDE 86 - #define DHIGH 104 -@@ -444,6 +447,10 @@ int WritePNG(fp, pic, ptype, w, h, rmap, - byte *p, *png_line; - char software[256]; - char *savecmnt; -+ /* for storing values until all are accumulated, so that the image header can be set in full */ -+ int _bit_depth,_color_type,_interlace_type,_compression_type,_filter_type; -+ png_uint_32 _width,_height; -+ png_time _mod_time; - - if ((png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, - png_xv_error, png_xv_warning)) == NULL) { -@@ -458,7 +465,7 @@ int WritePNG(fp, pic, ptype, w, h, rmap, - FatalError(software); - } - -- if (setjmp(png_ptr->jmpbuf)) { -+ if (setjmp(png_jmpbuf(png_ptr))) { - png_destroy_write_struct(&png_ptr, &info_ptr); - return -1; - } -@@ -489,8 +496,8 @@ int WritePNG(fp, pic, ptype, w, h, rmap, - png_set_filter(png_ptr, 0, filter); - } - -- info_ptr->width = w; -- info_ptr->height = h; -+ _width = w; -+ _height = h; - if (w <= 0 || h <= 0) { - SetISTR(ISTR_WARNING, "%s: image dimensions out of range (%dx%d)", - fbasename, w, h); -@@ -498,7 +505,7 @@ int WritePNG(fp, pic, ptype, w, h, rmap, - return -1; - } - -- info_ptr->interlace_type = interCB.val ? 1 : 0; -+ _interlace_type = interCB.val ? PNG_INTERLACE_ADAM7 : PNG_INTERLACE_NONE; - - linesize = 0; /* quiet a compiler warning */ - -@@ -542,40 +549,44 @@ int WritePNG(fp, pic, ptype, w, h, rmap, - png_destroy_write_struct(&png_ptr, &info_ptr); - return -1; - } -- info_ptr->color_type = PNG_COLOR_TYPE_RGB; -- info_ptr->bit_depth = 8; -+ _color_type = PNG_COLOR_TYPE_RGB; -+ _bit_depth = 8; - } else /* ptype == PIC8 */ { - linesize = w; -- info_ptr->color_type = PNG_COLOR_TYPE_PALETTE; -+ _color_type = PNG_COLOR_TYPE_PALETTE; - if (numuniqcols <= 2) -- info_ptr->bit_depth = 1; -+ _bit_depth = 1; - else - if (numuniqcols <= 4) -- info_ptr->bit_depth = 2; -+ _bit_depth = 2; - else - if (numuniqcols <= 16) -- info_ptr->bit_depth = 4; -+ _bit_depth = 4; - else -- info_ptr->bit_depth = 8; -+ _bit_depth = 8; - - for (i = 0; i < numuniqcols; i++) { - palette[i].red = r1[i]; - palette[i].green = g1[i]; - palette[i].blue = b1[i]; - } -- info_ptr->num_palette = numuniqcols; -- info_ptr->palette = palette; -+/* cannot find a setter for this, unsure if it is necessary anymore... - info_ptr->valid |= PNG_INFO_PLTE; -+*/ -+ /* set the header just in case it's needed */ -+ png_set_IHDR(png_ptr,info_ptr,_width,_height,_bit_depth,_color_type, -+ _interlace_type,PNG_COMPRESSION_TYPE_DEFAULT,PNG_FILTER_TYPE_DEFAULT); -+ png_set_PLTE(png_ptr,info_ptr,palette,numuniqcols); - } - } - - else if (colorType == F_GREYSCALE || colorType == F_BWDITHER) { -- info_ptr->color_type = PNG_COLOR_TYPE_GRAY; -+ _color_type = PNG_COLOR_TYPE_GRAY; - if (colorType == F_BWDITHER) { - /* shouldn't happen */ - if (ptype == PIC24) FatalError("PIC24 and B/W Stipple in WritePNG()"); - -- info_ptr->bit_depth = 1; -+ _bit_depth = 1; - if (MONO(r1[0], g1[0], b1[0]) > MONO(r1[1], g1[1], b1[1])) { - remap[0] = 1; - remap[1] = 0; -@@ -595,7 +606,7 @@ int WritePNG(fp, pic, ptype, w, h, rmap, - png_destroy_write_struct(&png_ptr, &info_ptr); - return -1; - } -- info_ptr->bit_depth = 8; -+ _bit_depth = 8; - } - else /* ptype == PIC8 */ { - int low_precision; -@@ -617,7 +628,7 @@ int WritePNG(fp, pic, ptype, w, h, rmap, - for (; i < 256; i++) - remap[i]=0; /* shouldn't be necessary, but... */ - -- info_ptr->bit_depth = 8; -+ _bit_depth = 8; - - /* Note that this fails most of the time because of gamma */ - /* (and that would be a bug: GRR FIXME) */ -@@ -636,7 +647,7 @@ int WritePNG(fp, pic, ptype, w, h, rmap, - for (i = 0; i < numuniqcols; i++) { - remap[i] &= 0xf; - } -- info_ptr->bit_depth = 4; -+ _bit_depth = 4; - - /* try to adjust to 2-bit precision grayscale */ - -@@ -652,7 +663,7 @@ int WritePNG(fp, pic, ptype, w, h, rmap, - for (i = 0; i < numuniqcols; i++) { - remap[i] &= 3; - } -- info_ptr->bit_depth = 2; -+ _bit_depth = 2; - - /* try to adjust to 1-bit precision grayscale */ - -@@ -668,7 +679,7 @@ int WritePNG(fp, pic, ptype, w, h, rmap, - for (i = 0; i < numuniqcols; i++) { - remap[i] &= 1; - } -- info_ptr->bit_depth = 1; -+ _bit_depth = 1; - } - } - } -@@ -677,6 +688,9 @@ int WritePNG(fp, pic, ptype, w, h, rmap, - else - png_error(png_ptr, "Unknown colorstyle in WritePNG"); - -+ png_set_IHDR(png_ptr,info_ptr,_width,_height,_bit_depth,_color_type, -+ _interlace_type,PNG_COMPRESSION_TYPE_DEFAULT,PNG_FILTER_TYPE_DEFAULT); -+ - if ((text = (png_textp)malloc(sizeof(png_text)))) { - sprintf(software, "XV %s", REVDATE); - -@@ -685,20 +699,22 @@ int WritePNG(fp, pic, ptype, w, h, rmap, - text->text = software; - text->text_length = strlen(text->text); - -- info_ptr->max_text = 1; -- info_ptr->num_text = 1; -- info_ptr->text = text; -+/* max_text seems to be internal only now, do not set -+ info_ptr->max_text = 1; */ -+ png_set_text(png_ptr,info_ptr,text,1); - } - - Display_Gamma = gDial.val; /* Save the current gamma for loading */ - - // GRR FIXME: add .Xdefaults option to omit writing gamma (size, cumulative errors when editing)--alternatively, modify save box to include "omit" checkbox -- info_ptr->gamma = 1.0/gDial.val; -- info_ptr->valid |= PNG_INFO_gAMA; -+ png_set_gAMA(png_ptr,info_ptr,1.0/gDial.val); -+/* doesn't seem to be a way to set valid directly anymore, unnecessary maybe.. -+ info_ptr->valid |= PNG_INFO_gAMA; */ - -+/* might need to be png_write_info_before_PLTE() ... */ - png_write_info(png_ptr, info_ptr); - -- if (info_ptr->bit_depth < 8) -+ if (_bit_depth < 8) - png_set_packing(png_ptr); - - pass=png_set_interlace_handling(png_ptr); -@@ -711,13 +727,13 @@ int WritePNG(fp, pic, ptype, w, h, rmap, - int j; - p = pic; - for (j = 0; j < h; ++j) { -- if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY) { -+ if (_color_type == PNG_COLOR_TYPE_GRAY) { - int k; - for (k = 0; k < w; ++k) - png_line[k] = ptype==PIC24 ? MONO(p[k*3], p[k*3+1], p[k*3+2]) : - remap[pc2nc[p[k]]]; - png_write_row(png_ptr, png_line); -- } else if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) { -+ } else if (_color_type == PNG_COLOR_TYPE_PALETTE) { - int k; - for (k = 0; k < w; ++k) - png_line[k] = pc2nc[p[k]]; -@@ -739,28 +755,31 @@ int WritePNG(fp, pic, ptype, w, h, rmap, - (savecmnt = (char *)malloc((strlen(picComments) + 1)*sizeof(char)))) { - png_textp tp; - char *comment, *key; -+ int nt; -+ int mt; - - strcpy(savecmnt, picComments); - key = savecmnt; -+ png_get_text(png_ptr,info_ptr,&tp,&mt); /* to get 'max_text' */ - tp = text; -- info_ptr->num_text = 0; -+ nt = 0; - - comment = strchr(key, ':'); - - do { - /* Allocate a larger structure for comments if necessary */ -- if (info_ptr->num_text >= info_ptr->max_text) -+ if (nt >= mt) - { - if ((tp = -- realloc(text, (info_ptr->num_text + 2)*sizeof(png_text))) == NULL) -+ realloc(text, (nt + 2)*sizeof(png_text))) == NULL) - { - break; - } - else - { - text = tp; -- tp = &text[info_ptr->num_text]; -- info_ptr->max_text += 2; -+ tp = &text[nt]; -+ mt += 2; - } - } - -@@ -810,7 +829,7 @@ int WritePNG(fp, pic, ptype, w, h, rmap, - } - - tp->compression = tp->text_length > 640 ? 0 : -1; -- info_ptr->num_text++; -+ nt++; - tp++; - } - } -@@ -834,27 +853,29 @@ int WritePNG(fp, pic, ptype, w, h, rmap, - tp->text = key; - tp->text_length = q - key; - tp->compression = tp->text_length > 750 ? 0 : -1; -- info_ptr->num_text++; -+ nt++; - key = NULL; - } - } while (key && *key); -+ png_set_text(png_ptr,info_ptr,text,nt); - } - else { -- info_ptr->num_text = 0; -+ png_set_text(png_ptr,info_ptr,text,0); - } - } -- info_ptr->text = text; - -- png_convert_from_time_t(&(info_ptr->mod_time), time(NULL)); -- info_ptr->valid |= PNG_INFO_tIME; -+ png_convert_from_time_t(&_mod_time, time(NULL)); -+ png_set_tIME(png_ptr,info_ptr,&_mod_time); -+/* dunno how to set validity -+ info_ptr->valid |= PNG_INFO_tIME; */ - - png_write_end(png_ptr, info_ptr); - fflush(fp); /* just in case we core-dump before finishing... */ - - if (text) { - free(text); -- /* must do this or png_destroy_write_struct() 0.97+ will free text again: */ -- info_ptr->text = (png_textp)NULL; -+ /* must do this or png_destroy_write_struct() 0.97+ will free text again: -+ info_ptr->text = (png_textp)NULL; */ - if (savecmnt) - { - free(savecmnt); -@@ -886,6 +907,14 @@ int LoadPNG(fname, pinfo) - int pass; - int gray_to_rgb; - size_t commentsize; -+ /* temp storage vars for libpng15 migration */ -+ int _bit_depth,_color_type,_interlace_type,_compression_type,_filter_type,_num_text,_num_palette; -+ png_uint_32 _width,_height; -+ png_timep _mod_time; -+ double _gamma; -+ png_textp _text; -+ png_colorp _palette; -+ png_color_16p _background; - - fbasename = BaseName(fname); - -@@ -921,7 +950,7 @@ int LoadPNG(fname, pinfo) - FatalError("malloc failure in LoadPNG"); - } - -- if (setjmp(png_ptr->jmpbuf)) { -+ if (setjmp(png_jmpbuf(png_ptr))) { - fclose(fp); - png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL); - if (!read_anything) { -@@ -945,8 +974,10 @@ int LoadPNG(fname, pinfo) - #endif - png_read_info(png_ptr, info_ptr); - -- pinfo->w = pinfo->normw = info_ptr->width; -- pinfo->h = pinfo->normh = info_ptr->height; -+ png_get_IHDR(png_ptr,info_ptr,&_width,&_height,&_bit_depth,&_color_type,&_interlace_type,NULL,NULL); -+ -+ pinfo->w = pinfo->normw = _width; -+ pinfo->h = pinfo->normh = _height; - if (pinfo->w <= 0 || pinfo->h <= 0) { - SetISTR(ISTR_WARNING, "%s: image dimensions out of range (%dx%d)", - fbasename, pinfo->w, pinfo->h); -@@ -957,9 +988,9 @@ int LoadPNG(fname, pinfo) - pinfo->frmType = F_PNG; - - sprintf(pinfo->fullInfo, "PNG, %d bit ", -- info_ptr->bit_depth * info_ptr->channels); -+ _bit_depth * png_get_channels(png_ptr,info_ptr)); - -- switch(info_ptr->color_type) { -+ switch(_color_type) { - case PNG_COLOR_TYPE_PALETTE: - strcat(pinfo->fullInfo, "palette color"); - break; -@@ -983,15 +1014,17 @@ int LoadPNG(fname, pinfo) - - sprintf(pinfo->fullInfo + strlen(pinfo->fullInfo), - ", %sinterlaced. (%d bytes)", -- info_ptr->interlace_type ? "" : "non-", filesize); -+ _interlace_type ? "" : "non-", filesize); - -- sprintf(pinfo->shrtInfo, "%lux%lu PNG", info_ptr->width, info_ptr->height); -+ sprintf(pinfo->shrtInfo, "%lux%lu PNG", _width, _height); - -- if (info_ptr->bit_depth < 8) -+ if (_bit_depth < 8) - png_set_packing(png_ptr); - -- if (info_ptr->valid & PNG_INFO_gAMA) -- png_set_gamma(png_ptr, Display_Gamma, info_ptr->gamma); -+ if (png_get_valid(png_ptr,info_ptr,PNG_INFO_gAMA)) { -+ png_get_gAMA(png_ptr,info_ptr,&_gamma); -+ png_set_gamma(png_ptr, Display_Gamma, _gamma); -+ } - /* - *else - * png_set_gamma(png_ptr, Display_Gamma, 0.45); -@@ -1000,7 +1033,7 @@ int LoadPNG(fname, pinfo) - gray_to_rgb = 0; /* quiet a compiler warning */ - - if (have_imagebg) { -- if (info_ptr->bit_depth == 16) { -+ if (_bit_depth == 16) { - my_background.red = imagebgR; - my_background.green = imagebgG; - my_background.blue = imagebgB; -@@ -1013,8 +1046,8 @@ int LoadPNG(fname, pinfo) - } - png_set_background(png_ptr, &my_background, PNG_BACKGROUND_GAMMA_SCREEN, - 0, Display_Gamma); -- if ((info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA || -- (info_ptr->color_type == PNG_COLOR_TYPE_GRAY && HAVE_tRNS)) && -+ if ((_color_type == PNG_COLOR_TYPE_GRAY_ALPHA || -+ (_color_type == PNG_COLOR_TYPE_GRAY && HAVE_tRNS)) && - (imagebgR != imagebgG || imagebgR != imagebgB)) /* i.e., colored bg */ - { - png_set_gray_to_rgb(png_ptr); -@@ -1022,8 +1055,9 @@ int LoadPNG(fname, pinfo) - gray_to_rgb = 1; - } - } else { -- if (info_ptr->valid & PNG_INFO_bKGD) { -- png_set_background(png_ptr, &info_ptr->background, -+ if (png_get_valid(png_ptr,info_ptr,PNG_INFO_bKGD)) { -+ png_get_bKGD(png_ptr,info_ptr,&_background); -+ png_set_background(png_ptr, _background, - PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); - } else { - my_background.red = my_background.green = my_background.blue = -@@ -1033,13 +1067,13 @@ int LoadPNG(fname, pinfo) - } - } - -- if (info_ptr->bit_depth == 16) -+ if (_bit_depth == 16) - png_set_strip_16(png_ptr); - -- if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY || -- info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) -+ if (_color_type == PNG_COLOR_TYPE_GRAY || -+ _color_type == PNG_COLOR_TYPE_GRAY_ALPHA) - { -- if (info_ptr->bit_depth == 1) -+ if (_bit_depth == 1) - pinfo->colType = F_BWDITHER; - else - pinfo->colType = F_GREYSCALE; -@@ -1049,9 +1083,11 @@ int LoadPNG(fname, pinfo) - pass=png_set_interlace_handling(png_ptr); - - png_read_update_info(png_ptr, info_ptr); -+ /* get HIDR again just in case the info_ptr changed */ -+ png_get_IHDR(png_ptr,info_ptr,&_width,&_height,&_bit_depth,&_color_type,&_interlace_type,NULL,NULL); - -- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB || -- info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA || gray_to_rgb) -+ if (_color_type == PNG_COLOR_TYPE_RGB || -+ _color_type == PNG_COLOR_TYPE_RGB_ALPHA || gray_to_rgb) - { - linesize = 3 * pinfo->w; - if (linesize/3 < pinfo->w) { /* know pinfo->w > 0 (see above) */ -@@ -1065,16 +1101,17 @@ int LoadPNG(fname, pinfo) - } else { - linesize = pinfo->w; - pinfo->type = PIC8; -- if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY || -- info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { -+ if (_color_type == PNG_COLOR_TYPE_GRAY || -+ _color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { - for (i = 0; i < 256; i++) - pinfo->r[i] = pinfo->g[i] = pinfo->b[i] = i; - } else { - pinfo->colType = F_FULLCOLOR; -- for (i = 0; i < info_ptr->num_palette; i++) { -- pinfo->r[i] = info_ptr->palette[i].red; -- pinfo->g[i] = info_ptr->palette[i].green; -- pinfo->b[i] = info_ptr->palette[i].blue; -+ png_get_PLTE(png_ptr,info_ptr,&_palette,&_num_palette); -+ for (i = 0; i < _num_palette; i++) { -+ pinfo->r[i] = _palette[i].red; -+ pinfo->g[i] = _palette[i].green; -+ pinfo->b[i] = _palette[i].blue; - } - } - } -@@ -1092,7 +1129,7 @@ int LoadPNG(fname, pinfo) - png_error(png_ptr, "can't allocate space for PNG image"); - } - -- png_start_read_image(png_ptr); -+ /*png_start_read_image(png_ptr); -- causes a warning and seems to be unnecessary */ - - for (i = 0; i < pass; i++) { - byte *p = pinfo->pic; -@@ -1106,22 +1143,23 @@ int LoadPNG(fname, pinfo) - - png_read_end(png_ptr, info_ptr); - -- if (info_ptr->num_text > 0) { -+ png_get_text(png_ptr,info_ptr,&_text,&_num_text); -+ if (_num_text > 0) { - commentsize = 1; - -- for (i = 0; i < info_ptr->num_text; i++) -- commentsize += strlen(info_ptr->text[i].key) + 1 + -- info_ptr->text[i].text_length + 2; -+ for (i = 0; i < _num_text; i++) -+ commentsize += strlen(_text[i].key) + 2 + -+ _text[i].text_length + _text[i].itxt_length + 1; - - if ((pinfo->comment = malloc(commentsize)) == NULL) { - png_warning(png_ptr,"can't allocate comment string"); - } - else { - pinfo->comment[0] = '\0'; -- for (i = 0; i < info_ptr->num_text; i++) { -- strcat(pinfo->comment, info_ptr->text[i].key); -+ for (i = 0; i < _num_text; i++) { -+ strcat(pinfo->comment, _text[i].key); - strcat(pinfo->comment, "::"); -- strcat(pinfo->comment, info_ptr->text[i].text); -+ strcat(pinfo->comment, _text[i].text); - strcat(pinfo->comment, "\n"); - } - } -@@ -1143,7 +1181,7 @@ png_xv_error(png_ptr, message) - { - SetISTR(ISTR_WARNING,"%s: libpng error: %s", fbasename, message); - -- longjmp(png_ptr->jmpbuf, 1); -+ longjmp(png_jmpbuf(png_ptr), 1); - } - - diff --git a/graphics/xv/files/patch-xvtext.c b/graphics/xv/files/patch-xvtext.c index a0218d2791a0..ce8254f3aa29 100644 --- a/graphics/xv/files/patch-xvtext.c +++ b/graphics/xv/files/patch-xvtext.c @@ -1,6 +1,6 @@ ---- xvtext.c.orig 2009-05-20 13:18:36.000000000 +0200 -+++ xvtext.c 2009-05-20 13:22:45.000000000 +0200 -@@ -181,7 +181,7 @@ +--- src/xvtext.c.orig 2023-07-17 01:25:42 UTC ++++ src/xvtext.c +@@ -181,7 +181,7 @@ static int selectCodeset PARM((TVINFO *)); #endif #ifdef TV_MULTILINGUAL static void setCodingSpec PARM((TVINFO *, struct coding_spec *)); diff --git a/graphics/xv/files/patch-xvvd.c b/graphics/xv/files/patch-xvvd.c index a3ec3b0d0b40..d0343720adf8 100644 --- a/graphics/xv/files/patch-xvvd.c +++ b/graphics/xv/files/patch-xvvd.c @@ -1,17 +1,17 @@ ---- xvvd.c.orig 2007-04-16 06:30:19.000000000 +0200 -+++ xvvd.c 2010-02-11 15:23:41.000000000 +0100 -@@ -1060,6 +1060,8 @@ +--- src/xvvd.c.orig 2023-07-17 01:25:42 UTC ++++ src/xvvd.c +@@ -1072,6 +1072,8 @@ static void HUPhandler(XtPointer dummy, XtSignalId* Id #endif } +int InSignal = 0; + - void vd_handler(sig) - int sig; + static void vd_handler(int sig) { -@@ -1068,7 +1070,7 @@ + UsedSignal = sig; +@@ -1085,7 +1087,7 @@ static void INThandler(XtPointer dummy, XtSignalId* Id #else - sigblock(sigmask(sig)); + sigblock(sigmask(UsedSignal)); #endif - + InSignal = 1; diff --git a/graphics/xv/pkg-descr b/graphics/xv/pkg-descr index f97231a5b2d7..0d55c40f5166 100644 --- a/graphics/xv/pkg-descr +++ b/graphics/xv/pkg-descr @@ -16,5 +16,3 @@ Please read the documentation in the directory for proper usage. LICENSE: shareware, free for personal use - -See also: http://www.gregroelofs.com/greg_xv.html diff --git a/graphics/xv/pkg-plist b/graphics/xv/pkg-plist index ad420820d0b2..36cb487ba513 100644 --- a/graphics/xv/pkg-plist +++ b/graphics/xv/pkg-plist @@ -3,22 +3,282 @@ bin/bggen bin/vdcomp bin/xcmap bin/xvpictoppm -lib/X11/xv_mgcsfx.sample -man/man1/bggen.1.gz -man/man1/vdcomp.1.gz -man/man1/xcmap.1.gz -man/man1/xv.1.gz -man/man1/xvp2p.1.gz +etc/xv_mgcsfx +%%PORTDOCS%%%%DOCSDIR%%/BUGS +%%PORTDOCS%%%%DOCSDIR%%/CHANGELOG +%%PORTDOCS%%%%DOCSDIR%%/CPMASK +%%PORTDOCS%%%%DOCSDIR%%/IDEAS %%PORTDOCS%%%%DOCSDIR%%/README %%PORTDOCS%%%%DOCSDIR%%/README.jumbo +%%PORTDOCS%%%%DOCSDIR%%/README.FLmask +%%PORTDOCS%%%%DOCSDIR%%/README.docs +%%PORTDOCS%%%%DOCSDIR%%/README.md %%PORTDOCS%%%%DOCSDIR%%/README.pcd -%%PORTDOCS%%%%DOCSDIR%%/epsf.ps -%%PORTDOCS%%%%DOCSDIR%%/xpm.ps -%%PORTDOCS%%%%DOCSDIR%%/xvdocs.ps -%%PORTDOCS%%%%DOCSDIR%%/xvtitle.ps +%%PORTDOCS%%%%DOCSDIR%%/bigxv.jpg +%%PORTDOCS%%%%DOCSDIR%%/copyright.h +%%PORTDOCS%%%%DOCSDIR%%/formats/bmp.doc +%%PORTDOCS%%%%DOCSDIR%%/formats/epsf.ps +%%PORTDOCS%%%%DOCSDIR%%/formats/gif.ack +%%PORTDOCS%%%%DOCSDIR%%/formats/gif.aspect +%%PORTDOCS%%%%DOCSDIR%%/formats/gif87.doc +%%PORTDOCS%%%%DOCSDIR%%/formats/gif89.doc +%%PORTDOCS%%%%DOCSDIR%%/formats/pbm.5 +%%PORTDOCS%%%%DOCSDIR%%/formats/pgm.5 +%%PORTDOCS%%%%DOCSDIR%%/formats/ppm.5 +%%PORTDOCS%%%%DOCSDIR%%/formats/xpm.ps %%PORTDOCS%%%%DOCSDIR%%/help -%%PORTDOCS%%%%DOCSDIR%%/bmp.doc -%%PORTDOCS%%%%DOCSDIR%%/gif.ack -%%PORTDOCS%%%%DOCSDIR%%/gif.aspect -%%PORTDOCS%%%%DOCSDIR%%/gif87.doc -%%PORTDOCS%%%%DOCSDIR%%/gif89.doc +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/adding-algorithms.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/adding-formats-1.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/adding-formats-2.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/availability.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/color-allocation.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/color-editor-1.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/color-editor-2.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/color-editor-3.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/command-line-options.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/control-window-1.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/control-window-2.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/control-window-3.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/control-window-4.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/control-window-5.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/control-window-6.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/credits.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/diversity-algorithm.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/external-programs.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/image-window.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/blutxtr2.jpg +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-001.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-002.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-003.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-004.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-005.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-006.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-007.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-008.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-009.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-010.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-011.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-012.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-013.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-014.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-015.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-016.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-017.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-018.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-019.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-020.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-021.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-022.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-023.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-024.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-025.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-026.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-027.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-028.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-029.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-030.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-031.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-032.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-033.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-034.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-035.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-036.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-037.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-038.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-039.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-040.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-041.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-042.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-043.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-044.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-045.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-046.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-047.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-048.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-049.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-050.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-051.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-052.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-053.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-054.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-055.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-056.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-057.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-058.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-059.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-060.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-061.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-062.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-063.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-064.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-065.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-066.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-067.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-068.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-069.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-070.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-071.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-072.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-073.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-074.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-075.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-076.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-077.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-078.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-079.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-080.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-081.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-082.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-083.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-084.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-085.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-086.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-087.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-088.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-089.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-090.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-091.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-092.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-093.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-094.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-095.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-096.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-097.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-098.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-099.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-100.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-101.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-102.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-103.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-104.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-105.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-106.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-107.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-108.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-109.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-110.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-111.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-112.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-113.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-114.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-115.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-116.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-117.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-118.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-119.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-120.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-121.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-122.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-123.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-124.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-125.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-126.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-127.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-128.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-129.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-130.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-131.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-132.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-133.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-134.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-135.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-136.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-137.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-138.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-139.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-140.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-141.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-142.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-143.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-144.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-145.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-146.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-147.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-148.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-149.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-150.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-151.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-152.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-153.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-154.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-155.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-156.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-157.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-158.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-159.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-160.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-161.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-162.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-163.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-164.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-165.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-166.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-167.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-168.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-169.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-170.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-171.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-172.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-173.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-174.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-175.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-176.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-177.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-178.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-179.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-180.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-181.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-182.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-183.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-184.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-185.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-186.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-187.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-188.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-189.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-190.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-191.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-192.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-193.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-194.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-195.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-196.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-197.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-198.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-199.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-200.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-201.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-202.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/fig-203.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/navbar.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/small_banner.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/images/xvlogo.gif +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/index.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/info-window.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/load-window.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/manindex.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/modifying-behavior-1.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/modifying-behavior-2.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/modifying-behavior-3.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/modifying-behavior-4.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/mouse-keyboard-usage.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/overview.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/postscript-window.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/release-notes.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/rgb-hsv-colorspaces.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/save-window-1.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/save-window-2.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/textview-window.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/visual-schnauzer-1.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/visual-schnauzer-2.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/html/x-resources.html +%%PORTDOCS%%%%DOCSDIR%%/manuals/xvdocs.pdf +%%PORTDOCS%%%%DOCSDIR%%/manuals/xvdocs.ps +%%PORTDOCS%%%%DOCSDIR%%/manuals/xvtitle.ps +share/man/fi/man1/xv.1.gz +share/man/man1/bggen.1.gz +share/man/man1/vdcomp.1.gz +share/man/man1/xcmap.1.gz +share/man/man1/xv.1.gz +share/man/man1/xvpictoppm.1.gz +share/man/pl/man1/xvpictoppm.1.gz |