xv-3.10a plus current jpeg/tiff/png
This commit is contained in:
parent
d9bd96efdc
commit
f5b9a210d5
51
graphics/xv/Makefile
Normal file
51
graphics/xv/Makefile
Normal file
@ -0,0 +1,51 @@
|
||||
# OpenBSD makefile for: xv
|
||||
# Version required: 3.10a
|
||||
# Date created: 1998-Mar-20
|
||||
# Whom: marc@OpenBSD.ORG
|
||||
#
|
||||
# $OpenBSD: Makefile,v 1.1.1.1 1998/03/21 05:38:13 marc Exp $
|
||||
#
|
||||
|
||||
DISTNAME= xv-3.10a
|
||||
DIST_SUBDIR= ${DISTNAME}
|
||||
CATEGORIES= graphics x11
|
||||
MASTER_SITES= ftp://ftp.cis.upenn.edu/pub/xv/
|
||||
DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
|
||||
|
||||
# Add support for png
|
||||
#
|
||||
MASTER_SITES+= ftp://swrinde.nde.swri.edu/pub/png/applications/
|
||||
DISTFILES+= xv-3.10a-png-1.2d.tar.gz
|
||||
|
||||
# Up-to-date jpeg/tiff libraries
|
||||
#
|
||||
PATCH_SITES= ftp://ftp.cis.upenn.edu/pub/xv/
|
||||
PATCHFILES= xv-3.10a.JPEG-patch xv-3.10a.TIFF-patch
|
||||
|
||||
# Various patches from the XV author's site
|
||||
#
|
||||
PATCH_SITES+= ftp://ftp.trilon.com/pub/xv/patches/
|
||||
PATCHFILES+= grabpatch vispatch mp-tiff-patch
|
||||
|
||||
MAINTAINER= ports@OpenBSD.ORG
|
||||
|
||||
LIB_DEPENDS= jpeg\\.7\\.:${PORTSDIR}/graphics/jpeg \
|
||||
tiff34\\.1:${PORTSDIR}/graphics/tiff34 \
|
||||
png\\.1\\.:${PORTSDIR}/graphics/png
|
||||
|
||||
USE_IMAKE= yes
|
||||
|
||||
pre-patch:
|
||||
@${PATCH} ${PATCH_ARGS} -p1 < ${WRKDIR}/xcmap.diff
|
||||
@${PATCH} ${PATCH_ARGS} -p1 < ${WRKDIR}/xvpng.diff
|
||||
@${CP} ${WRKDIR}/xvpng.c ${WRKSRC}
|
||||
@${CP} ${WRKDIR}/bits/br_png ${WRKSRC}/bits
|
||||
|
||||
post-install:
|
||||
${MKDIR} ${PREFIX}/share/doc/xv
|
||||
${INSTALL_DATA} ${WRKSRC}/README ${PREFIX}/share/doc/xv
|
||||
.if !defined(NOPORTDOCS)
|
||||
${INSTALL_DATA} ${WRKSRC}/docs/xvdocs.ps ${PREFIX}/share/doc/xv
|
||||
.endif
|
||||
|
||||
.include <bsd.port.mk>
|
7
graphics/xv/files/md5
Normal file
7
graphics/xv/files/md5
Normal file
@ -0,0 +1,7 @@
|
||||
MD5 (xv-3.10a/xv-3.10a.tar.gz) = 2d4fbeec1561304362781cc8e2f7f72d
|
||||
MD5 (xv-3.10a/xv-3.10a-png-1.2d.tar.gz) = c8cbe14db6e2104ed4eb5330cdaba420
|
||||
MD5 (xv-3.10a/xv-3.10a.JPEG-patch) = bd3ac79fa805319f583ccd382bdc825d
|
||||
MD5 (xv-3.10a/xv-3.10a.TIFF-patch) = 305f2f0273368bb6e029c3f212a14249
|
||||
MD5 (xv-3.10a/grabpatch) = fd9b9e735a1ed68e3792d904f1df422a
|
||||
MD5 (xv-3.10a/vispatch) = 4bc978d266bf1af9e29e8f21fc21e9d7
|
||||
MD5 (xv-3.10a/mp-tiff-patch) = acc754bea43bf957c37d2df293ed41e7
|
47
graphics/xv/patches/patch-aa
Normal file
47
graphics/xv/patches/patch-aa
Normal file
@ -0,0 +1,47 @@
|
||||
--- xvmisc.c.orig Fri Jan 13 23:41:34 1995
|
||||
+++ xvmisc.c Sat Mar 8 16:05:19 1997
|
||||
@@ -97,10 +97,18 @@
|
||||
if (!usesize || !(i&WidthValue)) w = defw;
|
||||
if (!usesize || !(i&HeightValue)) h = defh;
|
||||
|
||||
- hints.flags |= USSize;
|
||||
+ hints.flags |= USSize | PWinGravity;
|
||||
|
||||
- if (i&XValue && i&XNegative) x = dispWIDE - w - abs(x);
|
||||
- if (i&YValue && i&YNegative) y = dispHIGH - h - abs(y);
|
||||
+ hints.win_gravity = NorthWestGravity;
|
||||
+ if (i&XValue && i&XNegative) {
|
||||
+ hints.win_gravity = NorthEastGravity;
|
||||
+ x = dispWIDE - (w + 2 * bwidth) - abs(x);
|
||||
+ }
|
||||
+ if (i&YValue && i&YNegative) {
|
||||
+ hints.win_gravity = (hints.win_gravity == NorthWestGravity) ?
|
||||
+ SouthWestGravity : SouthEastGravity;
|
||||
+ y = dispHIGH - (h + 2 * bwidth) - abs(y);
|
||||
+ }
|
||||
|
||||
|
||||
#define VROOT_TRANS
|
||||
@@ -136,19 +144,18 @@
|
||||
if (!win) return(win); /* leave immediately if couldn't create */
|
||||
|
||||
|
||||
- XSetStandardProperties(theDisp, win, name, name, None, NULL, 0, &hints);
|
||||
-
|
||||
xwmh.input = True;
|
||||
xwmh.flags = InputHint;
|
||||
if (iconPix) { xwmh.icon_pixmap = iconPix; xwmh.flags |= IconPixmapHint; }
|
||||
- XSetWMHints(theDisp, win, &xwmh);
|
||||
|
||||
if (clname && strlen(clname)) {
|
||||
classh.res_name = "xv";
|
||||
classh.res_class = clname;
|
||||
- XSetClassHint(theDisp, win, &classh);
|
||||
StoreDeleteWindowProp(win);
|
||||
}
|
||||
+
|
||||
+ XmbSetWMProperties(theDisp, win, name, name, NULL, 0, &hints, &xwmh,
|
||||
+ clname ? &classh : NULL);
|
||||
|
||||
return(win);
|
||||
}
|
80
graphics/xv/patches/patch-ab
Normal file
80
graphics/xv/patches/patch-ab
Normal file
@ -0,0 +1,80 @@
|
||||
*** vdcomp.c.orig Thu Dec 22 14:34:47 1994
|
||||
--- vdcomp.c Sat Jan 31 22:54:41 1998
|
||||
***************
|
||||
*** 108,114 ****
|
||||
!defined(bsd43) && \
|
||||
!defined(aux) && \
|
||||
!defined(__bsdi__) && \
|
||||
! !defined(sequent)
|
||||
|
||||
# if defined(hp300) || defined(hp800) || defined(NeXT)
|
||||
# include <sys/malloc.h> /* it's in 'sys' on HPs and NeXT */
|
||||
--- 108,116 ----
|
||||
!defined(bsd43) && \
|
||||
!defined(aux) && \
|
||||
!defined(__bsdi__) && \
|
||||
! !defined(sequent) && \
|
||||
! !defined(__FreeBSD__) && \
|
||||
! !defined(__OpenBSD__)
|
||||
|
||||
# if defined(hp300) || defined(hp800) || defined(NeXT)
|
||||
# include <sys/malloc.h> /* it's in 'sys' on HPs and NeXT */
|
||||
***************
|
||||
*** 429,438 ****
|
||||
{
|
||||
short shortint;
|
||||
typedef long off_t;
|
||||
|
||||
if (inname[0] == ' ') {
|
||||
printf("\nEnter name of file to be decompressed: ");
|
||||
! gets (inname);
|
||||
}
|
||||
|
||||
if (host == 1 | host == 2) {
|
||||
--- 431,443 ----
|
||||
{
|
||||
short shortint;
|
||||
typedef long off_t;
|
||||
+ char *s;
|
||||
|
||||
if (inname[0] == ' ') {
|
||||
printf("\nEnter name of file to be decompressed: ");
|
||||
! fgets (inname, sizeof(inname), stdin);
|
||||
! if ((s = strchr(inname, '\n')) != NULL)
|
||||
! *s = '\0';
|
||||
}
|
||||
|
||||
if (host == 1 | host == 2) {
|
||||
***************
|
||||
*** 474,486 ****
|
||||
printf("\n 3. VICAR format.");
|
||||
printf("\n 4. Unlabelled binary array.\n");
|
||||
printf("\n Enter format number:");
|
||||
! gets(inname);
|
||||
output_format = atoi(inname);
|
||||
} while (output_format < 1 || output_format > 4);
|
||||
|
||||
if (outname[0] == ' ') {
|
||||
printf("\nEnter name of uncompressed output file: ");
|
||||
! gets (outname);
|
||||
}
|
||||
|
||||
return(host);
|
||||
--- 479,495 ----
|
||||
printf("\n 3. VICAR format.");
|
||||
printf("\n 4. Unlabelled binary array.\n");
|
||||
printf("\n Enter format number:");
|
||||
! fgets (inname, sizeof(inname), stdin);
|
||||
! if ((s = strchr(inname, '\n')) != NULL)
|
||||
! *s = '\0';
|
||||
output_format = atoi(inname);
|
||||
} while (output_format < 1 || output_format > 4);
|
||||
|
||||
if (outname[0] == ' ') {
|
||||
printf("\nEnter name of uncompressed output file: ");
|
||||
! fgets (outname, sizeof(outname), stdin);
|
||||
! if ((s = strchr(outname, '\n')) != NULL)
|
||||
! *s = '\0';
|
||||
}
|
||||
|
||||
return(host);
|
38
graphics/xv/patches/patch-ac
Normal file
38
graphics/xv/patches/patch-ac
Normal file
@ -0,0 +1,38 @@
|
||||
*** /tmp/T0a03151 Mon Feb 13 18:35:11 1995
|
||||
--- config.h Mon Feb 13 18:34:49 1995
|
||||
***************
|
||||
*** 13,18 ****
|
||||
* definition appropriately. (use 'which gunzip' to find if you have gunzip,
|
||||
* and where it lives)
|
||||
*/
|
||||
! #undef USE_GUNZIP
|
||||
|
||||
#ifdef USE_GUNZIP
|
||||
--- 13,18 ----
|
||||
* definition appropriately. (use 'which gunzip' to find if you have gunzip,
|
||||
* and where it lives)
|
||||
*/
|
||||
! #define USE_GUNZIP
|
||||
|
||||
#ifdef USE_GUNZIP
|
||||
***************
|
||||
*** 88,96 ****
|
||||
* should not need to be changed
|
||||
*/
|
||||
|
||||
! /* #define GS_PATH "/usr/local/bin/gs" */
|
||||
! /* #define GS_LIB "." */
|
||||
! /* #define GS_DEV "ppmraw" */
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
--- 88,96 ----
|
||||
* should not need to be changed
|
||||
*/
|
||||
|
||||
! #define GS_PATH "/usr/local/bin/gs"
|
||||
! #define GS_LIB "/usr/local/share/ghostscript"
|
||||
! #define GS_DEV "ppmraw"
|
||||
|
||||
|
||||
/***************************************************************************
|
62
graphics/xv/patches/patch-ad
Normal file
62
graphics/xv/patches/patch-ad
Normal file
@ -0,0 +1,62 @@
|
||||
--- ./Imakefile.org Fri Jan 13 12:24:01 1995
|
||||
+++ ./Imakefile Wed Jul 5 03:32:57 1995
|
||||
@@ -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
|
||||
@@ -119,16 +121,30 @@
|
||||
JPEG = -DDOJPEG
|
||||
JPEGDIR = jpeg
|
||||
LIBJPEG = $(JPEGDIR)/libjpeg.a
|
||||
+DEPLIBJPEG = $(LIBJPEG)
|
||||
JPEGINCLUDE = -I$(JPEGDIR)
|
||||
#endif
|
||||
|
||||
+#ifdef UseInstalledJpeg
|
||||
+JPEG = -DDOJPEG
|
||||
+LIBJPEG = -L/usr/local/lib -ljpeg
|
||||
+JPEGINCLUDE = -I/usr/local/include
|
||||
+#endif
|
||||
+
|
||||
#ifdef HaveTiff
|
||||
TIFF = -DDOTIFF
|
||||
TIFFDIR = tiff
|
||||
LIBTIFF = $(TIFFDIR)/libtiff.a
|
||||
+DEPLIBTIFF = $(LIBTIFF)
|
||||
TIFFINCLUDE = -I$(TIFFDIR)
|
||||
#endif
|
||||
|
||||
+#ifdef UseInstalledTiff
|
||||
+TIFF = -DDOTIFF
|
||||
+LIBTIFF = -L/usr/local/lib -ltiff34
|
||||
+TIFFINCLUDE = -I/usr/local/include/tiff34
|
||||
+#endif
|
||||
+
|
||||
#ifdef HavePDS
|
||||
PDS = -DDOPDS
|
||||
#endif
|
||||
@@ -142,8 +158,8 @@
|
||||
#endif
|
||||
|
||||
|
||||
-DEPLIBS = $(LIBJPEG) $(LIBTIFF)
|
||||
-LOCAL_LIBRARIES = $(XLIB) $(DEPLIBS)
|
||||
+DEPLIBS = $(DEPLIBJPEG) $(DEPLIBTIFF)
|
||||
+LOCAL_LIBRARIES = $(XLIB) $(LIBJPEG) $(LIBTIFF)
|
||||
|
||||
DEFINES= $(SCO) $(UNIX) $(NODIRENT) $(VPRINTF) $(TIMERS) \
|
||||
$(HPUX7) $(JPEG) $(TIFF) $(PDS) $(DXWM) $(RAND) \
|
472
graphics/xv/patches/patch-ae
Normal file
472
graphics/xv/patches/patch-ae
Normal file
@ -0,0 +1,472 @@
|
||||
--- xvimage.c~ Fri Jan 13 18:11:36 1995
|
||||
+++ xvimage.c Tue Oct 15 16:41:47 1996
|
||||
@@ -46,6 +46,274 @@
|
||||
static int ReadImageFile1 PARM((char *, PICINFO *));
|
||||
|
||||
|
||||
+/* The following array represents the pixel values for each shade of
|
||||
+ * the primary color components.
|
||||
+ * If 'p' is a pointer to a source image rgb-byte-triplet, we can
|
||||
+ * construct the output pixel value simply by 'oring' together
|
||||
+ * the corresponding components:
|
||||
+ *
|
||||
+ * unsigned char *p;
|
||||
+ * unsigned long pixval;
|
||||
+ *
|
||||
+ * pixval = screen_rgb[0][*p++];
|
||||
+ * pixval |= screen_rgb[1][*p++];
|
||||
+ * pixval |= screen_rgb[2][*p++];
|
||||
+ *
|
||||
+ * This is both efficient and generic, since the only assumption
|
||||
+ * is that the primary color components have separate bits.
|
||||
+ * The order and distribution of bits does not matter, and we
|
||||
+ * don't need additional vaiables and shifting/masking code.
|
||||
+ * The array size is 3 KBytes total and thus very reasonable.
|
||||
+ */
|
||||
+
|
||||
+static unsigned long screen_rgb[3][256];
|
||||
+
|
||||
+/* The following array holds the exact color representations
|
||||
+ * reported by the system.
|
||||
+ * This is useful for less than 24 bit deep displays as a base
|
||||
+ * for additional dithering to get smoother output.
|
||||
+ */
|
||||
+
|
||||
+static byte screen_set[3][256];
|
||||
+
|
||||
+/* The following routine initializes the screen_rgb and screen_set
|
||||
+ * arrays.
|
||||
+ * Since it is executed only once per program run, it does not need
|
||||
+ * to be super-efficient.
|
||||
+ *
|
||||
+ * The method is to draw points in a pixmap with the specified shades
|
||||
+ * of primary colors and then get the corresponding XImage pixel
|
||||
+ * representation.
|
||||
+ * Thus we can get away with any Bit-order/Byte-Order dependencies.
|
||||
+ *
|
||||
+ * The routine uses some global X variables: theDisp, theScreen,
|
||||
+ * and dispDEEP. Adapt these to your application as necessary.
|
||||
+ * I've not passed them in as parameters, since for other platforms
|
||||
+ * than X these may be different (see vfixpix.c), and so the
|
||||
+ * screen_init() interface is unique.
|
||||
+ *
|
||||
+ * BUG: I've read in the "Xlib Programming Manual" from O'Reilly &
|
||||
+ * Associates, that the DefaultColormap in TrueColor might not
|
||||
+ * provide the full shade representation in XAllocColor.
|
||||
+ * In this case one had to provide a 'best' colormap instead.
|
||||
+ * However, my tests with Xaccel on a Linux-Box with a Mach64
|
||||
+ * card were fully successful, so I leave that potential problem
|
||||
+ * to you at the moment and would appreciate any suggestions...
|
||||
+ */
|
||||
+
|
||||
+static void screen_init()
|
||||
+{
|
||||
+ static int init_flag; /* assume auto-init as 0 */
|
||||
+ Pixmap check_map;
|
||||
+ GC check_gc;
|
||||
+ XColor check_col;
|
||||
+ XImage *check_image;
|
||||
+ int ci, i;
|
||||
+
|
||||
+ if (init_flag) return;
|
||||
+ init_flag = 1;
|
||||
+
|
||||
+ check_map = XCreatePixmap(theDisp, RootWindow(theDisp,theScreen),
|
||||
+ 1, 1, dispDEEP);
|
||||
+ check_gc = XCreateGC(theDisp, RootWindow(theDisp,theScreen), 0, NULL);
|
||||
+ for (ci = 0; ci < 3; ci++) {
|
||||
+ for (i = 0; i < 256; i++) {
|
||||
+ check_col.flags = DoRed | DoGreen | DoBlue;
|
||||
+ check_col.red = 0;
|
||||
+ check_col.green = 0;
|
||||
+ check_col.blue = 0;
|
||||
+ /* Do proper upscaling from unsigned 8 bit (image data values)
|
||||
+ to unsigned 16 bit (X color representation). */
|
||||
+ ((unsigned short *)&check_col.red)[ci] = (unsigned short)((i << 8) | i);
|
||||
+ if (!XAllocColor(theDisp, DefaultColormap(theDisp,theScreen), &check_col))
|
||||
+ FatalError("XAllocColor in screen_init() failed"); /* shouldn't happen */
|
||||
+ screen_set[ci][i] =
|
||||
+ (((unsigned short *)&check_col.red)[ci] >> 8) & 0xff;
|
||||
+ XSetForeground(theDisp, check_gc, check_col.pixel);
|
||||
+ XDrawPoint(theDisp, check_map, check_gc, 0, 0);
|
||||
+ check_image = XGetImage(theDisp, check_map, 0, 0, 1, 1,
|
||||
+ AllPlanes, ZPixmap);
|
||||
+ if (!check_image) FatalError("XGetImage in screen_init() failed");
|
||||
+ switch (check_image->bits_per_pixel) {
|
||||
+ case 8:
|
||||
+ screen_rgb[ci][i] = *(CARD8 *)check_image->data;
|
||||
+ break;
|
||||
+ case 16:
|
||||
+ screen_rgb[ci][i] = *(CARD16 *)check_image->data;
|
||||
+ break;
|
||||
+ case 24:
|
||||
+ screen_rgb[ci][i] =
|
||||
+ ((unsigned long)*(CARD8 *)check_image->data << 16) |
|
||||
+ ((unsigned long)*(CARD8 *)(check_image->data + 1) << 8) |
|
||||
+ (unsigned long)*(CARD8 *)(check_image->data + 2);
|
||||
+ break;
|
||||
+ case 32:
|
||||
+ screen_rgb[ci][i] = *(CARD32 *)check_image->data;
|
||||
+ break;
|
||||
+ }
|
||||
+ XDestroyImage(check_image);
|
||||
+ }
|
||||
+ }
|
||||
+ XFreeGC(theDisp, check_gc);
|
||||
+ XFreePixmap(theDisp, check_map);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/* The following switch should better be provided at runtime for
|
||||
+ * comparison purposes.
|
||||
+ * At the moment it's only compile time, unfortunately.
|
||||
+ * Who can make adaptions for use as a runtime switch by a menu option?
|
||||
+ */
|
||||
+
|
||||
+#define DO_FIXPIX_SMOOTH
|
||||
+
|
||||
+#ifdef DO_FIXPIX_SMOOTH
|
||||
+
|
||||
+/* The following code is based in part on:
|
||||
+ *
|
||||
+ * jquant1.c
|
||||
+ *
|
||||
+ * Copyright (C) 1991-1996, Thomas G. Lane.
|
||||
+ * This file is part of the Independent JPEG Group's software.
|
||||
+ * For conditions of distribution and use, see the accompanying README file.
|
||||
+ *
|
||||
+ * This file contains 1-pass color quantization (color mapping) routines.
|
||||
+ * These routines provide mapping to a fixed color map using equally spaced
|
||||
+ * color values. Optional Floyd-Steinberg or ordered dithering is available.
|
||||
+ */
|
||||
+
|
||||
+/* Declarations for Floyd-Steinberg dithering.
|
||||
+ *
|
||||
+ * Errors are accumulated into the array fserrors[], at a resolution of
|
||||
+ * 1/16th of a pixel count. The error at a given pixel is propagated
|
||||
+ * to its not-yet-processed neighbors using the standard F-S fractions,
|
||||
+ * ... (here) 7/16
|
||||
+ * 3/16 5/16 1/16
|
||||
+ * We work left-to-right on even rows, right-to-left on odd rows.
|
||||
+ *
|
||||
+ * We can get away with a single array (holding one row's worth of errors)
|
||||
+ * by using it to store the current row's errors at pixel columns not yet
|
||||
+ * processed, but the next row's errors at columns already processed. We
|
||||
+ * need only a few extra variables to hold the errors immediately around the
|
||||
+ * current column. (If we are lucky, those variables are in registers, but
|
||||
+ * even if not, they're probably cheaper to access than array elements are.)
|
||||
+ *
|
||||
+ * The fserrors[] array is indexed [component#][position].
|
||||
+ * We provide (#columns + 2) entries per component; the extra entry at each
|
||||
+ * end saves us from special-casing the first and last pixels.
|
||||
+ */
|
||||
+
|
||||
+typedef INT16 FSERROR; /* 16 bits should be enough */
|
||||
+typedef int LOCFSERROR; /* use 'int' for calculation temps */
|
||||
+
|
||||
+typedef struct { byte *colorset;
|
||||
+ FSERROR *fserrors;
|
||||
+ } FSBUF;
|
||||
+
|
||||
+/* Floyd-Steinberg initialization function.
|
||||
+ *
|
||||
+ * It is called 'fs2_init' since it's specialized for our purpose and
|
||||
+ * could be embedded in a more general FS-package.
|
||||
+ *
|
||||
+ * Returns a malloced FSBUF pointer which has to be passed as first
|
||||
+ * parameter to subsequent 'fs2_dither' calls.
|
||||
+ * The FSBUF structure does not need to be referenced by the calling
|
||||
+ * application, it can be treated from the app like a void pointer.
|
||||
+ *
|
||||
+ * The current implementation does only require to free() this returned
|
||||
+ * pointer after processing.
|
||||
+ *
|
||||
+ * Returns NULL if malloc fails.
|
||||
+ *
|
||||
+ * NOTE: The FSBUF structure is designed to allow the 'fs2_dither'
|
||||
+ * function to work with an *arbitrary* number of color components
|
||||
+ * at runtime! This is an enhancement over the IJG code base :-).
|
||||
+ * Only fs2_init() specifies the (maximum) number of components.
|
||||
+ */
|
||||
+
|
||||
+static FSBUF *fs2_init(width)
|
||||
+int width;
|
||||
+{
|
||||
+ FSBUF *fs;
|
||||
+ FSERROR *p;
|
||||
+
|
||||
+ fs = (FSBUF *)
|
||||
+ malloc(sizeof(FSBUF) * 3 + ((size_t)width + 2) * sizeof(FSERROR) * 3);
|
||||
+ if (fs == 0) return fs;
|
||||
+
|
||||
+ fs[0].colorset = screen_set[0];
|
||||
+ fs[1].colorset = screen_set[1];
|
||||
+ fs[2].colorset = screen_set[2];
|
||||
+
|
||||
+ p = (FSERROR *)(fs + 3);
|
||||
+ memset(p, 0, ((size_t)width + 2) * sizeof(FSERROR) * 3);
|
||||
+
|
||||
+ fs[0].fserrors = p;
|
||||
+ fs[1].fserrors = p + 1;
|
||||
+ fs[2].fserrors = p + 2;
|
||||
+
|
||||
+ return fs;
|
||||
+}
|
||||
+
|
||||
+/* Floyd-Steinberg dithering function.
|
||||
+ *
|
||||
+ * NOTE:
|
||||
+ * (1) The image data referenced by 'ptr' is *overwritten* (input *and*
|
||||
+ * output) to allow more efficient implementation.
|
||||
+ * (2) Alternate FS dithering is provided by the sign of 'nc'. Pass in
|
||||
+ * a negative value for right-to-left processing. The return value
|
||||
+ * provides the right-signed value for subsequent calls!
|
||||
+ * (3) This particular implementation assumes *no* padding between lines!
|
||||
+ * Adapt this if necessary.
|
||||
+ */
|
||||
+
|
||||
+static int fs2_dither(fs, ptr, nc, num_rows, num_cols)
|
||||
+FSBUF *fs;
|
||||
+byte *ptr;
|
||||
+int nc, num_rows, num_cols;
|
||||
+{
|
||||
+ int abs_nc, ci, row, col;
|
||||
+ LOCFSERROR delta, cur, belowerr, bpreverr;
|
||||
+ byte *dataptr, *colsetptr;
|
||||
+ FSERROR *errorptr;
|
||||
+
|
||||
+ if ((abs_nc = nc) < 0) abs_nc = -abs_nc;
|
||||
+ for (row = 0; row < num_rows; row++) {
|
||||
+ for (ci = 0; ci < abs_nc; ci++, ptr++) {
|
||||
+ dataptr = ptr;
|
||||
+ colsetptr = fs[ci].colorset;
|
||||
+ errorptr = fs[ci].fserrors;
|
||||
+ if (nc < 0) {
|
||||
+ dataptr += (num_cols - 1) * abs_nc;
|
||||
+ errorptr += (num_cols + 1) * abs_nc;
|
||||
+ }
|
||||
+ cur = belowerr = bpreverr = 0;
|
||||
+ for (col = 0; col < num_cols; col++) {
|
||||
+ cur += errorptr[nc];
|
||||
+ cur += 8; cur >>= 4;
|
||||
+ if ((cur += *dataptr) < 0) cur = 0;
|
||||
+ else if (cur > 255) cur = 255;
|
||||
+ *dataptr = cur & 0xff;
|
||||
+ cur -= colsetptr[cur];
|
||||
+ delta = cur << 1; cur += delta;
|
||||
+ bpreverr += cur; cur += delta;
|
||||
+ belowerr += cur; cur += delta;
|
||||
+ errorptr[0] = (FSERROR)bpreverr;
|
||||
+ bpreverr = belowerr;
|
||||
+ belowerr = delta >> 1;
|
||||
+ dataptr += nc;
|
||||
+ errorptr += nc;
|
||||
+ }
|
||||
+ errorptr[0] = (FSERROR)bpreverr;
|
||||
+ }
|
||||
+ ptr += (num_cols - 1) * abs_nc;
|
||||
+ nc = -nc;
|
||||
+ }
|
||||
+ return nc;
|
||||
+}
|
||||
+
|
||||
+#endif /* DO_FIXPIX_SMOOTH */
|
||||
+
|
||||
|
||||
#define DO_CROP 0
|
||||
#define DO_ZOOM 1
|
||||
@@ -1883,33 +2151,17 @@
|
||||
/* Non-ColorMapped Visuals: TrueColor, DirectColor */
|
||||
/************************************************************************/
|
||||
|
||||
- unsigned long r, g, b, rmask, gmask, bmask, xcol;
|
||||
- int rshift, gshift, bshift, bperpix, bperline, border, cshift;
|
||||
- int maplen;
|
||||
+ unsigned long xcol;
|
||||
+ int bperpix, bperline;
|
||||
byte *imagedata, *lip, *ip, *pp;
|
||||
|
||||
|
||||
- /* compute various shifting constants that we'll need... */
|
||||
-
|
||||
- rmask = theVisual->red_mask;
|
||||
- gmask = theVisual->green_mask;
|
||||
- bmask = theVisual->blue_mask;
|
||||
-
|
||||
- rshift = 7 - highbit(rmask);
|
||||
- gshift = 7 - highbit(gmask);
|
||||
- bshift = 7 - highbit(bmask);
|
||||
-
|
||||
- maplen = theVisual->map_entries;
|
||||
- if (maplen>256) maplen=256;
|
||||
- cshift = 7 - highbit((u_long) (maplen-1));
|
||||
-
|
||||
xim = XCreateImage(theDisp, theVisual, dispDEEP, ZPixmap, 0, NULL,
|
||||
wide, high, 32, 0);
|
||||
if (!xim) FatalError("couldn't create X image!");
|
||||
|
||||
bperline = xim->bytes_per_line;
|
||||
bperpix = xim->bits_per_pixel;
|
||||
- border = xim->byte_order;
|
||||
|
||||
imagedata = (byte *) malloc((size_t) (high * bperline));
|
||||
if (!imagedata) FatalError("couldn't malloc imagedata");
|
||||
@@ -1923,82 +2175,87 @@
|
||||
FatalError(buf);
|
||||
}
|
||||
|
||||
+ screen_init();
|
||||
|
||||
- lip = imagedata; pp = pic24;
|
||||
- for (i=0; i<high; i++, lip+=bperline) {
|
||||
- for (j=0, ip=lip; j<wide; j++) {
|
||||
- r = *pp++; g = *pp++; b = *pp++;
|
||||
-
|
||||
- /* shift r,g,b so that high bit of 8-bit color specification is
|
||||
- * aligned with high bit of r,g,b-mask in visual,
|
||||
- * AND each component with its mask,
|
||||
- * and OR the three components together
|
||||
- */
|
||||
-
|
||||
- if (theVisual->class == DirectColor) {
|
||||
- r = (u_long) directConv[(r>>cshift) & 0xff] << cshift;
|
||||
- g = (u_long) directConv[(g>>cshift) & 0xff] << cshift;
|
||||
- b = (u_long) directConv[(b>>cshift) & 0xff] << cshift;
|
||||
- }
|
||||
-
|
||||
-
|
||||
- /* shift the bits around */
|
||||
- if (rshift<0) r = r << (-rshift);
|
||||
- else r = r >> rshift;
|
||||
-
|
||||
- if (gshift<0) g = g << (-gshift);
|
||||
- else g = g >> gshift;
|
||||
-
|
||||
- if (bshift<0) b = b << (-bshift);
|
||||
- else b = b >> bshift;
|
||||
-
|
||||
- r = r & rmask;
|
||||
- g = g & gmask;
|
||||
- b = b & bmask;
|
||||
-
|
||||
- xcol = r | g | b;
|
||||
-
|
||||
- if (bperpix == 32) {
|
||||
- if (border == MSBFirst) {
|
||||
- *ip++ = (xcol>>24) & 0xff;
|
||||
- *ip++ = (xcol>>16) & 0xff;
|
||||
- *ip++ = (xcol>>8) & 0xff;
|
||||
- *ip++ = xcol & 0xff;
|
||||
- }
|
||||
- else { /* LSBFirst */
|
||||
- *ip++ = xcol & 0xff;
|
||||
- *ip++ = (xcol>>8) & 0xff;
|
||||
- *ip++ = (xcol>>16) & 0xff;
|
||||
- *ip++ = (xcol>>24) & 0xff;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- else if (bperpix == 24) {
|
||||
- if (border == MSBFirst) {
|
||||
- *ip++ = (xcol>>16) & 0xff;
|
||||
- *ip++ = (xcol>>8) & 0xff;
|
||||
- *ip++ = xcol & 0xff;
|
||||
- }
|
||||
- else { /* LSBFirst */
|
||||
- *ip++ = xcol & 0xff;
|
||||
- *ip++ = (xcol>>8) & 0xff;
|
||||
- *ip++ = (xcol>>16) & 0xff;
|
||||
+#ifdef DO_FIXPIX_SMOOTH
|
||||
+#if 0
|
||||
+ /* If we wouldn't have to save the original pic24 image data,
|
||||
+ * the following code would do the dither job by overwriting
|
||||
+ * the image data, and the normal render code would then work
|
||||
+ * without any change on that data.
|
||||
+ * Unfortunately, this approach would hurt the xv assumptions...
|
||||
+ */
|
||||
+ if (bperpix < 24) {
|
||||
+ FSBUF *fs = fs2_init(wide);
|
||||
+ if (fs) {
|
||||
+ fs2_dither(fs, pic24, 3, high, wide);
|
||||
+ free(fs);
|
||||
+ }
|
||||
+ }
|
||||
+#else
|
||||
+ /* ...so we have to take a different approach with linewise
|
||||
+ * dithering/rendering in a loop using a temporary line buffer.
|
||||
+ */
|
||||
+ if (bperpix < 24) {
|
||||
+ int alldone = 0;
|
||||
+ FSBUF *fs = fs2_init(wide);
|
||||
+ if (fs) {
|
||||
+ byte *row_buf = malloc((size_t)wide * 3);
|
||||
+ if (row_buf) {
|
||||
+ int nc = 3;
|
||||
+ byte *picp = pic24; lip = imagedata;
|
||||
+ for (i=0; i<high; i++, lip+=bperline, picp+=(size_t)wide*3) {
|
||||
+ memcpy(row_buf, picp, (size_t)wide * 3);
|
||||
+ nc = fs2_dither(fs, row_buf, nc, 1, wide);
|
||||
+ for (j=0, ip=lip, pp=row_buf; j<wide; j++) {
|
||||
+
|
||||
+ xcol = screen_rgb[0][*pp++];
|
||||
+ xcol |= screen_rgb[1][*pp++];
|
||||
+ xcol |= screen_rgb[2][*pp++];
|
||||
+
|
||||
+ switch (bperpix) {
|
||||
+ case 8:
|
||||
+ *ip++ = xcol & 0xff;
|
||||
+ break;
|
||||
+ case 16:
|
||||
+ *((CARD16 *)ip)++ = (CARD16)xcol;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
+ alldone = 1;
|
||||
+ free(row_buf);
|
||||
}
|
||||
+ free(fs);
|
||||
+ }
|
||||
+ if (alldone) return xim;
|
||||
+ }
|
||||
+#endif
|
||||
+#endif
|
||||
|
||||
- else if (bperpix == 16) {
|
||||
- if (border == MSBFirst) {
|
||||
- *ip++ = (xcol>>8) & 0xff;
|
||||
- *ip++ = xcol & 0xff;
|
||||
- }
|
||||
- else { /* LSBFirst */
|
||||
- *ip++ = xcol & 0xff;
|
||||
- *ip++ = (xcol>>8) & 0xff;
|
||||
- }
|
||||
- }
|
||||
+ lip = imagedata; pp = pic24;
|
||||
+ for (i=0; i<high; i++, lip+=bperline) {
|
||||
+ for (j=0, ip=lip; j<wide; j++) {
|
||||
|
||||
- else if (bperpix == 8) {
|
||||
- *ip++ = xcol & 0xff;
|
||||
+ xcol = screen_rgb[0][*pp++];
|
||||
+ xcol |= screen_rgb[1][*pp++];
|
||||
+ xcol |= screen_rgb[2][*pp++];
|
||||
+
|
||||
+ switch (bperpix) {
|
||||
+ case 8:
|
||||
+ *ip++ = xcol & 0xff;
|
||||
+ break;
|
||||
+ case 16:
|
||||
+ *((CARD16 *)ip)++ = (CARD16)xcol;
|
||||
+ break;
|
||||
+ case 24:
|
||||
+ *ip++ = (xcol >> 16) & 0xff;
|
||||
+ *ip++ = (xcol >> 8) & 0xff;
|
||||
+ *ip++ = xcol & 0xff;
|
||||
+ break;
|
||||
+ case 32:
|
||||
+ *((CARD32 *)ip)++ = (CARD32)xcol;
|
||||
+ break;
|
||||
}
|
||||
}
|
||||
}
|
58
graphics/xv/patches/patch-af
Normal file
58
graphics/xv/patches/patch-af
Normal file
@ -0,0 +1,58 @@
|
||||
--- xv.c.orig Sat Mar 8 16:29:05 1997
|
||||
+++ xv.c Sat Mar 8 16:38:48 1997
|
||||
@@ -3197,9 +3197,17 @@
|
||||
hints.flags = 0;
|
||||
if ((i&XValue || i&YValue)) hints.flags = USPosition;
|
||||
|
||||
- if (i&XValue && i&XNegative) x = vrWIDE - eWIDE - abs(x);
|
||||
- if (i&YValue && i&YNegative) y = vrHIGH - eHIGH - abs(y);
|
||||
-
|
||||
+ hints.win_gravity = NorthWestGravity;
|
||||
+ if (i&XValue && i&XNegative) {
|
||||
+ hints.win_gravity = NorthEastGravity;
|
||||
+ x = vrWIDE - (eWIDE + 2 * bwidth) - abs(x);
|
||||
+ }
|
||||
+ if (i&YValue && i&YNegative) {
|
||||
+ hints.win_gravity = (hints.win_gravity == NorthWestGravity) ?
|
||||
+ SouthWestGravity : SouthEastGravity;
|
||||
+ y = vrHIGH - (eHIGH + 2 * bwidth) - abs(y);
|
||||
+ }
|
||||
+
|
||||
if (x+eWIDE > vrWIDE) x = vrWIDE - eWIDE; /* keep on screen */
|
||||
if (y+eHIGH > vrHIGH) y = vrHIGH - eHIGH;
|
||||
|
||||
@@ -3218,7 +3226,7 @@
|
||||
hints.x = x; hints.y = y;
|
||||
hints.width = eWIDE; hints.height = eHIGH;
|
||||
hints.max_width = maxWIDE; hints.max_height = maxHIGH;
|
||||
- hints.flags |= USSize | PMaxSize;
|
||||
+ hints.flags |= USSize | PMaxSize | PWinGravity;
|
||||
|
||||
xswa.bit_gravity = StaticGravity;
|
||||
xswa.background_pixel = bg;
|
||||
@@ -3267,10 +3275,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
-
|
||||
- XSetStandardProperties(theDisp,mainW,"","",None,NULL,0,&hints);
|
||||
- setWinIconNames(name);
|
||||
-
|
||||
xwmh.input = True;
|
||||
xwmh.flags = InputHint;
|
||||
|
||||
@@ -3295,12 +3299,12 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
- XSetWMHints(theDisp, mainW, &xwmh);
|
||||
|
||||
classh.res_name = "xv";
|
||||
classh.res_class = "XVroot";
|
||||
- XSetClassHint(theDisp, mainW, &classh);
|
||||
|
||||
+ XmbSetWMProperties(theDisp, mainW, NULL, NULL, NULL, 0, &hints, &xwmh, &classh);
|
||||
+ setWinIconNames(name);
|
||||
|
||||
if (nodecor) { /* turn of image window decorations (in MWM) */
|
||||
Atom mwm_wm_hints;
|
21
graphics/xv/patches/patch-ag
Normal file
21
graphics/xv/patches/patch-ag
Normal file
@ -0,0 +1,21 @@
|
||||
*** xv.h.~1~ Sat Jan 31 22:48:31 1998
|
||||
--- xv.h Sat Jan 31 22:50:16 1998
|
||||
***************
|
||||
*** 159,165 ****
|
||||
!defined(bsd43) && \
|
||||
!defined(aux) && \
|
||||
!defined(__bsdi__) && \
|
||||
! !defined(sequent)
|
||||
|
||||
# if defined(hp300) || defined(hp800) || defined(NeXT)
|
||||
# include <sys/malloc.h> /* it's in 'sys' on HPs and NeXT */
|
||||
--- 159,166 ----
|
||||
!defined(bsd43) && \
|
||||
!defined(aux) && \
|
||||
!defined(__bsdi__) && \
|
||||
! !defined(sequent) && \
|
||||
! !defined(__OpenBSD__)
|
||||
|
||||
# if defined(hp300) || defined(hp800) || defined(NeXT)
|
||||
# include <sys/malloc.h> /* it's in 'sys' on HPs and NeXT */
|
||||
|
19
graphics/xv/patches/patch-ah
Normal file
19
graphics/xv/patches/patch-ah
Normal file
@ -0,0 +1,19 @@
|
||||
*** xvtiff.c.~1~ Fri Feb 13 15:55:59 1998
|
||||
--- xvtiff.c Fri Feb 13 17:07:27 1998
|
||||
***************
|
||||
*** 12,18 ****
|
||||
|
||||
#ifdef HAVE_TIFF
|
||||
|
||||
! #include "tiffio.h" /* has to be after xv.h, as it needs varargs/stdarg */
|
||||
|
||||
|
||||
/* Portions fall under the following copyright:
|
||||
--- 12,18 ----
|
||||
|
||||
#ifdef HAVE_TIFF
|
||||
|
||||
! #include "tiffio34.h" /* has to be after xv.h, as it needs varargs/stdarg */
|
||||
|
||||
|
||||
/* Portions fall under the following copyright:
|
19
graphics/xv/patches/patch-ai
Normal file
19
graphics/xv/patches/patch-ai
Normal file
@ -0,0 +1,19 @@
|
||||
*** xvtiffwr.c.~1~ Tue Jan 3 13:28:13 1995
|
||||
--- xvtiffwr.c Fri Feb 13 17:07:49 1998
|
||||
***************
|
||||
*** 9,15 ****
|
||||
|
||||
#ifdef HAVE_TIFF
|
||||
|
||||
! #include "tiffio.h" /* has to be after xv.h, as it needs varargs/stdarg */
|
||||
|
||||
|
||||
#define ALLOW_JPEG 0 /* set to '1' to allow 'JPEG' choice in dialog box */
|
||||
--- 9,15 ----
|
||||
|
||||
#ifdef HAVE_TIFF
|
||||
|
||||
! #include "tiffio34.h" /* has to be after xv.h, as it needs varargs/stdarg */
|
||||
|
||||
|
||||
#define ALLOW_JPEG 0 /* set to '1' to allow 'JPEG' choice in dialog box */
|
1
graphics/xv/pkg/COMMENT
Normal file
1
graphics/xv/pkg/COMMENT
Normal file
@ -0,0 +1 @@
|
||||
X11 image display and modification tool
|
12
graphics/xv/pkg/DESCR
Normal file
12
graphics/xv/pkg/DESCR
Normal file
@ -0,0 +1,12 @@
|
||||
xv is an X11 program that displays images in the GIF,
|
||||
JPEG, TIFF, PBM, PGM, PPM, X11 bitmap, Utah Raster Toolkit
|
||||
RLE, PDS/VICAR, Sun Rasterfile, BMP, XPM, PCX, IRIS RGB,
|
||||
possibly PostScript, and PM formats on workstations and
|
||||
terminals running the X Window System, Version 11.
|
||||
|
||||
Note that this program is shareware except for personal use only.
|
||||
Please read the documentation in the directory
|
||||
|
||||
/usr/X11R6/share/doc/xv
|
||||
|
||||
for proper usage.
|
13
graphics/xv/pkg/PLIST
Normal file
13
graphics/xv/pkg/PLIST
Normal file
@ -0,0 +1,13 @@
|
||||
bin/xv
|
||||
bin/bggen
|
||||
bin/vdcomp
|
||||
bin/xcmap
|
||||
bin/xvpictoppm
|
||||
man/cat1/xv.0
|
||||
man/cat1/bggen.0
|
||||
man/cat1/vdcomp.0
|
||||
man/cat1/xcmap.0
|
||||
man/cat1/xvpictoppm.0
|
||||
share/doc/xv/README
|
||||
share/doc/xv/xvdocs.ps
|
||||
@dirrm share/doc/xv
|
Loading…
x
Reference in New Issue
Block a user