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 SVGFECompositeElement_h
22 #define SVGFECompositeElement_h
24 #if ENABLE(SVG) && ENABLE(FILTERS)
25 #include "FEComposite.h"
26 #include "SVGAnimatedEnumeration.h"
27 #include "SVGAnimatedNumber.h"
28 #include "SVGFilterPrimitiveStandardAttributes.h"
33 struct SVGPropertyTraits<CompositeOperationType> {
34 static CompositeOperationType highestEnumValue() { return FECOMPOSITE_OPERATOR_ARITHMETIC; }
36 static String toString(CompositeOperationType type)
39 case FECOMPOSITE_OPERATOR_UNKNOWN:
41 case FECOMPOSITE_OPERATOR_OVER:
43 case FECOMPOSITE_OPERATOR_IN:
45 case FECOMPOSITE_OPERATOR_OUT:
47 case FECOMPOSITE_OPERATOR_ATOP:
49 case FECOMPOSITE_OPERATOR_XOR:
51 case FECOMPOSITE_OPERATOR_ARITHMETIC:
59 static CompositeOperationType fromString(const String& value)
62 return FECOMPOSITE_OPERATOR_OVER;
64 return FECOMPOSITE_OPERATOR_IN;
66 return FECOMPOSITE_OPERATOR_OUT;
68 return FECOMPOSITE_OPERATOR_ATOP;
70 return FECOMPOSITE_OPERATOR_XOR;
71 if (value == "arithmetic")
72 return FECOMPOSITE_OPERATOR_ARITHMETIC;
73 return FECOMPOSITE_OPERATOR_UNKNOWN;
77 class SVGFECompositeElement : public SVGFilterPrimitiveStandardAttributes {
79 static PassRefPtr<SVGFECompositeElement> create(const QualifiedName&, Document*);
82 SVGFECompositeElement(const QualifiedName&, Document*);
84 bool isSupportedAttribute(const QualifiedName&);
85 virtual void parseMappedAttribute(Attribute*);
86 virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&);
87 virtual void svgAttributeChanged(const QualifiedName&);
88 virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*);
90 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFECompositeElement)
91 DECLARE_ANIMATED_STRING(In1, in1)
92 DECLARE_ANIMATED_STRING(In2, in2)
93 DECLARE_ANIMATED_ENUMERATION(_operator, _operator, CompositeOperationType)
94 DECLARE_ANIMATED_NUMBER(K1, k1)
95 DECLARE_ANIMATED_NUMBER(K2, k2)
96 DECLARE_ANIMATED_NUMBER(K3, k3)
97 DECLARE_ANIMATED_NUMBER(K4, k4)
98 END_DECLARE_ANIMATED_PROPERTIES
101 } // namespace WebCore
103 #endif // ENABLE(SVG)