blob: df64e75da2834e45965c6a33e44d14463e2c74bf [file] [log] [blame]
Tyler Dennistonb25caae2020-11-09 12:46:02 -05001/*
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
15class SkSVGFeComposite final : public SkSVGFe {
16public:
Tyler Dennistonb25caae2020-11-09 12:46:02 -050017 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
28protected:
29 sk_sp<SkImageFilter> onMakeImageFilter(const SkSVGRenderContext&,
30 const SkSVGFilterContext&) const override;
31
Tyler Denniston62a683e2020-12-11 11:47:55 -050032 std::vector<SkSVGFeInputType> getInputs() const override {
33 return {this->getIn(), this->getIn2()};
34 }
35
Tyler Dennistonb25caae2020-11-09 12:46:02 -050036 bool parseAndSetAttribute(const char*, const char*) override;
37
38private:
39 SkSVGFeComposite() : INHERITED(SkSVGTag::kFeComposite) {}
40
41 static SkBlendMode BlendModeForOperator(SkSVGFeCompositeOperator);
42
43 using INHERITED = SkSVGFe;
44};
45
46#endif // SkSVGFeComposite_DEFINED