FabGL
ESP32 Display Controller and Graphics Library
|
Represents the base abstract class for display controllers. More...
#include <displaycontroller.h>
Inherited by fabgl::GenericDisplayController.
Public Member Functions | |
void | enableBackgroundPrimitiveExecution (bool value) |
Enables or disables drawings inside vertical retracing time. More... | |
void | enableBackgroundPrimitiveTimeout (bool value) |
Enables or disables execution time limitation inside vertical retracing interrupt. More... | |
virtual int | getScreenHeight ()=0 |
Determines the screen height in pixels. More... | |
virtual int | getScreenWidth ()=0 |
Determines the screen width in pixels. More... | |
virtual int | getViewPortHeight ()=0 |
Determines vertical size of the viewport. More... | |
virtual int | getViewPortWidth ()=0 |
Determines horizontal size of the viewport. More... | |
bool | isDoubleBuffered () |
Determines whether DisplayController is on double buffered mode. More... | |
virtual NativePixelFormat | nativePixelFormat ()=0 |
Represents the native pixel format used by this display. More... | |
void | processPrimitives () |
Draws immediately all primitives in the queue. More... | |
void | refreshSprites () |
Forces the sprites to be updated. More... | |
void | removeSprites () |
Empties the list of active sprites. More... | |
virtual void | resumeBackgroundPrimitiveExecution ()=0 |
Resumes drawings after suspendBackgroundPrimitiveExecution(). More... | |
void | setMouseCursor (Cursor *cursor) |
Sets mouse cursor and make it visible. More... | |
void | setMouseCursor (CursorName cursorName) |
Sets mouse cursor from a set of predefined cursors. More... | |
void | setMouseCursorPos (int X, int Y) |
Sets mouse cursor position. More... | |
template<typename T > | |
void | setSprites (T *sprites, int count) |
Sets the list of active sprites. More... | |
virtual void | suspendBackgroundPrimitiveExecution ()=0 |
Suspends drawings. More... | |
Represents the base abstract class for display controllers.
void fabgl::DisplayController::enableBackgroundPrimitiveExecution | ( | bool | value | ) |
Enables or disables drawings inside vertical retracing time.
Primitives are processed in background (for example in vertical retracing for VGA or in a separated task for SPI/I2C displays). This method can disable (or reenable) this behavior, making drawing instantaneous. Flickering may occur when drawings are executed out of retracing time.
When background executing is disabled the queue is emptied executing all pending primitives. Some displays (SPI/I2C) may be not updated at all when enableBackgroundPrimitiveExecution is False.
value | When true drawings are done on background, when false drawings are executed instantly. |
|
inline |
Enables or disables execution time limitation inside vertical retracing interrupt.
Disabling interrupt execution timeout may generate flickering but speedup drawing operations.
value | True enables timeout (default), False disables timeout |
|
pure virtual |
Determines the screen height in pixels.
Implemented in fabgl::VGAController, fabgl::ST7789Controller, and fabgl::SSD1306Controller.
|
pure virtual |
Determines the screen width in pixels.
Implemented in fabgl::VGAController, fabgl::ST7789Controller, and fabgl::SSD1306Controller.
|
pure virtual |
Determines vertical size of the viewport.
Implemented in fabgl::VGAController, fabgl::ST7789Controller, and fabgl::SSD1306Controller.
|
pure virtual |
Determines horizontal size of the viewport.
Implemented in fabgl::VGAController, fabgl::ST7789Controller, and fabgl::SSD1306Controller.
|
inline |
Determines whether DisplayController is on double buffered mode.
|
pure virtual |
Represents the native pixel format used by this display.
Implemented in fabgl::VGAController, fabgl::ST7789Controller, and fabgl::SSD1306Controller.
void IRAM_ATTR fabgl::DisplayController::processPrimitives | ( | ) |
Draws immediately all primitives in the queue.
Draws all primitives before they are processed in the vertical sync interrupt.
May generate flickering because don't care of vertical sync.
void fabgl::DisplayController::refreshSprites | ( | ) |
Forces the sprites to be updated.
Screen is automatically updated whenever a primitive is painted (look at Canvas).
When a sprite updates its image or its position (or any other property) it is required to force a refresh using this method.
DisplayController.refreshSprites() is required also when using the double buffered mode, to paint sprites.
|
inline |
Empties the list of active sprites.
Call this method when you don't need active sprites anymore.
|
pure virtual |
Resumes drawings after suspendBackgroundPrimitiveExecution().
Resumes drawings enabling vertical sync interrupt.
Implemented in fabgl::VGAController, fabgl::ST7789Controller, and fabgl::SSD1306Controller.
void fabgl::DisplayController::setMouseCursor | ( | Cursor * | cursor | ) |
Sets mouse cursor and make it visible.
cursor | Cursor to use when mouse pointer need to be painted. nullptr = disable mouse pointer. |
void fabgl::DisplayController::setMouseCursor | ( | CursorName | cursorName | ) |
Sets mouse cursor from a set of predefined cursors.
cursorName | Name (enum) of predefined cursor. |
Example:
VGAController.setMouseCursor(CursorName::CursorPointerShadowed);
void fabgl::DisplayController::setMouseCursorPos | ( | int | X, |
int | Y | ||
) |
|
inline |
Sets the list of active sprites.
A sprite is an image that keeps background unchanged.
There is no limit to the number of active sprites, but flickering and slow refresh happens when a lot of sprites (or large sprites) are visible.
To empty the list of active sprites call DisplayController.removeSprites().
sprites | The list of sprites to make currently active. |
count | Number of sprites in the list. |
Example:
// define a sprite with user data (velX and velY) struct MySprite : Sprite { int velX; int velY; }; static MySprite sprites[10]; VGAController.setSprites(sprites, 10);
|
pure virtual |
Suspends drawings.
Suspends drawings disabling vertical sync interrupt.
After call to suspendBackgroundPrimitiveExecution() adding new primitives may cause a deadlock.
To avoid it a call to "processPrimitives()" should be performed very often.
This method maintains a counter so can be nested.
Implemented in fabgl::VGAController, fabgl::ST7789Controller, and fabgl::SSD1306Controller.