This class is intended as a intermediary class for your actual implementation of the ColorGraphicsDisplay interface. It uses the CRTP design pattern where the template argument is the child class. It provides implementations for most of the functions, except DrawPixel(), SetColorFG(), SetColorBG, Update() and Fill(), which you'll have to provide in your child class. The main goal of this class is to provide common drawing functions without relying on massive amounts of virtual function calls that would result in a performance loss. To achieve this, any drawing function that is implemented here and internally calls other drawing functions (e.g. DrawRect() which internally calls DrawPixel() and DrawLine()) makes these calls via the qualified name of these functions to explicitly suppress the virtual dispatch mechanism like this:
ChildType::DrawPixel(...); // no virtual function call; direct call into the child class function
To create a custom ColorGraphicsDisplay implementation, you can A) inherit from ColorGraphicsDisplay directly and provide all the drawing functions yourself B) Inherit from ColorGraphicsDisplayImpl and only provide DrawPixel(), Fill() and Update() like this:
class MyDisplayClass : public ColorGraphicsDisplayImpl<MyDisplayClass> { public: void Fill() override { ... }; void DrawPixel(uint_fast8_t x, uint_fast8_t y, bool on) override { ... }; void Update() override { ... } };
#include <color_display.h>
Additional Inherited Members | |
Protected Attributes inherited from daisy::ColorGraphicsDisplay | |
uint16_t | currentX_ |
uint16_t | currentY_ |
|
inline |
|
inlinevirtual |
|
inlineoverridevirtual |
Draws an arc around the specified coordinate
x | x Coordinate of the center of the arc |
y | y Coordinate of the center of the arc |
radius | radius of the arc |
start_angle | angle where to start the arc |
sweep | total angle of the arc |
on | on or off |
Implements daisy::ColorGraphicsDisplay.
|
inlineoverridevirtual |
Draws a line from (x1, y1) to (y1, y2)
x1 | x Coordinate of the starting point |
y1 | y Coordinate of the starting point |
x2 | x Coordinate of the ending point |
y2 | y Coordinate of the ending point |
on | on or off |
Implements daisy::ColorGraphicsDisplay.
|
inlineoverridevirtual |
Draws a rectangle based on two coordinates.
x1 | x Coordinate of the first point |
y1 | y Coordinate of the first point |
x2 | x Coordinate of the second point |
y2 | y Coordinate of the second point |
on | on or off |
fill | fill the rectangle or draw only the outline |
Implements daisy::ColorGraphicsDisplay.
|
inlineoverridevirtual |
Writes the character with the specific FontDef to the display buffer at the current Cursor position.
ch | character to be written |
font | font to be written in |
on | on or off |
Implements daisy::ColorGraphicsDisplay.
|
inlineoverridevirtual |
Similar to WriteChar, except it will handle an entire String. Wrapping does not happen automatically, so the width of the string must be kept within the dimensions of the screen.
str | string to be written |
font | font to use |
on | on or off |
Implements daisy::ColorGraphicsDisplay.
|
inlineoverridevirtual |
Similar to WriteString but justified within a bounding box.
str | string to be written |
font | font to use |
boundingBox | the bounding box to draw the text in |
alignment | the alignment to use |
on | on or off |
Implements daisy::ColorGraphicsDisplay.