Buffer.h 907 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #pragma once
  2. #include <furi.h>
  3. enum PixelColor {
  4. Black, //or
  5. White, //
  6. Flip //not
  7. };
  8. enum DrawMode {
  9. WhiteOnly,
  10. BlackOnly,
  11. WhiteAsBlack,
  12. BlackAsWhite,
  13. WhiteAsInverted,
  14. BlackAsInverted,
  15. };
  16. struct SpriteData;
  17. class Buffer {
  18. uint8_t _width=0, _height=0;
  19. bool remove_buffer=true;
  20. public:
  21. uint8_t *data;
  22. explicit Buffer(const SpriteData *icon);
  23. Buffer(uint8_t width, uint8_t height);
  24. virtual ~Buffer();
  25. bool test_pixel(uint8_t x, uint8_t y);
  26. void copy_into(uint8_t *other);
  27. void clear();
  28. bool test_coordinate(int x, int y) const;
  29. void set_pixel(int16_t x, int16_t y, PixelColor draw_mode);
  30. void set_pixel_with_check(int16_t x, int16_t y, PixelColor draw_mode);
  31. void copy_from(uint8_t *other);
  32. uint8_t width() { return _width; }
  33. uint8_t height() { return _height; }
  34. virtual void swap(uint8_t *&buffer);
  35. };