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

#include <SkSVGRadialGradient.h>

Inheritance diagram for SkSVGRadialGradient:
SkSVGGradient SkSVGHiddenContainer SkSVGContainer SkSVGTransformableNode SkSVGNode SkRefCnt SkRefCntBase

Static Public Member Functions

static sk_sp< SkSVGRadialGradientMake ()
 

Protected Member Functions

bool parseAndSetAttribute (const char *, const char *) override
 
sk_sp< SkShaderonMakeShader (const SkSVGRenderContext &, const SkColor4f *, const SkScalar *, int count, SkTileMode, const SkMatrix &) const override
 
- Protected Member Functions inherited from SkSVGHiddenContainer
 SkSVGHiddenContainer (SkSVGTag t)
 
void onRender (const SkSVGRenderContext &) const final
 
- Protected Member Functions inherited from SkSVGContainer
 SkSVGContainer (SkSVGTag)
 
void onRender (const SkSVGRenderContext &) const override
 
SkPath onAsPath (const SkSVGRenderContext &) const override
 
SkRect onObjectBoundingBox (const SkSVGRenderContext &) const override
 
bool hasChildren () const final
 
template<typename NodeType , typename Func >
void forEachChild (Func func) const
 
- 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 SkSVGGradient
 SVG_ATTR (GradientTransform, SkSVGTransformType, SkSVGTransformType(SkMatrix::I())) SVG_ATTR(GradientUnits
 
 SkSVGObjectBoundingBoxUnits (SkSVGObjectBoundingBoxUnits::Type::kObjectBoundingBox)) protected
 
bool parseAndSetAttribute (const char *, const char *) override
 
bool onAsPaint (const SkSVGRenderContext &, SkPaint *) const final
 
virtual sk_sp< SkShaderonMakeShader (const SkSVGRenderContext &, const SkColor4f *, const SkScalar *, int count, SkTileMode, const SkMatrix &localMatrix) const =0
 
- Public Member Functions inherited from SkSVGContainer
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
 
- Public Attributes inherited from SkSVGGradient
 SkSVGObjectBoundingBoxUnits
 
- Static Protected Member Functions inherited from SkSVGNode
static SkMatrix ComputeViewboxMatrix (const SkRect &, const SkRect &, SkSVGPreserveAspectRatio)
 
- Protected Attributes inherited from SkSVGContainer
skia_private::STArray< 1, sk_sp< SkSVGNode >, truefChildren
 

Detailed Description

Definition at line 14 of file SkSVGRadialGradient.h.

Member Function Documentation

◆ Make()

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

Definition at line 16 of file SkSVGRadialGradient.h.

◆ onMakeShader()

sk_sp< SkShader > SkSVGRadialGradient::onMakeShader ( const SkSVGRenderContext ctx,
const SkColor4f colors,
const SkScalar pos,
int  count,
SkTileMode  tm,
const SkMatrix m 
) const
overrideprotectedvirtual

Implements SkSVGGradient.

Definition at line 25 of file SkSVGRadialGradient.cpp.

28 {
29 const SkSVGLengthContext lctx =
30 this->getGradientUnits().type() == SkSVGObjectBoundingBoxUnits::Type::kObjectBoundingBox
31 ? SkSVGLengthContext({1, 1})
32 : ctx.lengthContext();
33
34 const auto r = lctx.resolve(fR , SkSVGLengthContext::LengthType::kOther);
35 const auto center = SkPoint::Make(
38 const auto focal = SkPoint::Make(
40 : center.x(),
41 fFy.isValid() ? lctx.resolve(*fFy, SkSVGLengthContext::LengthType::kVertical)
42 : center.y());
43
44 if (r == 0) {
45 const auto last_color = count > 0 ? colors[count - 1] : SkColors::kBlack;
46 return SkShaders::Color(last_color, nullptr);
47 }
48
49 return center == focal
50 ? SkGradientShader::MakeRadial(center, r, colors, nullptr, pos, count, tm, 0, &m)
51 : SkGradientShader::MakeTwoPointConical(focal, 0, center, r, colors, nullptr, pos,
52 count, tm, 0, &m);
53}
int count
Definition: FontMgrTest.cpp:50
SkPoint pos
static SkScalar center(float pos0, float pos1)
static sk_sp< SkShader > MakeRadial(const SkPoint &center, SkScalar radius, const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
SkScalar resolve(const SkSVGLength &, LengthType) const
const SkSVGLengthContext & lengthContext() const
constexpr SkColor4f kBlack
Definition: SkColor.h:435
PODArray< SkColor > colors
Definition: SkRecords.h:276
SK_API sk_sp< SkShader > Color(SkColor)
static constexpr SkPoint Make(float x, float y)
Definition: SkPoint_impl.h:173

◆ parseAndSetAttribute()

bool SkSVGRadialGradient::parseAndSetAttribute ( const char *  name,
const char *  value 
)
overrideprotectedvirtual

Reimplemented from SkSVGGradient.

Definition at line 16 of file SkSVGRadialGradient.cpp.

16 {
18 this->setCx(SkSVGAttributeParser::parse<SkSVGLength>("cx", name, value)) ||
19 this->setCy(SkSVGAttributeParser::parse<SkSVGLength>("cy", name, value)) ||
20 this->setR(SkSVGAttributeParser::parse<SkSVGLength>("r", name, value)) ||
21 this->setFx(SkSVGAttributeParser::parse<SkSVGLength>("fx", name, value)) ||
22 this->setFy(SkSVGAttributeParser::parse<SkSVGLength>("fy", name, value));
23}
bool parseAndSetAttribute(const char *, const char *) override
uint8_t value
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

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