This is hpcdtoppm.h in view mode; [Download] [Up]
/* hpcdtoppm (Hadmut's pcdtoppm) v0.5 * Copyright (c) 1992, 1993 by Hadmut Danisch (danisch@ira.uka.de). * Permission to use and distribute this software and its * documentation for noncommercial use and without fee is hereby granted, * provided that the above copyright notice appear in all copies and that * both that copyright notice and this permission notice appear in * supporting documentation. It is not allowed to sell this software in * any way. This software is not public domain. */ #include <stdio.h> #include <string.h> #include <malloc.h> #include <sys/types.h> #include <ctype.h> #include "config.h" /* Format definitions */ #define BaseW ((dim)768) #define BaseH ((dim)512) #define SECSIZE 0x800 #define SeHead 2 #define L_Head (1+SeHead) #define SeBase16 18 #define L_Base16 (1+SeBase16) #define SeBase4 72 #define L_Base4 (1+SeBase4) #define SeBase 288 #define L_Base (1+SeBase) #define neutrLum 128 #define neutrCh1 156 #define neutrCh2 137 /* Structures and definitions */ struct _implane {dim mwidth,mheight, iwidth,iheight; uBYTE *im,*mp; }; typedef struct _implane implane; #define nullplane ((implane *) 0) struct _sizeinfo {dim w,h; /* Image Resolution */ dim rdhoff,rdhlen, rdvoff, rdvlen; /* Size of Image in Memory */ dim imhoff,imhlen, imvoff, imvlen; /* Real Size of Image */ }; typedef struct _sizeinfo sizeinfo; enum TURNS { T_UNSPEC,T_NONE,T_RIGHT,T_LEFT,T_HEAD,T_AUTO }; enum SIZES { S_UNSPEC,S_Base16,S_Base4,S_Base,S_4Base,S_16Base,S_Over,S_Contact }; enum OUTFOR { O_UNSPEC,O_PPM,O_PGM,O_YCC,O_PS,O_EPS,O_PSG,O_EPSG,O_PSD,O_EPSD }; enum CORR { C_UNSPEC,C_LINEAR,C_DARK,C_BRIGHT }; enum ERRORS { E_NONE,E_READ,E_WRITE,E_INTERN,E_ARG,E_OPT,E_MEM,E_HUFF, E_SEQ,E_SEQ1,E_SEQ2,E_SEQ3,E_SEQ4,E_SEQ5,E_SEQ6,E_SEQ7,E_POS,E_IMP,E_OVSKIP, E_TAUTO,E_TCANT,E_SUBR,E_PRPAR,E_CONFIG }; /**** Macros ****/ #ifdef DEBUG #define RPRINT {fprintf(stderr,"R-Position %x\n",bufpos);} #else #define RPRINT #endif #define melde(x) {if (do_melde) fprintf(stderr,x);} #define READBUF READ(sbuffer,sizeof(sbuffer)) #define EREADBUF {if(READBUF < 1) error(E_READ);} #define SKIP(p) { if (SKIPn(p)) error(E_READ);} #define SKIPr(p) { if (SKIPn(p)) return(E_READ);} #define TRIF(x,u,o,a,b,c) ((x)<(u)? (a) : ( (x)>(o)?(c):(b) )) #define xNORM(x) x=TRIF(x,0,255,0,x,255) #define NORM(x) { if(x<0) x=0; else if (x>255) x=255;} #ifndef MIN #define MIN(a,b) (((a) < (b)) ? (a) : (b)) #endif /* main.c */ extern void close_all(void); extern char *ppmname,*pcdname; extern sINT do_diff,do_info,do_sharp,do_overskip,monochrome; extern sINT do_melde,do_rep,do_crop; extern sINT flvert,flhori; extern uBYTE sbuffer[SECSIZE]; extern enum TURNS turn; extern enum SIZES size; extern enum OUTFOR outfor; extern enum CORR corrmode; extern void SEEK(int); extern int SKIPn(int); extern int READ(uBYTE *,int); extern sINT bufpos; /* error.c */ extern void eerror(enum ERRORS,char *, int); /* color.c */ extern void colconvert(sizeinfo *,implane *,implane *,implane *); /* tools.c */ extern void clear(implane *,sINT); extern void halve(implane *); extern void interpolate(implane *); extern sINT Skip4Base(void); extern void planealloc(implane *,dim,dim); extern void pastein(implane *,dim,dim,dim,dim,implane *, enum TURNS); extern void cropit(sizeinfo *,implane *,implane *,implane *); extern void shrink(sizeinfo *,implane *,implane *,implane *); extern void typecheck(void); /* format.c */ extern void readhqt(sINT); extern void decode(sizeinfo *,int,implane *,implane *,implane *,sINT); extern enum ERRORS readplain(sizeinfo *,int,implane *,implane *,implane *); /* Type definitions for output format drives, used in output.c and the drivers */ typedef void (OUTGRAY)(FILE *,dim,dim, uBYTE *,sdim,sdim); typedef void (OUTRGB )(FILE *,dim,dim, uBYTE *,sdim,sdim, uBYTE *,sdim,sdim, uBYTE *,sdim,sdim); /* output.c */ extern void writepicture(FILE *,sizeinfo *,implane *,implane *,implane *,enum TURNS); extern void druckeid(void); /* ppm.c */ extern OUTRGB write_ppm; extern OUTGRAY write_pgm; /* postscr.c */ extern OUTRGB write_epsrgb,write_psrgb; extern OUTGRAY write_epsgrey,write_psgrey,write_epsdith,write_psdith; extern FLTPT PAPER_LEFT,PAPER_BOTTOM,PAPER_WIDTH,PAPER_HEIGHT,PRINTER_XDPI,PRINTER_YDPI,PRINTER_FAK; extern sINT PSIZE_SET,DPI_SET,FAK_SET;
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.