AbstractPainterLinearGradient
touchgfx/widgets/canvas/AbstractPainterLinearGradient.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: AbstractPainter
Inherited by: PainterARGB8888LinearGradient, PainterRGB565LinearGradient, PainterRGB888LinearGradient
Public Functions
AbstractPainterLinearGradient() | |
Constructor. | |
void | setGradientEndPoints(float startX, float startY, float endX, float endY, float width, float height, const Matrix3x3 & m) |
Set the gradient line. | |
void | setGradientTexture(const uint32_t * tex, bool solid) |
Set the 1024x1 texture used to color this texture. | |
virtual | ~AbstractPainterLinearGradient() |
Destructor. | |
Protected Attributes
float | clOffset |
Vertical offset for line with first color. | |
float | clSlope |
Slope of lines with same color. | |
int16_t | coord0 |
The gradient line start. | |
int16_t | coord1 |
The gradient line end. | |
float | deltaColor |
Color increment when moving 1 pixel horizontally. | |
float | horizontalDistance |
Horizontal distance between pixels with the first color and the last color. | |
bool | isHorizontal |
True if the gradient is horizontal (y0 == y1). | |
bool | isSolid |
True if all the gradient colors are solid. | |
bool | isVertical |
True if the gradient is vertical (x0 == x1). | |
const uint32_t * | texture |
The gradient color texture 1 x 1024. | |
Additional inherited members
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 | paint(uint8_t * destination, int16_t offset, int16_t widgetX, int16_t widgetY, int16_t count, uint8_t alpha) const =0 |
Paints a streak of pixels (all with the same alpha) in the framebuffer. | |
virtual bool | setup(const Rect & widgetRect) const |
This function is called before any actual paint operation is started. | |
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
AbstractPainterLinearGradient
Constructor.
setGradientEndPoints
void setGradientEndPoints | ( | float | startX , | ||
float | startY , | ||||
float | endX , | ||||
float | endY , | ||||
float | width , | ||||
float | height , | ||||
const Matrix3x3 & | m | ||||
) |
Set the gradient line.
First coordinate (startX, startY) specifies the position of the first color. Last coordinate (endX, endY) specifies the position of the last color.
startX | X coordinate of the gradient line start point. |
startY | Y coordinate of the gradient line start point. |
endX | X coordinate of the gradient line end point. |
endY | Y coordinate of the gradient line end point. |
width | Width of gradient. |
height | Height of gradient. |
m | Transformation. |
setGradientTexture
void setGradientTexture | ( | const uint32_t * | tex , | ||
bool | solid | ||||
) |
Set the 1024x1 texture used to color this texture.
The texture is mapped to the gradient line (startX, startY) to (endX, endY).
The texture must be in ARGB8888 format.
tex | The gradient texture. |
solid | True if all colors in the gradient are solid. |
~AbstractPainterLinearGradient
virtual ~AbstractPainterLinearGradient | ( | ) |
Destructor.
Protected Attributes Documentation
clOffset
float clOffset
Vertical offset for line with first color.
clSlope
float clSlope
Slope of lines with same color.
coord0
int16_t coord0
The gradient line start.
coord1
int16_t coord1
The gradient line end.
deltaColor
float deltaColor
Color increment when moving 1 pixel horizontally.
horizontalDistance
float horizontalDistance
Horizontal distance between pixels with the first color and the last color.
isHorizontal
bool isHorizontal
True if the gradient is horizontal (y0 == y1).
isSolid
bool isSolid
True if all the gradient colors are solid.
isVertical
bool isVertical
True if the gradient is vertical (x0 == x1).
texture
const uint32_t * texture
The gradient color texture 1 x 1024.