EPD4in2v2 C++ Enhanced
Loading...
Searching...
No Matches
Gui.hpp
Go to the documentation of this file.
1
22
23#ifndef GUI_HPP
24#define GUI_HPP
25
26#include <string>
27#include <cstdlib>
28#include <string_view>
29
30extern "C"{
31 #include "GUI_BMPfile.h"
32 #include "GUI_Paint.h"
33}
34
39namespace Gui {
56
61 enum DotStyle : uint8_t {
64 };
65
70 enum LineStyle : uint8_t {
71 SOLID = 1,
73 };
74
79 enum GeometryFill : uint8_t {
82 };
83
88 enum BmpReadMode : unsigned char {
92 };
93
98 class Picture {
99 private:
101 uint8_t *image;
102
103 public:
105 ~Picture();
106
107 void newImage(uint16_t width, uint16_t height, uint16_t rotate, uint16_t color);
108 uint8_t* getImage(void);
109
110 void setRotate(uint16_t rotate);
111 void setMirroring(uint8_t mirror);
112 void setPixel(uint16_t x_position, uint16_t y_position, uint16_t color);
113 void setScale(uint8_t scale);
114
115 void clear(uint16_t color);
116 void clearWindow(uint16_t x_start, uint16_t y_start, uint16_t x_end, uint16_t y_end, uint16_t color);
117
118 void drawDot(uint16_t x_position, uint16_t y_position, uint16_t color, uint8_t dot_size, uint8_t dot_style);
119 void drawLine(uint16_t x_start, uint16_t y_start, uint16_t x_end, uint16_t y_end, uint16_t color, uint8_t dot_size, uint8_t line_style);
120 void drawRectangle(uint16_t x_start, uint16_t y_start, uint16_t x_end, uint16_t y_end, uint16_t color, uint8_t dot_size, uint8_t geometry_fill);
121 void drawCircle(uint16_t x_center, uint16_t y_center, uint16_t radius, uint16_t color, uint8_t dot_size, uint8_t geometry_fill);
122
123 Cursor drawChar(uint16_t x_position, uint16_t y_position, const char ascii_char, sFONT* Font, uint16_t color_foreground, uint16_t color_background);
124 Cursor drawString(uint16_t x_position, uint16_t y_position, std::string_view pString, sFONT* font, uint16_t color_foreground, uint16_t color_background);
125 void drawFloatNum(uint16_t x_position, uint16_t y_position, double number, sFONT* font, uint16_t digit, uint16_t color_foreground, uint16_t color_background);
126
127 unsigned char readBmp(unsigned char read_mode, std::string path, unsigned int x_start, unsigned int y_start);
128 };
129}
130
131#endif
void setPixel(uint16_t x_position, uint16_t y_position, uint16_t color)
Set the specified pixel to the specified color.
Definition Gui.cpp:52
void newImage(uint16_t width, uint16_t height, uint16_t rotate, uint16_t color)
Insantiate a Picture object Allocates required memory and associates it with the low-level driver.
Definition Gui.cpp:20
Picture()
Definition Gui.hpp:104
void setRotate(uint16_t rotate)
Rotates the image.
Definition Gui.cpp:38
unsigned char readBmp(unsigned char read_mode, std::string path, unsigned int x_start, unsigned int y_start)
Read a BMP into the image.
Definition Gui.cpp:258
uint8_t * getImage(void)
Retrieves a pointer to the image data.
Definition Gui.cpp:32
void drawCircle(uint16_t x_center, uint16_t y_center, uint16_t radius, uint16_t color, uint8_t dot_size, uint8_t geometry_fill)
Draw a circle in the image.
Definition Gui.cpp:143
Cursor drawChar(uint16_t x_position, uint16_t y_position, const char ascii_char, sFONT *Font, uint16_t color_foreground, uint16_t color_background)
Draw a character in the image.
Definition Gui.cpp:163
void drawDot(uint16_t x_position, uint16_t y_position, uint16_t color, uint8_t dot_size, uint8_t dot_style)
Draw a dot in the image.
Definition Gui.cpp:91
void drawLine(uint16_t x_start, uint16_t y_start, uint16_t x_end, uint16_t y_end, uint16_t color, uint8_t dot_size, uint8_t line_style)
Draw a line in the image.
Definition Gui.cpp:108
void setMirroring(uint8_t mirror)
Mirrors the image.
Definition Gui.cpp:44
void drawRectangle(uint16_t x_start, uint16_t y_start, uint16_t x_end, uint16_t y_end, uint16_t color, uint8_t dot_size, uint8_t geometry_fill)
Draw a line in the image.
Definition Gui.cpp:126
void clear(uint16_t color)
Clear all the picture.
Definition Gui.cpp:66
void setScale(uint8_t scale)
Set the color scale.
Definition Gui.cpp:58
void drawFloatNum(uint16_t x_position, uint16_t y_position, double number, sFONT *font, uint16_t digit, uint16_t color_foreground, uint16_t color_background)
Draw a number with floating point.
Definition Gui.cpp:236
~Picture()
Free allocated memory.
Definition Gui.cpp:11
PAINT screenHandler
Definition Gui.hpp:100
void clearWindow(uint16_t x_start, uint16_t y_start, uint16_t x_end, uint16_t y_end, uint16_t color)
Fill the specified window with a color.
Definition Gui.cpp:77
uint8_t * image
Definition Gui.hpp:101
Cursor drawString(uint16_t x_position, uint16_t y_position, std::string_view pString, sFONT *font, uint16_t color_foreground, uint16_t color_background)
Draw a string in the image.
Definition Gui.cpp:199
Groups enumerations and the class Picture.
BmpReadMode
Color scale for reading BMPs.
Definition Gui.hpp:88
@ GRAY_4
Definition Gui.hpp:90
@ GRAY_16
Definition Gui.hpp:91
@ MONOCHROME
Definition Gui.hpp:89
DotSize
Size of drawing point.
Definition Gui.hpp:46
@ DOT_1
Definition Gui.hpp:47
@ DOT_2
Definition Gui.hpp:48
@ DOT_6
Definition Gui.hpp:52
@ DOT_8
Definition Gui.hpp:54
@ DOT_5
Definition Gui.hpp:51
@ DOT_4
Definition Gui.hpp:50
@ DOT_7
Definition Gui.hpp:53
@ DOT_3
Definition Gui.hpp:49
LineStyle
Style of drawing line.
Definition Gui.hpp:70
@ DOTTED
Definition Gui.hpp:72
@ SOLID
Definition Gui.hpp:71
GeometryFill
Enable/disable filling for drew figures.
Definition Gui.hpp:79
@ VOID
Definition Gui.hpp:80
@ FULL
Definition Gui.hpp:81
DotStyle
Style of drawing point.
Definition Gui.hpp:61
@ FILL_RIGHTUP
Definition Gui.hpp:63
@ FILL_AROUND
Definition Gui.hpp:62