Home | History | Annotate | Download | only in svg
      1 /*
      2     Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox (at) kde.org>
      3                   2004, 2005, 2006, 2007 Rob Buis <buis (at) kde.org>
      4     Copyright (C) 2006 Samuel Weinig (sam.weinig (at) gmial.com)
      5 
      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.
     10 
     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.
     15 
     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.
     20 */
     21 
     22 #ifndef SVGPaint_h
     23 #define SVGPaint_h
     24 #if ENABLE(SVG)
     25 
     26 #include "SVGColor.h"
     27 #include "PlatformString.h"
     28 
     29 namespace WebCore {
     30 
     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
     44         };
     45 
     46         static PassRefPtr<SVGPaint> create()
     47         {
     48             return adoptRef(new SVGPaint);
     49         }
     50         static PassRefPtr<SVGPaint> create(SVGPaintType type)
     51         {
     52             return adoptRef(new SVGPaint(type));
     53         }
     54         static PassRefPtr<SVGPaint> create(const Color& color)
     55         {
     56             return adoptRef(new SVGPaint(color));
     57         }
     58         static PassRefPtr<SVGPaint> create(SVGPaintType type, const String& uri)
     59         {
     60             return adoptRef(new SVGPaint(type, uri, String(), String()));
     61         }
     62         static PassRefPtr<SVGPaint> create(const String& uri, const Color& color)
     63         {
     64             return adoptRef(new SVGPaint(uri, color));
     65         }
     66 
     67         virtual ~SVGPaint();
     68 
     69         // 'SVGPaint' functions
     70         SVGPaintType paintType() const { return m_paintType; }
     71         String uri() const;
     72 
     73         void setUri(const String&);
     74         void setPaint(SVGPaintType, const String& uri, const String& rgbPaint, const String& iccPaint, ExceptionCode&);
     75 
     76         virtual String cssText() const;
     77 
     78         static SVGPaint* defaultFill();
     79         static SVGPaint* defaultStroke();
     80 
     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);
     88 
     89         virtual bool isSVGPaint() const { return true; }
     90 
     91         SVGPaintType m_paintType;
     92         String m_uri;
     93     };
     94 
     95 } // namespace WebCore
     96 
     97 #endif // ENABLE(SVG)
     98 #endif // SVGPaint_h
     99 
    100 // vim:ts=4:noet
    101