SVGFEGaussianBlurElement.h (2561B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef DOM_SVG_SVGFEGAUSSIANBLURELEMENT_H_ 8 #define DOM_SVG_SVGFEGAUSSIANBLURELEMENT_H_ 9 10 #include "SVGAnimatedNumberPair.h" 11 #include "SVGAnimatedString.h" 12 #include "mozilla/dom/SVGFilters.h" 13 14 nsresult NS_NewSVGFEGaussianBlurElement( 15 nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo); 16 17 namespace mozilla::dom { 18 19 using SVGFEGaussianBlurElementBase = SVGFilterPrimitiveElement; 20 21 class SVGFEGaussianBlurElement final : public SVGFEGaussianBlurElementBase { 22 friend nsresult(::NS_NewSVGFEGaussianBlurElement( 23 nsIContent** aResult, 24 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)); 25 26 protected: 27 explicit SVGFEGaussianBlurElement( 28 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) 29 : SVGFEGaussianBlurElementBase(std::move(aNodeInfo)) {} 30 JSObject* WrapNode(JSContext* aCx, 31 JS::Handle<JSObject*> aGivenProto) override; 32 33 public: 34 FilterPrimitiveDescription GetPrimitiveDescription( 35 SVGFilterInstance* aInstance, const IntRect& aFilterSubregion, 36 const nsTArray<bool>& aInputsAreTainted, 37 nsTArray<RefPtr<SourceSurface>>& aInputImages) override; 38 bool AttributeAffectsRendering(int32_t aNameSpaceID, 39 nsAtom* aAttribute) const override; 40 SVGAnimatedString& GetResultImageName() override { 41 return mStringAttributes[RESULT]; 42 } 43 void GetSourceImageNames(nsTArray<SVGStringInfo>& aSources) override; 44 45 nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override; 46 47 nsresult BindToTree(BindContext& aCtx, nsINode& aParent) override; 48 49 // WebIDL 50 already_AddRefed<DOMSVGAnimatedString> In1(); 51 already_AddRefed<DOMSVGAnimatedNumber> StdDeviationX(); 52 already_AddRefed<DOMSVGAnimatedNumber> StdDeviationY(); 53 void SetStdDeviation(float stdDeviationX, float stdDeviationY); 54 55 protected: 56 NumberPairAttributesInfo GetNumberPairInfo() override; 57 StringAttributesInfo GetStringInfo() override; 58 59 enum { STD_DEV }; 60 SVGAnimatedNumberPair mNumberPairAttributes[1]; 61 static NumberPairInfo sNumberPairInfo[1]; 62 63 enum { RESULT, IN1 }; 64 SVGAnimatedString mStringAttributes[2]; 65 static StringInfo sStringInfo[2]; 66 }; 67 68 } // namespace mozilla::dom 69 70 #endif // DOM_SVG_SVGFEGAUSSIANBLURELEMENT_H_