/** * TODO file description * * Created on 2020/01/05. */ #ifndef LCD_DRAWING_H #define LCD_DRAWING_H #include #include #include "utf8.h" #include "bitmaps.h" enum Color { WHITE = 0, BLACK = 1, }; // This function sets a pixel on displayMap to your preferred // color. 1=Black, 0= white. void LCD_setPixel(int x, int y, enum Color bw); // setLine draws a line from x0,y0 to x1,y1 with the set color void LCD_setLine(int x0, int y0, int x1, int y1, enum Color bw); // setRect will draw a rectangle from x0,y0 top-left corner to // a x1,y1 bottom-right corner. Can be filled with the fill // parameter, and colored with bw. void LCD_setRect(int x0, int y0, int x1, int y1, bool fill, enum Color bw); // setCircle draws a circle centered around x0,y0 with a defined // radius. The circle can be black or white. And have a line // thickness ranging from 1 to the radius of the circle. void LCD_setCircle (int x0, int y0, int radius, enum Color bw, int lineThickness); void LCD_setBitmapFullScreen(const uint8_t *bitArray); /* FONT FUNCTIONS size = 1 ... normal size = 2 ... 2x size = 3 ... normal bold size | 0x80 ... clear background behind characters */ enum TextSize { FONT_NORMAL = 0, FONT_DOUBLE = 1, FONT_BOLD = 2, }; enum TextAlign { ALIGN_LEFT = 0, ALIGN_CENTER = 1, ALIGN_RIGHT = 2, }; struct TextStyle { bool bg; //!< Fill the characters background with the opposite color enum TextSize size; //!< Character size enum TextAlign align; //!< Alignment (works only for single line) size_t limit; //!< Number of characters to print from the string, if > 0 size_t skip; //!< Characters to skip before printing int spacing_x; //!< Additional X spacing int spacing_y; //!< Additional Y spacing bool nowrap; //!< Stop painting when the right edge of the screen is reached bool wrap_to_0; //!< wrap to 0 instead of the initial X coordinate }; // setStr draws a string of characters, calling setChar with // progressive coordinates until it's done. // This function was grabbed from the SparkFun ColorLCDShield // library. void LCD_setStr(const char * dString, int x, int y, enum Color bw); void LCD_setStrEx(const char *dString, int x, int y, enum Color color, struct TextStyle style); // This function clears the entire display either white (0) or // black (1). // The screen won't actually clear until you call updateDisplay()! void LCD_clearDisplay(enum Color bw); /* Invert colors (hard change in data; does NOT send to display immediately) */ void LCD_invertDisplayData(); void LCD_setBitmap(const struct BitmapImage *image, int x, int y, bool bg, enum Color color); /** draw dotted shadow over current content */ void LCD_setShadeOverlay(); #endif //LCD_DRAWING_H