acid-drop

- Hacking the planet from a LilyGo T-Deck using custom firmware
git clone git://git.acid.vegas/acid-drop.git
Log | Files | Refs | Archive | README | LICENSE

Arduino_Canvas_Indexed.h (1494B)

      1 #include "../Arduino_DataBus.h"
      2 #if !defined(LITTLE_FOOT_PRINT)
      3 
      4 #ifndef _ARDUINO_CANVAS_INDEXED_H_
      5 #define _ARDUINO_CANVAS_INDEXED_H_
      6 
      7 #include "../Arduino_GFX.h"
      8 
      9 #define COLOR_IDX_SIZE 256
     10 
     11 class Arduino_Canvas_Indexed : public Arduino_GFX
     12 {
     13 public:
     14   Arduino_Canvas_Indexed(int16_t w, int16_t h, Arduino_G *output, int16_t output_x = 0, int16_t output_y = 0, uint8_t mask_level = 0);
     15 
     16   bool begin(int32_t speed = GFX_NOT_DEFINED) override;
     17   void writePixelPreclipped(int16_t x, int16_t y, uint16_t color) override;
     18   void writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color) override;
     19   void writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color) override;
     20   void flush(void) override;
     21 
     22   uint8_t *getFramebuffer();
     23   uint16_t *getColorIndex();
     24   void setDirectUseColorIndex(bool isEnable);
     25 
     26   uint8_t get_color_index(uint16_t color);
     27   uint16_t get_index_color(uint8_t idx);
     28   void raise_mask_level();
     29 
     30 protected:
     31   uint8_t *_framebuffer;
     32   Arduino_G *_output;
     33   int16_t _output_x, _output_y;
     34   uint16_t _color_index[COLOR_IDX_SIZE];
     35   uint8_t _indexed_size = 0;
     36   bool _isDirectUseColorIndex = false;
     37 
     38   uint8_t _current_mask_level;
     39   uint16_t _color_mask;
     40 #define MAXMASKLEVEL 3
     41   uint16_t mask_level_list[MAXMASKLEVEL] = {
     42       0b1111111111111111, // 16-bit, 65536 colors
     43       0b1111011110011110, // 12-bit, 4096 colors
     44       0b1100011000011000  // 7-bit, 128 colors
     45   };
     46 
     47 private:
     48 };
     49 
     50 #endif // _ARDUINO_CANVAS_INDEXED_H_
     51 
     52 #endif // !defined(LITTLE_FOOT_PRINT)