Skip to main content

PainterRGB565

The PainterRGB565 class allows a shape to be filled with a given color and alpha value. This allows transparent, anti-aliased elements to be drawn.

See: AbstractPainter

Inherits from: AbstractPainterRGB565, AbstractPainterColor, 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.
PainterRGB565(colortype color =0)
Initializes a new instance of the PainterRGB565 class.
virtual voidsetColor(colortype color)
Sets color to use when drawing the CanvasWidget.
virtual voidtearDown() const
This function is called after all paint operation have finished.

Protected Attributes

uint16_tcolor565
The native color in 565 format (for speed reasons)

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 AbstractPainterColor

AbstractPainterColor(colortype color =0)
Constructor.
colortypegetColor() const
Gets the current color.
virtual ~AbstractPainterColor()
Destructor.

Protected Attributes inherited from AbstractPainterColor

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 boolsetup(const Rect & widgetRect) const
This function is called before any actual paint operation is started.
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

PainterRGB565

Initializes a new instance of the PainterRGB565 class.

Parameters:
color(Optional) the color, default is black.

setColor

virtual void setColor(colortypecolor)

Sets color to use when drawing the CanvasWidget.

Parameters:
colorThe color.

Reimplements: touchgfx::AbstractPainterColor::setColor

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

color565

uint16_t color565

The native color in 565 format (for speed reasons)