skia2/modules/svg/include/SkSVGFeComposite.h
Tyler Denniston b25caae788 [svg] Implement feComposite, basic filter result storage
- Plumbing to store filter results by id and resolve them as inputs
  when referenced
- Added implementation of feComposite filter
- Added call to resolve input in feColorMatrix
- Bugfix to SkSVGFilterType operator==

The tests filters-color-01-b and filters-composite-03-b should now be
passing.

Bug: skia:10841
Change-Id: I2cd099c60ac21710f25184806c5cc537656b42af
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/332723
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-11-10 14:00:56 +00:00

44 lines
1.3 KiB
C++

/*
* Copyright 2020 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkSVGFeComposite_DEFINED
#define SkSVGFeComposite_DEFINED
#include "include/core/SkBlendMode.h"
#include "modules/svg/include/SkSVGFe.h"
#include "modules/svg/include/SkSVGTypes.h"
class SkSVGFeComposite final : public SkSVGFe {
public:
~SkSVGFeComposite() override = default;
static sk_sp<SkSVGFeComposite> Make() {
return sk_sp<SkSVGFeComposite>(new SkSVGFeComposite());
}
SVG_ATTR(In2, SkSVGFeInputType, SkSVGFeInputType())
SVG_ATTR(K1, SkSVGNumberType, SkSVGNumberType(0))
SVG_ATTR(K2, SkSVGNumberType, SkSVGNumberType(0))
SVG_ATTR(K3, SkSVGNumberType, SkSVGNumberType(0))
SVG_ATTR(K4, SkSVGNumberType, SkSVGNumberType(0))
SVG_ATTR(Operator, SkSVGFeCompositeOperator, SkSVGFeCompositeOperator::kOver)
protected:
sk_sp<SkImageFilter> onMakeImageFilter(const SkSVGRenderContext&,
const SkSVGFilterContext&) const override;
bool parseAndSetAttribute(const char*, const char*) override;
private:
SkSVGFeComposite() : INHERITED(SkSVGTag::kFeComposite) {}
static SkBlendMode BlendModeForOperator(SkSVGFeCompositeOperator);
using INHERITED = SkSVGFe;
};
#endif // SkSVGFeComposite_DEFINED