Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
SkSVGFeDisplacementMap Class Reference

#include <SkSVGFeDisplacementMap.h>

Inheritance diagram for SkSVGFeDisplacementMap:
SkSVGFe SkSVGHiddenContainer SkSVGContainer SkSVGTransformableNode SkSVGNode SkRefCnt SkRefCntBase

Public Types

using ChannelSelector = SkColorChannel
 

Public Member Functions

SkSVGColorspace resolveColorspace (const SkSVGRenderContext &, const SkSVGFilterContext &) const final
 
- Public Member Functions inherited from SkSVGFe
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 sk_sp< SkSVGFeDisplacementMapMake ()
 
- Static Public Member Functions inherited from SkSVGFe
static bool IsFilterEffect (const sk_sp< SkSVGNode > &node)
 

Protected Member Functions

sk_sp< SkImageFilteronMakeImageFilter (const SkSVGRenderContext &, const SkSVGFilterContext &) const override
 
std::vector< SkSVGFeInputTypegetInputs () const override
 
bool parseAndSetAttribute (const char *, const char *) override
 
- Protected Member Functions inherited from SkSVGFe
 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 14 of file SkSVGFeDisplacementMap.h.

Member Typedef Documentation

◆ ChannelSelector

Definition at line 16 of file SkSVGFeDisplacementMap.h.

Member Function Documentation

◆ getInputs()

std::vector< SkSVGFeInputType > SkSVGFeDisplacementMap::getInputs ( ) const
inlineoverrideprotectedvirtual

Implements SkSVGFe.

Definition at line 34 of file SkSVGFeDisplacementMap.h.

34 {
35 return {this->getIn(), this->getIn2()};
36 }

◆ Make()

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

◆ onMakeImageFilter()

sk_sp< SkImageFilter > SkSVGFeDisplacementMap::onMakeImageFilter ( const SkSVGRenderContext ctx,
const SkSVGFilterContext fctx 
) const
overrideprotectedvirtual

Implements SkSVGFe.

Definition at line 27 of file SkSVGFeDisplacementMap.cpp.

28 {
29 const SkRect cropRect = this->resolveFilterSubregion(ctx, fctx);
30 const SkSVGColorspace colorspace = this->resolveColorspace(ctx, fctx);
31
32 // According to spec https://www.w3.org/TR/SVG11/filters.html#feDisplacementMapElement,
33 // the 'in' source image must remain in its current colorspace.
34 sk_sp<SkImageFilter> in = fctx.resolveInput(ctx, this->getIn());
35 sk_sp<SkImageFilter> in2 = fctx.resolveInput(ctx, this->getIn2(), colorspace);
36
37 SkScalar scale = fScale;
39 const auto obbt = ctx.transformForCurrentOBB(fctx.primitiveUnits());
40 scale = SkSVGLengthContext({obbt.scale.x, obbt.scale.y})
43 }
44
46 fXChannelSelector, fYChannelSelector, scale, in2, in, cropRect);
47}
SkSVGColorspace
Definition: SkSVGTypes.h:719
static sk_sp< SkImageFilter > DisplacementMap(SkColorChannel xChannelSelector, SkColorChannel yChannelSelector, SkScalar scale, sk_sp< SkImageFilter > displacement, sk_sp< SkImageFilter > color, const CropRect &cropRect={})
SkSVGColorspace resolveColorspace(const SkSVGRenderContext &, const SkSVGFilterContext &) const final
SkRect resolveFilterSubregion(const SkSVGRenderContext &, const SkSVGFilterContext &) const
Definition: SkSVGFe.cpp:54
sk_sp< SkImageFilter > resolveInput(const SkSVGRenderContext &, const SkSVGFeInputType &) const
const SkSVGObjectBoundingBoxUnits & primitiveUnits() const
OBBTransform transformForCurrentOBB(SkSVGObjectBoundingBoxUnits) const
float SkScalar
Definition: extension.cpp:12
const Scalar scale

◆ parseAndSetAttribute()

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

Reimplemented from SkSVGFe.

Definition at line 15 of file SkSVGFeDisplacementMap.cpp.

15 {
17 this->setIn2(SkSVGAttributeParser::parse<SkSVGFeInputType>("in2", name, value)) ||
18 this->setXChannelSelector(
19 SkSVGAttributeParser::parse<SkSVGFeDisplacementMap::ChannelSelector>(
20 "xChannelSelector", name, value)) ||
21 this->setYChannelSelector(
22 SkSVGAttributeParser::parse<SkSVGFeDisplacementMap::ChannelSelector>(
23 "yChannelSelector", name, value)) ||
24 this->setScale(SkSVGAttributeParser::parse<SkSVGNumberType>("scale", name, value));
25}
bool parseAndSetAttribute(const char *, const char *) override
Definition: SkSVGFe.cpp:93
uint8_t value
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

◆ resolveColorspace()

SkSVGColorspace SkSVGFeDisplacementMap::resolveColorspace ( const SkSVGRenderContext ctx,
const SkSVGFilterContext  
) const
finalvirtual

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 from SkSVGFe.

Definition at line 49 of file SkSVGFeDisplacementMap.cpp.

50 {
51 // According to spec https://www.w3.org/TR/SVG11/filters.html#feDisplacementMapElement,
52 // the 'in' source image must remain in its current colorspace, which means the colorspace of
53 // this FE node is the same as the input.
54 return fctx.resolveInputColorspace(ctx, this->getIn());
55}

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