Tyler Denniston | df208a3 | 2020-10-30 16:01:54 -0400 | [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 SkSVGFe_DEFINED |
| 9 | #define SkSVGFe_DEFINED |
| 10 | |
| 11 | #include "modules/svg/include/SkSVGHiddenContainer.h" |
| 12 | |
| 13 | class SkImageFilter; |
| 14 | class SkSVGFilterContext; |
| 15 | |
| 16 | class SkSVGFe : public SkSVGHiddenContainer { |
| 17 | public: |
| 18 | ~SkSVGFe() override = default; |
| 19 | |
Tyler Denniston | dada960 | 2020-11-03 10:04:25 -0500 | [diff] [blame] | 20 | static bool IsFilterEffect(const sk_sp<SkSVGNode>& node) { |
Tyler Denniston | b25caae | 2020-11-09 12:46:02 -0500 | [diff] [blame^] | 21 | return node->tag() == SkSVGTag::kFeTurbulence || node->tag() == SkSVGTag::kFeColorMatrix || |
| 22 | node->tag() == SkSVGTag::kFeComposite; |
Tyler Denniston | dada960 | 2020-11-03 10:04:25 -0500 | [diff] [blame] | 23 | } |
Tyler Denniston | df208a3 | 2020-10-30 16:01:54 -0400 | [diff] [blame] | 24 | |
| 25 | sk_sp<SkImageFilter> makeImageFilter(const SkSVGRenderContext& ctx, |
Tyler Denniston | b25caae | 2020-11-09 12:46:02 -0500 | [diff] [blame^] | 26 | const SkSVGFilterContext& fctx) const; |
| 27 | |
| 28 | SVG_ATTR(In, SkSVGFeInputType, SkSVGFeInputType(SkSVGFeInputType::Type::kSourceGraphic)) |
| 29 | SVG_ATTR(Result, SkSVGStringType, SkSVGStringType()) |
Tyler Denniston | df208a3 | 2020-10-30 16:01:54 -0400 | [diff] [blame] | 30 | |
| 31 | protected: |
| 32 | explicit SkSVGFe(SkSVGTag t) : INHERITED(t) {} |
| 33 | |
| 34 | virtual sk_sp<SkImageFilter> onMakeImageFilter(const SkSVGRenderContext&, |
| 35 | const SkSVGFilterContext&) const = 0; |
| 36 | |
Tyler Denniston | b25caae | 2020-11-09 12:46:02 -0500 | [diff] [blame^] | 37 | bool parseAndSetAttribute(const char*, const char*) override; |
| 38 | |
Tyler Denniston | df208a3 | 2020-10-30 16:01:54 -0400 | [diff] [blame] | 39 | private: |
| 40 | using INHERITED = SkSVGHiddenContainer; |
| 41 | }; |
| 42 | |
| 43 | #endif // SkSVGFe_DEFINED |