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 SkSVGFilter_DEFINED 9 #define SkSVGFilter_DEFINED 10 11 #include "modules/svg/include/SkSVGHiddenContainer.h" 12 #include "modules/svg/include/SkSVGTypes.h" 13 14 class SK_API SkSVGFilter final : public SkSVGHiddenContainer { 15 public: Make()16 static sk_sp<SkSVGFilter> Make() { return sk_sp<SkSVGFilter>(new SkSVGFilter()); } 17 18 /** Propagates any inherited presentation attributes in the given context. */ 19 void applyProperties(SkSVGRenderContext*) const; 20 21 sk_sp<SkImageFilter> buildFilterDAG(const SkSVGRenderContext&) const; 22 23 SVG_ATTR(X, SkSVGLength, SkSVGLength(-10, SkSVGLength::Unit::kPercentage)) 24 SVG_ATTR(Y, SkSVGLength, SkSVGLength(-10, SkSVGLength::Unit::kPercentage)) 25 SVG_ATTR(Width, SkSVGLength, SkSVGLength(120, SkSVGLength::Unit::kPercentage)) 26 SVG_ATTR(Height, SkSVGLength, SkSVGLength(120, SkSVGLength::Unit::kPercentage)) SVG_ATTR(FilterUnits,SkSVGObjectBoundingBoxUnits,SkSVGObjectBoundingBoxUnits (SkSVGObjectBoundingBoxUnits::Type::kObjectBoundingBox))27 SVG_ATTR(FilterUnits, 28 SkSVGObjectBoundingBoxUnits, 29 SkSVGObjectBoundingBoxUnits(SkSVGObjectBoundingBoxUnits::Type::kObjectBoundingBox)) 30 SVG_ATTR(PrimitiveUnits, 31 SkSVGObjectBoundingBoxUnits, 32 SkSVGObjectBoundingBoxUnits(SkSVGObjectBoundingBoxUnits::Type::kUserSpaceOnUse)) 33 34 private: 35 SkSVGFilter() : INHERITED(SkSVGTag::kFilter) {} 36 37 bool parseAndSetAttribute(const char*, const char*) override; 38 39 using INHERITED = SkSVGHiddenContainer; 40 }; 41 42 #endif // SkSVGFilter_DEFINED 43