home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / xloadimg.zip / xloadimage.4.1 / img.h < prev    next >
C/C++ Source or Header  |  1993-10-21  |  2KB  |  71 lines

  1. /*
  2. ** img.h - structures/definitions for GEM Bit Image format conversion
  3. **
  4. **    Tim Northrup <tim@BRS.Com>
  5. **
  6. **    Version 0.1 --  4/25/91 -- Initial cut
  7. **
  8. **  Copyright (C) 1991 Tim Northrup
  9. **    (see file "tgncpyrght.h" for complete copyright information)
  10. */
  11.  
  12. #ifndef GEM_H
  13. #define GEM_H
  14.  
  15. /*
  16. **  Standard IMG Header Structure (8 words long)
  17. **
  18. **  May be followed by implementation-dependent information, so the
  19. **    value of hlen should be checked on input.
  20. */
  21.  
  22. typedef struct {
  23.     short    vers,            /* image version number */
  24.         hlen,            /* header length (in words) */
  25.         colors,            /* number of color planes (1=mono) */
  26.         patlen,            /* pattern length (for encoding) */
  27.         pixw, pixh,        /* pixel dimensions (in microns) */
  28.         llen, lines;        /* pixels/line and number of lines */
  29.     } IMG_Header;
  30.  
  31. /*
  32. **    Header record values used when creating an IMG file
  33. */
  34.  
  35. #define DEF_VERSION    1        /* default version number (on output) */
  36. #define DEF_HLEN    8        /* always standard header */
  37. #define DEF_COLORS    1        /* always B/W pics */
  38. #define DEF_PATLEN    1        /* easiest pattern size */
  39. #define DEF_PIXW    85        /* just a guess on this one */
  40. #define DEF_PIXH    85        /* assumed 1:1 aspect ratio */
  41.  
  42. /*
  43. **    Program limits and other constants
  44. */
  45.  
  46. #define MAX_SCANLINE    1024        /* max bytes for 1 scanline */
  47.  
  48. #define MAX_SLREPEAT    255        /* max repititions of scanline */
  49. #define MAX_PATREPEAT    255        /* max repititions of pattern */
  50. #define MAX_BYTEREPEAT    127        /* max repititions of byte value */
  51. #define MAX_LITERAL    255        /* max literal length allowed */
  52.  
  53. #define BYTE_FLAG    0x00        /* first byte 0 the ... */
  54. #define  BYTE_SLREPEAT     0x00           /* second 0 means scanline repeat */
  55. #define   BYTE_SLFLAG          0xFF       /* always followed by FF (?) */
  56. #define BYTE_LITERAL    0x80        /* char 80h - flag literal string */
  57.  
  58. #define BYTE_BLACK    0xFF        /* byte is all 1's */
  59. #define BIT_BLACK    1        /* single black bit */
  60. #define BYTE_WHITE    0x00        /* byte is all 0's */
  61. #define BIT_WHITE    0        /* single white bit */
  62.  
  63. #define RUN_BLACK    0x80        /* bit flag for run of all 0's or 1's */
  64. #define RUN_WHITE    0x00
  65.  
  66. #define RUN_LENGTH(X)   ((X) & 0x7F)
  67. #define RUN_COLOR(X)    ((((X) & RUN_BLACK) == RUN_BLACK)?BIT_BLACK:BIT_WHITE)
  68. #define PIXEL_COLOR(X)    ((((X) & 0x01) == 1)?BIT_BLACK:BIT_WHITE)
  69.  
  70. #endif /* GEM_H */
  71.