Flutter Engine
The Flutter Engine
Static Public Member Functions | Protected Member Functions | List of all members
SkSVGPoly Class Referencefinal

#include <SkSVGPoly.h>

Inheritance diagram for SkSVGPoly:
SkSVGShape SkSVGTransformableNode SkSVGNode SkRefCnt SkRefCntBase

Static Public Member Functions

static sk_sp< SkSVGPolyMakePolygon ()
 
static sk_sp< SkSVGPolyMakePolyline ()
 

Protected Member Functions

bool parseAndSetAttribute (const char *, const char *) override
 
void onDraw (SkCanvas *, const SkSVGLengthContext &, const SkPaint &, SkPathFillType) const override
 
SkPath onAsPath (const SkSVGRenderContext &) const override
 
SkRect onObjectBoundingBox (const SkSVGRenderContext &) const override
 
- Protected Member Functions inherited from SkSVGShape
 SkSVGShape (SkSVGTag)
 
void onRender (const SkSVGRenderContext &) const final
 
virtual void onDraw (SkCanvas *, const SkSVGLengthContext &, const SkPaint &, SkPathFillType) const =0
 
- Protected Member Functions inherited from SkSVGTransformableNode
 SkSVGTransformableNode (SkSVGTag)
 
bool onPrepareToRender (SkSVGRenderContext *) const override
 
void onSetAttribute (SkSVGAttribute, const SkSVGValue &) override
 
void mapToParent (SkPath *) const
 
void mapToParent (SkRect *) const
 
- Protected Member Functions inherited from SkSVGNode
 SkSVGNode (SkSVGTag)
 
virtual bool onPrepareToRender (SkSVGRenderContext *) const
 
virtual void onRender (const SkSVGRenderContext &) const =0
 
virtual bool onAsPaint (const SkSVGRenderContext &, SkPaint *) const
 
virtual SkPath onAsPath (const SkSVGRenderContext &) const =0
 
virtual void onSetAttribute (SkSVGAttribute, const SkSVGValue &)
 
virtual bool hasChildren () const
 
virtual SkRect onObjectBoundingBox (const SkSVGRenderContext &) const
 

Additional Inherited Members

- Public Member Functions inherited from SkSVGShape
void appendChild (sk_sp< SkSVGNode >) override
 
- Public Member Functions inherited from SkSVGTransformableNode
void setTransform (const SkSVGTransformType &t)
 
- Public Member Functions inherited from SkSVGNode
 ~SkSVGNode () override
 
SkSVGTag tag () const
 
virtual void appendChild (sk_sp< SkSVGNode >)=0
 
void render (const SkSVGRenderContext &) const
 
bool asPaint (const SkSVGRenderContext &, SkPaint *) const
 
SkPath asPath (const SkSVGRenderContext &) const
 
SkRect objectBoundingBox (const SkSVGRenderContext &) const
 
void setAttribute (SkSVGAttribute, const SkSVGValue &)
 
bool setAttribute (const char *attributeName, const char *attributeValue)
 
virtual bool parseAndSetAttribute (const char *name, const char *value)
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 
- Static Protected Member Functions inherited from SkSVGNode
static SkMatrix ComputeViewboxMatrix (const SkRect &, const SkRect &, SkSVGPreserveAspectRatio)
 

Detailed Description

Definition at line 15 of file SkSVGPoly.h.

Member Function Documentation

◆ MakePolygon()

static sk_sp< SkSVGPoly > SkSVGPoly::MakePolygon ( )
inlinestatic

Definition at line 17 of file SkSVGPoly.h.

◆ MakePolyline()

static sk_sp< SkSVGPoly > SkSVGPoly::MakePolyline ( )
inlinestatic

Definition at line 21 of file SkSVGPoly.h.

21 {
23 }

◆ onAsPath()

SkPath SkSVGPoly::onAsPath ( const SkSVGRenderContext ctx) const
overrideprotectedvirtual

Implements SkSVGNode.

Definition at line 39 of file SkSVGPoly.cpp.

39 {
40 SkPath path = fPath;
41
42 // clip-rule can be inherited and needs to be applied at clip time.
44
45 this->mapToParent(&path);
46 return path;
47}
Definition: SkPath.h:59
SkPathFillType asFillType() const
Definition: SkSVGTypes.h:361
const SkSVGPresentationContext & presentationContext() const
void mapToParent(SkPath *) const
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57
SkSVGProperty< SkSVGFillRule, true > fClipRule
SkSVGPresentationAttributes fInherited

◆ onDraw()

void SkSVGPoly::onDraw ( SkCanvas canvas,
const SkSVGLengthContext ,
const SkPaint paint,
SkPathFillType  fillType 
) const
overrideprotectedvirtual

Implements SkSVGShape.

Definition at line 32 of file SkSVGPoly.cpp.

33 {
34 // the passed fillType follows inheritance rules and needs to be applied at draw time.
35 fPath.setFillType(fillType);
36 canvas->drawPath(fPath, paint);
37}
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
void setFillType(SkPathFillType ft)
Definition: SkPath.h:235
const Paint & paint
Definition: color_source.cc:38

◆ onObjectBoundingBox()

SkRect SkSVGPoly::onObjectBoundingBox ( const SkSVGRenderContext ctx) const
overrideprotectedvirtual

Reimplemented from SkSVGNode.

Definition at line 49 of file SkSVGPoly.cpp.

49 {
50 return fPath.getBounds();
51}
const SkRect & getBounds() const
Definition: SkPath.cpp:430

◆ parseAndSetAttribute()

bool SkSVGPoly::parseAndSetAttribute ( const char *  n,
const char *  v 
)
overrideprotectedvirtual

Reimplemented from SkSVGNode.

Definition at line 16 of file SkSVGPoly.cpp.

16 {
18 return true;
19 }
20
21 if (this->setPoints(SkSVGAttributeParser::parse<SkSVGPointsType>("points", n, v))) {
22 // TODO: we can likely just keep the points array and create the SkPath when needed.
23 fPath = SkPath::Polygon(
24 fPoints.data(), fPoints.size(),
25 this->tag() == SkSVGTag::kPolygon); // only polygons are auto-closed
26 }
27
28 // No other attributes on this node
29 return false;
30}
static SkPath Polygon(const SkPoint pts[], int count, bool isClosed, SkPathFillType=SkPathFillType::kWinding, bool isVolatile=false)
Definition: SkPath.cpp:3614
virtual bool parseAndSetAttribute(const char *name, const char *value)
Definition: SkSVGNode.cpp:90

The documentation for this class was generated from the following files: