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) 2006 Oliver Hunt <oliver@nerget.com> |
| 3 | * |
| 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. |
| 8 | * |
| 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. |
| 13 | * |
| 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. |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 18 | */ |
| 19 | |
eseidel | 8eddecf | 2007-01-16 00:49:43 +0000 | [diff] [blame] | 20 | #ifndef SVGFEDisplacementMapElement_h |
| 21 | #define SVGFEDisplacementMapElement_h |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 22 | |
krit@webkit.org | a64eca0 | 2010-09-22 07:42:12 +0000 | [diff] [blame] | 23 | #include "FEDisplacementMap.h" |
zimmermann@webkit.org | 15de2b8 | 2010-12-02 15:19:03 +0000 | [diff] [blame] | 24 | #include "SVGAnimatedEnumeration.h" |
zimmermann@webkit.org | e5a72c6 | 2010-12-01 16:36:29 +0000 | [diff] [blame] | 25 | #include "SVGAnimatedNumber.h" |
rwlbuis | 7998312 | 2006-10-09 07:40:41 +0000 | [diff] [blame] | 26 | #include "SVGFilterPrimitiveStandardAttributes.h" |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 27 | |
darin | d18e72a | 2006-03-21 01:15:36 +0000 | [diff] [blame] | 28 | namespace WebCore { |
zimmermann@webkit.org | e1c7c58 | 2011-07-07 14:18:01 +0000 | [diff] [blame] | 29 | |
zimmermann@webkit.org | 94630af | 2011-05-18 15:35:36 +0000 | [diff] [blame] | 30 | template<> |
| 31 | struct SVGPropertyTraits<ChannelSelectorType> { |
zimmermann@webkit.org | f941d3c | 2012-04-03 11:26:50 +0000 | [diff] [blame] | 32 | static unsigned highestEnumValue() { return CHANNEL_A; } |
zimmermann@webkit.org | 94630af | 2011-05-18 15:35:36 +0000 | [diff] [blame] | 33 | |
| 34 | static String toString(ChannelSelectorType type) |
| 35 | { |
| 36 | switch (type) { |
| 37 | case CHANNEL_UNKNOWN: |
| 38 | return emptyString(); |
| 39 | case CHANNEL_R: |
| 40 | return "R"; |
| 41 | case CHANNEL_G: |
| 42 | return "G"; |
| 43 | case CHANNEL_B: |
| 44 | return "B"; |
| 45 | case CHANNEL_A: |
| 46 | return "A"; |
| 47 | } |
| 48 | |
| 49 | ASSERT_NOT_REACHED(); |
| 50 | return emptyString(); |
| 51 | } |
| 52 | |
| 53 | static ChannelSelectorType fromString(const String& value) |
| 54 | { |
| 55 | if (value == "R") |
| 56 | return CHANNEL_R; |
| 57 | if (value == "G") |
| 58 | return CHANNEL_G; |
| 59 | if (value == "B") |
| 60 | return CHANNEL_B; |
| 61 | if (value == "A") |
| 62 | return CHANNEL_A; |
| 63 | return CHANNEL_UNKNOWN; |
| 64 | } |
| 65 | }; |
| 66 | |
andersca@apple.com | 16d2dd4 | 2014-01-16 23:08:24 +0000 | [diff] [blame] | 67 | class SVGFEDisplacementMapElement final : public SVGFilterPrimitiveStandardAttributes { |
zimmermann@webkit.org | e1c7c58 | 2011-07-07 14:18:01 +0000 | [diff] [blame] | 68 | public: |
weinig@apple.com | 1092357 | 2015-01-07 20:56:24 +0000 | [diff] [blame] | 69 | static Ref<SVGFEDisplacementMapElement> create(const QualifiedName&, Document&); |
zimmermann@webkit.org | e1c7c58 | 2011-07-07 14:18:01 +0000 | [diff] [blame] | 70 | |
| 71 | static ChannelSelectorType stringToChannel(const String&); |
| 72 | |
| 73 | private: |
weinig@apple.com | 52e786e | 2013-09-15 18:06:06 +0000 | [diff] [blame] | 74 | SVGFEDisplacementMapElement(const QualifiedName& tagName, Document&); |
zimmermann@webkit.org | e1c7c58 | 2011-07-07 14:18:01 +0000 | [diff] [blame] | 75 | |
commit-queue@webkit.org | 2dfe6cb | 2014-01-16 19:42:50 +0000 | [diff] [blame] | 76 | virtual void parseAttribute(const QualifiedName&, const AtomicString&) override; |
andersca@apple.com | ca796ab | 2014-01-17 03:23:06 +0000 | [diff] [blame] | 77 | virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) override; |
| 78 | virtual void svgAttributeChanged(const QualifiedName&) override; |
commit-queue@webkit.org | 98d1e37 | 2015-04-27 03:51:23 +0000 | [diff] [blame] | 79 | virtual RefPtr<FilterEffect> build(SVGFilterBuilder*, Filter&) override; |
zimmermann@webkit.org | e1c7c58 | 2011-07-07 14:18:01 +0000 | [diff] [blame] | 80 | |
zimmermann@webkit.org | a285742 | 2011-07-09 11:26:10 +0000 | [diff] [blame] | 81 | BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEDisplacementMapElement) |
| 82 | DECLARE_ANIMATED_STRING(In1, in1) |
| 83 | DECLARE_ANIMATED_STRING(In2, in2) |
| 84 | DECLARE_ANIMATED_ENUMERATION(XChannelSelector, xChannelSelector, ChannelSelectorType) |
| 85 | DECLARE_ANIMATED_ENUMERATION(YChannelSelector, yChannelSelector, ChannelSelectorType) |
| 86 | DECLARE_ANIMATED_NUMBER(Scale, scale) |
| 87 | END_DECLARE_ANIMATED_PROPERTIES |
zimmermann@webkit.org | e1c7c58 | 2011-07-07 14:18:01 +0000 | [diff] [blame] | 88 | }; |
| 89 | |
weinig | ab5f09e | 2006-07-29 23:15:25 +0000 | [diff] [blame] | 90 | } // namespace WebCore |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 91 | |
eseidel | 8eddecf | 2007-01-16 00:49:43 +0000 | [diff] [blame] | 92 | #endif // SVGFEDisplacementMapElement_h |