跳轉到主要內容

PainterARGB8888LinearGradient

touchgfx/widgets/canvas/PainterARGB8888LinearGradient.hpp

An abstract class for creating painter classes for drawing canvas widgets. All canvas widgets need a painter to fill the shape drawn with a CanvasWidgetRenderer. The painter must provide the color of a pixel on a given coordinate, which will the be blended into the framebuffer depending on the position of the canvas widget and the transparency of the given pixel.

Inherits from: AbstractPainterLinearGradient, 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.
virtual voidtearDown() const
This function is called after all paint operation have finished.

Additional inherited members

Public Functions inherited from AbstractPainterLinearGradient

AbstractPainterLinearGradient()
Constructor.
voidsetGradientEndPoints(float startX, float startY, float endX, float endY, float width, float height, const Matrix3x3 & m)
Set the gradient line.
voidsetGradientTexture(const uint32_t * tex, bool solid)
Set the 1024x1 texture used to color this texture.
virtual ~AbstractPainterLinearGradient()
Destructor.

Protected Attributes inherited from AbstractPainterLinearGradient

floatclOffset
Vertical offset for line with first color.
floatclSlope
Slope of lines with same color.
int16_tcoord0
The gradient line start.
int16_tcoord1
The gradient line end.
floatdeltaColor
Color increment when moving 1 pixel horizontally.
floathorizontalDistance
Horizontal distance between pixels with the first color and the last color.
boolisHorizontal
True if the gradient is horizontal (y0 == y1).
boolisSolid
True if all the gradient colors are solid.
boolisVertical
True if the gradient is vertical (x0 == x1).
const uint32_t *texture
The gradient color texture 1 x 1024.

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 HAL::RenderingMethodgetRenderingMethod() const
Return the applicable rendering method of the painter.
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

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

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