Flutter Engine
The Flutter Engine
Classes | Protected Member Functions | List of all members
SkSVGFeLighting Class Referenceabstract

#include <SkSVGFeLighting.h>

Inheritance diagram for SkSVGFeLighting:
SkSVGFe SkSVGHiddenContainer SkSVGContainer SkSVGTransformableNode SkSVGNode SkRefCnt SkRefCntBase SkSVGFeDiffuseLighting SkSVGFeSpecularLighting

Classes

struct  KernelUnitLength
 

Protected Member Functions

 SkSVGFeLighting (SkSVGTag t)
 
std::vector< SkSVGFeInputTypegetInputs () const final
 
bool parseAndSetAttribute (const char *, const char *) override
 
sk_sp< SkImageFilteronMakeImageFilter (const SkSVGRenderContext &, const SkSVGFilterContext &) const final
 
virtual sk_sp< SkImageFiltermakeDistantLight (const SkSVGRenderContext &, const SkSVGFilterContext &, const SkSVGFeDistantLight *) const =0
 
virtual sk_sp< SkImageFiltermakePointLight (const SkSVGRenderContext &, const SkSVGFilterContext &, const SkSVGFePointLight *) const =0
 
virtual sk_sp< SkImageFiltermakeSpotLight (const SkSVGRenderContext &, const SkSVGFilterContext &, const SkSVGFeSpotLight *) const =0
 
SkColor resolveLightingColor (const SkSVGRenderContext &) const
 
SkPoint3 resolveXYZ (const SkSVGRenderContext &, const SkSVGFilterContext &, SkSVGNumberType, SkSVGNumberType, SkSVGNumberType) const
 
- 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

- 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 inherited from SkSVGFe
static bool IsFilterEffect (const sk_sp< SkSVGNode > &node)
 
- 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 SkSVGFeLighting.h.

Constructor & Destructor Documentation

◆ SkSVGFeLighting()

SkSVGFeLighting::SkSVGFeLighting ( SkSVGTag  t)
inlineexplicitprotected

Definition at line 29 of file SkSVGFeLighting.h.

29: INHERITED(t) {}

Member Function Documentation

◆ getInputs()

std::vector< SkSVGFeInputType > SkSVGFeLighting::getInputs ( ) const
inlinefinalprotectedvirtual

Implements SkSVGFe.

Definition at line 31 of file SkSVGFeLighting.h.

31{ return {this->getIn()}; }

◆ makeDistantLight()

virtual sk_sp< SkImageFilter > SkSVGFeLighting::makeDistantLight ( const SkSVGRenderContext ,
const SkSVGFilterContext ,
const SkSVGFeDistantLight  
) const
protectedpure virtual

◆ makePointLight()

virtual sk_sp< SkImageFilter > SkSVGFeLighting::makePointLight ( const SkSVGRenderContext ,
const SkSVGFilterContext ,
const SkSVGFePointLight  
) const
protectedpure virtual

◆ makeSpotLight()

virtual sk_sp< SkImageFilter > SkSVGFeLighting::makeSpotLight ( const SkSVGRenderContext ,
const SkSVGFilterContext ,
const SkSVGFeSpotLight  
) const
protectedpure virtual

◆ onMakeImageFilter()

sk_sp< SkImageFilter > SkSVGFeLighting::onMakeImageFilter ( const SkSVGRenderContext ctx,
const SkSVGFilterContext fctx 
) const
finalprotectedvirtual

Implements SkSVGFe.

Definition at line 38 of file SkSVGFeLighting.cpp.

39 {
40 for (const auto& child : fChildren) {
41 switch (child->tag()) {
43 return this->makeDistantLight(
44 ctx, fctx, static_cast<const SkSVGFeDistantLight*>(child.get()));
46 return this->makePointLight(
47 ctx, fctx, static_cast<const SkSVGFePointLight*>(child.get()));
49 return this->makeSpotLight(
50 ctx, fctx, static_cast<const SkSVGFeSpotLight*>(child.get()));
51 default:
52 // Ignore unknown children, such as <desc> elements
53 break;
54 }
55 }
56
57 SkDebugf("lighting filter effect needs exactly one light source\n");
58 return nullptr;
59}
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
@ kFeDistantLight
skia_private::STArray< 1, sk_sp< SkSVGNode >, true > fChildren
virtual sk_sp< SkImageFilter > makePointLight(const SkSVGRenderContext &, const SkSVGFilterContext &, const SkSVGFePointLight *) const =0
virtual sk_sp< SkImageFilter > makeDistantLight(const SkSVGRenderContext &, const SkSVGFilterContext &, const SkSVGFeDistantLight *) const =0
virtual sk_sp< SkImageFilter > makeSpotLight(const SkSVGRenderContext &, const SkSVGFilterContext &, const SkSVGFeSpotLight *) const =0

◆ parseAndSetAttribute()

bool SkSVGFeLighting::parseAndSetAttribute ( const char *  n,
const char *  v 
)
overrideprotectedvirtual

Reimplemented from SkSVGFe.

Reimplemented in SkSVGFeSpecularLighting, and SkSVGFeDiffuseLighting.

Definition at line 17 of file SkSVGFeLighting.cpp.

17 {
19 this->setSurfaceScale(
20 SkSVGAttributeParser::parse<SkSVGNumberType>("surfaceScale", n, v)) ||
21 this->setKernelUnitLength(SkSVGAttributeParser::parse<SkSVGFeLighting::KernelUnitLength>(
22 "kernelUnitLength", n, v));
23}
bool parseAndSetAttribute(const char *, const char *) override
Definition: SkSVGFe.cpp:93

◆ resolveLightingColor()

SkColor SkSVGFeLighting::resolveLightingColor ( const SkSVGRenderContext ctx) const
protected

Definition at line 61 of file SkSVGFeLighting.cpp.

61 {
62 const auto color = this->getLightingColor();
63 if (!color.isValue()) {
64 // Uninherited presentation attributes should have a concrete value by now.
65 SkDebugf("unhandled: lighting-color has no value\n");
66 return SK_ColorWHITE;
67 }
68
69 return ctx.resolveSvgColor(*color);
70}
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
SkSVGColorType resolveSvgColor(const SkSVGColor &) const
DlColor color

◆ resolveXYZ()

SkPoint3 SkSVGFeLighting::resolveXYZ ( const SkSVGRenderContext ctx,
const SkSVGFilterContext fctx,
SkSVGNumberType  x,
SkSVGNumberType  y,
SkSVGNumberType  z 
) const
protected

Definition at line 72 of file SkSVGFeLighting.cpp.

76 {
77 const auto obbt = ctx.transformForCurrentOBB(fctx.primitiveUnits());
78 const auto xy = SkV2{x,y} * obbt.scale + obbt.offset;
79 z = SkSVGLengthContext({obbt.scale.x, obbt.scale.y})
82 return SkPoint3::Make(xy.x, xy.y, z);
83}
const SkSVGObjectBoundingBoxUnits & primitiveUnits() const
OBBTransform transformForCurrentOBB(SkSVGObjectBoundingBoxUnits) const
double y
double x
static SkPoint3 Make(SkScalar x, SkScalar y, SkScalar z)
Definition: SkPoint3.h:18
Definition: SkM44.h:19

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