File indexing completed on 2024-04-28 15:24:27

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 RadialGradientAttributes_h
0023 #define RadialGradientAttributes_h
0024 
0025 #include "GradientAttributes.h"
0026 
0027 #if ENABLE(SVG)
0028 
0029 namespace WebCore
0030 {
0031 struct RadialGradientAttributes : GradientAttributes {
0032     RadialGradientAttributes()
0033         : m_cx(0.5)
0034         , m_cy(0.5)
0035         , m_r(0.5)
0036         , m_fx(0.0)
0037         , m_fy(0.0)
0038         , m_cxSet(false)
0039         , m_cySet(false)
0040         , m_rSet(false)
0041         , m_fxSet(false)
0042         , m_fySet(false)
0043     {
0044     }
0045 
0046     double cx() const
0047     {
0048         return m_cx;
0049     }
0050     double cy() const
0051     {
0052         return m_cy;
0053     }
0054     double r() const
0055     {
0056         return m_r;
0057     }
0058     double fx() const
0059     {
0060         return m_fx;
0061     }
0062     double fy() const
0063     {
0064         return m_fy;
0065     }
0066 
0067     void setCx(double value)
0068     {
0069         m_cx = value;
0070         m_cxSet = true;
0071     }
0072     void setCy(double value)
0073     {
0074         m_cy = value;
0075         m_cySet = true;
0076     }
0077     void setR(double value)
0078     {
0079         m_r = value;
0080         m_rSet = true;
0081     }
0082     void setFx(double value)
0083     {
0084         m_fx = value;
0085         m_fxSet = true;
0086     }
0087     void setFy(double value)
0088     {
0089         m_fy = value;
0090         m_fySet = true;
0091     }
0092 
0093     bool hasCx() const
0094     {
0095         return m_cxSet;
0096     }
0097     bool hasCy() const
0098     {
0099         return m_cySet;
0100     }
0101     bool hasR() const
0102     {
0103         return m_rSet;
0104     }
0105     bool hasFx() const
0106     {
0107         return m_fxSet;
0108     }
0109     bool hasFy() const
0110     {
0111         return m_fySet;
0112     }
0113 
0114 private:
0115     // Properties
0116     double m_cx;
0117     double m_cy;
0118     double m_r;
0119     double m_fx;
0120     double m_fy;
0121 
0122     // Property states
0123     bool m_cxSet : 1;
0124     bool m_cySet : 1;
0125     bool m_rSet : 1;
0126     bool m_fxSet : 1;
0127     bool m_fySet : 1;
0128 };
0129 
0130 } // namespace WebCore
0131 
0132 #endif // ENABLE(SVG)
0133 #endif
0134