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

#include <SkSVGFe.h>

Inheritance diagram for SkSVGFe:
SkSVGHiddenContainer SkSVGContainer SkSVGTransformableNode SkSVGNode SkRefCnt SkRefCntBase SkSVGFeBlend SkSVGFeColorMatrix SkSVGFeComponentTransfer SkSVGFeComposite SkSVGFeDisplacementMap SkSVGFeFlood SkSVGFeGaussianBlur SkSVGFeImage SkSVGFeLighting SkSVGFeMerge SkSVGFeMorphology SkSVGFeOffset SkSVGFeTurbulence

Public Member Functions

sk_sp< SkImageFiltermakeImageFilter (const SkSVGRenderContext &ctx, const SkSVGFilterContext &fctx) const
 
SkRect resolveFilterSubregion (const SkSVGRenderContext &, const SkSVGFilterContext &) const
 
virtual SkSVGColorspace resolveColorspace (const SkSVGRenderContext &, const SkSVGFilterContext &) const
 
void applyProperties (SkSVGRenderContext *) const
 
- 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 bool IsFilterEffect (const sk_sp< SkSVGNode > &node)
 

Protected Member Functions

 SkSVGFe (SkSVGTag t)
 
virtual sk_sp< SkImageFilteronMakeImageFilter (const SkSVGRenderContext &, const SkSVGFilterContext &) const =0
 
virtual std::vector< SkSVGFeInputTypegetInputs () const =0
 
bool parseAndSetAttribute (const char *, const char *) 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

- 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 18 of file SkSVGFe.h.

Constructor & Destructor Documentation

◆ SkSVGFe()

SkSVGFe::SkSVGFe ( SkSVGTag  t)
inlineexplicitprotected

Definition at line 67 of file SkSVGFe.h.

67: INHERITED(t) {}

Member Function Documentation

◆ applyProperties()

void SkSVGFe::applyProperties ( SkSVGRenderContext ctx) const

Propagates any inherited presentation attributes in the given context.

Definition at line 91 of file SkSVGFe.cpp.

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

◆ getInputs()

virtual std::vector< SkSVGFeInputType > SkSVGFe::getInputs ( ) const
protectedpure virtual

◆ IsFilterEffect()

static bool SkSVGFe::IsFilterEffect ( const sk_sp< SkSVGNode > &  node)
inlinestatic

Definition at line 20 of file SkSVGFe.h.

20 {
21 switch (node->tag()) {
36 return true;
37 default:
38 return false;
39 }
40 }
@ kFeColorMatrix
@ kFeSpecularLighting
@ kFeDisplacementMap
@ kFeGaussianBlur
@ kFeDiffuseLighting
@ kFeComponentTransfer
SkSVGTag tag() const
Definition: SkSVGNode.h:106

◆ makeImageFilter()

sk_sp< SkImageFilter > SkSVGFe::makeImageFilter ( const SkSVGRenderContext ctx,
const SkSVGFilterContext fctx 
) const

Definition at line 14 of file SkSVGFe.cpp.

15 {
16 return this->onMakeImageFilter(ctx, fctx);
17}
virtual sk_sp< SkImageFilter > onMakeImageFilter(const SkSVGRenderContext &, const SkSVGFilterContext &) const =0

◆ onMakeImageFilter()

virtual sk_sp< SkImageFilter > SkSVGFe::onMakeImageFilter ( const SkSVGRenderContext ,
const SkSVGFilterContext  
) const
protectedpure virtual

◆ parseAndSetAttribute()

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

Reimplemented from SkSVGNode.

Reimplemented in SkSVGFeBlend, SkSVGFeColorMatrix, SkSVGFeComposite, SkSVGFeDisplacementMap, SkSVGFeGaussianBlur, SkSVGFeImage, SkSVGFeLighting, SkSVGFeSpecularLighting, SkSVGFeDiffuseLighting, SkSVGFeMorphology, SkSVGFeOffset, and SkSVGFeTurbulence.

Definition at line 93 of file SkSVGFe.cpp.

93 {
95 this->setIn(SkSVGAttributeParser::parse<SkSVGFeInputType>("in", name, value)) ||
96 this->setResult(SkSVGAttributeParser::parse<SkSVGStringType>("result", name, value)) ||
97 this->setX(SkSVGAttributeParser::parse<SkSVGLength>("x", name, value)) ||
98 this->setY(SkSVGAttributeParser::parse<SkSVGLength>("y", name, value)) ||
99 this->setWidth(SkSVGAttributeParser::parse<SkSVGLength>("width", name, value)) ||
100 this->setHeight(SkSVGAttributeParser::parse<SkSVGLength>("height", name, value));
101}
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

◆ resolveColorspace()

SkSVGColorspace SkSVGFe::resolveColorspace ( const SkSVGRenderContext ctx,
const SkSVGFilterContext  
) const
virtual

Resolves the colorspace within which this filter effect should be applied. Spec: https://www.w3.org/TR/SVG11/painting.html#ColorInterpolationProperties 'color-interpolation-filters' property.

Reimplemented in SkSVGFeDisplacementMap.

Definition at line 84 of file SkSVGFe.cpp.

85 {
86 constexpr SkSVGColorspace kDefaultCS = SkSVGColorspace::kSRGB;
88 return cs == SkSVGColorspace::kAuto ? kDefaultCS : cs;
89}
SkSVGColorspace
Definition: SkSVGTypes.h:719
const SkSVGPresentationContext & presentationContext() const
SkSVGProperty< SkSVGColorspace, true > fColorInterpolationFilters
SkSVGPresentationAttributes fInherited

◆ resolveFilterSubregion()

SkRect SkSVGFe::resolveFilterSubregion ( const SkSVGRenderContext ctx,
const SkSVGFilterContext fctx 
) const

Definition at line 54 of file SkSVGFe.cpp.

55 {
56 // From https://www.w3.org/TR/SVG11/filters.html#FilterPrimitiveSubRegion,
57 // the default filter effect subregion is equal to the union of the subregions defined
58 // for all "referenced nodes" (filter effect inputs). If there are no inputs, the
59 // default subregion is equal to the filter effects region
60 // (https://www.w3.org/TR/SVG11/filters.html#FilterEffectsRegion).
61 const std::vector<SkSVGFeInputType> inputs = this->getInputs();
62 SkRect defaultSubregion;
63 if (inputs.empty() || AnyIsStandardInput(fctx, inputs)) {
64 defaultSubregion = fctx.filterEffectsRegion();
65 } else {
66 defaultSubregion = fctx.filterPrimitiveSubregion(inputs[0]);
67 for (size_t i = 1; i < inputs.size(); i++) {
68 defaultSubregion.join(fctx.filterPrimitiveSubregion(inputs[i]));
69 }
70 }
71
72 // Next resolve the rect specified by the x, y, width, height attributes on this filter effect.
73 // If those attributes were given, they override the corresponding attribute of the default
74 // filter effect subregion calculated above.
75 const SkRect boundaries = this->resolveBoundaries(ctx, fctx);
76
77 // Compute and return the fully resolved subregion.
78 return SkRect::MakeXYWH(fX.isValid() ? boundaries.fLeft : defaultSubregion.fLeft,
79 fY.isValid() ? boundaries.fTop : defaultSubregion.fTop,
80 fWidth.isValid() ? boundaries.width() : defaultSubregion.width(),
81 fHeight.isValid() ? boundaries.height() : defaultSubregion.height());
82}
static bool AnyIsStandardInput(const SkSVGFilterContext &fctx, const std::vector< SkSVGFeInputType > &inputs)
Definition: SkSVGFe.cpp:29
virtual std::vector< SkSVGFeInputType > getInputs() const =0
const SkRect & filterEffectsRegion() const
const SkRect & filterPrimitiveSubregion(const SkSVGFeInputType &) const
SkScalar fLeft
smaller x-axis bounds
Definition: extension.cpp:14
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659
constexpr float height() const
Definition: SkRect.h:769
constexpr float width() const
Definition: SkRect.h:762
void join(const SkRect &r)
Definition: SkRect.cpp:126
SkScalar fTop
smaller y-axis bounds
Definition: extension.cpp:15

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