bitmap.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef __GRASS_BITMAP__
  2. #define __GRASS_BITMAP__
  3. #define BM_MAGIC 2
  4. #define BM_TEXT "BITMAP"
  5. #define BM_TEXT_LEN 6
  6. #define BM_FLAT 0
  7. #define BM_NOTSPARSE 0
  8. #define BM_SPARSE 1
  9. #ifndef GRASS_LINKM_H
  10. #include <grass/linkm.h>
  11. #endif
  12. struct BM {
  13. int rows;
  14. int cols;
  15. int bytes;
  16. unsigned char *data;
  17. int sparse;
  18. /* char *token; */
  19. struct link_head *token;
  20. };
  21. struct BMlink {
  22. short count;
  23. char val;
  24. struct BMlink *next;
  25. };
  26. #ifndef _STDIO_H
  27. #include <stdio.h>
  28. #endif
  29. /* bitmap.c */
  30. struct BM *BM_create(int, int);
  31. int BM_destroy(struct BM *);
  32. int BM_set_mode(int, int);
  33. int BM_set(struct BM *, int, int, int);
  34. int BM_get(struct BM *, int, int);
  35. int BM_get_map_size(struct BM *);
  36. int BM_file_write(FILE *, struct BM *);
  37. struct BM *BM_file_read(FILE *);
  38. /* sparse.c */
  39. struct BM *BM_create_sparse(int, int);
  40. int BM_destroy_sparse(struct BM *);
  41. int BM_set_sparse(struct BM *, int, int, int);
  42. int BM_get_sparse(struct BM *, int, int);
  43. int BM_get_map_size_sparse(struct BM *);
  44. int BM_dump_map_sparse(struct BM *);
  45. int BM_dump_map_row_sparse(struct BM *, int);
  46. int BM_file_write_sparse(FILE *, struct BM *);
  47. #endif /* __GRASS_BITMAP__ */