1 /* 2 * Copyright 2020 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef SkSVGFeDisplacementMap_DEFINED 9 #define SkSVGFeDisplacementMap_DEFINED 10 11 #include "modules/svg/include/SkSVGFe.h" 12 #include "modules/svg/include/SkSVGTypes.h" 13 14 class SkSVGFeDisplacementMap : public SkSVGFe { 15 public: 16 using ChannelSelector = SkColorChannel; 17 Make()18 static sk_sp<SkSVGFeDisplacementMap> Make() { 19 return sk_sp<SkSVGFeDisplacementMap>(new SkSVGFeDisplacementMap()); 20 } 21 22 SkSVGColorspace resolveColorspace(const SkSVGRenderContext&, 23 const SkSVGFilterContext&) const final; 24 25 SVG_ATTR(In2 , SkSVGFeInputType, SkSVGFeInputType()) 26 SVG_ATTR(XChannelSelector, ChannelSelector , ChannelSelector::kA) 27 SVG_ATTR(YChannelSelector, ChannelSelector , ChannelSelector::kA) 28 SVG_ATTR(Scale , SkSVGNumberType , SkSVGNumberType(0)) 29 30 protected: 31 sk_sp<SkImageFilter> onMakeImageFilter(const SkSVGRenderContext&, 32 const SkSVGFilterContext&) const override; 33 getInputs()34 std::vector<SkSVGFeInputType> getInputs() const override { 35 return {this->getIn(), this->getIn2()}; 36 } 37 38 bool parseAndSetAttribute(const char*, const char*) override; 39 40 private: SkSVGFeDisplacementMap()41 SkSVGFeDisplacementMap() : INHERITED(SkSVGTag::kFeDisplacementMap) {} 42 43 using INHERITED = SkSVGFe; 44 }; 45 46 #endif // SkSVGFeDisplacementMap_DEFINED 47