home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / rexx / library2 / gbmrexx / gbm / gbm.h < prev    next >
C/C++ Source or Header  |  1992-11-06  |  2KB  |  69 lines

  1. /*
  2.  
  3. GBM.H  General Bitmap Code
  4.  
  5. Data is stored as an array of lines.
  6. Lines are stored with bottom line first, moving upwards.
  7. Each line is an array of pixels, leftmost first.
  8. Lines are padded to be a multiple of a dword long.
  9. Palettised pixels are either a 1 bit, 4 bit, or 8 bit indexes.
  10. Alternately a B, G, R triple in that order is stored.
  11. This format exactly matches the format used by OS/2 1.2 bitmaps.
  12.  
  13. */
  14.  
  15. typedef int GBM_ERR;
  16. #define    GBM_ERR_OK        ((GBM_ERR) 0)
  17. #define    GBM_ERR_MEM        ((GBM_ERR) 1)
  18. #define    GBM_ERR_NOT_SUPP    ((GBM_ERR) 2)
  19. #define    GBM_ERR_BAD_OPTION    ((GBM_ERR) 3)
  20. #define    GBM_ERR_NOT_FOUND    ((GBM_ERR) 4)
  21. #define    GBM_ERR_BAD_MAGIC    ((GBM_ERR) 5)
  22. #define    GBM_ERR_BAD_SIZE    ((GBM_ERR) 6)
  23. #define    GBM_ERR_READ        ((GBM_ERR) 7)
  24. #define    GBM_ERR_WRITE        ((GBM_ERR) 8)
  25.  
  26. #define    GBM_FT_R1        0x0001
  27. #define    GBM_FT_R4        0x0002
  28. #define    GBM_FT_R8        0x0004
  29. #define    GBM_FT_R24        0x0008
  30. #define    GBM_FT_W1        0x0010
  31. #define    GBM_FT_W4        0x0020
  32. #define    GBM_FT_W8        0x0040
  33. #define    GBM_FT_W24        0x0080
  34.  
  35. typedef struct
  36.     {
  37.     char    *short_name;        /* Eg: "Targa"                       */
  38.     char    *long_name;        /* Eg: "Truevision Targa / Vista"    */
  39.     char    *extensions;        /* Eg: "TGA VST"                     */
  40.     int    flags;            /* What functionality exists         */
  41.     } GBMFT;
  42.  
  43. typedef struct { byte r, g, b; } GBMRGB;
  44.  
  45. #define    PRIV_SIZE    2000
  46.  
  47. typedef struct
  48.     {
  49.     int    w, h, bpp;        /* Bitmap dimensions                 */
  50.     byte    priv [PRIV_SIZE];    /* Private internal buffer           */
  51.     } GBM;
  52.  
  53. #ifndef _GBM_
  54.  
  55. GBM_ERR gbm_init(void);
  56. GBM_ERR gbm_deinit(void);
  57.  
  58. GBM_ERR gbm_query_n_filetypes(int *n_ft);
  59. GBM_ERR gbm_query_filetype(int ft, GBMFT *gbmft);
  60. GBM_ERR gbm_guess_filetype(char *fn, int *ft);
  61.  
  62. GBM_ERR gbm_read_header(char *fn, int fd, int ft, GBM *gbm, char *opt);
  63. GBM_ERR gbm_read_palette(int fd, int ft, GBM *gbm, GBMRGB *gbmrgb);
  64. GBM_ERR gbm_read_data(int fd, int ft, GBM *gbm, byte *data);
  65. GBM_ERR gbm_write(char *fn, int fd, int ft, GBM *gbm, GBMRGB *gbmrgb, byte *data, char *opt);
  66. char *gbm_err(GBM_ERR rc);
  67.  
  68. #endif
  69.