KHtml

GradientAttributes.h
1 /*
2  Copyright (C) 2006 Nikolas Zimmermann <[email protected]>
3 
4  This file is part of the KDE project
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #ifndef GradientAttributes_h
23 #define GradientAttributes_h
24 
25 #if ENABLE(SVG)
26 
27 namespace WebCore
28 {
29 struct GradientAttributes {
30  GradientAttributes()
31  : m_spreadMethod(SPREADMETHOD_PAD)
32  , m_boundingBoxMode(true)
33  , m_spreadMethodSet(false)
34  , m_boundingBoxModeSet(false)
35  , m_gradientTransformSet(false)
36  , m_stopsSet(false)
37  {
38  }
39 
40  SVGGradientSpreadMethod spreadMethod() const
41  {
42  return m_spreadMethod;
43  }
44  bool boundingBoxMode() const
45  {
46  return m_boundingBoxMode;
47  }
48  AffineTransform gradientTransform() const
49  {
50  return m_gradientTransform;
51  }
52  const Vector<SVGGradientStop> &stops() const
53  {
54  return m_stops;
55  }
56 
57  void setSpreadMethod(SVGGradientSpreadMethod value)
58  {
59  m_spreadMethod = value;
60  m_spreadMethodSet = true;
61  }
62  void setBoundingBoxMode(bool value)
63  {
64  m_boundingBoxMode = value;
65  m_boundingBoxModeSet = true;
66  }
67  void setGradientTransform(const AffineTransform &value)
68  {
69  m_gradientTransform = value;
70  m_gradientTransformSet = true;
71  }
72  void setStops(const Vector<SVGGradientStop> &value)
73  {
74  m_stops = value;
75  m_stopsSet = true;
76  }
77 
78  bool hasSpreadMethod() const
79  {
80  return m_spreadMethodSet;
81  }
82  bool hasBoundingBoxMode() const
83  {
84  return m_boundingBoxModeSet;
85  }
86  bool hasGradientTransform() const
87  {
88  return m_gradientTransformSet;
89  }
90  bool hasStops() const
91  {
92  return m_stopsSet;
93  }
94 
95 private:
96  // Properties
97  SVGGradientSpreadMethod m_spreadMethod;
98  bool m_boundingBoxMode;
99  AffineTransform m_gradientTransform;
100  Vector<SVGGradientStop> m_stops;
101 
102  // Property states
103  bool m_spreadMethodSet : 1;
104  bool m_boundingBoxModeSet : 1;
105  bool m_gradientTransformSet : 1;
106  bool m_stopsSet : 1;
107 };
108 
109 } // namespace WebCore
110 
111 #endif // ENABLE(SVG)
112 #endif
113 
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Oct 26 2021 22:48:01 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.