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

#include <SkSVGCircle.h>

Inheritance diagram for SkSVGCircle:
SkSVGShape SkSVGTransformableNode SkSVGNode SkRefCnt SkRefCntBase

Static Public Member Functions

static sk_sp< SkSVGCircleMake ()
 

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 16 of file SkSVGCircle.h.

Member Function Documentation

◆ Make()

static sk_sp< SkSVGCircle > SkSVGCircle::Make ( )
inlinestatic

Definition at line 18 of file SkSVGCircle.h.

18{ return sk_sp<SkSVGCircle>(new SkSVGCircle()); }

◆ onAsPath()

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

Implements SkSVGNode.

Definition at line 40 of file SkSVGCircle.cpp.

40 {
42 SkScalar r;
43 std::tie(pos, r) = this->resolve(ctx.lengthContext());
44
45 SkPath path = SkPath::Circle(pos.x(), pos.y(), r);
46 this->mapToParent(&path);
47
48 return path;
49}
SkPoint pos
Definition: SkPath.h:59
static SkPath Circle(SkScalar center_x, SkScalar center_y, SkScalar radius, SkPathDirection dir=SkPathDirection::kCW)
Definition: SkPath.cpp:3598
const SkSVGLengthContext & lengthContext() const
void mapToParent(SkPath *) const
float SkScalar
Definition: extension.cpp:12
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
constexpr float y() const
Definition: SkPoint_impl.h:187
constexpr float x() const
Definition: SkPoint_impl.h:181

◆ onDraw()

void SkSVGCircle::onDraw ( SkCanvas canvas,
const SkSVGLengthContext lctx,
const SkPaint paint,
SkPathFillType   
) const
overrideprotectedvirtual

Implements SkSVGShape.

Definition at line 29 of file SkSVGCircle.cpp.

30 {
32 SkScalar r;
33 std::tie(pos, r) = this->resolve(lctx);
34
35 if (r > 0) {
36 canvas->drawCircle(pos.x(), pos.y(), r, paint);
37 }
38}
void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint &paint)
Definition: SkCanvas.cpp:2707
const Paint & paint
Definition: color_source.cc:38

◆ onObjectBoundingBox()

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

Reimplemented from SkSVGNode.

Definition at line 51 of file SkSVGCircle.cpp.

51 {
52 const auto [pos, r] = this->resolve(ctx.lengthContext());
53 return SkRect::MakeXYWH(pos.fX - r, pos.fY - r, 2 * r, 2 * r);
54}
float fX
x-axis value
Definition: SkPoint_impl.h:164
float fY
y-axis value
Definition: SkPoint_impl.h:165
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659

◆ parseAndSetAttribute()

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

Reimplemented from SkSVGNode.

Definition at line 15 of file SkSVGCircle.cpp.

15 {
17 this->setCx(SkSVGAttributeParser::parse<SkSVGLength>("cx", n, v)) ||
18 this->setCy(SkSVGAttributeParser::parse<SkSVGLength>("cy", n, v)) ||
19 this->setR(SkSVGAttributeParser::parse<SkSVGLength>("r", n, v));
20}
virtual bool parseAndSetAttribute(const char *name, const char *value)
Definition: SkSVGNode.cpp:90

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