luat_zbuff.h 786 B

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