PainterXRGB8888Bitmap
touchgfx/widgets/canvas/PainterXRGB8888Bitmap.hpp
PainterXRGB8888Bitmap 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: AbstractPainterARGB8888, AbstractPainterBitmap, AbstractPainter
Public Functions
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. | |
PainterXRGB8888Bitmap(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. | |
Additional inherited members
Public Functions inherited from AbstractPainterARGB8888
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 HAL::RenderingMethod | getRenderingMethod() const |
Return the applicable rendering method of the painter. | |
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
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
PainterXRGB8888Bitmap
PainterXRGB8888Bitmap | ( | 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