PainterABGR2222
The PainterABGR2222 class allows a shape to be filled with a given color value. This allows anti-aliased elements to be drawn.
See: AbstractPainter
Inherits from: AbstractPainterABGR2222, AbstractPainter
Public Functions
colortype | getColor() const |
Gets the current color. | |
PainterABGR2222(colortype color =0) | |
Initializes a new instance of the PainterABGR2222 class. | |
virtual void | render(uint8_t ptr, int x, int xAdjust, int y, unsigned count, const uint8_t covers) |
Paint a designated part of the RenderingBuffer with respect to the amount of coverage of each pixel given by the parameter covers. | |
void | setColor(colortype color) |
Sets color to use when drawing the CanvasWidget. | |
Protected Functions
virtual bool | renderNext(uint8_t & red, uint8_t & green, uint8_t & blue, uint8_t & alpha) |
Get the color of the next pixel in the scan line to blend into the framebuffer. | |
Protected Attributes
uint8_t | painterBlue |
The blue part of the color, scaled up to [0..255]. | |
colortype | painterColor |
The color. | |
uint8_t | painterGreen |
The green part of the color, scaled up to [0..255]. | |
uint8_t | painterRed |
The red part of the color, scaled up to [0..255]. | |
Additional inherited members
Public Functions inherited from AbstractPainterABGR2222
AbstractPainterABGR2222() | |
FORCE_INLINE_FUNCTION uint8_t | mixColors(uint8_t newpix, uint8_t bufpix, uint8_t alpha) |
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 uint8_t | mixColors(uint8_t R, uint8_t G, uint8_t B, uint8_t bufpix, uint8_t alpha) |
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. | |
Protected Functions inherited from AbstractPainterABGR2222
virtual bool | renderInit() |
Initialize rendering of a single scan line of pixels for the render. | |
virtual void | renderPixel(uint8_t * p, uint8_t red, uint8_t green, uint8_t blue) |
Renders (writes) the specified color into the framebuffer. | |
Protected Attributes inherited from AbstractPainterABGR2222
int | currentX |
Current x coordinate relative to the widget. | |
int | currentY |
Current y coordinate relative to the widget. | |
Public Functions inherited from AbstractPainter
AbstractPainter() | |
Initializes a new instance of the AbstractPainter class. | |
void | setOffset(uint16_t offsetX, uint16_t offsetY) |
Sets the offset of the area being drawn. | |
virtual | ~AbstractPainter() |
Finalizes an instance of the AbstractPainter class. | |
Protected Functions inherited from AbstractPainter
void | setWidgetAlpha(const uint8_t alpha) |
Sets the widget alpha to allow an entire canvas widget to easily be faded without changing the painter of the widget. | |
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 | areaOffsetX |
The offset x coordinate of the area being drawn. | |
int16_t | areaOffsetY |
The offset y coordinate of the area being drawn. | |
uint8_t | widgetAlpha |
The alpha of the widget using the painter. | |
Public Functions Documentation
getColor
colortype getColor | ( | ) | const |
Gets the current color.
The color.
PainterABGR2222
PainterABGR2222 | ( | colortype | color =0 | ) | |
Initializes a new instance of the PainterABGR2222 class.
color | (Optional) the color, default is black. |
render
virtual void render | ( | uint8_t * | ptr , | ||
int | x , | ||||
int | xAdjust , | ||||
int | y , | ||||
unsigned | count , | ||||
const uint8_t * | covers | ||||
) |
Paint a designated part of the RenderingBuffer with respect to the amount of coverage of each pixel given by the parameter covers.
The cover is the alpha for each pixel, which is what makes it possible to have smooth anti-aliased edges on the shapes drawn with CanvasWidgetRenderer.
ptr | Pointer to the row in the RenderingBuffer. |
x | The x coordinate. |
xAdjust | The minor adjustment of x (used when a pixel is smaller than a byte to specify that the ptr should have been advanced "xAdjust" pixels futher into the byte). |
y | The y coordinate. |
count | Number of pixels to fill. |
covers | The coverage in of each pixel. |
Note
The implementation of render() in the AbstractPainter classes is a generic (i.e. slow) implementation that should be completely implemented in subclasses of AbstractPainter for better performance.
Reimplements: touchgfx::AbstractPainterABGR2222::render
setColor
Protected Functions Documentation
renderNext
virtual bool renderNext | ( | uint8_t & | red , | ||
uint8_t & | green , | ||||
uint8_t & | blue , | ||||
uint8_t & | alpha | ||||
) |
Get the color of the next pixel in the scan line to blend into the framebuffer.
red | The red. |
green | The green. |
blue | The blue. |
alpha | The alpha. |
true if the pixel should be painted, false otherwise.
Reimplements: touchgfx::AbstractPainterABGR2222::renderNext
Protected Attributes Documentation
painterBlue
uint8_t painterBlue
The blue part of the color, scaled up to [0..255].
painterColor
colortype painterColor
The color.
painterGreen
uint8_t painterGreen
The green part of the color, scaled up to [0..255].
painterRed
uint8_t painterRed
The red part of the color, scaled up to [0..255].