2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
21 #ifndef SVGFEColorMatrixElement_h
22 #define SVGFEColorMatrixElement_h
24 #if ENABLE(SVG) && ENABLE(FILTERS)
25 #include "FEColorMatrix.h"
26 #include "SVGAnimatedEnumeration.h"
27 #include "SVGAnimatedNumberList.h"
28 #include "SVGFilterPrimitiveStandardAttributes.h"
33 struct SVGPropertyTraits<ColorMatrixType> {
34 static ColorMatrixType highestEnumValue() { return FECOLORMATRIX_TYPE_LUMINANCETOALPHA; }
36 static String toString(ColorMatrixType type)
39 case FECOLORMATRIX_TYPE_UNKNOWN:
41 case FECOLORMATRIX_TYPE_MATRIX:
43 case FECOLORMATRIX_TYPE_SATURATE:
45 case FECOLORMATRIX_TYPE_HUEROTATE:
47 case FECOLORMATRIX_TYPE_LUMINANCETOALPHA:
48 return "luminanceToAlpha";
55 static ColorMatrixType fromString(const String& value)
57 if (value == "matrix")
58 return FECOLORMATRIX_TYPE_MATRIX;
59 if (value == "saturate")
60 return FECOLORMATRIX_TYPE_SATURATE;
61 if (value == "hueRotate")
62 return FECOLORMATRIX_TYPE_HUEROTATE;
63 if (value == "luminanceToAlpha")
64 return FECOLORMATRIX_TYPE_LUMINANCETOALPHA;
65 return FECOLORMATRIX_TYPE_UNKNOWN;
69 class SVGFEColorMatrixElement : public SVGFilterPrimitiveStandardAttributes {
71 static PassRefPtr<SVGFEColorMatrixElement> create(const QualifiedName&, Document*);
74 SVGFEColorMatrixElement(const QualifiedName&, Document*);
76 bool isSupportedAttribute(const QualifiedName&);
77 virtual void parseMappedAttribute(Attribute*);
78 virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&);
79 virtual void svgAttributeChanged(const QualifiedName&);
80 virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*);
82 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEColorMatrixElement)
83 DECLARE_ANIMATED_STRING(In1, in1)
84 DECLARE_ANIMATED_ENUMERATION(Type, type, ColorMatrixType)
85 DECLARE_ANIMATED_NUMBER_LIST(Values, values)
86 END_DECLARE_ANIMATED_PROPERTIES
89 } // namespace WebCore