Skip to main content



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 voidpaint(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))
virtual voidsetBitmap(const Bitmap & bmp)
Sets a bitmap to be used when drawing the CanvasWidget.
virtual boolsetup(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))
BitmapgetBitmap() const
Gets the bitmap previously set using setBitmap().
voidgetOffset(int16_t & x, int16_t & y)
Gets the bitmap offset previously set using setOffset().
boolgetTiled() const
Gets the tiled setting, previously set using setTiled().
virtual voidsetOffset(int16_t x, int16_t y)
Sets an offset for the bitmap used.
virtual voidsetTiled(bool tiled)
Instruct the painter to tile the bitmap specified.
virtual ~AbstractPainterBitmap()

Protected Functions inherited from AbstractPainterBitmap

booladjustBitmapXY(int16_t & bitmapX, int16_t & bitmapY, int16_t & offset, int16_t & count) const
Adjust bitmap x and y.
voidupdateBitmapOffsets(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

The bitmap to be used when painting.
const uint8_t *bitmapData
Pointer to the bitmap data.
Copy of the bitmap format (for speed reasons)
Bitmap rectangle translated to framebuffer coordinates.
True if bitmap should be tiled, false if not.
The x offset of the bitmap.
The y offset of the bitmap.

Public Functions inherited from AbstractPainter

Initializes a new instance of the AbstractPainter class.
voidframebufferToDisplay(int16_t & widgetX, int16_t & widgetY) const
Convert Framebuffer widget coordinates to display widget coordinates.
virtual HAL::RenderingMethodgetRenderingMethod() const
Return the applicable rendering method of the painter.
virtual voidtearDown() 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 boolcompatibleFramebuffer(Bitmap::BitmapFormat format)
Helper function to check if the provided bitmap format matches the current framebuffer format.

Protected Attributes inherited from AbstractPainter

The width of the widget on screen, used by framebufferToDisplay()

Public Functions Documentation


virtual void paint(uint8_t *destination ,const
int16_toffset ,const
int16_twidgetX ,const
int16_twidgetY ,const
int16_tcount ,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().

destinationIf non-null, the pointer.
offsetThe offset to add to the destination.
widgetXThe widget x coordinate.
widgetYThe widget y coordinate.
countNumber of pixels.
alphaThe alpha of the pixels.
See also:

Reimplements: touchgfx::AbstractPainter::paint


PainterXRGB8888Bitmap(const Bitmap &bmp =Bitmap(BITMAP_INVALID))


bmp(Optional) The bitmap to use in the painter.


virtual void setBitmap(const Bitmap &bmp)

Sets a bitmap to be used when drawing the CanvasWidget.

bmpThe bitmap.

Reimplements: touchgfx::AbstractPainterBitmap::setBitmap


virtual bool setup(const Rect &widgetRect)

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.

widgetRectThe widget rectangle.

True if the painter is ready to paint, false otherwise.

See also:

Reimplements: touchgfx::AbstractPainter::setup