Tyler Denniston | b25caae | 2020-11-09 12:46:02 -0500 | [diff] [blame] | 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/SkBlendMode.h" |
| 12 | #include "modules/svg/include/SkSVGFe.h" |
| 13 | #include "modules/svg/include/SkSVGTypes.h" |
| 14 | |
| 15 | class SkSVGFeComposite final : public SkSVGFe { |
| 16 | public: |
Tyler Denniston | b25caae | 2020-11-09 12:46:02 -0500 | [diff] [blame] | 17 | static sk_sp<SkSVGFeComposite> Make() { |
| 18 | return sk_sp<SkSVGFeComposite>(new SkSVGFeComposite()); |
| 19 | } |
| 20 | |
| 21 | SVG_ATTR(In2, SkSVGFeInputType, SkSVGFeInputType()) |
| 22 | SVG_ATTR(K1, SkSVGNumberType, SkSVGNumberType(0)) |
| 23 | SVG_ATTR(K2, SkSVGNumberType, SkSVGNumberType(0)) |
| 24 | SVG_ATTR(K3, SkSVGNumberType, SkSVGNumberType(0)) |
| 25 | SVG_ATTR(K4, SkSVGNumberType, SkSVGNumberType(0)) |
| 26 | SVG_ATTR(Operator, SkSVGFeCompositeOperator, SkSVGFeCompositeOperator::kOver) |
| 27 | |
| 28 | protected: |
| 29 | sk_sp<SkImageFilter> onMakeImageFilter(const SkSVGRenderContext&, |
| 30 | const SkSVGFilterContext&) const override; |
| 31 | |
Tyler Denniston | 62a683e | 2020-12-11 11:47:55 -0500 | [diff] [blame] | 32 | std::vector<SkSVGFeInputType> getInputs() const override { |
| 33 | return {this->getIn(), this->getIn2()}; |
| 34 | } |
| 35 | |
Tyler Denniston | b25caae | 2020-11-09 12:46:02 -0500 | [diff] [blame] | 36 | bool parseAndSetAttribute(const char*, const char*) override; |
| 37 | |
| 38 | private: |
| 39 | SkSVGFeComposite() : INHERITED(SkSVGTag::kFeComposite) {} |
| 40 | |
| 41 | static SkBlendMode BlendModeForOperator(SkSVGFeCompositeOperator); |
| 42 | |
| 43 | using INHERITED = SkSVGFe; |
| 44 | }; |
| 45 | |
| 46 | #endif // SkSVGFeComposite_DEFINED |