blob: 36d1f0f996dc74f89ebd3b5a079d8977bbcb7f8a [file] [log] [blame]
Tyler Dennistona25e1a32021-01-15 12:38:29 -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 SkSVGFeBlend_DEFINED
9#define SkSVGFeBlend_DEFINED
10
11#include "modules/svg/include/SkSVGFe.h"
12#include "modules/svg/include/SkSVGTypes.h"
13
14class SkSVGFeBlend : public SkSVGFe {
15public:
16 enum class Mode {
17 kNormal,
18 kMultiply,
19 kScreen,
20 kDarken,
21 kLighten,
22 };
23
24 static sk_sp<SkSVGFeBlend> Make() { return sk_sp<SkSVGFeBlend>(new SkSVGFeBlend()); }
25
26 SVG_ATTR(Mode, Mode, Mode::kNormal)
27 SVG_ATTR(In2, SkSVGFeInputType, SkSVGFeInputType())
28
29protected:
30 sk_sp<SkImageFilter> onMakeImageFilter(const SkSVGRenderContext&,
31 const SkSVGFilterContext&) const override;
32
33 std::vector<SkSVGFeInputType> getInputs() const override {
34 return {this->getIn(), this->getIn2()};
35 }
36
37 bool parseAndSetAttribute(const char*, const char*) override;
38
39private:
40 SkSVGFeBlend() : INHERITED(SkSVGTag::kFeBlend) {}
41
42 using INHERITED = SkSVGFe;
43};
44
45#endif // SkSVGFeBlend_DEFINED