initial import
[vuplus_webkit] / Source / WebCore / svg / GradientAttributes.h
1 /*
2  * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.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 GradientAttributes_h
21 #define GradientAttributes_h
22
23 #if ENABLE(SVG)
24 #include "SVGGradientElement.h"
25 #include "SVGLength.h"
26
27 namespace WebCore {
28
29 struct GradientAttributes {
30     GradientAttributes()
31         : m_spreadMethod(SVGSpreadMethodPad)
32         , m_boundingBoxMode(true)
33         , m_spreadMethodSet(false)
34         , m_boundingBoxModeSet(false)
35         , m_gradientTransformSet(false)
36         , m_stopsSet(false)
37     {
38     }
39
40     SVGSpreadMethodType spreadMethod() const { return m_spreadMethod; }
41     bool boundingBoxMode() const { return m_boundingBoxMode; }
42     AffineTransform gradientTransform() const { return m_gradientTransform; }
43     const Vector<Gradient::ColorStop>& stops() const { return m_stops; }
44
45     void setSpreadMethod(SVGSpreadMethodType value)
46     {
47         m_spreadMethod = value;
48         m_spreadMethodSet = true;
49     }
50
51     void setBoundingBoxMode(bool value)
52     {
53         m_boundingBoxMode = value;
54         m_boundingBoxModeSet = true;
55     }
56
57     void setGradientTransform(const AffineTransform& value)
58     {
59         m_gradientTransform = value;
60         m_gradientTransformSet = true;
61     }
62
63     void setStops(const Vector<Gradient::ColorStop>& value)
64     {
65         m_stops = value;
66         m_stopsSet = true;
67     } 
68
69     bool hasSpreadMethod() const { return m_spreadMethodSet; }
70     bool hasBoundingBoxMode() const { return m_boundingBoxModeSet; }
71     bool hasGradientTransform() const { return m_gradientTransformSet; }
72     bool hasStops() const { return m_stopsSet; }
73
74 private:
75     // Properties
76     SVGSpreadMethodType m_spreadMethod;
77     bool m_boundingBoxMode;
78     AffineTransform m_gradientTransform;
79     Vector<Gradient::ColorStop> m_stops;
80
81     // Property states
82     bool m_spreadMethodSet : 1;
83     bool m_boundingBoxModeSet : 1;
84     bool m_gradientTransformSet : 1;
85     bool m_stopsSet : 1;
86 };
87
88 } // namespace WebCore
89
90 #endif // ENABLE(SVG)
91 #endif