home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1930 / display.h next >
Encoding:
C/C++ Source or Header  |  1990-12-28  |  1.6 KB  |  114 lines

  1.  
  2. #include <stdio.h>
  3. #include <ctype.h>
  4. #include <math.h>
  5. #ifdef vms
  6. #define pclose(file)  (FILE *) exit(1)
  7. #define popen(command,mode)  (FILE *) exit(1)
  8. #else
  9. #include <malloc.h>
  10. #include <memory.h>
  11.  
  12. extern long
  13.   strtol(),
  14.   time();
  15. #endif
  16. /*
  17.   Define declarations for the Display program.
  18. */
  19. #ifndef False
  20. #define False  0
  21. #endif
  22. #define Intensity(color)  \
  23.   (((color).red*77+(color).green*150+(color).blue*29) >> 8)
  24. #define Max(x,y)  (((x) > (y)) ? (x) : (y))
  25. #define MaxColormapSize  4096
  26. #define MaxImageSize  (4096*4096)
  27. #define MaxRgb  255
  28. #define MaxRunlength  255
  29. #define Min(x,y)  (((x) < (y)) ? (x) : (y))
  30. #ifndef True
  31. #define True  1
  32. #endif
  33. /*
  34.   Image Id's
  35. */
  36. #define UnknownId  0
  37. #define ImageMagickId  1
  38. /*
  39.   Image classes:
  40. */
  41. #define UnknownClass  0
  42. #define DirectClass  1
  43. #define PseudoClass  2
  44. /*
  45.   Image compression algorithms:
  46. */
  47. #define UnknownCompression  0
  48. #define NoCompression  1
  49. #define RunlengthEncodedCompression  2
  50. #define QEncodedCompression  3
  51.  
  52. /*
  53.   Typedef declarations for the Display program.
  54. */
  55. typedef struct _ColorPacket
  56. {
  57.   unsigned char
  58.     red,
  59.     green,
  60.     blue;
  61.  
  62.   unsigned short
  63.     index;
  64. } ColorPacket;
  65.  
  66. typedef struct _RunlengthPacket
  67. {
  68.   unsigned char
  69.     red,
  70.     green,
  71.     blue,
  72.     length;
  73.  
  74.   unsigned short
  75.     index;
  76. } RunlengthPacket;
  77.  
  78. typedef struct _Image
  79. {
  80.   FILE
  81.     *file;
  82.  
  83.   char
  84.     filename[256];
  85.  
  86.   unsigned int
  87.     id,
  88.     class,
  89.     colors,
  90.     packets,
  91.     compression,
  92.     columns,
  93.     rows,
  94.     scene,
  95.     channel;
  96.  
  97.   char
  98.     *comments;
  99.  
  100.   ColorPacket
  101.     *colormap;
  102.  
  103.   RunlengthPacket
  104.     *pixels;
  105.  
  106.   unsigned int
  107.     runlength;
  108. } Image;
  109. /*
  110.   Variable declarations.
  111. */
  112. char
  113.   *application_name;
  114.