Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
SkSVGFilter Class Referencefinal

#include <SkSVGFilter.h>

Inheritance diagram for SkSVGFilter:
SkSVGHiddenContainer SkSVGContainer SkSVGTransformableNode SkSVGNode SkRefCnt SkRefCntBase

Public Types

using INHERITED = SkSVGHiddenContainer
 

Public Member Functions

void applyProperties (SkSVGRenderContext *) const
 
sk_sp< SkImageFilterbuildFilterDAG (const SkSVGRenderContext &) const
 
 SVG_ATTR (FilterUnits, SkSVGObjectBoundingBoxUnits, SkSVGObjectBoundingBoxUnits(SkSVGObjectBoundingBoxUnits::Type::kObjectBoundingBox)) SVG_ATTR(PrimitiveUnits
 
 SkSVGObjectBoundingBoxUnits (SkSVGObjectBoundingBoxUnits::Type::kUserSpaceOnUse)) private
 
bool parseAndSetAttribute (const char *, const char *) override
 
- 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
 

Static Public Member Functions

static sk_sp< SkSVGFilterMake ()
 

Public Attributes

 SkSVGObjectBoundingBoxUnits
 

Additional Inherited Members

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

Member Typedef Documentation

◆ INHERITED

Definition at line 39 of file SkSVGFilter.h.

Member Function Documentation

◆ applyProperties()

void SkSVGFilter::applyProperties ( SkSVGRenderContext ctx) const

Propagates any inherited presentation attributes in the given context.

Definition at line 28 of file SkSVGFilter.cpp.

28{ this->onPrepareToRender(ctx); }
bool onPrepareToRender(SkSVGRenderContext *) const override

◆ buildFilterDAG()

sk_sp< SkImageFilter > SkSVGFilter::buildFilterDAG ( const SkSVGRenderContext ctx) const

Definition at line 30 of file SkSVGFilter.cpp.

30 {
32 SkSVGFilterContext fctx(ctx.resolveOBBRect(fX, fY, fWidth, fHeight, fFilterUnits),
33 fPrimitiveUnits);
34 SkSVGRenderContext localCtx(ctx);
35 this->applyProperties(&localCtx);
37 for (const auto& child : fChildren) {
38 if (!SkSVGFe::IsFilterEffect(child)) {
39 continue;
40 }
41
42 const auto& feNode = static_cast<const SkSVGFe&>(*child);
43 const auto& feResultType = feNode.getResult();
44
45 // Propagate any inherited properties that may impact filter effect behavior (e.g.
46 // color-interpolation-filters). We call this explicitly here because the SkSVGFe
47 // nodes do not participate in the normal onRender path, which is when property
48 // propagation currently occurs.
49 SkSVGRenderContext localChildCtx(localCtx);
50 feNode.applyProperties(&localChildCtx);
51
52 const SkRect filterSubregion = feNode.resolveFilterSubregion(localChildCtx, fctx);
53 cs = feNode.resolveColorspace(localChildCtx, fctx);
54 filter = feNode.makeImageFilter(localChildCtx, fctx);
55
56 if (!feResultType.isEmpty()) {
57 fctx.registerResult(feResultType, filter, filterSubregion, cs);
58 }
59
60 // Unspecified 'in' and 'in2' inputs implicitly resolve to the previous filter's result.
61 fctx.setPreviousResult(filter, filterSubregion, cs);
62 }
63
64 // Convert to final destination colorspace
65 if (cs != SkSVGColorspace::kSRGB) {
67 }
68
69 return filter;
70}
SkSVGColorspace
Definition: SkSVGTypes.h:719
static sk_sp< SkColorFilter > LinearToSRGBGamma()
static sk_sp< SkImageFilter > ColorFilter(sk_sp< SkColorFilter > cf, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
skia_private::STArray< 1, sk_sp< SkSVGNode >, true > fChildren
static bool IsFilterEffect(const sk_sp< SkSVGNode > &node)
Definition: SkSVGFe.h:20
void applyProperties(SkSVGRenderContext *) const
Definition: SkSVGFilter.cpp:28
SkRect resolveOBBRect(const SkSVGLength &x, const SkSVGLength &y, const SkSVGLength &w, const SkSVGLength &h, SkSVGObjectBoundingBoxUnits) const

◆ Make()

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

Definition at line 16 of file SkSVGFilter.h.

◆ parseAndSetAttribute()

bool SkSVGFilter::parseAndSetAttribute ( const char *  name,
const char *  value 
)
overridevirtual

Reimplemented from SkSVGNode.

Definition at line 16 of file SkSVGFilter.cpp.

16 {
18 this->setX(SkSVGAttributeParser::parse<SkSVGLength>("x", name, value)) ||
19 this->setY(SkSVGAttributeParser::parse<SkSVGLength>("y", name, value)) ||
20 this->setWidth(SkSVGAttributeParser::parse<SkSVGLength>("width", name, value)) ||
21 this->setHeight(SkSVGAttributeParser::parse<SkSVGLength>("height", name, value)) ||
22 this->setFilterUnits(SkSVGAttributeParser::parse<SkSVGObjectBoundingBoxUnits>(
23 "filterUnits", name, value)) ||
24 this->setPrimitiveUnits(SkSVGAttributeParser::parse<SkSVGObjectBoundingBoxUnits>(
25 "primitiveUnits", name, value));
26}
virtual bool parseAndSetAttribute(const char *name, const char *value)
Definition: SkSVGNode.cpp:90
uint8_t value
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

◆ SkSVGObjectBoundingBoxUnits()

SkSVGFilter::SkSVGObjectBoundingBoxUnits ( SkSVGObjectBoundingBoxUnits::Type::kUserSpaceOnUse  )
inline

Definition at line 32 of file SkSVGFilter.h.

34 :
SkSVGTag
Definition: SkSVGNode.h:23
SkSVGHiddenContainer INHERITED
Definition: SkSVGFilter.h:39

◆ SVG_ATTR()

Member Data Documentation

◆ SkSVGObjectBoundingBoxUnits

SkSVGFilter::SkSVGObjectBoundingBoxUnits

Definition at line 31 of file SkSVGFilter.h.


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