2 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
20 #ifndef SVGFEConvolveMatrixElement_h
21 #define SVGFEConvolveMatrixElement_h
23 #if ENABLE(SVG) && ENABLE(FILTERS)
24 #include "FEConvolveMatrix.h"
25 #include "SVGAnimatedBoolean.h"
26 #include "SVGAnimatedEnumeration.h"
27 #include "SVGAnimatedInteger.h"
28 #include "SVGAnimatedNumber.h"
29 #include "SVGAnimatedNumberList.h"
30 #include "SVGFilterPrimitiveStandardAttributes.h"
35 struct SVGPropertyTraits<EdgeModeType> {
36 static EdgeModeType highestEnumValue() { return EDGEMODE_NONE; }
38 static String toString(EdgeModeType type)
41 case EDGEMODE_UNKNOWN:
43 case EDGEMODE_DUPLICATE:
55 static EdgeModeType fromString(const String& value)
57 if (value == "duplicate")
58 return EDGEMODE_DUPLICATE;
63 return EDGEMODE_UNKNOWN;
67 class SVGFEConvolveMatrixElement : public SVGFilterPrimitiveStandardAttributes {
69 static PassRefPtr<SVGFEConvolveMatrixElement> create(const QualifiedName&, Document*);
71 void setOrder(float orderX, float orderY);
72 void setKernelUnitLength(float kernelUnitLengthX, float kernelUnitLengthY);
75 SVGFEConvolveMatrixElement(const QualifiedName&, Document*);
77 bool isSupportedAttribute(const QualifiedName&);
78 virtual void parseMappedAttribute(Attribute*);
79 virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&);
80 virtual void svgAttributeChanged(const QualifiedName&);
81 virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*);
83 static const AtomicString& orderXIdentifier();
84 static const AtomicString& orderYIdentifier();
85 static const AtomicString& kernelUnitLengthXIdentifier();
86 static const AtomicString& kernelUnitLengthYIdentifier();
88 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEConvolveMatrixElement)
89 DECLARE_ANIMATED_STRING(In1, in1)
90 DECLARE_ANIMATED_INTEGER(OrderX, orderX)
91 DECLARE_ANIMATED_INTEGER(OrderY, orderY)
92 DECLARE_ANIMATED_NUMBER_LIST(KernelMatrix, kernelMatrix)
93 DECLARE_ANIMATED_NUMBER(Divisor, divisor)
94 DECLARE_ANIMATED_NUMBER(Bias, bias)
95 DECLARE_ANIMATED_INTEGER(TargetX, targetX)
96 DECLARE_ANIMATED_INTEGER(TargetY, targetY)
97 DECLARE_ANIMATED_ENUMERATION(EdgeMode, edgeMode, EdgeModeType)
98 DECLARE_ANIMATED_NUMBER(KernelUnitLengthX, kernelUnitLengthX)
99 DECLARE_ANIMATED_NUMBER(KernelUnitLengthY, kernelUnitLengthY)
100 DECLARE_ANIMATED_BOOLEAN(PreserveAlpha, preserveAlpha)
101 END_DECLARE_ANIMATED_PROPERTIES
104 } // namespace WebCore
106 #endif // ENABLE(SVG)