SVGFEConvolveMatrixElement.h (4267B)
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_SVGFECONVOLVEMATRIXELEMENT_H_ 8 #define DOM_SVG_SVGFECONVOLVEMATRIXELEMENT_H_ 9 10 #include "SVGAnimatedBoolean.h" 11 #include "SVGAnimatedEnumeration.h" 12 #include "SVGAnimatedInteger.h" 13 #include "SVGAnimatedIntegerPair.h" 14 #include "SVGAnimatedNumber.h" 15 #include "SVGAnimatedNumberList.h" 16 #include "SVGAnimatedString.h" 17 #include "mozilla/dom/SVGFilters.h" 18 19 nsresult NS_NewSVGFEConvolveMatrixElement( 20 nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo); 21 22 namespace mozilla::dom { 23 class DOMSVGAnimatedNumberList; 24 class DOMSVGAnimatedBoolean; 25 26 using SVGFEConvolveMatrixElementBase = SVGFilterPrimitiveElement; 27 28 class SVGFEConvolveMatrixElement final : public SVGFEConvolveMatrixElementBase { 29 friend nsresult(::NS_NewSVGFEConvolveMatrixElement( 30 nsIContent** aResult, 31 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)); 32 33 protected: 34 explicit SVGFEConvolveMatrixElement( 35 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) 36 : SVGFEConvolveMatrixElementBase(std::move(aNodeInfo)) {} 37 JSObject* WrapNode(JSContext* aCx, 38 JS::Handle<JSObject*> aGivenProto) override; 39 40 public: 41 FilterPrimitiveDescription GetPrimitiveDescription( 42 SVGFilterInstance* aInstance, const IntRect& aFilterSubregion, 43 const nsTArray<bool>& aInputsAreTainted, 44 nsTArray<RefPtr<SourceSurface>>& aInputImages) override; 45 bool AttributeAffectsRendering(int32_t aNameSpaceID, 46 nsAtom* aAttribute) const override; 47 SVGAnimatedString& GetResultImageName() override { 48 return mStringAttributes[RESULT]; 49 } 50 void GetSourceImageNames(nsTArray<SVGStringInfo>& aSources) override; 51 52 nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override; 53 54 nsresult BindToTree(BindContext& aCtx, nsINode& aParent) override; 55 56 // WebIDL 57 already_AddRefed<DOMSVGAnimatedString> In1(); 58 already_AddRefed<DOMSVGAnimatedInteger> OrderX(); 59 already_AddRefed<DOMSVGAnimatedInteger> OrderY(); 60 already_AddRefed<DOMSVGAnimatedNumberList> KernelMatrix(); 61 already_AddRefed<DOMSVGAnimatedInteger> TargetX(); 62 already_AddRefed<DOMSVGAnimatedInteger> TargetY(); 63 already_AddRefed<DOMSVGAnimatedEnumeration> EdgeMode(); 64 already_AddRefed<DOMSVGAnimatedBoolean> PreserveAlpha(); 65 already_AddRefed<DOMSVGAnimatedNumber> Divisor(); 66 already_AddRefed<DOMSVGAnimatedNumber> Bias(); 67 already_AddRefed<DOMSVGAnimatedNumber> KernelUnitLengthX(); 68 already_AddRefed<DOMSVGAnimatedNumber> KernelUnitLengthY(); 69 70 protected: 71 NumberAttributesInfo GetNumberInfo() override; 72 NumberPairAttributesInfo GetNumberPairInfo() override; 73 IntegerAttributesInfo GetIntegerInfo() override; 74 IntegerPairAttributesInfo GetIntegerPairInfo() override; 75 BooleanAttributesInfo GetBooleanInfo() override; 76 EnumAttributesInfo GetEnumInfo() override; 77 StringAttributesInfo GetStringInfo() override; 78 NumberListAttributesInfo GetNumberListInfo() override; 79 80 enum { DIVISOR, BIAS }; 81 SVGAnimatedNumber mNumberAttributes[2]; 82 static NumberInfo sNumberInfo[2]; 83 84 enum { KERNEL_UNIT_LENGTH }; 85 SVGAnimatedNumberPair mNumberPairAttributes[1]; 86 static NumberPairInfo sNumberPairInfo[1]; 87 88 enum { TARGET_X, TARGET_Y }; 89 SVGAnimatedInteger mIntegerAttributes[2]; 90 static IntegerInfo sIntegerInfo[2]; 91 92 enum { ORDER }; 93 SVGAnimatedIntegerPair mIntegerPairAttributes[1]; 94 static IntegerPairInfo sIntegerPairInfo[1]; 95 96 enum { PRESERVEALPHA }; 97 SVGAnimatedBoolean mBooleanAttributes[1]; 98 static BooleanInfo sBooleanInfo[1]; 99 100 enum { EDGEMODE }; 101 SVGAnimatedEnumeration mEnumAttributes[1]; 102 static SVGEnumMapping sEdgeModeMap[]; 103 static EnumInfo sEnumInfo[1]; 104 105 enum { RESULT, IN1 }; 106 SVGAnimatedString mStringAttributes[2]; 107 static StringInfo sStringInfo[2]; 108 109 enum { KERNELMATRIX }; 110 SVGAnimatedNumberList mNumberListAttributes[1]; 111 static NumberListInfo sNumberListInfo[1]; 112 }; 113 114 } // namespace mozilla::dom 115 116 #endif // DOM_SVG_SVGFECONVOLVEMATRIXELEMENT_H_