File indexing completed on 2024-04-28 11:39:08

0001 /*
0002     Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
0003 
0004     This file is part of the KDE project
0005 
0006     This library is free software; you can redistribute it and/or
0007     modify it under the terms of the GNU Library General Public
0008     License as published by the Free Software Foundation; either
0009     version 2 of the License, or (at your option) any later version.
0010 
0011     This library is distributed in the hope that it will be useful,
0012     but WITHOUT ANY WARRANTY; without even the implied warranty of
0013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014     Library General Public License for more details.
0015 
0016     You should have received a copy of the GNU Library General Public License
0017     along with this library; see the file COPYING.LIB.  If not, write to
0018     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0019     Boston, MA 02110-1301, USA.
0020 */
0021 
0022 #ifndef LinearGradientAttributes_h
0023 #define LinearGradientAttributes_h
0024 
0025 #include "GradientAttributes.h"
0026 
0027 #if ENABLE(SVG)
0028 
0029 namespace WebCore
0030 {
0031 struct LinearGradientAttributes : GradientAttributes {
0032     LinearGradientAttributes()
0033         : m_x1(0.0)
0034         , m_y1(0.0)
0035         , m_x2(1.0)
0036         , m_y2(0.0)
0037         , m_x1Set(false)
0038         , m_y1Set(false)
0039         , m_x2Set(false)
0040         , m_y2Set(false)
0041     {
0042     }
0043 
0044     double x1() const
0045     {
0046         return m_x1;
0047     }
0048     double y1() const
0049     {
0050         return m_y1;
0051     }
0052     double x2() const
0053     {
0054         return m_x2;
0055     }
0056     double y2() const
0057     {
0058         return m_y2;
0059     }
0060 
0061     void setX1(double value)
0062     {
0063         m_x1 = value;
0064         m_x1Set = true;
0065     }
0066     void setY1(double value)
0067     {
0068         m_y1 = value;
0069         m_y1Set = true;
0070     }
0071     void setX2(double value)
0072     {
0073         m_x2 = value;
0074         m_x2Set = true;
0075     }
0076     void setY2(double value)
0077     {
0078         m_y2 = value;
0079         m_y2Set = true;
0080     }
0081 
0082     bool hasX1() const
0083     {
0084         return m_x1Set;
0085     }
0086     bool hasY1() const
0087     {
0088         return m_y1Set;
0089     }
0090     bool hasX2() const
0091     {
0092         return m_x2Set;
0093     }
0094     bool hasY2() const
0095     {
0096         return m_y2Set;
0097     }
0098 
0099 private:
0100     // Properties
0101     double m_x1;
0102     double m_y1;
0103     double m_x2;
0104     double m_y2;
0105 
0106     // Property states
0107     bool m_x1Set : 1;
0108     bool m_y1Set : 1;
0109     bool m_x2Set : 1;
0110     bool m_y2Set : 1;
0111 };
0112 
0113 } // namespace WebCore
0114 
0115 #endif // ENABLE(SVG)
0116 #endif
0117