diff options
Diffstat (limited to 'Build/source/utils/jpeg2ps')
-rw-r--r-- | Build/source/utils/jpeg2ps/Makefile | 68 | ||||
-rw-r--r-- | Build/source/utils/jpeg2ps/asc85ec.c | 129 | ||||
-rw-r--r-- | Build/source/utils/jpeg2ps/descrip.mms | 40 | ||||
-rw-r--r-- | Build/source/utils/jpeg2ps/getopt.c | 119 | ||||
-rw-r--r-- | Build/source/utils/jpeg2ps/jpeg2ps.c | 422 | ||||
-rw-r--r-- | Build/source/utils/jpeg2ps/jpeg2ps.dsp | 86 | ||||
-rw-r--r-- | Build/source/utils/jpeg2ps/jpeg2ps.pdf | 110 | ||||
-rw-r--r-- | Build/source/utils/jpeg2ps/jpeg2ps.txt | 338 | ||||
-rw-r--r-- | Build/source/utils/jpeg2ps/psimage.h | 48 | ||||
-rw-r--r-- | Build/source/utils/jpeg2ps/readjpeg.c | 323 |
10 files changed, 0 insertions, 1683 deletions
diff --git a/Build/source/utils/jpeg2ps/Makefile b/Build/source/utils/jpeg2ps/Makefile deleted file mode 100644 index a1b5aa98706..00000000000 --- a/Build/source/utils/jpeg2ps/Makefile +++ /dev/null @@ -1,68 +0,0 @@ -# Makefile for jpeg2ps -# (C) Thomas Merz 1994-1999 - -VERSION=1.8 -DIRNAME = jpeg2ps-$(VERSION) -TARFILE = jpeg2ps-$(VERSION).tar -ZIPFILE = jpeg2ps-$(VERSION).zip - -# ---------------------------------------------------------------------------- -# Available compile time options: -# -DKNR for Kernighan/Ritchie compilers -# -DA4 gives A4 as default page size, omitting -DA4 gives U.S. letter format -# -DDOS adds DOS and OS/2 support - -# The following was reported to work for emx/gcc 0.9c fix04 under OS/2: -# make -f Makefile "CCFLAGS=-c -DA4 -DDOS -O2" "LDFLAGS=-Zexe -s" - -CC=gcc -CCFLAGS= -c -DA4 -LD=gcc -LDFLAGS= -OBJ=o -EXE= -RM=rm -f - -.c.$(OBJ) : - $(CC) $(CCFLAGS) $*.c - -all: jpeg2ps$(EXE) - -# If your system doesn't have getopt(), add the supplied getopt.c -# module below in the jpeg2ps line. - -jpeg2ps$(EXE): jpeg2ps.$(OBJ) readjpeg.$(OBJ) asc85ec.$(OBJ) - $(LD) $(LDFLAGS) -o jpeg2ps$(EXE) jpeg2ps.$(OBJ) readjpeg.$(OBJ) asc85ec.$(OBJ) - -DISTFILES = jpeg2ps.c psimage.h readjpeg.c asc85ec.c getopt.c Makefile jpeg2ps.dsp jpeg2ps.txt descrip.mms - -DOSDISTFILES = $(DISTFILES) jpeg2ps.exe - -CONVFILES = jpeg2ps.c psimage.h readjpeg.c asc85ec.c getopt.c Makefile jpeg2ps.txt - -dist: $(DOSDISTFILES) - $(RM) $(ZIPFILE) $(TARFILE).gz; \ - ln -s . $(DIRNAME); \ - lineend -d $(CONVFILES); \ - (for i in $(DOSDISTFILES); do \ - echo $$i; \ - done) | sed "s;.*;$(DIRNAME)/&;" >distfiles; \ - zip -9 $(ZIPFILE) `cat distfiles`; \ - (for i in $(DISTFILES); do \ - echo $$i; \ - done) | sed "s;.*;$(DIRNAME)/&;" >distfiles; \ - lineend -u $(CONVFILES); \ - tar cvf $(TARFILE) `cat distfiles`; \ - gzip -9 $(TARFILE); \ - $(RM) $(DIRNAME) distfiles; - -clean: - $(RM) *.$(OBJ) jpeg2ps$(EXE) $(TARFILE) $(ZIPFILE) - -jpeg2ps.$(OBJ): jpeg2ps.c psimage.h - -readjpeg.$(OBJ): readjpeg.c psimage.h - -asc85ec.$(OBJ): asc85ec.c psimage.h - -getopt.$(OBJ): getopt.c diff --git a/Build/source/utils/jpeg2ps/asc85ec.c b/Build/source/utils/jpeg2ps/asc85ec.c deleted file mode 100644 index 7f03b80991b..00000000000 --- a/Build/source/utils/jpeg2ps/asc85ec.c +++ /dev/null @@ -1,129 +0,0 @@ -/* ASCII85 and Hex encoding for PostScript Level 2 and PDF */ -/* (C) Thomas Merz 1994-99 */ - -#include <stdio.h> -#include <fcntl.h> - -#ifdef WIN32 -#define DOS -#endif - -#ifdef DOS -#include <io.h> -#include <stdlib.h> -#endif - -#include "psimage.h" - -typedef unsigned char byte; - -static unsigned char buf[4]; -static unsigned long power85[5] = { 1L, 85L, 85L*85, 85L*85*85, 85L*85*85*85}; -static int outbytes; /* Number of characters in an output line */ - -/* read 0-4 Bytes. result: number of bytes read */ -static int -ReadSomeBytes P1(FILE *, in) -{ - register int count, i; - - for (count = 0; count < 4; count++) { - if ((i = getc(in)) == EOF) - break; - else - buf[count] = (byte) i; - } - return count; -} - -/* Two percent characters at the start of a line will cause trouble - * with some post-processing software. In order to avoid this, we - * simply insert a line break if we encounter a percent character - * at the start of the line. Of course, this rather simplistic - * algorithm may lead to a large line count in pathological cases, - * but the chance for hitting such a case is very small, and even - * so it's only a cosmetic flaw and not a functional restriction. - */ - -static void -outbyte P2(byte, c, FILE *, out) -{ /* output one byte */ - - if (fputc(c, out) == EOF) { - fprintf(stderr, "jpeg2ps: write error - exit!\n"); - exit(1); - } - - if (++outbytes > 63 || /* line limit reached */ - (outbytes == 1 && c == '%') ) { /* caution: percent character at start of line */ - fputc('\n', out); /* insert line feed */ - outbytes = 0; - } -} - -int -ASCII85Encode P2(FILE *, in, FILE *, out) -{ - register int i, count; - unsigned long word, v; - - outbytes = 0; - - /* 4 bytes read ==> output 5 bytes */ - while ((count = ReadSomeBytes(in)) == 4) { - word = ((unsigned long)(((unsigned int)buf[0] << 8) + buf[1]) << 16) + - (((unsigned int)buf[2] << 8) + buf[3]); - if (word == 0) - outbyte('z', out); /* shortcut for 0 */ - else - /* calculate 5 ASCII85 bytes and output them */ - for (i = 4; i >= 0; i--) { - v = word / power85[i]; - outbyte((byte) (v + '!'), out); - word -= v * power85[i]; - } - } - - word = 0; - - if (count != 0) { /* 1-3 bytes left */ - for (i = count-1; i >= 0; i--) /* accumulate bytes */ - word += (unsigned long)buf[i] << 8 * (3-i); - - /* encoding as above, but output only count+1 bytes */ - for (i = 4; i >= 4-count; i--) { - v = word / power85[i]; - outbyte((byte) (v + '!'), out); - word -= v * power85[i]; - } - } - - fputc('~', out); /* EOD marker */ - fputc('>', out); - return 0; -} - -void -ASCIIHexEncode P2(FILE *, in, FILE *, out) { - static char buffer[512]; - static char BinToHex[] = "0123456789ABCDEF"; - int CharsPerLine; - size_t i, n; - unsigned char *p; - - CharsPerLine = 0; - fputc('\n', out); - - while ((n = fread(buffer, 1, sizeof(buffer), in)) != 0) - for (i = 0, p = (unsigned char *) buffer; i < n; i++, p++) { - fputc(BinToHex[*p>>4], out); /* first nibble */ - fputc(BinToHex[*p & 0x0F], out); /* second nibble */ - if ((CharsPerLine += 2) >= 64) { - fputc('\n', out); - CharsPerLine = 0; - } - } - - fputc('>', out); /* EOD marker for PostScript hex strings */ -} - diff --git a/Build/source/utils/jpeg2ps/descrip.mms b/Build/source/utils/jpeg2ps/descrip.mms deleted file mode 100644 index 2f50c3d8f82..00000000000 --- a/Build/source/utils/jpeg2ps/descrip.mms +++ /dev/null @@ -1,40 +0,0 @@ -# Makefile for jpeg2ps -# (C) Thomas Merz 1994-1999 -# Unsupported VMS Makefile for mms, initially provided by -# Rolf Niepraschk (niepraschk@ptb.de ) - -# ---------------------------------------------------------------------------- -# VMS version -# -# throw out /DEFINE=A4 if you want letter format as default size -# throw out -DA4 if you want letter format as default size -# use /DEFINE=KNR for Kernighan/Ritchie compilers - -CC=cc -CCOPT= /DEFINE=A4/PREFIX=ALL/NOWARN -LDOPT= -OBJ=OBJ -EXE=.EXE -RM=DEL/LOG - -.c.$(OBJ) : - $(CC) $(CCOPT) $*.c - -all : jpeg2ps$(EXE) - @ ! - -jpeg2ps$(EXE) : jpeg2ps.$(OBJ) readjpeg.$(OBJ) asc85ec.$(OBJ) getopt.$(OBJ) - LINK $(LDOPT) /EXE=$@ $+ - - -clean : - @ $ IF F$SEARCH("*.$(OBJ)",).NES."" THEN $(RM) *.$(OBJ);* - @ $ IF F$SEARCH("jpeg2ps$(EXE)",).NES."" THEN $(RM) jpeg2ps$(EXE);* - -jpeg2ps.$(OBJ) : jpeg2ps.c psimage.h - -readjpeg.$(OBJ) : readjpeg.c psimage.h - -asc85ec.$(OBJ) : asc85ec.c - -getopt.$(OBJ) : getopt.c diff --git a/Build/source/utils/jpeg2ps/getopt.c b/Build/source/utils/jpeg2ps/getopt.c deleted file mode 100644 index 43470b8c887..00000000000 --- a/Build/source/utils/jpeg2ps/getopt.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 1987 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)getopt.c 4.13 (Berkeley) 2/23/91"; -#endif /* LIBC_SCCS and not lint */ - -#include <stdio.h> -#include <string.h> - -/* - * get option letter from argument vector - */ -int opterr = 1, /* if error message should be printed */ - optind = 1, /* index into parent argv vector */ - optopt; /* character checked for validity */ -char *optarg; /* argument associated with option */ - -#define BADCH (int)'?' -#define EMSG "" - -int -getopt(nargc, nargv, ostr) - int nargc; - char **nargv; - char *ostr; -{ - static char *place = EMSG; /* option letter processing */ - register char *oli; /* option letter list index */ - char *p; - - if (!*place) { /* update scanning pointer */ - if (optind >= nargc || *(place = nargv[optind]) != '-') { - place = EMSG; - return(EOF); - } - if (place[1] && *++place == '-') { /* found "--" */ - ++optind; - place = EMSG; - return(EOF); - } - } /* option letter okay? */ - if ((optopt = (int)*place++) == (int)':' || - !(oli = strchr(ostr, optopt))) { - /* - * if the user didn't specify '-' as an option, - * assume it means EOF. - */ - if (optopt == (int)'-') - return(EOF); - if (!*place) - ++optind; - if (opterr) { - if (!(p = strrchr(*nargv, '/'))) - p = *nargv; - else - ++p; - (void)fprintf(stderr, "%s: illegal option -- %c\n", - p, optopt); - } - return(BADCH); - } - if (*++oli != ':') { /* don't need argument */ - optarg = NULL; - if (!*place) - ++optind; - } - else { /* need an argument */ - if (*place) /* no white space */ - optarg = place; - else if (nargc <= ++optind) { /* no arg */ - place = EMSG; - if (!(p = strrchr(*nargv, '/'))) - p = *nargv; - else - ++p; - if (opterr) - (void)fprintf(stderr, - "%s: option requires an argument -- %c\n", - p, optopt); - return(BADCH); - } - else /* white space */ - optarg = nargv[optind]; - place = EMSG; - ++optind; - } - return(optopt); /* dump back option letter */ -} diff --git a/Build/source/utils/jpeg2ps/jpeg2ps.c b/Build/source/utils/jpeg2ps/jpeg2ps.c deleted file mode 100644 index 9ce4f9acf00..00000000000 --- a/Build/source/utils/jpeg2ps/jpeg2ps.c +++ /dev/null @@ -1,422 +0,0 @@ -/* -------------------------------------------------------------------- - * jpeg2ps: convert JPEG files to compressed PostScript Level 2 EPS - * - * (C) 1994-1999 Thomas Merz - * - * ------------------------------------------------------------------*/ - -#define VERSION "V1.8" - -#include <stdio.h> -#include <time.h> -#include <stdlib.h> -#include <string.h> - -#ifdef WIN32 -#define DOS -#include <oldnames.h> -#endif - -#ifndef DOS -#include <unistd.h> -#endif - -#ifdef DOS -#include <dos.h> -#include <io.h> -#include <fcntl.h> -#endif - -/* try to identify Mac compilers */ -#if __POWERPC__ || __CFM68K__ || __MC68K_ -#define MAC -#endif - -#ifdef MAC -#include "Main.h" /* Required for DropUNIX */ -#endif - -#include "psimage.h" - -#if (defined(DOS) || defined (MAC)) -#define READMODE "rb" /* read JPEG files in binary mode */ -#define WRITEMODE "wb" /* write (some) PS files in binary mode */ -#else -#define READMODE "r" -#define WRITEMODE "w" /* write (some) PS files in binary mode */ -#endif - -int Margin = 20; /* safety margin */ -BOOL quiet = FALSE; /* suppress informational messages */ -BOOL autorotate = FALSE; /* disable automatic rotation */ - -extern BOOL AnalyzeJPEG P1(imagedata *, image); -extern int ASCII85Encode P2(FILE *, in, FILE *, out); -extern void ASCIIHexEncode P2(FILE *, in, FILE *, out); - -#ifndef MAC -extern char *optarg; -extern int optind; -#endif - -#ifdef DOS -extern int getopt P3(int, nargc, char **, nargv, char *, ostr); -#endif - -#define BUFFERSIZE 1024 -static char buffer[BUFFERSIZE]; -static char *ColorSpaceNames[] = {"", "Gray", "", "RGB", "CMYK" }; - -/* Array of known page sizes including name, width, and height */ - -typedef struct { const char *name; int width; int height; } PageSize_s; - -PageSize_s PageSizes[] = { - {"a0", 2380, 3368}, - {"a1", 1684, 2380}, - {"a2", 1190, 1684}, - {"a3", 842, 1190}, - {"a4", 595, 842}, - {"a5", 421, 595}, - {"a6", 297, 421}, - {"b5", 501, 709}, - {"letter", 612, 792}, - {"legal", 612, 1008}, - {"ledger", 1224, 792}, - {"p11x17", 792, 1224} -}; - -#define PAGESIZELIST (sizeof(PageSizes)/sizeof(PageSizes[0])) - -#ifdef A4 -int PageWidth = 595; /* page width A4 */ -int PageHeight = 842; /* page height A4 */ -#else -int PageWidth = 612; /* page width letter */ -int PageHeight = 792; /* page height letter */ -#endif - -static void -JPEGtoPS P2(imagedata *, JPEG, FILE *, PSfile) { - int llx, lly, urx, ury; /* Bounding box coordinates */ - size_t n; - float scale, sx, sy; /* scale factors */ - time_t t; - int i; - - /* read image parameters and fill JPEG struct*/ - if (!AnalyzeJPEG(JPEG)) { - fprintf(stderr, "Error: '%s' is not a proper JPEG file!\n", JPEG->filename); - return; - } - - if (!quiet) - fprintf(stderr, "Note on file '%s': %dx%d pixel, %d color component%s\n", - JPEG->filename, JPEG->width, JPEG->height, JPEG->components, - (JPEG->components == 1 ? "" : "s")); - - /* "Use resolution from file" was requested, but we couldn't find any */ - if (JPEG->dpi == DPI_USE_FILE && !quiet) { - fprintf(stderr, - "Note: no resolution values found in JPEG file - using standard scaling.\n"); - JPEG->dpi = DPI_IGNORE; - } - - if (JPEG->dpi == DPI_IGNORE) { - if (JPEG->width > JPEG->height && autorotate) { /* switch to landscape if needed */ - JPEG->landscape = TRUE; - if (!quiet) - fprintf(stderr, - "Note: image width exceeds height - producing landscape output!\n"); - } - if (!JPEG->landscape) { /* calculate scaling factors */ - sx = (float) (PageWidth - 2*Margin) / JPEG->width; - sy = (float) (PageHeight - 2*Margin) / JPEG->height; - }else { - sx = (float) (PageHeight - 2*Margin) / JPEG->width; - sy = (float) (PageWidth - 2*Margin) / JPEG->height; - } - scale = min(sx, sy); /* We use at least one edge of the page */ - } else { - if (!quiet) - fprintf(stderr, "Note: Using resolution %d dpi.\n", (int) JPEG->dpi); - scale = 72 / JPEG->dpi; /* use given image resolution */ - } - - if (JPEG->landscape) { - /* landscape: move to (urx, lly) */ - urx = PageWidth - Margin; - lly = Margin; - ury = (int) (Margin + scale*JPEG->width + 0.9); /* ceiling */ - llx = (int) (urx - scale * JPEG->height); /* floor */ - }else { - /* portrait: move to (llx, lly) */ - llx = lly = Margin; - urx = (int) (llx + scale * JPEG->width + 0.9); /* ceiling */ - ury = (int) (lly + scale * JPEG->height + 0.9); /* ceiling */ - } - - time(&t); - - /* produce EPS header comments */ - fprintf(PSfile, "%%!PS-Adobe-3.0 EPSF-3.0\n"); - fprintf(PSfile, "%%%%Creator: jpeg2ps %s by Thomas Merz\n", VERSION); - fprintf(PSfile, "%%%%Title: %s\n", JPEG->filename); - fprintf(PSfile, "%%%%CreationDate: %s", ctime(&t)); - fprintf(PSfile, "%%%%BoundingBox: %d %d %d %d\n", - llx, lly, urx, ury); - fprintf(PSfile, "%%%%DocumentData: %s\n", - JPEG->mode == BINARY ? "Binary" : "Clean7Bit"); - fprintf(PSfile, "%%%%LanguageLevel: 2\n"); - fprintf(PSfile, "%%%%EndComments\n"); - fprintf(PSfile, "%%%%BeginProlog\n"); - fprintf(PSfile, "%%%%EndProlog\n"); - fprintf(PSfile, "%%%%Page: 1 1\n"); - - fprintf(PSfile, "/languagelevel where {pop languagelevel 2 lt}"); - fprintf(PSfile, "{true} ifelse {\n"); - fprintf(PSfile, " (JPEG file '%s' needs PostScript Level 2!", - JPEG->filename); - fprintf(PSfile, "\\n) dup print flush\n"); - fprintf(PSfile, " /Helvetica findfont 20 scalefont setfont "); - fprintf(PSfile, "100 100 moveto show showpage stop\n"); - fprintf(PSfile, "} if\n"); - - fprintf(PSfile, "save\n"); - fprintf(PSfile, "/RawData currentfile "); - - if (JPEG->mode == ASCIIHEX) /* hex representation... */ - fprintf(PSfile, "/ASCIIHexDecode filter "); - else if (JPEG->mode == ASCII85) /* ...or ASCII85 */ - fprintf(PSfile, "/ASCII85Decode filter "); - /* else binary mode: don't use any additional filter! */ - - fprintf(PSfile, "def\n"); - - fprintf(PSfile, "/Data RawData << "); - fprintf(PSfile, ">> /DCTDecode filter def\n"); - - /* translate to lower left corner of image */ - fprintf(PSfile, "%d %d translate\n", (JPEG->landscape ? - PageWidth - Margin : Margin), Margin); - - if (JPEG->landscape) /* rotation for landscape */ - fprintf(PSfile, "90 rotate\n"); - - fprintf(PSfile, "%.2f %.2f scale\n", /* scaling */ - JPEG->width * scale, JPEG->height * scale); - fprintf(PSfile, "/Device%s setcolorspace\n", - ColorSpaceNames[JPEG->components]); - fprintf(PSfile, "{ << /ImageType 1\n"); - fprintf(PSfile, " /Width %d\n", JPEG->width); - fprintf(PSfile, " /Height %d\n", JPEG->height); - fprintf(PSfile, " /ImageMatrix [ %d 0 0 %d 0 %d ]\n", - JPEG->width, -JPEG->height, JPEG->height); - fprintf(PSfile, " /DataSource Data\n"); - fprintf(PSfile, " /BitsPerComponent %d\n", - JPEG->bits_per_component); - - /* workaround for color-inverted CMYK files produced by Adobe Photoshop: - * compensate for the color inversion in the PostScript code - */ - if (JPEG->adobe && JPEG->components == 4) { - if (!quiet) - fprintf(stderr, "Note: Adobe-conforming CMYK file - applying workaround for color inversion.\n"); - fprintf(PSfile, " /Decode [1 0 1 0 1 0 1 0]\n"); - }else { - fprintf(PSfile, " /Decode [0 1"); - for (i = 1; i < JPEG->components; i++) - fprintf(PSfile," 0 1"); - fprintf(PSfile, "]\n"); - } - - fprintf(PSfile, " >> image\n"); - fprintf(PSfile, " Data closefile\n"); - fprintf(PSfile, " RawData flushfile\n"); - fprintf(PSfile, " showpage\n"); - fprintf(PSfile, " restore\n"); - fprintf(PSfile, "} exec"); - - /* seek to start position of JPEG data */ - fseek(JPEG->fp, JPEG->startpos, SEEK_SET); - - switch (JPEG->mode) { - case BINARY: - /* important: ONE blank and NO newline */ - fprintf(PSfile, " "); -#ifdef DOS - fflush(PSfile); /* up to now we have CR/NL mapping */ - setmode(fileno(PSfile), O_BINARY); /* continue in binary mode */ -#endif - /* copy data without change */ - while ((n = fread(buffer, 1, sizeof(buffer), JPEG->fp)) != 0) - fwrite(buffer, 1, n, PSfile); -#ifdef DOS - fflush(PSfile); /* binary yet */ - setmode(fileno(PSfile), O_TEXT); /* text mode */ -#endif - break; - - case ASCII85: - fprintf(PSfile, "\n"); - - /* ASCII85 representation of image data */ - if (ASCII85Encode(JPEG->fp, PSfile)) { - fprintf(stderr, "Error: internal problems with ASCII85Encode!\n"); - exit(1); - } - break; - - case ASCIIHEX: - /* hex representation of image data (useful for buggy dvips) */ - ASCIIHexEncode(JPEG->fp, PSfile); - break; - } - fprintf(PSfile, "\n%%%%EOF\n"); -} - -static -void usage P0(void) { - fprintf(stderr, "jpeg2ps %s: convert JPEG files to PostScript Level 2.\n", - VERSION); - fprintf(stderr, "(C) Thomas Merz 1994-1999\n\n"); - fprintf(stderr, "usage: jpeg2ps [options] jpegfile > epsfile\n"); - fprintf(stderr, "-a auto rotate: produce landscape output if width > height\n"); - fprintf(stderr, "-b binary mode: output 8 bit data (default: 7 bit with ASCII85)\n"); - fprintf(stderr, "-h hex mode: output 7 bit data in ASCIIHex encoding\n"); - fprintf(stderr, "-o <name> output file name\n"); - fprintf(stderr, "-p <size> page size name. Known names are:\n"); - fprintf(stderr, " a0, a1, a2, a3, a4, a5, a6, b5, letter, legal, ledger, p11x17\n"); - fprintf(stderr, "-q quiet mode: suppress all informational messages\n"); - fprintf(stderr, "-r <dpi> resolution value (dots per inch)\n"); - fprintf(stderr, " 0 means use value given in file, if any (disables autorotate)\n"); - exit(1); -} - -int -main P2(int, argc, char **, argv) { - imagedata image; - FILE *outfile; - -#ifdef MAC - int i, bufLength; - char *cp, outfilename[512]; -#else - int opt, pagesizeindex = -1; -#endif - - image.filename = NULL; - image.mode = ASCII85; - image.startpos = 0L; - image.landscape= FALSE; - image.dpi = DPI_IGNORE; - image.adobe = FALSE; - - outfile = stdout; - - if (argc == 1) - usage(); - -#ifndef MAC - while ((opt = getopt(argc, argv, "abho:p:qr:")) != -1) - switch (opt) { - case 'a': - autorotate = TRUE; - break; - case 'b': - image.mode = BINARY; - break; - case 'h': - image.mode = ASCIIHEX; - break; - case 'o': - outfile = fopen(optarg, "w"); - if (outfile == NULL) { - fprintf(stderr, "Error: cannot open output file %s.\n", optarg); - exit(-2); - } - break; - case 'p': - for(pagesizeindex=0; pagesizeindex < PAGESIZELIST; pagesizeindex++) - if (!strcmp((const char *) optarg, PageSizes[pagesizeindex].name)) { - PageHeight = PageSizes[pagesizeindex].height; - PageWidth = PageSizes[pagesizeindex].width; - break; - } - if (pagesizeindex == PAGESIZELIST) { /* page size name not found */ - fprintf(stderr, "Error: Unknown page size %s.\n", optarg); - exit(-3); - } - break; - case 'q': - quiet = TRUE; - break; - case 'r': - image.dpi = (float) atof(optarg); - if (image.dpi < 0) { - fprintf(stderr, "Error: bad resolution value %f !\n", image.dpi); - exit(1); - } - break; - case '?': - usage(); - } - - if (pagesizeindex != -1 && ! quiet) /* page size user option given */ - fprintf(stderr, "Note: Using %s page size.\n", - PageSizes[pagesizeindex].name); - - if (optind == argc) /* filename missing */ - usage(); - else - image.filename = argv[optind]; - - if (!image.filename) - usage(); - - if ((image.fp = fopen(image.filename, READMODE)) == NULL) { - fprintf(stderr, "Error: couldn't read JPEG file '%s'!\n", - image.filename), - exit(1); - } - - JPEGtoPS(&image, outfile); /* convert JPEG data */ - fclose(image.fp); - fclose(outfile); - -#else /* MAC */ - - for (i = 1; i < argc; i++) { - image.filename = argv[i]; - - strcpy(outfilename, image.filename); - bufLength = strlen(outfilename); - cp = outfilename; - if (bufLength > 3) - { - cp += (bufLength - 4); - /* strip .jpg from terminating string */ - if (strcmp(cp, ".jpg") == 0 || strcmp(cp, ".JPG") == 0) - outfilename[bufLength - 4] = '\0'; - } - - strcat(outfilename, ".eps"); - - if ((image.fp = fopen(image.filename, READMODE)) == NULL) { - fprintf(stderr, "Error: couldn't read JPEG file '%s'!\n", - image.filename), - exit(1); - } - - outfile = fopen(outfilename, WRITEMODE); - - JPEGtoPS(&image, outfile); /* convert JPEG data */ - - fclose(image.fp); - fclose(outfile); - } - -#endif /* not MAC */ - - return 0; -} diff --git a/Build/source/utils/jpeg2ps/jpeg2ps.dsp b/Build/source/utils/jpeg2ps/jpeg2ps.dsp deleted file mode 100644 index 2aeebe907fc..00000000000 --- a/Build/source/utils/jpeg2ps/jpeg2ps.dsp +++ /dev/null @@ -1,86 +0,0 @@ -# Microsoft Developer Studio Project File - Name="jpeg2ps" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=jpeg2ps - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "jpeg2ps.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "jpeg2ps.mak" CFG="jpeg2ps - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "jpeg2ps - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "DOS" /YX /FD /c -# ADD BASE RSC /l 0x407 /d "NDEBUG" -# ADD RSC /l 0x407 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# Begin Target - -# Name "jpeg2ps - Win32 Release" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\ASC85EC.C -# End Source File -# Begin Source File - -SOURCE=.\GETOPT.C -# End Source File -# Begin Source File - -SOURCE=.\JPEG2PS.C -# End Source File -# Begin Source File - -SOURCE=.\READJPEG.C -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\PSIMAGE.H -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/Build/source/utils/jpeg2ps/jpeg2ps.pdf b/Build/source/utils/jpeg2ps/jpeg2ps.pdf deleted file mode 100644 index 7c28519571b..00000000000 --- a/Build/source/utils/jpeg2ps/jpeg2ps.pdf +++ /dev/null @@ -1,110 +0,0 @@ -%PDF-1.1 -% -1 0 obj -[ -/CalRGB << /WhitePoint [ 0.9505 1 1.089 ] /Gamma [ 1.8 1.8 1.8 ] /Matrix [ 0.4497 0.2446 0.0252 0.3163 0.672 0.1412 0.1845 0.0833 0.9227 ] >> - -] -endobj -2 2 obj -<< -/Title (JPEG und PostScript Level 2) -/Parent 37 0 R -/Dest [ 199 0 R /Fit ] -/First 3 1 R -/Last 12 2 R -/Count 5 ->> -endobj -3 1 obj -<< -/Title (JPEG-Marker) -/Dest [ 11 0 R /Fit ] -/Parent 2 2 R -/Next 4 2 R ->> -endobj -4 2 obj -<< -/Title (JPEG und TIFF 6.0) -/Next 5 1 R -/Prev 3 1 R -/Parent 2 2 R -/Dest [ 17 0 R /Fit ] ->> -endobj -5 1 obj -<< -/Title (JPEG/PostScript-Wrapper) -/Next 6 1 R -/Prev 4 2 R -/Parent 2 2 R -/Dest [ 21 0 R /Fit ] ->> -endobj -6 1 obj -<< -/Title (Literatur) -/Dest [ 26 0 R /Fit ] -/Next 12 2 R -/Prev 5 1 R -/Parent 2 2 R ->> -endobj -7 0 obj -<< -/Type /Font -/Subtype /Type1 -/Name /F6 -/Encoding /MacRomanEncoding -/BaseFont /Times-Roman ->> -endobj -8 0 obj -<< -/Type /Font -/Subtype /Type1 -/Name /F7 -/Encoding 34 0 R -/BaseFont /Symbol ->> -endobj -9 0 obj -<< -/Type /Font -/Subtype /Type1 -/Name /F9 -/Encoding /MacRomanEncoding -/BaseFont /Helvetica-Bold ->> -endobj -10 0 obj -<< -/Type /Pages -/Kids [ 199 0 R 11 0 R 17 0 R 21 0 R 26 0 R 30 0 R ] -/Count 6 -/MediaBox [ 0 0 595 842 ] ->> -endobj -11 0 obj -<< -/Type /Page -/Parent 10 0 R -/Resources 14 0 R -/Contents 13 0 R -/Thumb 117 1 R -/Annots 43 1 R ->> -endobj -12 2 obj -<< -/Title (JPEG-Wrapper, C-Source) -/Dest [ 26 0 R /FitH 845 ] -/Prev 6 1 R -/Parent 2 2 R ->> -endobj -13 0 obj -<< /Length 7962 /Filter /LZWDecode >> -stream -A@8Q(Z8FX\@nDx
\ No newline at end of file diff --git a/Build/source/utils/jpeg2ps/jpeg2ps.txt b/Build/source/utils/jpeg2ps/jpeg2ps.txt deleted file mode 100644 index c59c2523158..00000000000 --- a/Build/source/utils/jpeg2ps/jpeg2ps.txt +++ /dev/null @@ -1,338 +0,0 @@ -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -jpeg2ps - convert JPEG compressed images to PostScript Level 2 - -jpeg2ps is available from http://www.ifconnection.de/~tm -and many other sites, notably CTAN mirrors. - -Copyright (C) 1994-99 Thomas Merz (tm@muc.de) -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- - -Purpose of jpeg2ps -================== -jpeg2ps converts JPEG files to PostScript Level 2 or 3 EPS. In fact, jpeg2ps -is not really a converter but a "wrapper": it reads the image parameters -(width, height, number of color components) in a JPEG file, writes the -according EPS header and then copies the compressed JPEG data to the output -file. Decompression is done by the PostScript interpreter (only PostScript -Level 2 and 3 interpreters support JPEG compression and decompression). -If you have a slow communication channel and a fast printer, sending -compressed image data is a big win. - - -Change History -============== - -V1.8 (July 28, 1999) - - Added -q option for suppressing all non-error messages. - - Don't use the supplied getopt on Unix by default, but still - include the source module in the distribution (and use it on - DOS/Windows) - - Added -p option for setting the page size on the command line. - If no such option is supplied, A4 or letter is used as default, - according to a compile time option. - - Renamed makefile.gcc to the more common Makefile. - - Added casts to get rid of some warning messages. - - Added Mac support for use with DropUNIX. This required opening - the files in binary mode, properly initializing some statics, - and replacing the getopt loop with a plain argc loop (for now). - -V1.7 (April 9, 1999) - - Fixed an omission in the Makefile (makefile.gcc) - - Removed the OS2 #ifdefs and made the conditional code identical to the - DOS code. Therefore, using -DDOS should also work on OS/2. - -V1.6 (March 29, 1999) - - Changed all references to my old Web site to the current address - http://www.ifconnection.de/~tm - - Added support for OS/2, provided by - Stefan A. Deutscher (sad@utk.edu / stefand@ibm.net) - - Added support for VMS, provided by - Rolf Niepraschk (niepraschk@ptb.de) - - Changed the get_2bytes() macro in readjpeg.c to a static function - in order to avoid portability issues. Since the evaluation order - in the formely used macro version isn't guaranteed, the result - was garbled on some platforms, notably with the Metrowerks C - compilers for BeOS and Macintosh. - - Changed the auto rotate feature in order to produce "clean" (unrotated) - EPS files. The old feature of automatically rotating images to - landscape mode if width > height can be reactivated with the new - command line option "-a" (auto rotate) - - Changed the ASCII85 output routine in order to avoid two consecutive - percent characters at the beginning of a line. Although legal PostScript, - this may cause trouble with some post-processing programs, notably - when including jpeg2ps output in TeX files. This should fix the - problems dvips users sometimes encountered when using jpeg2ps. - The comment in this file (jpeg2ps.txt) regarding problems with - TeX PostScript drivers has been deleted. - -V1.5 (Dec. 12, 1996) - - Included ASCIIHex encoding again (the code was already there, - only command line option added). This is primarily useful as as - workaround for a brain-damaged dvips "feature" (see below). - - Added note on dvips and tgif in jpeg2ps.txt. - - Removed jpeg2pdf again. Its functionality will be contained in the - forthcoming PDFlib C library and some library client programs. - -V1.4 (Aug. 19, 1996) - - included getopt.c in distribution, changed option handling - - prepared readjpeg.c for use with jpeg2pdf program (accept baseline only) - - included jpeg2pdf in the distribution - -V1.3 (Jan. 31, 1996) - - Fixed ASCII85 encoding bug. In rare cases ~ and > could get - separated. - -V1.2 (Jan. 25, 1996) - - Fixed "unsigned" bug when reading JFIF density marker. - -V1.1 (Jan. 22, 1996) Several enhancements: - - invert colors of Adobe Photoshop CMYK files - - interpret JFIF resolution ("density") markers - - implemented -r switch for specifying resolution - - accept compression markers other than SOF0 and SOF1 (this won't - be useful for many people, and didn't have any testing). - -V1.0 (Jan. 9, 1996) Re-release of formerly released Usenet version. - - -Building JPEG2PS -================ -jpeg2ps is coded in rather simple-minded ANSI C. It should compile cleanly -on many systems. For old K&R compilers, include the compiler flag -DKNR in -the makefile to disable ANSI prototypes. - -The jpeg2ps distribution is available in .zip and .tar.gz format. -jpeg2ps-x.x.zip is intended for MS-DOS (real or DOS box in Windows) -and also includes an executable. Source code is identical in both -jpeg2ps-x.x.zip and jpeg2ps-x.x.tar.gz, the only exception being different -line end conventions. - -General compilation options ---------------------------- --DA4 makes jpeg2ps use A4 as default paper size. If -DA4 is not -given, letter format will be used instead. Note that the paper -size can always be specified at the command line. - -Unix ----- -jpeg2ps should compile out of the box on most Unix systems, -probably after a little Makefile tweaking. The distributed -Makefile is set up for GCC on Linux. - -DOS ---- -Use -DDOS to compile jpeg2ps on DOSish systems. The distributed -source builds fine with MS Visual C++ 6.0. A project file for -this environment is included in the distribution. - -OS/2 ----- -OS/2 support was provided by Stefan A. Deutscher (sad@utk.edu / stefand@ibm.net) -and is included in the distribution "as is", i.e., I'm unable to assist in -any OS/2-related issues. The following is from Stefan's description for OS/2: - ->The executable was made from the unmodified unix sources with gcc / emx09c + ->emxfix2 applied. To run it you need the emx runtime system, which you ->find as emxrt.zip, or on ftp-os2.cdrom.com or ftp-os2.nmsu.edu or ftp.leo.org. ->Newer versions than emx09c+ef2 should be fine. I tested this only on Warp 4, ->and there it works. - -Mac ---- -jpeg2ps can be built on the Mac using a facility called DropUNIX. This is -a wrapper for conventional command-line driven Unix programs which gives -some sort of drag-and-drop support. However, command line options are -not available. For this reason, jpeg2ps always generates ASCII85 output -if built on the Mac. - -In order to build jpeg2ps on the Mac, you will need DropUNIX from -http://www.zenspider.com or some mirror, such as -http://omlc.ogi.edu/software/tex_convert - -and set the C preprocessor define -DMAC. Since the MetroWerks compiler -has a somewhat kludgey way to set preprocessor options, the file -prefix-mac.pch is supplied which should be added to the project as -a precompiled header (see MW docs). - -The idea for the Mac port and the DropUNIX support were provided by -Ujwal Sathyam (setlur@bigfoot.com). - -Although I successfully built jpeg2ps with the MetroWerks compiler, -Mac support is still somewhat experimental. The required build -files are not included in the distribution. (No, please don't ask me for -an executable). - -Note that for unknown reason the Mac version currently supports only -conversion of single files. Although it seems to work with multiple -files too, the output generated for the second and subsequent files -will be rubbish. - - -VMS ---- -A VMS build file was provided by Rolf Niepraschk (niepraschk@ptb.de). It isn't -supported by the author of this software. Use the supplied file "descrip.mms" -as a starting point for building jpeg2ps with the VMS build tool mms. - - -Usage Details -============= -jpeg2ps [options] file.jpg > file.eps - --a auto rotate feature --b binary mode --h hex mode (ASCIIHex encoding) --o name output file name (as an alternative to output redirection) --p size page size name. Known names are: - a0, a1, a2, a3, a4, a5, a6, b5, letter, legal, ledger, p11x17 --q quiet mode: suppress all informational messages --r dpi resolution value (0 = read from file if possible) - -jpeg2ps reads a JPEG file (*not* stdin) and writes a DSC-compliant EPS -file containing the compressed JPEG data in PostScript format to stdout. -The produced EPS files contain the necessary DSC comments including -BoundingBox, so they may be imported in page layout applications. However, -they do not contain preview images, so you will only see a gray box on screen. - -If the auto rotate feature is activated with the -a option, images with -width > height are automatically rotated to landscape mode. Don't use this -option if you simply want to generate EPS files for inclusion in your -documents. Note: prior to version 1.6, jpeg2ps always "autorotated" images -with width > height which was especially bad for TeX users. I hope this -change helps the TeX community in better using jpeg2ps! - -jpeg2ps performs some sanity checks with the JPEG data. It detects several -kinds of corrupt input data, but it is not absolutely foolproof. One special -feature is that you can feed Macintosh JPEG files (PICT-JPEG) to jpeg2ps. -These normally have several hundred bytes of additional stuff before the JPEG -data. This PICT rubbish is simply ignored by jpeg2ps. - - -Output modes -============ -By default, jpeg2ps sends the image data in ASCII85 encoded form which is -suitable for any communication channel (serial, parallel or whatever). If -you are *sure* that your channel is truly 8-bit clean, you can force 8-bit -data with the -b option. Note that this normally does not apply to 8-bit -serial or even parallel channels since some control characters are reserved -for the communications protocol. You can use binary data e.g.: - -- with some networked printers -- with direct-access PostScript interpreters, e.g. Ghostscript -- serial or parallel channels using Binary Control Protocol (BCP). - -Using the -h option, jpeg2ps generates 7-bit clean data by using -ASCIIHex encoding instead of the more space-efficient ASCII85 encoding. -This is only useful for specialized applications, e.g. for debugging, -since jpeg2ps requires PostScript Level 2 anyway, and ASCII85 is -supported in any Level 2 interpreter. - - -Scaling and resolution -====================== -Concerning the size of the printed image, you have three options: - -Default behaviour: -By default, doesn't change the image size and rotation. -With the -a option, jpeg2ps tries to fit the image on the page, rotating -it if necessary (image width exceeds image height) -The image is scaled in a way to use at least one full edge of the paper. -A 20 pt margin is subtracted on each side. "Page" means A4 size if compiled -with "-DA4", letter size otherwise. The -p option may be used to select -other page sizes. - -Using resolution value from the file: -The option "-r 0" instructs jpeg2ps to look for a JFIF density/resolution -marker and use that value. Automatic scaling and rotation are disabled. -However, if no resolution information is found in the file, jpeg2ps -applies the default algorithm described above. - -Explicitly setting the resolution: -Using "-r <dpi>" you can force jpeg2ps to use a certain dpi value. -Since automatic actions are also disabled in this case, you are -responsible for choosing a reasonable resolution value. For example, -you can print a 300 dpi image half-sized by supplying -r 600. - - -Messages -======== -jpeg2ps issues three kinds of messages: - -Notes: have informational character - -Warnings: a potential problem with the file was recognized, processing - continues. - -Errors: Either a severe problem within the JPEG file was found or the - file explores JPEG features not compatible with PostScript Level 2. - -Note that there are some JPEG producers which do not exactly conform to the -specification and that the JPEG spec itself does not cover every aspect of -the file format. You are on the safe side if you demand JFIF files which are -happily accepted by jpeg2ps. (For further information see the JPEG FAQ -by Tom Lane.) - - -Adobe Photoshop CMYK files -========================== -This is what the Independent JPEG Group has to say about Photoshop -CMYK files (quoted from libjpeg.doc, part of the IJG JPEG library): - -> CAUTION: it appears that Adobe Photoshop writes inverted data in CMYK JPEG -> files: 0 represents 100% ink coverage, rather than 0% ink as you'd expect. -> This is arguably a bug in Photoshop, but if you need to work with Photoshop -> CMYK files, you will have to deal with it in your application. We cannot -> "fix" this in the library by inverting the data during the CMYK<=>YCCK -> transform, because that would break other applications, notably Ghostscript. -> Photoshop versions prior to 3.0 write EPS files containing JPEG-encoded CMYK -> data in the same inverted-YCCK representation used in bare JPEG files, but -> the surrounding PostScript code performs an inversion using the PS image -> operator. I am told that Photoshop 3.0 will write uninverted YCCK in -> EPS/JPEG files, and will omit the PS-level inversion. (But the data -> polarity used in bare JPEG files will not change in 3.0.) In either case, -> the JPEG library must not invert the data itself, or else Ghostscript would -> read these EPS files incorrectly. - -Accordingly, jpeg2ps tries to detect such files (by looking for Adobes -APP marker) and inverts the colors in the case of 4-component images. -This inversion takes place in the PostScript instructions, not by -changing the actual image data. - - -Further Information -=================== - -If you like to know more about the inner workings of jpeg2ps, the JPEG -standard and its integration in PostScript Level 2, the JFIF file format, -JPEG/TIFF *and* if you can read German, you may want to check out -my article in a German computer magazine: - -"Gut verpackt - Drucken von JPEG-Bildern mit PostScript Level 2" -c't, Magazin fuer Computertechnik, Heise Verlag Hannover, 6/94, p.236 ff. - -This article is also available in PDF format from my WWW page: -http://www.ifconnection.de/~tm - - -Related Software -================ - -Note that there is a related PostScript program called "viewjpeg.ps" which -is part of the Ghostscript distribution. viewjpeg.ps operates similarly to -jpeg2ps, but the PostScript interpreter does the "wrapping" of JPEG data -itself. With viewjpeg.ps you can e.g. view JPEG files directly within -GhostScript or another interpreter with access to the file system. -Ghostscript can be found at http://www.cs.wisc.edu/~ghost - - -Disclaimer -========== -This software is free. You are granted the right to use and copy it. This -software may not be sold or bundled with any commercial package without -express written permission of the author. - -The author accepts no responsibility for damages resulting from the use of -this software and makes no warranty, either express or implied, including but -not limited to, any implied warranty of merchantability or fitness for a -particular purpose. This software is provided as is, and you assume all risks -when using it. diff --git a/Build/source/utils/jpeg2ps/psimage.h b/Build/source/utils/jpeg2ps/psimage.h deleted file mode 100644 index a8fe7a506b1..00000000000 --- a/Build/source/utils/jpeg2ps/psimage.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -------------------------- psimage.h ------------------------- */ -#ifndef TRUE -#define TRUE 1 -#endif -#ifndef FALSE -#define FALSE 0 -#endif - -#ifdef min -#undef min -#endif -#define min(a, b) ((a) < (b) ? (a) : (b)) - -typedef int BOOL; - -/* Simple prototype macros for K&R and ANSI-C */ - -#ifdef KNR -#define P0(v) () -#define P1(t1, p1) (p1) t1 p1 -#define P2(t1, p1, t2, p2) (p1, p2) t1 p1; t2 p2 -#define P3(t1, p1, t2, p2, t3, p3) (p1, p2, p3) t1 p1; t2 p2; t3 p3 -#else -#define P0(v) (void) -#define P1(t1, p1) (t1 p1) -#define P2(t1, p1, t2, p2) (t1 p1, t2 p2) -#define P3(t1, p1, t2, p2, t3, p3) (t1 p1, t2 p2, t3 p3) -#endif - -/* data output mode: binary, ascii85, hex-ascii */ -typedef enum { BINARY, ASCII85, ASCIIHEX } DATAMODE; - -typedef struct { - FILE *fp; /* file pointer for jpeg file */ - char *filename; /* name of image file */ - int width; /* pixels per line */ - int height; /* rows */ - int components; /* number of color components */ - int bits_per_component; /* bits per color component */ - float dpi; /* image resolution in dots per inch */ - DATAMODE mode; /* output mode: 8bit, ascii, ascii85 */ - long startpos; /* offset to jpeg data */ - BOOL landscape; /* rotate image to landscape mode? */ - BOOL adobe; /* image includes Adobe comment marker */ -} imagedata; - -#define DPI_IGNORE -1.0 /* dummy value for imagedata.dpi */ -#define DPI_USE_FILE 0.0 /* dummy value for imagedata.dpi */ diff --git a/Build/source/utils/jpeg2ps/readjpeg.c b/Build/source/utils/jpeg2ps/readjpeg.c deleted file mode 100644 index afa49dcf6be..00000000000 --- a/Build/source/utils/jpeg2ps/readjpeg.c +++ /dev/null @@ -1,323 +0,0 @@ -/* ------------------------- readjpeg.c ------------------------- */ -#include <stdio.h> -#include <string.h> - -#if !defined(DOS) && !defined(WIN32) -#include <unistd.h> -#endif - -#include "psimage.h" - -/* The following enum is stolen from the IJG JPEG library - * Comments added by tm - * This table contains far too many names since jpeg2ps - * is rather simple-minded about markers - */ - -extern BOOL quiet; - -typedef enum { /* JPEG marker codes */ - M_SOF0 = 0xc0, /* baseline DCT */ - M_SOF1 = 0xc1, /* extended sequential DCT */ - M_SOF2 = 0xc2, /* progressive DCT */ - M_SOF3 = 0xc3, /* lossless (sequential) */ - - M_SOF5 = 0xc5, /* differential sequential DCT */ - M_SOF6 = 0xc6, /* differential progressive DCT */ - M_SOF7 = 0xc7, /* differential lossless */ - - M_JPG = 0xc8, /* JPEG extensions */ - M_SOF9 = 0xc9, /* extended sequential DCT */ - M_SOF10 = 0xca, /* progressive DCT */ - M_SOF11 = 0xcb, /* lossless (sequential) */ - - M_SOF13 = 0xcd, /* differential sequential DCT */ - M_SOF14 = 0xce, /* differential progressive DCT */ - M_SOF15 = 0xcf, /* differential lossless */ - - M_DHT = 0xc4, /* define Huffman tables */ - - M_DAC = 0xcc, /* define arithmetic conditioning table */ - - M_RST0 = 0xd0, /* restart */ - M_RST1 = 0xd1, /* restart */ - M_RST2 = 0xd2, /* restart */ - M_RST3 = 0xd3, /* restart */ - M_RST4 = 0xd4, /* restart */ - M_RST5 = 0xd5, /* restart */ - M_RST6 = 0xd6, /* restart */ - M_RST7 = 0xd7, /* restart */ - - M_SOI = 0xd8, /* start of image */ - M_EOI = 0xd9, /* end of image */ - M_SOS = 0xda, /* start of scan */ - M_DQT = 0xdb, /* define quantization tables */ - M_DNL = 0xdc, /* define number of lines */ - M_DRI = 0xdd, /* define restart interval */ - M_DHP = 0xde, /* define hierarchical progression */ - M_EXP = 0xdf, /* expand reference image(s) */ - - M_APP0 = 0xe0, /* application marker, used for JFIF */ - M_APP1 = 0xe1, /* application marker */ - M_APP2 = 0xe2, /* application marker */ - M_APP3 = 0xe3, /* application marker */ - M_APP4 = 0xe4, /* application marker */ - M_APP5 = 0xe5, /* application marker */ - M_APP6 = 0xe6, /* application marker */ - M_APP7 = 0xe7, /* application marker */ - M_APP8 = 0xe8, /* application marker */ - M_APP9 = 0xe9, /* application marker */ - M_APP10 = 0xea, /* application marker */ - M_APP11 = 0xeb, /* application marker */ - M_APP12 = 0xec, /* application marker */ - M_APP13 = 0xed, /* application marker */ - M_APP14 = 0xee, /* application marker, used by Adobe */ - M_APP15 = 0xef, /* application marker */ - - M_JPG0 = 0xf0, /* reserved for JPEG extensions */ - M_JPG13 = 0xfd, /* reserved for JPEG extensions */ - M_COM = 0xfe, /* comment */ - - M_TEM = 0x01, /* temporary use */ - - M_ERROR = 0x100 /* dummy marker, internal use only */ -} JPEG_MARKER; - -/* - * The following routine used to be a macro in its first incarnation: - * #define get_2bytes(fp) ((unsigned int) (getc(fp) << 8) + getc(fp)) - * However, this is bad programming since C doesn't guarantee - * the evaluation order of the getc() calls! As suggested by - * Murphy's law, there are indeed compilers which produce the wrong - * order of the getc() calls, e.g. the Metrowerks C compilers for BeOS - * and Macintosh. - * Since there are only few calls we don't care about the performance - * penalty and use a simplistic C function. - */ - -/* read two byte parameter, MSB first */ -static unsigned int -get_2bytes(FILE *fp) -{ - unsigned int val; - val = getc(fp) << 8; - val += getc(fp); - return val; -} - -static int -next_marker P1(FILE *, fp) -{ /* look for next JPEG Marker */ - int c, nbytes = 0; - - if (feof(fp)) - return M_ERROR; /* dummy marker */ - - do { - do { /* skip to FF */ - nbytes++; - c = getc(fp); - } while (c != 0xFF); - do { /* skip repeated FFs */ - c = getc(fp); - } while (c == 0xFF); - } while (c == 0); /* repeat if FF/00 */ - - return c; -} - -/* analyze JPEG marker */ -BOOL AnalyzeJPEG P1(imagedata *, image) { - int b, c, unit; - unsigned long i, length = 0; -#define APP_MAX 255 - unsigned char appstring[APP_MAX]; - BOOL SOF_done = FALSE; - - /* Tommy's special trick for Macintosh JPEGs: simply skip some */ - /* hundred bytes at the beginning of the file! */ - do { - do { /* skip if not FF */ - c = getc(image->fp); - } while (!feof(image->fp) && c != 0xFF); - - do { /* skip repeated FFs */ - c = getc(image->fp); - } while (c == 0xFF); - - /* remember start position */ - if ((image->startpos = ftell(image->fp)) < 0L) { - fprintf(stderr, "Error: internal error in ftell()!\n"); - return FALSE; - } - image->startpos -= 2; /* subtract marker length */ - - if (c == M_SOI) { - fseek(image->fp, image->startpos, SEEK_SET); - break; - } - } while (!feof(image->fp)); - - if (feof(image->fp)) { - fprintf(stderr, "Error: SOI marker not found!\n"); - return FALSE; - } - - if (image->startpos > 0L && !quiet) { - fprintf(stderr, "Note: skipped %ld bytes ", image->startpos); - fprintf(stderr, "Probably Macintosh JPEG file?\n"); - } - - /* process JPEG markers */ - while (!SOF_done && (c = next_marker(image->fp)) != M_EOI) { - switch (c) { - case M_ERROR: - fprintf(stderr, "Error: unexpected end of JPEG file!\n"); - return FALSE; - - /* The following are not officially supported in PostScript level 2 */ - case M_SOF2: - case M_SOF3: - case M_SOF5: - case M_SOF6: - case M_SOF7: - case M_SOF9: - case M_SOF10: - case M_SOF11: - case M_SOF13: - case M_SOF14: - case M_SOF15: - fprintf(stderr, - "Warning: JPEG file uses compression method %X - proceeding anyway.\n", - c); - fprintf(stderr, - "PostScript output does not work on all PS interpreters!\n"); - /* FALLTHROUGH */ - - case M_SOF0: - case M_SOF1: - length = get_2bytes(image->fp); /* read segment length */ - - image->bits_per_component = getc(image->fp); - image->height = get_2bytes(image->fp); - image->width = get_2bytes(image->fp); - image->components = getc(image->fp); - - SOF_done = TRUE; - break; - - case M_APP0: /* check for JFIF marker with resolution */ - length = get_2bytes(image->fp); - - for (i = 0; i < length-2; i++) { /* get contents of marker */ - b = getc(image->fp); - if (i < APP_MAX) /* store marker in appstring */ - appstring[i] = b; - } - - /* Check for JFIF application marker and read density values - * per JFIF spec version 1.02. - * We only check X resolution, assuming X and Y resolution are equal. - * Use values only if resolution not preset by user or to be ignored. - */ - -#define ASPECT_RATIO 0 /* JFIF unit byte: aspect ratio only */ -#define DOTS_PER_INCH 1 /* JFIF unit byte: dots per inch */ -#define DOTS_PER_CM 2 /* JFIF unit byte: dots per cm */ - - if (image->dpi == DPI_USE_FILE && length >= 14 && - !strncmp((const char *)appstring, "JFIF", 4)) { - unit = appstring[7]; /* resolution unit */ - /* resolution value */ - image->dpi = (float) ((appstring[8]<<8) + appstring[9]); - - if (image->dpi == 0.0) { - image->dpi = DPI_USE_FILE; - break; - } - - switch (unit) { - /* tell the caller we didn't find a resolution value */ - case ASPECT_RATIO: - image->dpi = DPI_USE_FILE; - break; - - case DOTS_PER_INCH: - break; - - case DOTS_PER_CM: - image->dpi *= (float) 2.54; - break; - - default: /* unknown ==> ignore */ - fprintf(stderr, - "Warning: JPEG file contains unknown JFIF resolution unit - ignored!\n"); - image->dpi = DPI_IGNORE; - break; - } - } - break; - - case M_APP14: /* check for Adobe marker */ - length = get_2bytes(image->fp); - - for (i = 0; i < length-2; i++) { /* get contents of marker */ - b = getc(image->fp); - if (i < APP_MAX) /* store marker in appstring */ - appstring[i] = b; - } - - /* Check for Adobe application marker. It is known (per Adobe's TN5116) - * to contain the string "Adobe" at the start of the APP14 marker. - */ - if (length >= 12 && !strncmp((const char *) appstring, "Adobe", 5)) - image->adobe = TRUE; /* set Adobe flag */ - - break; - - case M_SOI: /* ignore markers without parameters */ - case M_EOI: - case M_TEM: - case M_RST0: - case M_RST1: - case M_RST2: - case M_RST3: - case M_RST4: - case M_RST5: - case M_RST6: - case M_RST7: - break; - - default: /* skip variable length markers */ - length = get_2bytes(image->fp); - for (length -= 2; length > 0; length--) - (void) getc(image->fp); - break; - } - } - - /* do some sanity checks with the parameters */ - if (image->height <= 0 || image->width <= 0 || image->components <= 0) { - fprintf(stderr, "Error: DNL marker not supported in PostScript Level 2!\n"); - return FALSE; - } - - /* some broken JPEG files have this but they print anyway... */ - if (length != (unsigned int) (image->components * 3 + 8)) - fprintf(stderr, "Warning: SOF marker has incorrect length - ignored!\n"); - - if (image->bits_per_component != 8) { - fprintf(stderr, "Error: %d bits per color component ", - image->bits_per_component); - fprintf(stderr, "not supported in PostScript level 2!\n"); - return FALSE; - } - - if (image->components!=1 && image->components!=3 && image->components!=4) { - fprintf(stderr, "Error: unknown color space (%d components)!\n", - image->components); - return FALSE; - } - - return TRUE; -} |