CWRVectorRenderer
touchgfx/widgets/canvas/CWRVectorRenderer.hpp
Implementation of the VectorRendererInterface based on the CanvasWidgetRenderer. The class needs to be subclasses to provide the painter objecs.
See: CWRVectorRendererRGB888, CWRVectorRendererRGB565
Inherits from: VectorRenderer
Inherited by: CWRVectorRendererRGB565, CWRVectorRendererRGB888
Public Functions
virtual void | drawPath(const uint8_t cmds, uint32_t nCmds, const float points, uint32_t nPoints, const float * bbox =0) |
Draw a Path defined by the given array of primitives (commands) and an array of the corresponding floating point coordinates. | |
virtual void | setAlpha(uint8_t a) |
Set the alpha value (opacity) used for future drawings. | |
virtual void | setColor(colortype c) |
Set a constant color used for future drawings. | |
virtual void | setLinearGradient(float x0, float y0, float x1, float y1, uint32_t stops, const float stopPositions, const uint32_t stopColors, float width, float height, bool solid, const uint32_t * palette) |
Set a linear gradient used for future drawings. | |
virtual void | setMode(DrawMode mode) |
Set the drawing mode for the VectorRenderer. | |
virtual void | setRadialGradient(float cx, float cy, float radius, uint32_t stops, const float stopPositions, const colortype stopColors) |
Set a radial gradient used for future drawings. | |
virtual void | setStrokeLineCap(VGStrokeLineCap lineCap) |
Sets stroke line cap type. | |
virtual void | setStrokeLineJoin(VGStrokeLineJoin lineJoin) |
Sets stroke line join type. | |
virtual void | setStrokeMiterLimit(float miterLimit) |
Sets stroke miter limit. | |
virtual void | setStrokeWidth(float w) |
Set the width used for future drawings using the VECTOR_STROKE drawing mode. | |
virtual void | setTransformationMatrix(const Matrix3x3 & m) |
Sets the transformation matrix used for future drawings. | |
virtual void | setup(const Widget & renderer, const Rect & drawingArea) |
Start a new drawing in the given area. | |
virtual void | tearDown() |
Finalizes the current drawing. | |
Additional inherited members
Public Types inherited from VectorRenderer
enum | DrawMode { STROKE, FILL_EVEN_ODD, FILL_NON_ZERO } |
A list of vector graphics drawing modes. | |
Public Functions inherited from VectorRenderer
virtual | ~VectorRenderer() |
Virtual destructor. | |
VectorRenderer * | getInstance() |
Gets the VectorRenderer instance. | |
Public Functions Documentation
drawPath
virtual void drawPath | ( | const uint8_t * | cmds , | ||
uint32_t | nCmds , | ||||
const float * | points , | ||||
uint32_t | nPoints , | ||||
const float * | bbox =0 | ||||
) |
Draw a Path defined by the given array of primitives (commands) and an array of the corresponding floating point coordinates.
cmds | An uint8_t array of VectorPrimitives values |
nCmds | The number of commands in cmds |
points | An array of coordinates for the commands |
nPoints | The number of values in the points arrays |
bbox | Array describing the bounding box of the path [minx,miny,maxx,maxy] or 0 if unknown |
Reimplements: touchgfx::VectorRenderer::drawPath
setAlpha
virtual void setAlpha | ( | uint8_t | a | ) | |
Set the alpha value (opacity) used for future drawings.
The alpha is specified in the interval [0;1].
a | The alpha value. |
Reimplements: touchgfx::VectorRenderer::setAlpha
setColor
Set a constant color used for future drawings.
c | An ARGB color value |
Reimplements: touchgfx::VectorRenderer::setColor
setLinearGradient
virtual void setLinearGradient | ( | float | x0 , | ||
float | y0 , | ||||
float | x1 , | ||||
float | y1 , | ||||
uint32_t | stops , | ||||
const float * | stopPositions , | ||||
const uint32_t * | stopColors , | ||||
float | width , | ||||
float | height , | ||||
bool | solid , | ||||
const uint32_t * | palette | ||||
) |
Set a linear gradient used for future drawings.
The linear gradient is transformed using the current transformation matrix. Multiple colors (stops) can be specified for the gradient. The stop positions are given in the range [0;1].
x0 | X-coordinate for gradient starting point |
y0 | Y-coordinate for gradient starting point |
x1 | X-coordinate for gradient end point |
y1 | Y-coordinate for gradient end point |
stops | Number of stops |
stopPositions | Positions of the stops on the line |
stopColors | Colors of the stops |
width | Width of the box to fill |
height | Height of the box to fill |
solid | True if all colors in the gradient are solid |
palette | The gradient palette |
Reimplements: touchgfx::VectorRenderer::setLinearGradient
setMode
Set the drawing mode for the VectorRenderer.
The mode will be used for all subsequent drawings until setMode is called again.
The default mode is non-zero filling.
mode | The filling mode. |
Reimplements: touchgfx::VectorRenderer::setMode
setRadialGradient
virtual void setRadialGradient | ( | float | cx , | ||
float | cy , | ||||
float | radius , | ||||
uint32_t | stops , | ||||
const float * | stopPositions , | ||||
const colortype * | stopColors | ||||
) |
Set a radial gradient used for future drawings.
The radial gradient is transformed using the current transformation matrix. Multiple colors (stops) can be specified for the gradient. The stop positions are given in the range [0;1].
cx | X-coordinate for the gradient center |
cy | Y-coordinate for the gradient center |
radius | Radius of the gradient |
stops | Number of stops |
stopPositions | Positions of the stops on the line |
stopColors | Colors of the stops |
setStrokeLineCap
virtual void setStrokeLineCap | ( | VGStrokeLineCap | lineCap | ) | |
Sets stroke line cap type.
lineCap | The line cap type. |
Reimplements: touchgfx::VectorRenderer::setStrokeLineCap
setStrokeLineJoin
virtual void setStrokeLineJoin | ( | VGStrokeLineJoin | lineJoin | ) | |
Sets stroke line join type.
lineJoin | The line join type. |
Reimplements: touchgfx::VectorRenderer::setStrokeLineJoin
setStrokeMiterLimit
virtual void setStrokeMiterLimit | ( | float | miterLimit | ) | |
Sets stroke miter limit.
This the max distance from the Miter point on the stroke to the stroke point that will be used. If the miter limit is exceeded for a stroke join, it will not be drawn as a Miter but as a Bevel.
miterLimit | The miter limit. |
Reimplements: touchgfx::VectorRenderer::setStrokeMiterLimit
setStrokeWidth
virtual void setStrokeWidth | ( | float | w | ) | |
Set the width used for future drawings using the VECTOR_STROKE drawing mode.
w | The width used for stroke drawing. |
Reimplements: touchgfx::VectorRenderer::setStrokeWidth
setTransformationMatrix
virtual void setTransformationMatrix | ( | const Matrix3x3 & | m | ) | |
Sets the transformation matrix used for future drawings.
The transformation is reset when setup is called.
m | The transformation matrix |
Reimplements: touchgfx::VectorRenderer::setTransformationMatrix
setup
Start a new drawing in the given area.
The area typically corresponds to an invalidated area of a Widget. Implementations may lock the framebuffer here. The drawing area is given in the widget coordinate system.
renderer | The Widget that does the rendering. |
drawingArea | The area of the screen to draw in. |
Reimplements: touchgfx::VectorRenderer::setup
tearDown
virtual void tearDown | ( | ) |
Finalizes the current drawing.
The implementation may block here until the drawing is done.
The implementation is required to unlock the framebuffer when tearDown is called.
Reimplements: touchgfx::VectorRenderer::tearDown