1/*
2 * Copyright (C) 2004, 2005, 2007 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 */
20
21#ifndef SVGFEBlendElement_h
22#define SVGFEBlendElement_h
23
24#include "core/svg/SVGAnimatedEnumeration.h"
25#include "core/svg/SVGFilterPrimitiveStandardAttributes.h"
26
27namespace blink {
28
29class SVGFEBlendElement FINAL : public SVGFilterPrimitiveStandardAttributes {
30    DEFINE_WRAPPERTYPEINFO();
31public:
32    enum Mode {
33        ModeUnknown = 0,
34        ModeNormal = 1,
35        ModeMultiply = 2,
36        ModeScreen = 3,
37        ModeDarken = 4,
38        ModeLighten = 5,
39
40        // The following modes do not map to IDL constants on
41        // SVGFEBlendElement.
42        ModeOverlay,
43        ModeColorDodge,
44        ModeColorBurn,
45        ModeHardLight,
46        ModeSoftLight,
47        ModeDifference,
48        ModeExclusion,
49        ModeHue,
50        ModeSaturation,
51        ModeColor,
52        ModeLuminosity,
53    };
54
55    DECLARE_NODE_FACTORY(SVGFEBlendElement);
56    SVGAnimatedString* in1() { return m_in1.get(); }
57    SVGAnimatedString* in2() { return m_in2.get(); }
58    SVGAnimatedEnumeration<Mode>* mode() { return m_mode.get(); }
59
60private:
61    explicit SVGFEBlendElement(Document&);
62
63    bool isSupportedAttribute(const QualifiedName&);
64    virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
65    virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName) OVERRIDE;
66    virtual void svgAttributeChanged(const QualifiedName&) OVERRIDE;
67    virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*) OVERRIDE;
68
69    RefPtr<SVGAnimatedString> m_in1;
70    RefPtr<SVGAnimatedString> m_in2;
71    RefPtr<SVGAnimatedEnumeration<Mode> > m_mode;
72};
73
74template<> const SVGEnumerationStringEntries& getStaticStringEntries<SVGFEBlendElement::Mode>();
75template<> unsigned short getMaxExposedEnumValue<SVGFEBlendElement::Mode>();
76
77} // namespace blink
78
79#endif // SVGFEBlendElement_h
80