EPD4in2v2 C++ Enhanced
Loading...
Searching...
No Matches
Gui::Picture Class Reference

Handles drawing in a picture and retrieving data from it. More...

#include <Gui.hpp>

Collaboration diagram for Gui::Picture:

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
 

Detailed Description

Handles drawing in a picture and retrieving data from it.

Constructor & Destructor Documentation

◆ Picture()

Gui::Picture::Picture ( )
inline

◆ ~Picture()

Gui::Picture::~Picture ( )

Free allocated memory.

Member Function Documentation

◆ clear()

void Gui::Picture::clear ( uint16_t color)

Clear all the picture.

Parameters
colorBlack or White
Here is the caller graph for this function:

◆ clearWindow()

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.

Parameters
x_startStarting point x coordinate
y_startStarting point y coordinate
x_endEnding point x coordinate
y_endEnding point y coordinate
colorBlack or white
Here is the caller graph for this function:

◆ drawChar()

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

Parameters
x_positionX coordinate to start
y_positionY coordinate to start
ascii_charASCII character to draw
fontFont
color_foregroundColor for foreground
color_backgroundColor for background
Returns
Cursor with data from last character and start point of new character
Here is the caller graph for this function:

◆ drawCircle()

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.

Parameters
x_centerX corrdinate of center
y_centerY corrdinate of center
radiusRadius
colorColor
dot_sizeSize of dot
geometry_fillEnable/disable filling

◆ drawDot()

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.

Parameters
x_positionX coordinate
y_positionY coordinate
colorColor
dot_sizeSize of dot
dot_styleStyle of dot

◆ drawFloatNum()

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

Parameters
x_positionX coordinate to start
y_positionY coordinate to start
numberNumber to draw
fontFont
digitDigits after point
color_foregroundColor for foreground
color_backgroundColor for background

◆ drawLine()

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.

Parameters
x_positionStart point X coordinate
y_positionStart point Y coordinate
x_endEnd point X coordinate
y_endEnd point Y coordinate
colorColor
dot_sizeSize of dot
line_styleStyle of dot

◆ drawRectangle()

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.

Parameters
x_positionStart point X coordinate
y_positionStart point Y coordinate
x_endEnd point X coordinate
y_endEnd point Y coordinate
colorColor
dot_sizeSize of dot
geometry_fillEnable/disbale filling

◆ drawString()

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

Parameters
x_positionX coordinate to start
y_positionY coordinate to start
pStringString to draw
fontFont
color_foregroundColor for foreground
color_backgroundColor for background
Returns
Cursor with data from last character and start point of new character
Here is the caller graph for this function:

◆ getImage()

uint8_t * Gui::Picture::getImage ( void )

Retrieves a pointer to the image data.

Here is the caller graph for this function:

◆ newImage()

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.

Parameters
width
height
rotate
color
Here is the caller graph for this function:

◆ readBmp()

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.

Parameters
read_modeColor scale
pathPath of the file
x_positionX coordinate to start
y_positionY coordinate to start
Returns

◆ setMirroring()

void Gui::Picture::setMirroring ( uint8_t mirror)

Mirrors the image.

Parameters
mirrorType of mirroring

◆ setPixel()

void Gui::Picture::setPixel ( uint16_t x_position,
uint16_t y_position,
uint16_t color )

Set the specified pixel to the specified color.

Parameters
x_positionX coordinate of point
y_positionY coordinate of point
colorColor

◆ setRotate()

void Gui::Picture::setRotate ( uint16_t rotate)

Rotates the image.

Parameters
rotateDegrees to rotate (90 degrees multiple)

◆ setScale()

void Gui::Picture::setScale ( uint8_t scale)

Set the color scale.

Parameters
scale2 or 4
Here is the caller graph for this function:

Member Data Documentation

◆ image

uint8_t* Gui::Picture::image
private

◆ screenHandler

PAINT Gui::Picture::screenHandler
private

The documentation for this class was generated from the following files: