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 GradientAttributes_h
0023 #define GradientAttributes_h
0024 
0025 #if ENABLE(SVG)
0026 
0027 namespace WebCore
0028 {
0029 struct GradientAttributes {
0030     GradientAttributes()
0031         : m_spreadMethod(SPREADMETHOD_PAD)
0032         , m_boundingBoxMode(true)
0033         , m_spreadMethodSet(false)
0034         , m_boundingBoxModeSet(false)
0035         , m_gradientTransformSet(false)
0036         , m_stopsSet(false)
0037     {
0038     }
0039 
0040     SVGGradientSpreadMethod spreadMethod() const
0041     {
0042         return m_spreadMethod;
0043     }
0044     bool boundingBoxMode() const
0045     {
0046         return m_boundingBoxMode;
0047     }
0048     AffineTransform gradientTransform() const
0049     {
0050         return m_gradientTransform;
0051     }
0052     const Vector<SVGGradientStop> &stops() const
0053     {
0054         return m_stops;
0055     }
0056 
0057     void setSpreadMethod(SVGGradientSpreadMethod value)
0058     {
0059         m_spreadMethod = value;
0060         m_spreadMethodSet = true;
0061     }
0062     void setBoundingBoxMode(bool value)
0063     {
0064         m_boundingBoxMode = value;
0065         m_boundingBoxModeSet = true;
0066     }
0067     void setGradientTransform(const AffineTransform &value)
0068     {
0069         m_gradientTransform = value;
0070         m_gradientTransformSet = true;
0071     }
0072     void setStops(const Vector<SVGGradientStop> &value)
0073     {
0074         m_stops = value;
0075         m_stopsSet = true;
0076     }
0077 
0078     bool hasSpreadMethod() const
0079     {
0080         return m_spreadMethodSet;
0081     }
0082     bool hasBoundingBoxMode() const
0083     {
0084         return m_boundingBoxModeSet;
0085     }
0086     bool hasGradientTransform() const
0087     {
0088         return m_gradientTransformSet;
0089     }
0090     bool hasStops() const
0091     {
0092         return m_stopsSet;
0093     }
0094 
0095 private:
0096     // Properties
0097     SVGGradientSpreadMethod m_spreadMethod;
0098     bool m_boundingBoxMode;
0099     AffineTransform m_gradientTransform;
0100     Vector<SVGGradientStop> m_stops;
0101 
0102     // Property states
0103     bool m_spreadMethodSet : 1;
0104     bool m_boundingBoxModeSet : 1;
0105     bool m_gradientTransformSet : 1;
0106     bool m_stopsSet : 1;
0107 };
0108 
0109 } // namespace WebCore
0110 
0111 #endif // ENABLE(SVG)
0112 #endif
0113