home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / netpbma.zip / pbm / pbm.h < prev    next >
C/C++ Source or Header  |  1996-11-10  |  2KB  |  52 lines

  1. /* pbm.h - header file for libpbm portable bitmap library
  2. */
  3.  
  4. #ifndef _PBM_H_
  5. #define _PBM_H_
  6.  
  7. #include "pbmplus.h"
  8.  
  9. typedef unsigned char bit;
  10. #define PBM_WHITE 0
  11. #define PBM_BLACK 1
  12.  
  13.  
  14. /* Magic constants. */
  15.  
  16. #define PBM_MAGIC1 'P'
  17. #define PBM_MAGIC2 '1'
  18. #define RPBM_MAGIC2 '4'
  19. #define PBM_FORMAT (PBM_MAGIC1 * 256 + PBM_MAGIC2)
  20. #define RPBM_FORMAT (PBM_MAGIC1 * 256 + RPBM_MAGIC2)
  21. #define PBM_TYPE PBM_FORMAT
  22.  
  23.  
  24. /* Macro for turning a format number into a type number. */
  25.  
  26. #define PBM_FORMAT_TYPE(f) ((f) == PBM_FORMAT || (f) == RPBM_FORMAT ? PBM_TYPE : -1)
  27.  
  28. #ifdef __EMX__
  29. #define srandom srand
  30. #define random rand
  31. #endif
  32.  
  33. /* Declarations of routines. */
  34.  
  35. void pbm_init ARGS(( int* argcP, char* argv[] ));
  36.  
  37. #define pbm_allocarray( cols, rows ) ((bit**) pm_allocarray( cols, rows, sizeof(bit) ))
  38. #define pbm_allocrow( cols ) ((bit*) pm_allocrow( cols, sizeof(bit) ))
  39. #define pbm_freearray( bits, rows ) pm_freearray( (char**) bits, rows )
  40. #define pbm_freerow( bitrow ) pm_freerow( (char*) bitrow )
  41.  
  42. bit** pbm_readpbm ARGS(( FILE* file, int* colsP, int* rowsP ));
  43. void pbm_readpbminit ARGS(( FILE* file, int* colsP, int* rowsP, int* formatP ));
  44. void pbm_readpbmrow ARGS(( FILE* file, bit* bitrow, int cols, int format ));
  45. char* pm_read_unknown_size ARGS(( FILE* file, long* buf ));
  46.  
  47. void pbm_writepbm ARGS(( FILE* file, bit** bits, int cols, int rows, int forceplain ));
  48. void pbm_writepbminit ARGS(( FILE* file, int cols, int rows, int forceplain ));
  49. void pbm_writepbmrow ARGS(( FILE* file, bit* bitrow, int cols, int forceplain ));
  50.  
  51. #endif /*_PBM_H_*/
  52.