• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 SkSVGFeBlend_DEFINED
9 #define SkSVGFeBlend_DEFINED
10 
11 #include "modules/svg/include/SkSVGFe.h"
12 #include "modules/svg/include/SkSVGTypes.h"
13 
14 class SkSVGFeBlend : public SkSVGFe {
15 public:
16     enum class Mode {
17         kNormal,
18         kMultiply,
19         kScreen,
20         kDarken,
21         kLighten,
22     };
23 
Make()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 
29 protected:
30     sk_sp<SkImageFilter> onMakeImageFilter(const SkSVGRenderContext&,
31                                            const SkSVGFilterContext&) const override;
32 
getInputs()33     std::vector<SkSVGFeInputType> getInputs() const override {
34         return {this->getIn(), this->getIn2()};
35     }
36 
37     bool parseAndSetAttribute(const char*, const char*) override;
38 
39 private:
SkSVGFeBlend()40     SkSVGFeBlend() : INHERITED(SkSVGTag::kFeBlend) {}
41 
42     using INHERITED = SkSVGFe;
43 };
44 
45 #endif  // SkSVGFeBlend_DEFINED
46