Skia
2D Graphics Library
SkSVGFeBlend.h
Go to the documentation of this file.
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 
13 
14 class SK_API SkSVGFeBlend : public SkSVGFe {
15 public:
16  enum class Mode {
17  kNormal,
18  kMultiply,
19  kScreen,
20  kDarken,
21  kLighten,
22  };
23 
25 
26  SVG_ATTR(Mode, Mode, Mode::kNormal)
28 
29 protected:
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 
39 private:
41 
42  using INHERITED = SkSVGFe;
43 };
44 
45 #endif // SkSVGFeBlend_DEFINED
@ kLighten
rc = s + d - min(s*da, d*sa), ra = kSrcOver
@ kMultiply
r = s*(1-da) + d*(1-sa) + s*d
@ kScreen
r = s + d - s*d
@ kDarken
rc = s + d - max(s*da, d*sa), ra = kSrcOver
@ kNormal
glyph outlines modified to improve constrast
SkSVGTag
Definition: SkSVGNode.h:23
#define SVG_ATTR(attr_name, attr_type, attr_default)
Definition: SkSVGNode.h:203
Base class for image filters.
Definition: SkImageFilter.h:35
Definition: SkSVGFeBlend.h:14
Mode
Definition: SkSVGFeBlend.h:16
bool parseAndSetAttribute(const char *, const char *) override
static sk_sp< SkSVGFeBlend > Make()
Definition: SkSVGFeBlend.h:24
Definition: SkSVGTypes.h:635
Definition: SkSVGFe.h:18
SkSVGFe(SkSVGTag t)
Definition: SkSVGFe.h:65
Definition: SkSVGFilterContext.h:21
Definition: SkSVGRenderContext.h:61
Definition: SkSVGTransformableNode.h:14
Shared pointer class to wrap classes that support a ref()/unref() interface.
Definition: SkRefCnt.h:220