AbstractPainterRGB565
The AbstractPainterRGB565 class is an abstract class for creating a painter to draw on a RGB565 display using CanvasWidgetRenderer.
See: AbstractPainter
Inherits from: AbstractPainter
Inherited by: PainterRGB565, PainterRGB565Bitmap, PainterRGB565L8Bitmap
Public Functions
AbstractPainterRGB565() | |
FORCE_INLINE_FUNCTION uint16_t | alphaBlend(uint16_t newpix, uint16_t bufpix, uint8_t alpha) const |
Mix colors from a new pixel and a buffer pixel with the given alpha applied to the new pixel, and the inverse alpha applied to the buffer pixel. | |
FORCE_INLINE_FUNCTION uint16_t | alphaBlend(uint16_t R, uint16_t G, uint16_t B, uint16_t bufpix, uint8_t alpha) const |
Mix colors from a new pixel and a buffer pixel with the given alpha applied to the new pixel, and the inverse alpha applied to the buffer pixel. | |
Public Attributes
const uint16_t | BMASK |
Mask for blue (0000000000011111) | |
const uint16_t | GMASK |
Mask for green (0000011111100000) | |
const uint16_t | RMASK |
Mask for red (1111100000000000) | |
Additional inherited members
Public Functions inherited from AbstractPainter
AbstractPainter() | |
Initializes a new instance of the AbstractPainter class. | |
void | framebufferToDisplay(int16_t & widgetX, int16_t & widgetY) const |
Convert Framebuffer widget coordinates to display widget coordinates. | |
virtual HAL::RenderingMethod | getRenderingMethod() const |
Return the applicable rendering method of the painter. | |
virtual void | paint(uint8_t * destination, int16_t offset, int16_t widgetX, int16_t widgetY, int16_t count, uint8_t alpha) const =0 |
Paints a streak of pixels (all with the same alpha) in the framebuffer. | |
virtual bool | setup(const Rect & widgetRect) const |
This function is called before any actual paint operation is started. | |
virtual void | tearDown() const |
This function is called after all paint operation have finished. | |
virtual | ~AbstractPainter() |
Finalizes an instance of the AbstractPainter class. | |
Protected Functions inherited from AbstractPainter
FORCE_INLINE_FUNCTION bool | compatibleFramebuffer(Bitmap::BitmapFormat format) |
Helper function to check if the provided bitmap format matches the current framebuffer format. | |
Protected Attributes inherited from AbstractPainter
int16_t | widgetWidth |
The width of the widget on screen, used by framebufferToDisplay() | |
Public Functions Documentation
AbstractPainterRGB565
alphaBlend
FORCE_INLINE_FUNCTION uint16_t alphaBlend | ( | uint16_t | newpix , | const | |
uint16_t | bufpix , | const | |||
uint8_t | alpha | const | |||
) | const |
Mix colors from a new pixel and a buffer pixel with the given alpha applied to the new pixel, and the inverse alpha applied to the buffer pixel.
newpix | The new pixel value. |
bufpix | The buffer pixel value. |
alpha | The alpha to apply to the new pixel. |
The result of blending the two colors into a new color.
alphaBlend
FORCE_INLINE_FUNCTION uint16_t alphaBlend | ( | uint16_t | R , | const | |
uint16_t | G , | const | |||
uint16_t | B , | const | |||
uint16_t | bufpix , | const | |||
uint8_t | alpha | const | |||
) | const |
Mix colors from a new pixel and a buffer pixel with the given alpha applied to the new pixel, and the inverse alpha applied to the buffer pixel.
R | The red color (0-31 shifted into RMASK). |
G | The green color (0-63 shifted into GMASK). |
B | The blue color (0-31 shifted into BMASK). |
bufpix | The buffer pixel value. |
alpha | The alpha of the R,G,B. |
The result of blending the two colors into a new color.
Public Attributes Documentation
BMASK
const uint16_t BMASK = 0x001F
Mask for blue (0000000000011111)
GMASK
const uint16_t GMASK = 0x07E0
Mask for green (0000011111100000)
RMASK
const uint16_t RMASK = 0xF800
Mask for red (1111100000000000)