Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | List of all members
SkSVGShape Class Referenceabstract

#include <SkSVGShape.h>

Inheritance diagram for SkSVGShape:
SkSVGTransformableNode SkSVGNode SkRefCnt SkRefCntBase SkSVGCircle SkSVGEllipse SkSVGLine SkSVGPath SkSVGPoly SkSVGRect

Public Member Functions

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
 

Protected Member Functions

 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

- Static Protected Member Functions inherited from SkSVGNode
static SkMatrix ComputeViewboxMatrix (const SkRect &, const SkRect &, SkSVGPreserveAspectRatio)
 

Detailed Description

Definition at line 17 of file SkSVGShape.h.

Constructor & Destructor Documentation

◆ SkSVGShape()

SkSVGShape::SkSVGShape ( SkSVGTag  t)
protected

Definition at line 11 of file SkSVGShape.cpp.

11: INHERITED(t) {}

Member Function Documentation

◆ appendChild()

void SkSVGShape::appendChild ( sk_sp< SkSVGNode )
overridevirtual

Implements SkSVGNode.

Definition at line 29 of file SkSVGShape.cpp.

29 {
30 SkDebugf("cannot append child nodes to an SVG shape.\n");
31}
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1

◆ onDraw()

virtual void SkSVGShape::onDraw ( SkCanvas ,
const SkSVGLengthContext ,
const SkPaint ,
SkPathFillType   
) const
protectedpure virtual

◆ onRender()

void SkSVGShape::onRender ( const SkSVGRenderContext ctx) const
finalprotectedvirtual

Implements SkSVGNode.

Definition at line 13 of file SkSVGShape.cpp.

13 {
14 const auto fillType = ctx.presentationContext().fInherited.fFillRule->asFillType();
15
16 const auto fillPaint = ctx.fillPaint(),
17 strokePaint = ctx.strokePaint();
18
19 // TODO: this approach forces duplicate geometry resolution in onDraw(); refactor to avoid.
20 if (fillPaint.isValid()) {
21 this->onDraw(ctx.canvas(), ctx.lengthContext(), *fillPaint, fillType);
22 }
23
24 if (strokePaint.isValid()) {
25 this->onDraw(ctx.canvas(), ctx.lengthContext(), *strokePaint, fillType);
26 }
27}
SkPathFillType asFillType() const
Definition: SkSVGTypes.h:361
SkTLazy< SkPaint > fillPaint() const
const SkSVGPresentationContext & presentationContext() const
SkCanvas * canvas() const
const SkSVGLengthContext & lengthContext() const
SkTLazy< SkPaint > strokePaint() const
virtual void onDraw(SkCanvas *, const SkSVGLengthContext &, const SkPaint &, SkPathFillType) const =0
SkSVGProperty< SkSVGFillRule, true > fFillRule
SkSVGPresentationAttributes fInherited

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