PainterRGB565L8Bitmap
touchgfx/widgets/canvas/PainterRGB565L8Bitmap.hpp
PainterRGB565L8Bitmap will take the color for a given point in the shape from a bitmap. Please be aware, the the bitmap is used by the CanvasWidgetRenderer (not Shape), so any rotation you might specify for a CanvasWidget (e.g. Shape) is not applied to the bitmap as CWR is not aware of this rotation.
See: AbstractPainter
Inherits from: AbstractPainterRGB565, AbstractPainterBitmap, AbstractPainter
Public Functions
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 |
Paints a streak of pixels (all with the same alpha) in the framebuffer. | |
PainterRGB565L8Bitmap(const Bitmap & bmp =Bitmap(BITMAP_INVALID)) | |
Constructor. | |
virtual void | setBitmap(const Bitmap & bmp) |
Sets a bitmap to be used when drawing the CanvasWidget. | |
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. | |
Protected Attributes
const uint8_t * | bitmapCLUT |
Pointer to the CLUT. | |
Bitmap::ClutFormat | l8format |
The l8format read from the bitmap extra data. | |
Additional inherited members
Public Functions inherited from AbstractPainterRGB565
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 inherited from AbstractPainterRGB565
const uint16_t | BMASK |
Mask for blue (0000000000011111) | |
const uint16_t | GMASK |
Mask for green (0000011111100000) | |
const uint16_t | RMASK |
Mask for red (1111100000000000) | |
Public Functions inherited from AbstractPainterBitmap
AbstractPainterBitmap(const Bitmap & bmp =Bitmap(BITMAP_INVALID)) | |
Constructor. | |
Bitmap | getBitmap() const |
Gets the bitmap previously set using setBitmap(). | |
void | getOffset(int16_t & x, int16_t & y) |
Gets the bitmap offset previously set using setOffset(). | |
bool | getTiled() const |
Gets the tiled setting, previously set using setTiled(). | |
virtual void | setOffset(int16_t x, int16_t y) |
Sets an offset for the bitmap used. | |
virtual void | setTiled(bool tiled) |
Instruct the painter to tile the bitmap specified. | |
virtual | ~AbstractPainterBitmap() |
Destructor. | |
Protected Functions inherited from AbstractPainterBitmap
bool | adjustBitmapXY(int16_t & bitmapX, int16_t & bitmapY, int16_t & offset, int16_t & count) const |
Adjust bitmap x and y. | |
void | updateBitmapOffsets(int16_t widgetWidth) const |
Updates the bitmap offsets described by widgetWidth, these offset are used by bitmap painters adjust the coordinate position inside the widget. | |
Protected Attributes inherited from AbstractPainterBitmap
Bitmap | bitmap |
The bitmap to be used when painting. | |
const uint8_t * | bitmapData |
Pointer to the bitmap data. | |
Bitmap::BitmapFormat | bitmapFormat |
Copy of the bitmap format (for speed reasons) | |
Rect | bitmapRect |
Bitmap rectangle translated to framebuffer coordinates. | |
bool | isTiled |
True if bitmap should be tiled, false if not. | |
int16_t | xOffset |
The x offset of the bitmap. | |
int16_t | yOffset |
The y offset of the bitmap. | |
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 | ~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
getRenderingMethod
virtual HAL::RenderingMethod getRenderingMethod | ( | ) | const |
Return the applicable rendering method of the painter.
HARDWARE if the painter uses hardware based drawing, SOFTWARE otherwise. Relevant on platforms using DCACHE.
HARDWARE if painter uses hardware based drawing, SOFTWARE otherwise.
Reimplements: touchgfx::AbstractPainter::getRenderingMethod
paint
virtual void paint | ( | uint8_t * | destination , | const | |
int16_t | offset , | const | |||
int16_t | widgetX , | const | |||
int16_t | widgetY , | const | |||
int16_t | count , | const | |||
uint8_t | alpha | const | |||
) | const |
Paints a streak of pixels (all with the same alpha) in the framebuffer.
The first pixel to paint is at 'offset' relative to 'destination' (to be able to support 1bpp, 2bpp and 4bpp). The first pixel to paint is at the given 'widgetX', 'widgetY' coordinate. The number of pixels to paint is 'count' and the alpha to apply is 'alpha'.
Note that the widgetX, widgetY is relative to the widget in the framebuffer, not the display. To convert the coordinate to display widget coordinates, use framebufferToDisplay().
destination | If non-null, the pointer. |
offset | The offset to add to the destination. |
widgetX | The widget x coordinate. |
widgetY | The widget y coordinate. |
count | Number of pixels. |
alpha | The alpha of the pixels. |
Reimplements: touchgfx::AbstractPainter::paint
PainterRGB565L8Bitmap
PainterRGB565L8Bitmap | ( | const Bitmap & | bmp =Bitmap(BITMAP_INVALID) | ) | |
Constructor.
bmp | (Optional) The bitmap to use in the painter. |
setBitmap
Sets a bitmap to be used when drawing the CanvasWidget.
bmp | The bitmap. |
Reimplements: touchgfx::AbstractPainterBitmap::setBitmap
setup
This function is called before any actual paint operation is started.
This allows the painter to initialize variables and optional dma queues. This happens before the first scan line segment is being drawn. If the painter is unable to draw, e.g. no bitmap assigned to a bitmap painter, 'false' should be returned.
widgetRect | The widget rectangle. |
True if the painter is ready to paint, false otherwise.
Reimplements: touchgfx::AbstractPainter::setup
tearDown
virtual void tearDown | ( | ) | const |
This function is called after all paint operation have finished.
This allows the painter to close down dma queues etc. This happens after the last scan line segment has been drawn.
Reimplements: touchgfx::AbstractPainter::tearDown
Protected Attributes Documentation
bitmapCLUT
const uint8_t * bitmapCLUT
Pointer to the CLUT.
l8format
Bitmap::ClutFormat l8format
The l8format read from the bitmap extra data.