Home | History | Annotate | Download | only in svg
      1 /*
      2     Copyright (C) 2006 Nikolas Zimmermann <zimmermann (at) 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 
     25 namespace WebCore {
     26     struct GradientAttributes {
     27         GradientAttributes()
     28             : m_spreadMethod(SpreadMethodPad)
     29             , m_boundingBoxMode(true)
     30             , m_spreadMethodSet(false)
     31             , m_boundingBoxModeSet(false)
     32             , m_gradientTransformSet(false)
     33             , m_stopsSet(false)
     34         {
     35         }
     36 
     37         GradientSpreadMethod spreadMethod() const { return m_spreadMethod; }
     38         bool boundingBoxMode() const { return m_boundingBoxMode; }
     39         AffineTransform gradientTransform() const { return m_gradientTransform; }
     40         const Vector<SVGGradientStop>& stops() const { return m_stops; }
     41 
     42         void setSpreadMethod(GradientSpreadMethod value) { m_spreadMethod = value; m_spreadMethodSet = true; }
     43         void setBoundingBoxMode(bool value) { m_boundingBoxMode = value; m_boundingBoxModeSet = true; }
     44         void setGradientTransform(const AffineTransform& value) { m_gradientTransform = value; m_gradientTransformSet = true; }
     45         void setStops(const Vector<SVGGradientStop>& value) { m_stops = value; m_stopsSet = true; }
     46 
     47         bool hasSpreadMethod() const { return m_spreadMethodSet; }
     48         bool hasBoundingBoxMode() const { return m_boundingBoxModeSet; }
     49         bool hasGradientTransform() const { return m_gradientTransformSet; }
     50         bool hasStops() const { return m_stopsSet; }
     51 
     52     private:
     53         // Properties
     54         GradientSpreadMethod m_spreadMethod;
     55         bool m_boundingBoxMode;
     56         AffineTransform m_gradientTransform;
     57         Vector<SVGGradientStop> m_stops;
     58 
     59         // Property states
     60         bool m_spreadMethodSet : 1;
     61         bool m_boundingBoxModeSet : 1;
     62         bool m_gradientTransformSet : 1;
     63         bool m_stopsSet : 1;
     64     };
     65 
     66 } // namespace WebCore
     67 
     68 #endif // ENABLE(SVG)
     69 #endif
     70 
     71 // vim:ts=4:noet
     72