darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 1 | /* |
zimmermann@webkit.org | 711245f | 2010-08-03 19:39:01 +0000 | [diff] [blame] | 2 | * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 | * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> |
| 4 | * |
| 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. |
| 9 | * |
| 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. |
| 14 | * |
| 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. |
| 19 | */ |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 20 | |
eseidel | 8eddecf | 2007-01-16 00:49:43 +0000 | [diff] [blame] | 21 | #ifndef SVGComponentTransferFunctionElement_h |
| 22 | #define SVGComponentTransferFunctionElement_h |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 23 | |
krit@webkit.org | bfb80bf | 2009-05-28 22:10:29 +0000 | [diff] [blame] | 24 | #if ENABLE(SVG) && ENABLE(FILTERS) |
zimmermann@webkit.org | f08b5ba | 2010-10-30 13:23:55 +0000 | [diff] [blame] | 25 | #include "FEComponentTransfer.h" |
zimmermann@webkit.org | 15de2b8 | 2010-12-02 15:19:03 +0000 | [diff] [blame] | 26 | #include "SVGAnimatedEnumeration.h" |
zimmermann@webkit.org | e5a72c6 | 2010-12-01 16:36:29 +0000 | [diff] [blame] | 27 | #include "SVGAnimatedNumber.h" |
zimmermann@webkit.org | ca9551e | 2010-12-01 15:41:53 +0000 | [diff] [blame] | 28 | #include "SVGAnimatedNumberList.h" |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 29 | |
zimmermann@webkit.org | 057741d | 2008-07-19 15:46:48 +0000 | [diff] [blame] | 30 | namespace WebCore { |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 31 | |
zimmermann@webkit.org | 94630af | 2011-05-18 15:35:36 +0000 | [diff] [blame] | 32 | template<> |
| 33 | struct SVGPropertyTraits<ComponentTransferType> { |
| 34 | static ComponentTransferType highestEnumValue() { return FECOMPONENTTRANSFER_TYPE_GAMMA; } |
| 35 | |
| 36 | static String toString(ComponentTransferType type) |
| 37 | { |
| 38 | switch (type) { |
| 39 | case FECOMPONENTTRANSFER_TYPE_UNKNOWN: |
| 40 | return emptyString(); |
| 41 | case FECOMPONENTTRANSFER_TYPE_IDENTITY: |
| 42 | return "identity"; |
| 43 | case FECOMPONENTTRANSFER_TYPE_TABLE: |
| 44 | return "table"; |
| 45 | case FECOMPONENTTRANSFER_TYPE_DISCRETE: |
| 46 | return "discrete"; |
| 47 | case FECOMPONENTTRANSFER_TYPE_LINEAR: |
| 48 | return "linear"; |
| 49 | case FECOMPONENTTRANSFER_TYPE_GAMMA: |
| 50 | return "gamma"; |
| 51 | } |
| 52 | |
| 53 | ASSERT_NOT_REACHED(); |
| 54 | return emptyString(); |
| 55 | } |
| 56 | |
| 57 | static ComponentTransferType fromString(const String& value) |
| 58 | { |
| 59 | if (value == "identity") |
| 60 | return FECOMPONENTTRANSFER_TYPE_IDENTITY; |
| 61 | if (value == "table") |
| 62 | return FECOMPONENTTRANSFER_TYPE_TABLE; |
| 63 | if (value == "discrete") |
| 64 | return FECOMPONENTTRANSFER_TYPE_DISCRETE; |
| 65 | if (value == "linear") |
| 66 | return FECOMPONENTTRANSFER_TYPE_LINEAR; |
| 67 | if (value == "gamma") |
| 68 | return FECOMPONENTTRANSFER_TYPE_GAMMA; |
| 69 | return FECOMPONENTTRANSFER_TYPE_UNKNOWN; |
| 70 | } |
| 71 | }; |
| 72 | |
zimmermann@webkit.org | e1c7c58 | 2011-07-07 14:18:01 +0000 | [diff] [blame] | 73 | class SVGComponentTransferFunctionElement : public SVGElement { |
| 74 | public: |
| 75 | ComponentTransferFunction transferFunction() const; |
| 76 | |
| 77 | protected: |
| 78 | SVGComponentTransferFunctionElement(const QualifiedName&, Document*); |
| 79 | |
zimmermann@webkit.org | e1c7c58 | 2011-07-07 14:18:01 +0000 | [diff] [blame] | 80 | bool isSupportedAttribute(const QualifiedName&); |
kling@webkit.org | 8a3d4af | 2012-02-06 02:21:57 +0000 | [diff] [blame] | 81 | virtual void parseAttribute(Attribute*) OVERRIDE; |
reni@webkit.org | a0e3174 | 2011-10-13 16:33:19 +0000 | [diff] [blame] | 82 | virtual void svgAttributeChanged(const QualifiedName&); |
zimmermann@webkit.org | e1c7c58 | 2011-07-07 14:18:01 +0000 | [diff] [blame] | 83 | |
| 84 | private: |
zimmermann@webkit.org | a285742 | 2011-07-09 11:26:10 +0000 | [diff] [blame] | 85 | BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGComponentTransferFunctionElement) |
| 86 | DECLARE_ANIMATED_ENUMERATION(Type, type, ComponentTransferType) |
| 87 | DECLARE_ANIMATED_NUMBER_LIST(TableValues, tableValues) |
| 88 | DECLARE_ANIMATED_NUMBER(Slope, slope) |
| 89 | DECLARE_ANIMATED_NUMBER(Intercept, intercept) |
| 90 | DECLARE_ANIMATED_NUMBER(Amplitude, amplitude) |
| 91 | DECLARE_ANIMATED_NUMBER(Exponent, exponent) |
| 92 | DECLARE_ANIMATED_NUMBER(Offset, offset) |
| 93 | END_DECLARE_ANIMATED_PROPERTIES |
zimmermann@webkit.org | e1c7c58 | 2011-07-07 14:18:01 +0000 | [diff] [blame] | 94 | }; |
| 95 | |
weinig | ab5f09e | 2006-07-29 23:15:25 +0000 | [diff] [blame] | 96 | } // namespace WebCore |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 97 | |
krit@webkit.org | bfb80bf | 2009-05-28 22:10:29 +0000 | [diff] [blame] | 98 | #endif // ENABLE(SVG) && ENABLE(FILTERS) |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 99 | #endif |