2010-12-01 Nikolas Zimmermann <nzimmermann@rim.com>
[WebKit-https.git] / WebCore / svg / SVGFEConvolveMatrixElement.h
1 /*
2  * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
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.
18  */
19
20 #ifndef SVGFEConvolveMatrixElement_h
21 #define SVGFEConvolveMatrixElement_h
22
23 #if ENABLE(SVG) && ENABLE(FILTERS)
24 #include "FEConvolveMatrix.h"
25 #include "SVGAnimatedNumber.h"
26 #include "SVGAnimatedNumberList.h"
27 #include "SVGFilterPrimitiveStandardAttributes.h"
28
29 namespace WebCore {
30
31 class SVGFEConvolveMatrixElement : public SVGFilterPrimitiveStandardAttributes {
32 public:
33     static PassRefPtr<SVGFEConvolveMatrixElement> create(const QualifiedName&, Document*);
34
35     void setOrder(float orderX, float orderY);
36     void setKernelUnitLength(float kernelUnitLengthX, float kernelUnitLengthY);
37
38 private:
39     SVGFEConvolveMatrixElement(const QualifiedName&, Document*);
40
41     virtual void parseMappedAttribute(Attribute*);
42     virtual void svgAttributeChanged(const QualifiedName&);
43     virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*);
44
45     static const AtomicString& orderXIdentifier();
46     static const AtomicString& orderYIdentifier();
47     static const AtomicString& kernelUnitLengthXIdentifier();
48     static const AtomicString& kernelUnitLengthYIdentifier();
49
50     // Animated property declarations
51     DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEConvolveMatrixElement, SVGNames::inAttr, String, In1, in1)
52     DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFEConvolveMatrixElement, SVGNames::orderAttr, orderXIdentifier(), long, OrderX, orderX)
53     DECLARE_ANIMATED_STATIC_PROPERTY_MULTIPLE_WRAPPERS_NEW(SVGFEConvolveMatrixElement, SVGNames::orderAttr, orderYIdentifier(), long, OrderY, orderY)
54     DECLARE_ANIMATED_NUMBER_LIST(KernelMatrix, kernelMatrix)
55     DECLARE_ANIMATED_NUMBER(Divisor, divisor)
56     DECLARE_ANIMATED_NUMBER(Bias, bias)
57     DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEConvolveMatrixElement, SVGNames::targetXAttr, long, TargetX, targetX)
58     DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEConvolveMatrixElement, SVGNames::targetYAttr, long, TargetY, targetY)
59     DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEConvolveMatrixElement, SVGNames::operatorAttr, int, EdgeMode, edgeMode)
60     DECLARE_ANIMATED_NUMBER(KernelUnitLengthX, kernelUnitLengthX)
61     DECLARE_ANIMATED_NUMBER(KernelUnitLengthY, kernelUnitLengthY)
62     DECLARE_ANIMATED_STATIC_PROPERTY_NEW(SVGFEConvolveMatrixElement, SVGNames::preserveAlphaAttr, bool, PreserveAlpha, preserveAlpha)
63 };
64
65 } // namespace WebCore
66
67 #endif // ENABLE(SVG)
68 #endif