luat_zbuff.h 850 B

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef LUAT_ZBUFF_H
  2. #define LUAT_ZBUFF_H
  3. #include "luat_mem.h"
  4. #include "luat_msgbus.h"
  5. #define LUAT_ZBUFF_TYPE "ZBUFF*"
  6. #define tozbuff(L) ((luat_zbuff_t *)luaL_checkudata(L, 1, LUAT_ZBUFF_TYPE))
  7. #define ZBUFF_SEEK_SET 0
  8. #define ZBUFF_SEEK_CUR 1
  9. #define ZBUFF_SEEK_END 2
  10. #if defined ( __CC_ARM )
  11. #pragma anon_unions
  12. #endif
  13. typedef struct luat_zbuff {
  14. LUAT_HEAP_TYPE_E type; //内存类型
  15. uint8_t* addr; //数据存储的地址
  16. size_t len; //实际分配空间的长度
  17. union {
  18. size_t cursor; //目前的指针位置,表明了处理了多少数据
  19. size_t used; //已经保存的数据量,表明了存了多少数据
  20. };
  21. uint32_t width; //宽度
  22. uint32_t height;//高度
  23. uint8_t bit; //色深度
  24. } luat_zbuff_t;
  25. int __zbuff_resize(luat_zbuff_t *buff, uint32_t new_size);
  26. #endif