bitmap.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. {
  14. int rows;
  15. int cols;
  16. int bytes;
  17. unsigned char *data;
  18. int sparse;
  19. /* char *token; */
  20. struct link_head *token;
  21. };
  22. struct BMlink
  23. {
  24. short count;
  25. char val;
  26. struct BMlink *next;
  27. };
  28. #ifndef _STDIO_H
  29. #include <stdio.h>
  30. #endif
  31. /* bitmap.c */
  32. struct BM *BM_create(int, int);
  33. int BM_destroy(struct BM *);
  34. int BM_set_mode(int, int);
  35. int BM_set(struct BM *, int, int, int);
  36. int BM_get(struct BM *, int, int);
  37. int BM_get_map_size(struct BM *);
  38. int BM_file_write(FILE *, struct BM *);
  39. struct BM *BM_file_read(FILE *);
  40. /* sparse.c */
  41. struct BM *BM_create_sparse(int, int);
  42. int BM_destroy_sparse(struct BM *);
  43. int BM_set_sparse(struct BM *, int, int, int);
  44. int BM_get_sparse(struct BM *, int, int);
  45. int BM_get_map_size_sparse(struct BM *);
  46. int BM_dump_map_sparse(struct BM *);
  47. int BM_dump_map_row_sparse(struct BM *, int);
  48. int BM_file_write_sparse(FILE *, struct BM *);
  49. #endif /* __GRASS_BITMAP__ */