EPD4in2v2 C++ Enhanced
|
Handles drawing in a picture and retrieving data from it. More...
#include <Gui.hpp>
Public Member Functions | |
Picture () | |
~Picture () | |
Free allocated memory. | |
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. | |
uint8_t * | getImage (void) |
Retrieves a pointer to the image data. | |
void | setRotate (uint16_t rotate) |
Rotates the image. | |
void | setMirroring (uint8_t mirror) |
Mirrors the image. | |
void | setPixel (uint16_t x_position, uint16_t y_position, uint16_t color) |
Set the specified pixel to the specified color. | |
void | setScale (uint8_t scale) |
Set the color scale. | |
void | clear (uint16_t color) |
Clear all the picture. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
unsigned char | readBmp (unsigned char read_mode, std::string path, unsigned int x_start, unsigned int y_start) |
Read a BMP into the image. | |
Private Attributes | |
PAINT | screenHandler |
uint8_t * | image |
Handles drawing in a picture and retrieving data from it.
|
inline |
Gui::Picture::~Picture | ( | ) |
Free allocated memory.
void Gui::Picture::clear | ( | uint16_t | color | ) |
Clear all the picture.
color | Black or White |
void Gui::Picture::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.
x_start | Starting point x coordinate |
y_start | Starting point y coordinate |
x_end | Ending point x coordinate |
y_end | Ending point y coordinate |
color | Black or white |
Cursor Gui::Picture::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.
Automatically detects if the font is monospaced or variable-width
x_position | X coordinate to start |
y_position | Y coordinate to start |
ascii_char | ASCII character to draw |
font | Font |
color_foreground | Color for foreground |
color_background | Color for background |
void Gui::Picture::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.
x_center | X corrdinate of center |
y_center | Y corrdinate of center |
radius | Radius |
color | Color |
dot_size | Size of dot |
geometry_fill | Enable/disable filling |
void Gui::Picture::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.
x_position | X coordinate |
y_position | Y coordinate |
color | Color |
dot_size | Size of dot |
dot_style | Style of dot |
void Gui::Picture::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.
NOT FULLY SUPOPRTED RIGHT NOW
x_position | X coordinate to start |
y_position | Y coordinate to start |
number | Number to draw |
font | Font |
digit | Digits after point |
color_foreground | Color for foreground |
color_background | Color for background |
void Gui::Picture::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.
x_position | Start point X coordinate |
y_position | Start point Y coordinate |
x_end | End point X coordinate |
y_end | End point Y coordinate |
color | Color |
dot_size | Size of dot |
line_style | Style of dot |
void Gui::Picture::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.
x_position | Start point X coordinate |
y_position | Start point Y coordinate |
x_end | End point X coordinate |
y_end | End point Y coordinate |
color | Color |
dot_size | Size of dot |
geometry_fill | Enable/disbale filling |
Cursor Gui::Picture::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.
Automatically detects if the font is monospaced or variable-width
x_position | X coordinate to start |
y_position | Y coordinate to start |
pString | String to draw |
font | Font |
color_foreground | Color for foreground |
color_background | Color for background |
uint8_t * Gui::Picture::getImage | ( | void | ) |
Retrieves a pointer to the image data.
void Gui::Picture::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.
width | |
height | |
rotate | |
color |
unsigned char Gui::Picture::readBmp | ( | unsigned char | read_mode, |
std::string | path, | ||
unsigned int | x_start, | ||
unsigned int | y_start ) |
Read a BMP into the image.
read_mode | Color scale |
path | Path of the file |
x_position | X coordinate to start |
y_position | Y coordinate to start |
void Gui::Picture::setMirroring | ( | uint8_t | mirror | ) |
Mirrors the image.
mirror | Type of mirroring |
void Gui::Picture::setPixel | ( | uint16_t | x_position, |
uint16_t | y_position, | ||
uint16_t | color ) |
Set the specified pixel to the specified color.
x_position | X coordinate of point |
y_position | Y coordinate of point |
color | Color |
void Gui::Picture::setRotate | ( | uint16_t | rotate | ) |
Rotates the image.
rotate | Degrees to rotate (90 degrees multiple) |
void Gui::Picture::setScale | ( | uint8_t | scale | ) |
Set the color scale.
scale | 2 or 4 |
|
private |
|
private |