Rubber-stamped by Brady Eidson.
[webbrowser.git] / WebCore / svg / SVGPaint.h
blob032f7157641dfcda82c19538cbded13521200f2c
1 /*
2 Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
3 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmial.com)
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
22 #ifndef SVGPaint_h
23 #define SVGPaint_h
24 #if ENABLE(SVG)
26 #include "SVGColor.h"
27 #include "PlatformString.h"
29 namespace WebCore {
31 class SVGPaint : public SVGColor {
32 public:
33 enum SVGPaintType {
34 SVG_PAINTTYPE_UNKNOWN = 0,
35 SVG_PAINTTYPE_RGBCOLOR = 1,
36 SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR = 2,
37 SVG_PAINTTYPE_NONE = 101,
38 SVG_PAINTTYPE_CURRENTCOLOR = 102,
39 SVG_PAINTTYPE_URI_NONE = 103,
40 SVG_PAINTTYPE_URI_CURRENTCOLOR = 104,
41 SVG_PAINTTYPE_URI_RGBCOLOR = 105,
42 SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR = 106,
43 SVG_PAINTTYPE_URI = 107
46 static PassRefPtr<SVGPaint> create()
48 return adoptRef(new SVGPaint);
50 static PassRefPtr<SVGPaint> create(SVGPaintType type)
52 return adoptRef(new SVGPaint(type));
54 static PassRefPtr<SVGPaint> create(const Color& color)
56 return adoptRef(new SVGPaint(color));
58 static PassRefPtr<SVGPaint> create(SVGPaintType type, const String& uri)
60 return adoptRef(new SVGPaint(type, uri, String(), String()));
62 static PassRefPtr<SVGPaint> create(const String& uri, const Color& color)
64 return adoptRef(new SVGPaint(uri, color));
67 virtual ~SVGPaint();
69 // 'SVGPaint' functions
70 SVGPaintType paintType() const { return m_paintType; }
71 String uri() const;
73 void setUri(const String&);
74 void setPaint(SVGPaintType, const String& uri, const String& rgbPaint, const String& iccPaint, ExceptionCode&);
76 virtual String cssText() const;
78 static SVGPaint* defaultFill();
79 static SVGPaint* defaultStroke();
81 private:
82 SVGPaint();
83 SVGPaint(const String& uri);
84 SVGPaint(SVGPaintType);
85 SVGPaint(SVGPaintType, const String& uri, const String& rgbPaint, const String& iccPaint);
86 SVGPaint(const Color& c);
87 SVGPaint(const String& uri, const Color& c);
89 virtual bool isSVGPaint() const { return true; }
91 SVGPaintType m_paintType;
92 String m_uri;
95 } // namespace WebCore
97 #endif // ENABLE(SVG)
98 #endif // SVGPaint_h
100 // vim:ts=4:noet