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 SkSVGFeComposite_DEFINED 9 #define SkSVGFeComposite_DEFINED 10 11 #include "include/core/SkRefCnt.h" 12 #include "include/private/base/SkAPI.h" 13 #include "modules/svg/include/SkSVGFe.h" 14 #include "modules/svg/include/SkSVGNode.h" 15 #include "modules/svg/include/SkSVGTypes.h" 16 17 #include <vector> 18 19 class SkImageFilter; 20 class SkSVGFilterContext; 21 class SkSVGRenderContext; 22 enum class SkBlendMode; 23 24 class SK_API SkSVGFeComposite final : public SkSVGFe { 25 public: Make()26 static sk_sp<SkSVGFeComposite> Make() { 27 return sk_sp<SkSVGFeComposite>(new SkSVGFeComposite()); 28 } 29 30 SVG_ATTR(In2, SkSVGFeInputType, SkSVGFeInputType()) 31 SVG_ATTR(K1, SkSVGNumberType, SkSVGNumberType(0)) 32 SVG_ATTR(K2, SkSVGNumberType, SkSVGNumberType(0)) 33 SVG_ATTR(K3, SkSVGNumberType, SkSVGNumberType(0)) 34 SVG_ATTR(K4, SkSVGNumberType, SkSVGNumberType(0)) 35 SVG_ATTR(Operator, SkSVGFeCompositeOperator, SkSVGFeCompositeOperator::kOver) 36 37 protected: 38 sk_sp<SkImageFilter> onMakeImageFilter(const SkSVGRenderContext&, 39 const SkSVGFilterContext&) const override; 40 getInputs()41 std::vector<SkSVGFeInputType> getInputs() const override { 42 return {this->getIn(), this->getIn2()}; 43 } 44 45 bool parseAndSetAttribute(const char*, const char*) override; 46 47 private: SkSVGFeComposite()48 SkSVGFeComposite() : INHERITED(SkSVGTag::kFeComposite) {} 49 50 static SkBlendMode BlendModeForOperator(SkSVGFeCompositeOperator); 51 52 using INHERITED = SkSVGFe; 53 }; 54 55 #endif // SkSVGFeComposite_DEFINED 56