跳转到主要内容

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: CWRVectorRendererARGB8888, CWRVectorRendererRGB565, CWRVectorRendererRGB888

Public Functions

virtual voiddrawPath(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 voidsetAlpha(uint8_t a)
Set the alpha value (opacity) used for future drawings.
virtual voidsetColor(colortype c)
Set a constant color used for future drawings.
virtual voidsetLinearGradient(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 voidsetMode(DrawMode mode)
Set the drawing mode for the VectorRenderer.
virtual voidsetStrokeLineCap(VGStrokeLineCap lineCap)
Sets stroke line cap type.
virtual voidsetStrokeLineJoin(VGStrokeLineJoin lineJoin)
Sets stroke line join type.
virtual voidsetStrokeMiterLimit(float miterLimit)
Sets stroke miter limit.
virtual voidsetStrokeWidth(float w)
Set the width used for future drawings using the VECTOR_STROKE drawing mode.
virtual voidsetTransformationMatrix(const Matrix3x3 & m)
Sets the transformation matrix used for future drawings.
virtual voidsetup(const Rect & canvasAreaAbs, const Rect & invalidatedAreaRel)
Start a new drawing (invalidated area) within the given canvas area.
virtual voidtearDown()
Finalizes the current drawing.

Additional inherited members

Public Types inherited from VectorRenderer

enumDrawMode { 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_tnCmds ,
const float *points ,
uint32_tnPoints ,
const float *bbox =0
)

Draw a Path defined by the given array of primitives (commands) and an array of the corresponding floating point coordinates.

Parameters:
cmdsAn uint8_t array of VectorPrimitives values
nCmdsThe number of commands in cmds
pointsAn array of coordinates for the commands
nPointsThe number of values in the points arrays
bboxArray describing the bounding box of the path [minx,miny,maxx,maxy] or 0 if unknown

Reimplements: touchgfx::VectorRenderer::drawPath

setAlpha

virtual void setAlpha(uint8_ta)

Set the alpha value (opacity) used for future drawings.

The alpha is specified in the interval [0;1].

Parameters:
aThe alpha value.

Reimplements: touchgfx::VectorRenderer::setAlpha

setColor

virtual void setColor(colortypec)

Set a constant color used for future drawings.

Parameters:
cAn ARGB color value

Reimplements: touchgfx::VectorRenderer::setColor

setLinearGradient

virtual void setLinearGradient(floatx0 ,
floaty0 ,
floatx1 ,
floaty1 ,
uint32_tstops ,
const float *stopPositions ,
const uint32_t *stopColors ,
floatwidth ,
floatheight ,
boolsolid ,
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].

Parameters:
x0X-coordinate for gradient starting point
y0Y-coordinate for gradient starting point
x1X-coordinate for gradient end point
y1Y-coordinate for gradient end point
stopsNumber of stops
stopPositionsPositions of the stops on the line
stopColorsColors of the stops
widthWidth of the box to fill
heightHeight of the box to fill
solidTrue if all colors in the gradient are solid
paletteThe gradient palette

Reimplements: touchgfx::VectorRenderer::setLinearGradient

setMode

virtual void setMode(DrawModemode)

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.

Parameters:
modeThe filling mode.

Reimplements: touchgfx::VectorRenderer::setMode

setStrokeLineCap

virtual void setStrokeLineCap(VGStrokeLineCaplineCap)

Sets stroke line cap type.

Parameters:
lineCapThe line cap type.

Reimplements: touchgfx::VectorRenderer::setStrokeLineCap

setStrokeLineJoin

virtual void setStrokeLineJoin(VGStrokeLineJoinlineJoin)

Sets stroke line join type.

Parameters:
lineJoinThe line join type.

Reimplements: touchgfx::VectorRenderer::setStrokeLineJoin

setStrokeMiterLimit

virtual void setStrokeMiterLimit(floatmiterLimit)

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.

Parameters:
miterLimitThe miter limit.

Reimplements: touchgfx::VectorRenderer::setStrokeMiterLimit

setStrokeWidth

virtual void setStrokeWidth(floatw)

Set the width used for future drawings using the VECTOR_STROKE drawing mode.

Parameters:
wThe 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.

Parameters:
mThe transformation matrix

Reimplements: touchgfx::VectorRenderer::setTransformationMatrix

setup

virtual void setup(const Rect &canvasAreaAbs ,
const Rect &invalidatedAreaRel
)

Start a new drawing (invalidated area) within the given canvas area.

The canvas area typically corresponds to the area of a Widget and is given in absolute coordinates, whereas the invalidated area is given in relative coordinates. Implementations may lock the framebuffer here.

Parameters:
canvasAreaAbsThe canvas dimensions in absolute coordinates.
invalidatedAreaRelThe area which should be updated in relative coordinates.

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