home *** CD-ROM | disk | FTP | other *** search
- *** Imakefile.orig Mon Nov 20 16:10:40 1989
- --- Imakefile Mon Nov 20 16:17:15 1989
- ***************
- *** 1,13 ****
- ! DEFINES = -DSYSPATHFILE=\"/usr/lib/X11/xloadimage/xloadimagerc\"
- DEPLIBS = $(DEPLIBS)
- LOCAL_LIBRARIES = $(XLIB)
- SRCS = bright.c clip.c compress.c dither.c faces.c fill.c \
- ! imagetypes.c merge.c misc.c new.c options.c path.c \
- ! pbm.c reduce.c root.c send.c sunraster.c value.c \
- ! window.c xbitmap.c xloadimage.c zio.c zoom.c
- OBJS = bright.o clip.o compress.o dither.o faces.o fill.o \
- ! imagetypes.o merge.o misc.o new.o options.o path.o \
- ! pbm.o reduce.o root.o send.o sunraster.o value.o \
- ! window.o xbitmap.o xloadimage.o zio.o zoom.o
-
- ComplexProgramTarget(xloadimage)
- --- 1,16 ----
- ! SYSPATHFILE = $(USRLIBDIR)/xloadimagerc
- ! DEFINES = -DSYSPATHFILE=\"$(SYSPATHFILE)\"
- DEPLIBS = $(DEPLIBS)
- LOCAL_LIBRARIES = $(XLIB)
- SRCS = bright.c clip.c compress.c dither.c faces.c fill.c \
- ! halftone.c imagetypes.c merge.c misc.c new.c \
- ! options.c path.c pbm.c reduce.c root.c send.c \
- ! sunraster.c value.c window.c xbitmap.c xloadimage.c \
- ! xpixmap.c zio.c zoom.c
- OBJS = bright.o clip.o compress.o dither.o faces.o fill.o \
- ! halftone.o imagetypes.o merge.o misc.o new.o \
- ! options.o path.o pbm.o reduce.o root.o send.o \
- ! sunraster.o value.o window.o xbitmap.o xloadimage.o \
- ! xpixmap.o zio.o zoom.o
-
- ComplexProgramTarget(xloadimage)
- *** Makefile.gcc.orig Mon Nov 20 16:10:41 1989
- --- Makefile.gcc Mon Nov 20 16:18:54 1989
- ***************
- *** 8,16 ****
- CFLAGS= -O -fstrength-reduce -finline-functions -DSYSPATHFILE=\"/usr/lib/xloadimagerc\"
-
- LIBS= -lX11
- ! OBJS= bright.o clip.o compress.o dither.o faces.o fill.o imagetypes.o \
- ! merge.o misc.o new.o options.o path.o pbm.o reduce.o root.o send.o \
- ! sunraster.o value.o window.o xbitmap.o xloadimage.o zio.o zoom.o
-
- xloadimage: $(OBJS)
- $(CC) $(CFLAGS) -o xloadimage $(OBJS) $(LIBS)
- --- 8,17 ----
- CFLAGS= -O -fstrength-reduce -finline-functions -DSYSPATHFILE=\"/usr/lib/xloadimagerc\"
-
- LIBS= -lX11
- ! OBJS= bright.o clip.o compress.o dither.o faces.o fill.o \
- ! halftone.o imagetypes.o merge.o misc.o new.o options.o path.o \
- ! pbm.o reduce.o root.o send.o sunraster.o value.o window.o \
- ! xbitmap.o xloadimage.o xpixmap.o zio.o zoom.o
-
- xloadimage: $(OBJS)
- $(CC) $(CFLAGS) -o xloadimage $(OBJS) $(LIBS)
- *** Makefile.std.orig Mon Nov 20 16:41:09 1989
- --- Makefile.std Mon Nov 20 16:38:39 1989
- ***************
- *** 8,16 ****
- CFLAGS= -O -DSYSPATHFILE=\"/usr/lib/xloadimagerc\"
-
- LIBS= -lX11
- ! OBJS= bright.o clip.o compress.o dither.o faces.o fill.o imagetypes.o \
- ! merge.o misc.o new.o options.o path.o pbm.o reduce.o root.o send.o \
- ! sunraster.o value.o window.o xbitmap.o xloadimage.o zio.o zoom.o
-
- xloadimage: $(OBJS)
- $(CC) $(CFLAGS) -o xloadimage $(OBJS) $(LIBS)
- --- 8,17 ----
- CFLAGS= -O -DSYSPATHFILE=\"/usr/lib/xloadimagerc\"
-
- LIBS= -lX11
- ! OBJS= bright.o clip.o compress.o dither.o faces.o fill.o \
- ! halftone.o imagetypes.o merge.o misc.o new.o options.o path.o \
- ! pbm.o reduce.o root.o send.o sunraster.o value.o window.o \
- ! xbitmap.o xloadimage.o xpixmap.o zio.o zoom.o
-
- xloadimage: $(OBJS)
- $(CC) $(CFLAGS) -o xloadimage $(OBJS) $(LIBS)
- *** dither.c.orig Mon Nov 20 16:10:44 1989
- --- dither.c Mon Nov 20 16:15:07 1989
- ***************
- *** 1,13 ****
- /* dither.c:
- *
- ! * routine for dithering a color image to monochrome based on color
- ! * intensity. this is loosely based on an algorithm which barry shein
- ! * (bzs@std.com) used in his "xf" program.
- *
- * jim frost 07.10.89
- *
- ! * Copyright 1989 Jim Frost. See included file "copyright.h" for complete
- ! * copyright information.
- */
-
- #include "copyright.h"
- --- 1,14 ----
- /* dither.c:
- *
- ! * this is a modified version of the dithering algorithm in halftone.c
- ! * which doesn't enlarge the image. modifications made by
- ! * Steve Losen (scl@virginia.edu).
- *
- * jim frost 07.10.89
- + * Steve Losen 11.17.89
- *
- ! * Copyright 1989 Jim Frost and Steve Losen. See included file
- ! * "copyright.h" for complete copyright information.
- */
-
- #include "copyright.h"
- ***************
- *** 21,41 ****
-
- static byte DitherBits[GRAYS][4] = {
- 0xf, 0xf, 0xf, 0xf,
- ! 0xe, 0xf, 0xf, 0xf,
- ! 0xe, 0xf, 0xb, 0xf,
- ! 0xa, 0xf, 0xb, 0xf,
- ! 0xa, 0xf, 0xa, 0xf,
- ! 0xa, 0xd, 0xa, 0xf,
- ! 0xa, 0xd, 0xa, 0x7,
- ! 0xa, 0x5, 0xa, 0x7,
- ! 0xa, 0x5, 0xa, 0x5,
- ! 0x8, 0x5, 0xa, 0x5,
- ! 0x8, 0x5, 0x2, 0x5,
- ! 0x0, 0x5, 0x2, 0x5,
- ! 0x0, 0x5, 0x0, 0x5,
- ! 0x0, 0x4, 0x0, 0x5,
- ! 0x0, 0x4, 0x0, 0x1,
- ! 0x0, 0x0, 0x0, 0x1,
- 0x0, 0x0, 0x0, 0x0
- };
-
- --- 22,42 ----
-
- static byte DitherBits[GRAYS][4] = {
- 0xf, 0xf, 0xf, 0xf,
- ! 0xf, 0xf, 0xf, 0x7,
- ! 0xf, 0xf, 0xf, 0x3,
- ! 0xf, 0xf, 0x7, 0x3,
- ! 0xf, 0xf, 0x3, 0x3,
- ! 0xf, 0xf, 0x3, 0x1,
- ! 0xf, 0x7, 0x3, 0x1,
- ! 0xf, 0x7, 0x1, 0x1,
- ! 0x7, 0x7, 0x3, 0x0,
- ! 0x7, 0x7, 0x1, 0x0,
- ! 0x7, 0x3, 0x1, 0x0,
- ! 0x7, 0x3, 0x0, 0x0,
- ! 0x3, 0x3, 0x0, 0x0,
- ! 0x3, 0x1, 0x0, 0x0,
- ! 0x3, 0x0, 0x0, 0x0,
- ! 0x1, 0x0, 0x0, 0x0,
- 0x0, 0x0, 0x0, 0x0
- };
-
- ***************
- *** 65,71 ****
- printf(" Dithering image...");
- fflush(stdout);
- }
- ! image= newBitImage(cimage->width * 4, cimage->height * 4);
- if (cimage->title) {
- image->title= (char *)malloc(strlen(cimage->title) + 12);
- sprintf(image->title, "%s (dithered)", cimage->title);
- --- 66,72 ----
- printf(" Dithering image...");
- fflush(stdout);
- }
- ! image= newBitImage(cimage->width, cimage->height);
- if (cimage->title) {
- image->title= (char *)malloc(strlen(cimage->title) + 12);
- sprintf(image->title, "%s (dithered)", cimage->title);
- ***************
- *** 99,105 ****
- dp= image->data;
- for (y= 0; y < cimage->height; y++) {
- for (x= 0; x < cimage->width; x++) {
- - dp2= dp + (x >> 1);
- color= memToVal(sp, spl);
- if (index)
- dindex= *(index + color);
- --- 100,105 ----
- ***************
- *** 107,130 ****
- dindex= ((unsigned long)(*(cimage->rgb.red + color)) +
- *(cimage->rgb.green + color) +
- *(cimage->rgb.blue + color)) / GRAYSTEP;
- !
- ! /* loop for the four Y bits in the dither pattern, putting all
- ! * four X bits in at once. if you think this would be hard to
- ! * change to be an NxN dithering array, you're right, since we're
- ! * banking on the fact that we need only shift the mask based on
- ! * whether x is odd or not. an 8x8 array wouldn't even need that,
- ! * but blowing an image up by 64x is probably not a feature.
- ! */
- !
- ! if (x & 1)
- ! for (a= 0; a < 4; a++, dp2 += dll)
- ! *dp2 |= DitherBits[dindex][a];
- ! else
- ! for (a= 0; a < 4; a++, dp2 += dll)
- ! *dp2 |= (DitherBits[dindex][a] << 4);
- sp += spl;
- }
- ! dp += (dll << 2); /* (dll * 4) but I like shifts */
- }
- if (verbose)
- printf("done\n");
- --- 107,117 ----
- dindex= ((unsigned long)(*(cimage->rgb.red + color)) +
- *(cimage->rgb.green + color) +
- *(cimage->rgb.blue + color)) / GRAYSTEP;
- ! if (DitherBits[dindex][y & 3] & (1 << (x & 3)))
- ! dp[x / 8] |= 1 << (7 - (x & 7));
- sp += spl;
- }
- ! dp += dll;
- }
- if (verbose)
- printf("done\n");
- *** image.h.orig Mon Nov 20 16:10:45 1989
- --- image.h Mon Nov 20 16:15:08 1989
- ***************
- *** 60,65 ****
- --- 60,67 ----
-
- void fold(); /* fold.c */
-
- + Image *halftone(); /* halftone.c */
- +
- Image *loadImage(); /* imagetypes.c */
- void identifyImage();
- void goodImage();
- ***************
- *** 82,86 ****
- --- 84,90 ----
-
- unsigned long memToVal(); /* value.c */
- void valToMem();
- + unsigned long memToValLSB();
- + void valToMemLSB();
-
- Image *zoom(); /* zoom.c */
- *** imagetypes.h.orig Mon Nov 20 16:10:46 1989
- --- imagetypes.h Mon Nov 20 16:19:13 1989
- ***************
- *** 19,24 ****
- --- 19,27 ----
- int xbitmapIdent();
- int xpixmapIdent();
-
- + /* some of these are order-dependent
- + */
- +
- struct {
- int (*identifier)(); /* print out image info if this kind of image */
- Image *(*loader)(); /* load image if this kind of image */
- ***************
- *** 27,32 ****
- --- 30,36 ----
- sunRasterIdent, sunRasterLoad, "Sun Rasterfile",
- pbmIdent, pbmLoad, "Portable Bit Map (PBM)",
- facesIdent, facesLoad, "Faces Project",
- + xpixmapIdent, xpixmapLoad, "X Pixmap",
- xbitmapIdent, xbitmapLoad, "X Bitmap",
- NULL, NULL, NULL
- };
- *** misc.c.orig Mon Nov 20 16:10:47 1989
- --- misc.c Mon Nov 20 16:15:09 1989
- ***************
- *** 39,44 ****
- --- 39,45 ----
- printf(" -clip X,Y,W,H - use clipped portion of image\n");
- printf(" -dither - dither color image to bitmap image\n");
- printf(" -foreground colorname - foreground color for bitmap images\n");
- + printf(" -halftone - halftone a color image to bitmap image\n");
- printf(" -name name - force next argument to be image name\n");
- printf(" -xzoom percentage - zoom the X axis by a percentage\n");
- printf(" -yzoom percentage - zoom the Y axis by a percentage\n");
- ***************
- *** 111,117 ****
- }
-
- if (options->dither && (image->depth > 1)) { /* image is to be dithered */
- ! tmpimage= dither(image, verbose);
- freeImage(image);
- image= tmpimage;
- options->clipx *= 4; /* image was blown up by 4 */
- --- 112,121 ----
- }
-
- if (options->dither && (image->depth > 1)) { /* image is to be dithered */
- ! if (options->dither == 1)
- ! tmpimage= dither(image, verbose);
- ! else
- ! tmpimage= halftone(image, verbose);
- freeImage(image);
- image= tmpimage;
- options->clipx *= 4; /* image was blown up by 4 */
- *** value.c.orig Mon Nov 20 16:10:59 1989
- --- value.c Mon Nov 20 16:15:11 1989
- ***************
- *** 36,38 ****
- --- 36,64 ----
- val >>= 8;
- }
- }
- +
- + unsigned long memToValLSB(p, len)
- + byte *p;
- + unsigned int len;
- + { int val, a;
- +
- + val= 0;
- + for (a= len - 1; a >= 0; a--)
- + val= (val << 8) + *(p + a);
- + return(val);
- + }
- +
- + /* this is provided for orthagonality
- + */
- +
- + void valToMemLSB(val, p, len)
- + byte *p;
- + unsigned long val;
- + unsigned int len;
- + { int a;
- +
- + while (len--) {
- + *(p++)= val & 0xff;
- + val >>= 8;
- + }
- + }
- *** xloadimage.c.orig Mon Nov 20 16:11:01 1989
- --- xloadimage.c Mon Nov 20 16:15:12 1989
- ***************
- *** 37,42 ****
- --- 37,43 ----
- "colors",
- "dither",
- "foreground",
- + "halftone",
- "name",
- "xzoom",
- "yzoom",
- ***************
- *** 66,76 ****
- #define COLORS 18
- #define DITHER 19
- #define FOREGROUND 20
- ! #define NAME 21
- ! #define XZOOM 22
- ! #define YZOOM 23
- ! #define ZOOM 24
-
- /* the real thing
- */
-
- --- 67,86 ----
- #define COLORS 18
- #define DITHER 19
- #define FOREGROUND 20
- ! #define HALFTONE 21
- ! #define NAME 22
- ! #define XZOOM 23
- ! #define YZOOM 24
- ! #define ZOOM 25
-
- + /* if an image loader needs to have our display and screen, it will get
- + * them from here. this is done to keep most of the image routines
- + * clean
- + */
- +
- + Display *Disp= NULL;
- + int Scrn= 0;
- +
- /* the real thing
- */
-
- ***************
- *** 246,251 ****
- --- 256,265 ----
- images[imagecount].fg= argv[++a];
- break;
-
- + case HALFTONE:
- + images[imagecount].dither= 2;
- + break;
- +
- case NAME:
- if (imagecount == MAXIMAGES)
- printf("%s: Too many images (ignoring)\n", argv[++a]);
- ***************
- *** 287,297 ****
- /* start talking to the display
- */
-
- ! if (! (disp= XOpenDisplay(dname))) {
- printf("%s: Cannot open display\n", XDisplayName(dname));
- exit(1);
- }
- ! scrn= DefaultScreen(disp);
- XSetIOErrorHandler(ioErrorHandler);
-
- dispimage= NULL;
- --- 301,311 ----
- /* start talking to the display
- */
-
- ! if (! (Disp= disp= XOpenDisplay(dname))) {
- printf("%s: Cannot open display\n", XDisplayName(dname));
- exit(1);
- }
- ! Scrn= scrn= DefaultScreen(disp);
- XSetIOErrorHandler(ioErrorHandler);
-
- dispimage= NULL;
- ***************
- *** 325,332 ****
- for (a= 0; a < imagecount; a++) {
- if (! (newimage= loadImage(images[a].name, verbose)))
- continue;
- ! if ((dispimage && BITMAPP(dispimage)) || (DefaultDepth(disp, scrn) == 1))
- ! images[a].dither= 1;
- newimage= processImage(disp, scrn, newimage, &images[a], verbose);
- if (!images[a].clipw && !images[a].cliph) {
- images[a].clipw= newimage->width;
- --- 339,347 ----
- for (a= 0; a < imagecount; a++) {
- if (! (newimage= loadImage(images[a].name, verbose)))
- continue;
- ! if (!images[a].dither &&
- ! ((dispimage && BITMAPP(dispimage)) || (DefaultDepth(disp, scrn) == 1)))
- ! images[a].dither= 2;
- newimage= processImage(disp, scrn, newimage, &images[a], verbose);
- if (!images[a].clipw && !images[a].cliph) {
- images[a].clipw= newimage->width;
- *** xloadimage.man.orig Mon Nov 20 16:53:22 1989
- --- xloadimage.man Mon Nov 20 17:06:00 1989
- ***************
- *** 13,19 ****
- If the destination display cannot support the number of colors in the
- image, the image will be dithered (monochrome destination) or have its
- colormap reduced (color destination) as appropriate. This can also be
- ! done forcibly with the \fI-dither\fR and \fI-colors\fR options.
- .PP
- If more than one image is to be loaded, they will be merged into a
- single image. The \fI-at\fR and \fI-center\fR options control where
- --- 13,19 ----
- If the destination display cannot support the number of colors in the
- image, the image will be dithered (monochrome destination) or have its
- colormap reduced (color destination) as appropriate. This can also be
- ! done forcibly with the \fI-halftone\fR and \fI-colors\fR options.
- .PP
- If more than one image is to be loaded, they will be merged into a
- single image. The \fI-at\fR and \fI-center\fR options control where
- ***************
- *** 128,136 ****
- interpreted as the remainder of the image.
- .TP
- -dither
- ! Force halftone dithering of a color image when displaying on a color
- ! display. This happens by default when viewing color images on a
- ! monochrome display. This option is ignored on monochrome images.
- .TP
- -foreground \fIcolor\fR
- Use \fIcolor\fR as the foreground color instead of black if you are
- --- 128,136 ----
- interpreted as the remainder of the image.
- .TP
- -dither
- ! Dither a color image to monochrome. This algorithm is very trivial;
- ! the \fI-halftone\fR option may look better if you don't mind the
- ! blown-up image.
- .TP
- -foreground \fIcolor\fR
- Use \fIcolor\fR as the foreground color instead of black if you are
- ***************
- *** 138,143 ****
- --- 138,151 ----
- used to invert the foreground and background colors of a monochrome
- image.
- .TP
- + -halftone
- + Force halftone dithering of a color image when displaying on a
- + monochrome display. This happens by default when viewing color images
- + on a monochrome display. This option is ignored on monochrome images.
- + This dithering algorithm blows an image up by sixteen times; if you
- + don't like this, the \fI-dither\fR option will not blow the image up
- + (but won't look as nice).
- + .TP
- -name \fIimage_name\fR
- Force the next argument to be treated as an image name. This is
- useful if the name of the image is \fI-dither\fR, for instance.
- ***************
- *** 208,213 ****
- --- 216,222 ----
- Sun color RGB rasterfiles
- X10 bitmap files
- X11 bitmap files
- + X pixmap files
- .fi
- .PP
- Both normal and compact PBM images are supported. Both standard and
- ***************
- *** 219,224 ****
- --- 228,235 ----
- madd@std.com
- .fi
- .SH BUGS
- + Zooming dithered images is UGLY.
- + .PP
- Loading images onto the root with PseudoColor or GrayScale displays
- can cause colormap problems (and may interfere with window manager
- operation) if there are not enough colors in the default colormap to
- *** zoom.c.orig Mon Nov 20 16:11:03 1989
- --- zoom.c Mon Nov 20 16:15:13 1989
- ***************
- *** 46,53 ****
- unsigned int x, y, xsrc, ysrc;
- unsigned int pixlen;
- unsigned int srclinelen;
- byte *srcline, *srcptr;
- ! byte *destptr;
- byte srcmask, destmask, bit;
- Pixel value;
-
- --- 46,54 ----
- unsigned int x, y, xsrc, ysrc;
- unsigned int pixlen;
- unsigned int srclinelen;
- + unsigned int destlinelen;
- byte *srcline, *srcptr;
- ! byte *destline, *destptr;
- byte srcmask, destmask, bit;
- Pixel value;
-
- ***************
- *** 90,96 ****
- *(image->rgb.blue + x)= *(oimage->rgb.blue + x);
- }
- image->rgb.used= oimage->rgb.used;
- ! destptr= image->data;
- srcline= oimage->data;
- srclinelen= (oimage->width / 8) + (oimage->width % 8 ? 1 : 0);
- for (y= 0, ysrc= *(yindex + y); y < ywidth; y++) {
- --- 91,98 ----
- *(image->rgb.blue + x)= *(oimage->rgb.blue + x);
- }
- image->rgb.used= oimage->rgb.used;
- ! destline= image->data;
- ! destlinelen= (xwidth / 8) + (xwidth % 8 ? 1 : 0);
- srcline= oimage->data;
- srclinelen= (oimage->width / 8) + (oimage->width % 8 ? 1 : 0);
- for (y= 0, ysrc= *(yindex + y); y < ywidth; y++) {
- ***************
- *** 99,104 ****
- --- 101,107 ----
- srcline += srclinelen;
- }
- srcptr= srcline;
- + destptr= destline;
- srcmask= 0x80;
- destmask= 0x80;
- bit= srcmask & *srcptr;
- ***************
- *** 120,125 ****
- --- 123,129 ----
- destptr++;
- }
- }
- + destline += destlinelen;
- }
- break;
-
- *** README.orig Mon Nov 20 16:10:42 1989
- --- README Mon Nov 20 16:33:15 1989
- ***************
- *** 97,99 ****
- --- 97,104 ----
- windows by typing 'q' was submitted by Chris Tengi
- (tengi@idunno.princeton.edu) and was included. The previously missing
- file 'patchlevel' was included.
- +
- + Patch 02 contained modifications to the Makefiles, support for the X
- + Pixmap image type, a different dithering algorithm that didn't blow
- + the image up (with the old one moved to halftone.c), and a bug fix to
- + zoom.c to correct problems when zooming bitmaps.
- *** patchlevel.orig Mon Nov 20 16:41:17 1989
- --- patchlevel Mon Nov 20 16:47:04 1989
- ***************
- *** 1 ****
- ! PATCHLEVEL 01
- --- 1 ----
- ! PATCHLEVEL 02
-