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_G.h (2133B)

      1 #if !defined(LITTLE_FOOT_PRINT)
      2 
      3 #ifndef _ARDUINO_G_H_
      4 #define _ARDUINO_G_H_
      5 
      6 #include <Arduino.h>
      7 
      8 #include "Arduino_DataBus.h"
      9 
     10 /// A generic graphics superclass that can handle all sorts of drawing. At a minimum you can subclass and provide drawPixel(). At a maximum you can do a ton of overriding to optimize. Used for any/all Adafruit displays!
     11 class Arduino_G
     12 {
     13 public:
     14   Arduino_G(int16_t w, int16_t h); // Constructor
     15 
     16   // This MUST be defined by the subclass:
     17   virtual bool begin(int32_t speed = GFX_NOT_DEFINED) = 0;
     18 
     19   virtual void drawBitmap(int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h, uint16_t color, uint16_t bg) = 0;
     20   virtual void drawIndexedBitmap(int16_t x, int16_t y, uint8_t *bitmap, uint16_t *color_index, int16_t w, int16_t h) = 0;
     21   virtual void draw3bitRGBBitmap(int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h) = 0;
     22   virtual void draw16bitRGBBitmap(int16_t x, int16_t y, uint16_t *bitmap, int16_t w, int16_t h) = 0;
     23   virtual void draw24bitRGBBitmap(int16_t x, int16_t y, uint8_t *bitmap, int16_t w, int16_t h) = 0;
     24 
     25 protected:
     26   int16_t
     27       WIDTH,  ///< This is the 'raw' display width - never changes
     28       HEIGHT; ///< This is the 'raw' display height - never changes
     29 };
     30 
     31 #endif // _ARDUINO_G_H_
     32 
     33 // utility functions
     34 bool gfx_draw_bitmap_to_framebuffer(
     35     uint16_t *from_bitmap, int16_t bitmap_w, int16_t bitmap_h,
     36     uint16_t *framebuffer, int16_t x, int16_t y, int16_t framebuffer_w, int16_t framebuffer_h);
     37 
     38 bool gfx_draw_bitmap_to_framebuffer_rotate_1(
     39     uint16_t *from_bitmap, int16_t bitmap_w, int16_t bitmap_h,
     40     uint16_t *framebuffer, int16_t x, int16_t y, int16_t framebuffer_w, int16_t framebuffer_h);
     41 
     42 bool gfx_draw_bitmap_to_framebuffer_rotate_2(
     43     uint16_t *from_bitmap, int16_t bitmap_w, int16_t bitmap_h,
     44     uint16_t *framebuffer, int16_t x, int16_t y, int16_t framebuffer_w, int16_t framebuffer_h);
     45 
     46 bool gfx_draw_bitmap_to_framebuffer_rotate_3(
     47     uint16_t *from_bitmap, int16_t bitmap_w, int16_t bitmap_h,
     48     uint16_t *framebuffer, int16_t x, int16_t y, int16_t framebuffer_w, int16_t framebuffer_h);
     49 
     50 #endif // !defined(LITTLE_FOOT_PRINT)