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

#include <SkSVGFeImage.h>

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

Static Public Member Functions

static sk_sp< SkSVGFeImageMake ()
 
- Static Public Member Functions inherited from SkSVGFe
static bool IsFilterEffect (const sk_sp< SkSVGNode > &node)
 

Protected Member Functions

bool parseAndSetAttribute (const char *, const char *) override
 
sk_sp< SkImageFilteronMakeImageFilter (const SkSVGRenderContext &, const SkSVGFilterContext &) const override
 
std::vector< SkSVGFeInputTypegetInputs () const 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

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

Member Function Documentation

◆ getInputs()

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

Implements SkSVGFe.

Definition at line 27 of file SkSVGFeImage.h.

27{ return {}; }

◆ Make()

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

Definition at line 16 of file SkSVGFeImage.h.

◆ onMakeImageFilter()

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

Implements SkSVGFe.

Definition at line 23 of file SkSVGFeImage.cpp.

24 {
25 // Load image and map viewbox (image bounds) to viewport (filter effects subregion).
26 const SkRect viewport = this->resolveFilterSubregion(ctx, fctx);
27 const auto imgInfo =
28 SkSVGImage::LoadImage(ctx.resourceProvider(), fHref, viewport, fPreserveAspectRatio);
29 if (!imgInfo.fImage) {
30 return nullptr;
31 }
32
33 // Create the image filter mapped according to aspect ratio
34 const SkRect srcRect = SkRect::Make(imgInfo.fImage->bounds());
35 const SkRect& dstRect = imgInfo.fDst;
36 // TODO: image-rendering property
37 auto imgfilt = SkImageFilters::Image(imgInfo.fImage, srcRect, dstRect,
40
41 // Aspect ratio mapping may end up drawing content outside of the filter effects region,
42 // so perform an explicit crop.
43 return SkImageFilters::Merge(&imgfilt, 1, fctx.filterEffectsRegion());
44}
static sk_sp< SkImageFilter > Merge(sk_sp< SkImageFilter > *const filters, int count, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Image(sk_sp< SkImage > image, const SkRect &srcRect, const SkRect &dstRect, const SkSamplingOptions &sampling)
SkRect resolveFilterSubregion(const SkSVGRenderContext &, const SkSVGFilterContext &) const
Definition: SkSVGFe.cpp:54
const SkRect & filterEffectsRegion() const
static ImageInfo LoadImage(const sk_sp< skresources::ResourceProvider > &, const SkSVGIRI &, const SkRect &, SkSVGPreserveAspectRatio)
Definition: SkSVGImage.cpp:57
const sk_sp< skresources::ResourceProvider > & resourceProvider() const
static SkRect Make(const SkISize &size)
Definition: SkRect.h:669

◆ parseAndSetAttribute()

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

Reimplemented from SkSVGFe.

Definition at line 16 of file SkSVGFeImage.cpp.

16 {
18 this->setHref(SkSVGAttributeParser::parse<SkSVGIRI>("xlink:href", n, v)) ||
19 this->setPreserveAspectRatio(SkSVGAttributeParser::parse<SkSVGPreserveAspectRatio>(
20 "preserveAspectRatio", n, v));
21}
bool parseAndSetAttribute(const char *, const char *) override
Definition: SkSVGFe.cpp:93

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