home *** CD-ROM | disk | FTP | other *** search
/ Graphics 16,000 / graphics-16000.iso / msdos / viewers / pcshow / show.h < prev    next >
C/C++ Source or Header  |  1991-07-01  |  7KB  |  148 lines

  1. /* header file for pcshow include files and variables */
  2.  
  3. /* include statements */
  4.  
  5. #include <stdio.h>        /* standard i/o routines */
  6. #include <fcntl.h>        /* other standard routines */
  7. #include <stdlib.h>        /* more lattice c standard i/o routines */
  8. /*#include <tardev.h>        /* targa header files */
  9. #include <math.h>        /* some math functions needed */
  10. /*#include <time.h>        /* some time functions needed */
  11. #include "df.h"            /* header file with defines for HDF */
  12.  
  13. #define MOUSE
  14. /* remove comments before compiling for mouse operation */
  15.  
  16. /* define statements */
  17. #define TRUE 1
  18. #define FALSE 0
  19. #define HI 2
  20. #define LO 3
  21. #define    SCRLLEFT        203
  22. #define    SCRLUP            200
  23. #define    SCRLDOWN        208
  24. #define    SCRLRIGHT        205
  25. #define    PAGEUP            201
  26. #define    PAGEDOWN        209
  27. #define    HOME            199
  28. #define    END                207
  29. #define ALTSCRLUP        152
  30. #define ALTSCRLDOWN        160
  31. #define ALTSCRLLEFT        155
  32. #define ALTSCRLRIGHT    157    
  33. #define ALTPAGEUP        153
  34. #define ALTPAGEDOWN        161
  35. #define ALTHOME            151
  36. #define ALTEND            159
  37. #define HDF            'h'
  38. #define RASTER        'b'
  39. #define NO9            '9'
  40. #define    VGA            'v'
  41. #define    EGA            'e'
  42. #define    TARGA        't'
  43. #define RAWSIZE 32000    /* maximum size of the block to be read in from disk */
  44. #define LINEEGA    egaline(xwhere,ywhere+i,store[i+yoff],max(min(xdim-xoff,maxx-xwhere),0),trans,xoff)
  45.     /* call to print a line on the ega screen */
  46. #define LINEVGA       vgaline1(xwhere,ywhere+i,store[i+yoff],xoff,max(min(maxx-xwhere,xdim-xoff),0))
  47.     /* call to print a line on the vga screen */
  48. #define LINENO9       no9line(xwhere,ywhere+i,store[i+yoff],xoff,max(min(maxx-xwhere,xdim-xoff),0))
  49.     /* call to print a line on the no. 9 screen */
  50. /*#define LINET16       t16line(xwhere,ywhere+i,store[i+yoff],xoff,max(min(maxx-xwhere,xdim-xoff),0))*/
  51.     /* call to print a line on the Targa16 screen */
  52.  
  53. /* define a bigger stack */
  54. int _STACK = 8192;
  55.  
  56. /* regular variables defined */
  57.  
  58. int        i,j,k,l,c,        /* temporary global counters and such */
  59.     xdim,ydim,            /* x & y dimensions for the image to be displayed */
  60.     file,                /* the file pointer for binary files */
  61.     xoff=0,yoff=0,        /* the offset into the picture to be displayed */
  62.     palnum=0,            /* the palette number which is currently displayed */
  63.     show=0,                /* a binary variable telling whether the palette is displayed on the screen */
  64.     palmax=-1,            /* the number of palettes in memory */
  65.     maxx,maxy,            /* the x & y dimensions of the screen */
  66.     palspeed=0,            /* how fast the palette rotates */
  67.     lastref,            /* the last reference number used in palette searching */
  68.     lasttag,            /* the last tag number used in searching for palettes */
  69.     newref,                /* reference number for a new palette */
  70.     imref,                /* the current image's reference number */
  71.     imtag,                /* the current image's tag number */
  72.     slope,                /* slope of line in fiddle mode */
  73.     offset,                /* offset for center of palette for fiddle mode */
  74.     animate=0,            /* the animation toggle */
  75.     one_file=0,            /* the one file animation toggle */
  76.     first_hdf=1,        /* boolean to flag the first time through an hdf animation */
  77.     cycled=0,            /* boolean variable to tell whether a sequence has been animated */
  78.     oneimage=0,            /* boolean variable to indicate whether there are multiple binary images to be displayed */
  79.     xshow,                /* the width of the image */
  80.     m1,m2,m3,m4,        /* mouse variables */
  81.     leftbutton,            /* boolean variables for buttons on the mouse */
  82.     rightbutton,
  83.     mouse=0,            /* boolean variable to determine if the mouse is active */
  84.     mx,my,                /* last position where the mouse was at */
  85.     pal_xoff=0,            /* location of the upper left hand corner of the color bar */
  86.     pal_yoff,
  87.     screen=1,            /* boolean variable for screen on or off */
  88.     before=0,            /* boolean variable for mouse activated previously */
  89.     anispeed=0,            /* speed for animation */
  90.     doneinit=0,            /* boolean variable to keep track of whether the palette has been initialized for ega mode */
  91.     getout=0,            /* boolean variable to exit program */
  92.     pal_height,            /* height in bytes of the color bar on the screen */
  93.     expandit=1,            /* preference boolean variable to expand(1) or interpolate(0) */ 
  94.     center=0,            /* boolean variable to specify a centered image */
  95.     file_err,            /* the error returned from file operations */
  96.     file_attr,            /* the file attribute to look for */
  97.     xwhere=0,ywhere=0;  /* where the upper left hand of the image is */
  98.  
  99. #ifdef QAK
  100. long    waitcount;        /* counter for timing out */
  101. #endif
  102.  
  103. unsigned short int l16[512];    /* array for the targa line */
  104.  
  105. char *store[1024],         /* one per line of image */
  106.     *p,                    /* temporary character storage */
  107.     mode,                /* the display mode we are in = EGA,VGA,NO9,TARGA */
  108.     filetype='h';          /* the type of file to be read = 'h,'b' */
  109.  
  110. unsigned char rmap[256],gmap[256],bmap[256],    /* the red, green, and blue bytes for 24 bit palettes */
  111.               pal[768],                            /* the full 24 bit palette, interleaved as red, green, blue, red, green ... */
  112.             *rpal[16],*gpal[16],*bpal[16],        /* arrays of pointers to different palettes */
  113.             *egapals[16],                        /* array of pointers to different ega palettes */
  114.             raw[RAWSIZE],                        /* for file buffering */
  115.             filename[128],                        /* name of binary image file */
  116.             old_path[128],                        /* the name of the original path to restore when execution stops */
  117.             drive[3],                            /* array to hold the name of the drive */
  118.             path[64],                            /* array to hold the name of the path */
  119.             node[9],                            /* array to hold the name of a node (drive:path\node.ext) */
  120.             ext[4],                                /* array to hold the name of a file extension */
  121.             palfile[128] = {0,0},                /* starts out = NULL */
  122.             palstore[8][512],                    /* large array to store the portion of the screen the palette overlays */
  123.             bigstore[4096];                        /* array to expand four lines of imcomp compressed image into */
  124.  
  125. unsigned char trans[256],            /* translation table for palette in ega mode */
  126.                     trans1[256]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}, /* temporary translation table */
  127.                     count[64],        /* the colors to choose from in ega mode */
  128.                     regrs[16];        /* the actual palette for ega mode */
  129.  
  130. static unsigned char *mem_error="\nNot enough memory for image to be stored";
  131. extern unsigned char *DTAPTR;        /* pointer to a DTA containing filenames to be found (located in dosio.asm) */
  132.  
  133. FILE *fp,        /* file pointer for binary image files */
  134.         *pfp;    /* file pointer for binary palette files */
  135.  
  136. /* number nine variables */
  137. char *NO9ram;
  138. int *NO9bank; /* bank control registers */
  139.  
  140. struct {
  141.         int xdim,
  142.             ydim;
  143.         } dims;        /* dimension structure for HDF dimension reads */
  144.  
  145. /* HDF stuff */
  146. DF *dff;                    /* HDF file descriptor */
  147. DFdesc ddstr;                /* HDF structure for the tag & ref of something */
  148.