2 * Copyright (C) 2004, 2005, 2008 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 SVGComponentTransferFunctionElement_h
22 #define SVGComponentTransferFunctionElement_h
24 #include "core/platform/graphics/filters/FEComponentTransfer.h"
25 #include "core/svg/SVGAnimatedEnumeration.h"
26 #include "core/svg/SVGAnimatedNumber.h"
27 #include "core/svg/SVGAnimatedNumberList.h"
32 struct SVGPropertyTraits<ComponentTransferType> {
33 static unsigned highestEnumValue() { return FECOMPONENTTRANSFER_TYPE_GAMMA; }
35 static String toString(ComponentTransferType type)
38 case FECOMPONENTTRANSFER_TYPE_UNKNOWN:
40 case FECOMPONENTTRANSFER_TYPE_IDENTITY:
42 case FECOMPONENTTRANSFER_TYPE_TABLE:
44 case FECOMPONENTTRANSFER_TYPE_DISCRETE:
46 case FECOMPONENTTRANSFER_TYPE_LINEAR:
48 case FECOMPONENTTRANSFER_TYPE_GAMMA:
56 static ComponentTransferType fromString(const String& value)
58 if (value == "identity")
59 return FECOMPONENTTRANSFER_TYPE_IDENTITY;
61 return FECOMPONENTTRANSFER_TYPE_TABLE;
62 if (value == "discrete")
63 return FECOMPONENTTRANSFER_TYPE_DISCRETE;
64 if (value == "linear")
65 return FECOMPONENTTRANSFER_TYPE_LINEAR;
67 return FECOMPONENTTRANSFER_TYPE_GAMMA;
68 return FECOMPONENTTRANSFER_TYPE_UNKNOWN;
72 class SVGComponentTransferFunctionElement : public SVGElement {
74 ComponentTransferFunction transferFunction() const;
77 SVGComponentTransferFunctionElement(const QualifiedName&, Document&);
79 bool isSupportedAttribute(const QualifiedName&);
80 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
81 virtual void svgAttributeChanged(const QualifiedName&);
83 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; }
86 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGComponentTransferFunctionElement)
87 DECLARE_ANIMATED_ENUMERATION(Type, type, ComponentTransferType)
88 DECLARE_ANIMATED_NUMBER_LIST(TableValues, tableValues)
89 DECLARE_ANIMATED_NUMBER(Slope, slope)
90 DECLARE_ANIMATED_NUMBER(Intercept, intercept)
91 DECLARE_ANIMATED_NUMBER(Amplitude, amplitude)
92 DECLARE_ANIMATED_NUMBER(Exponent, exponent)
93 DECLARE_ANIMATED_NUMBER(Offset, offset)
94 END_DECLARE_ANIMATED_PROPERTIES
97 } // namespace WebCore