Skip to main content

PainterRGB565Bitmap

PainterRGB565Bitmap 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::RenderingMethodgetRenderingMethod() const
Return the applicable rendering method of the painter.
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.
PainterRGB565Bitmap(const Bitmap & bmp =Bitmap(BITMAP_INVALID))
Constructor.
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.
virtual voidtearDown() const
This function is called after all paint operation have finished.

Protected Attributes

const uint8_t *bitmapExtraData
Pointer to the bitmap extra data.

Additional inherited members

Public Functions inherited from AbstractPainterRGB565

AbstractPainterRGB565()
FORCE_INLINE_FUNCTION uint16_talphaBlend(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_talphaBlend(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_tBMASK
Mask for blue (0000000000011111)
const uint16_tGMASK
Mask for green (0000011111100000)
const uint16_tRMASK
Mask for red (1111100000000000)

Public Functions inherited from AbstractPainterBitmap

AbstractPainterBitmap(const Bitmap & bmp =Bitmap(BITMAP_INVALID))
Constructor.
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()
Destructor.

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

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

Public Functions inherited from AbstractPainter

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 ~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

int16_twidgetWidth
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.

Returns:

HARDWARE if painter uses hardware based drawing, SOFTWARE otherwise.

Reimplements: touchgfx::AbstractPainter::getRenderingMethod

paint

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

Parameters:
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

PainterRGB565Bitmap

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

Constructor.

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

setBitmap

virtual void setBitmap(const Bitmap &bmp)

Sets a bitmap to be used when drawing the CanvasWidget.

Parameters:
bmpThe bitmap.

Reimplements: touchgfx::AbstractPainterBitmap::setBitmap

setup

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.

Parameters:
widgetRectThe widget rectangle.
Returns:

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

See also:

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.

See also:

Reimplements: touchgfx::AbstractPainter::tearDown

Protected Attributes Documentation

bitmapExtraData

const uint8_t * bitmapExtraData

Pointer to the bitmap extra data.