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

#include <SkSVGLinearGradient.h>

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

Static Public Member Functions

static sk_sp< SkSVGLinearGradientMake ()
 

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 SkSVGLinearGradient.h.

Member Function Documentation

◆ Make()

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

Definition at line 16 of file SkSVGLinearGradient.h.

◆ onMakeShader()

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

Implements SkSVGGradient.

Definition at line 24 of file SkSVGLinearGradient.cpp.

27 {
28 const SkSVGLengthContext lctx =
29 this->getGradientUnits().type() == SkSVGObjectBoundingBoxUnits::Type::kObjectBoundingBox
30 ? SkSVGLengthContext({1, 1})
31 : ctx.lengthContext();
32
34 const auto y1 = lctx.resolve(fY1, SkSVGLengthContext::LengthType::kVertical);
36 const auto y2 = lctx.resolve(fY2, SkSVGLengthContext::LengthType::kVertical);
37
38 const SkPoint pts[2] = { {x1, y1}, {x2, y2}};
39
40 return SkGradientShader::MakeLinear(pts, colors, nullptr, pos, count, tm, 0, &localMatrix);
41}
int count
Definition: FontMgrTest.cpp:50
SkPoint pos
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], 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
PODArray< SkColor > colors
Definition: SkRecords.h:276

◆ parseAndSetAttribute()

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

Reimplemented from SkSVGGradient.

Definition at line 16 of file SkSVGLinearGradient.cpp.

16 {
18 this->setX1(SkSVGAttributeParser::parse<SkSVGLength>("x1", name, value)) ||
19 this->setY1(SkSVGAttributeParser::parse<SkSVGLength>("y1", name, value)) ||
20 this->setX2(SkSVGAttributeParser::parse<SkSVGLength>("x2", name, value)) ||
21 this->setY2(SkSVGAttributeParser::parse<SkSVGLength>("y2", name, value));
22}
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: