1 /* 2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@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 #include "Color.h" 25 #include "Gradient.h" 26 #include "SVGLength.h" 27 28 namespace WebCore { 29 30 struct GradientAttributes { GradientAttributesGradientAttributes31 GradientAttributes() 32 : m_spreadMethod(SpreadMethodPad) 33 , m_boundingBoxMode(true) 34 , m_spreadMethodSet(false) 35 , m_boundingBoxModeSet(false) 36 , m_gradientTransformSet(false) 37 , m_stopsSet(false) 38 { 39 } 40 spreadMethodGradientAttributes41 GradientSpreadMethod spreadMethod() const { return m_spreadMethod; } boundingBoxModeGradientAttributes42 bool boundingBoxMode() const { return m_boundingBoxMode; } gradientTransformGradientAttributes43 AffineTransform gradientTransform() const { return m_gradientTransform; } stopsGradientAttributes44 const Vector<Gradient::ColorStop>& stops() const { return m_stops; } 45 setSpreadMethodGradientAttributes46 void setSpreadMethod(GradientSpreadMethod value) 47 { 48 m_spreadMethod = value; 49 m_spreadMethodSet = true; 50 } 51 setBoundingBoxModeGradientAttributes52 void setBoundingBoxMode(bool value) 53 { 54 m_boundingBoxMode = value; 55 m_boundingBoxModeSet = true; 56 } 57 setGradientTransformGradientAttributes58 void setGradientTransform(const AffineTransform& value) 59 { 60 m_gradientTransform = value; 61 m_gradientTransformSet = true; 62 } 63 setStopsGradientAttributes64 void setStops(const Vector<Gradient::ColorStop>& value) 65 { 66 m_stops = value; 67 m_stopsSet = true; 68 } 69 hasSpreadMethodGradientAttributes70 bool hasSpreadMethod() const { return m_spreadMethodSet; } hasBoundingBoxModeGradientAttributes71 bool hasBoundingBoxMode() const { return m_boundingBoxModeSet; } hasGradientTransformGradientAttributes72 bool hasGradientTransform() const { return m_gradientTransformSet; } hasStopsGradientAttributes73 bool hasStops() const { return m_stopsSet; } 74 75 private: 76 // Properties 77 GradientSpreadMethod m_spreadMethod; 78 bool m_boundingBoxMode; 79 AffineTransform m_gradientTransform; 80 Vector<Gradient::ColorStop> m_stops; 81 82 // Property states 83 bool m_spreadMethodSet : 1; 84 bool m_boundingBoxModeSet : 1; 85 bool m_gradientTransformSet : 1; 86 bool m_stopsSet : 1; 87 }; 88 89 } // namespace WebCore 90 91 #endif // ENABLE(SVG) 92 #endif 93