• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KHTML

SVGPaint.cpp

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
00003                   2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
00004 
00005     This file is part of the KDE project
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Library General Public
00009     License as published by the Free Software Foundation; either
00010     version 2 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Library General Public License for more details.
00016 
00017     You should have received a copy of the GNU Library General Public License
00018     along with this library; see the file COPYING.LIB.  If not, write to
00019     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020     Boston, MA 02110-1301, USA.
00021 */
00022 
00023 #include "config.h"
00024 #include "wtf/Platform.h"
00025 #if ENABLE(SVG)
00026 #include "SVGPaint.h"
00027 
00028 namespace WebCore {
00029 
00030 SVGPaint::SVGPaint()
00031     : SVGColor()
00032     , m_paintType(SVG_PAINTTYPE_UNKNOWN)
00033 {
00034 }
00035 
00036 SVGPaint::SVGPaint(const String& uri)
00037     : SVGColor()
00038     , m_paintType(SVG_PAINTTYPE_URI_RGBCOLOR)
00039 {
00040     setUri(uri);
00041 }
00042 
00043 SVGPaint::SVGPaint(SVGPaintType paintType)
00044     : SVGColor()
00045     , m_paintType(paintType)
00046 {
00047 }
00048 
00049 SVGPaint::SVGPaint(SVGPaintType paintType, const String& uri, const String& rgbPaint, const String&)
00050     : SVGColor(rgbPaint)
00051     , m_paintType(paintType)
00052 {
00053     setUri(uri);
00054 }
00055 
00056 SVGPaint::SVGPaint(const Color& c)
00057     : SVGColor(c)
00058     , m_paintType(SVG_PAINTTYPE_RGBCOLOR)
00059 {
00060 }
00061 
00062 SVGPaint::SVGPaint(const String& uri, const Color& c)
00063     : SVGColor(c)
00064     , m_paintType(SVG_PAINTTYPE_URI_RGBCOLOR)
00065 {
00066     setUri(uri);
00067 }
00068 
00069 SVGPaint::~SVGPaint()
00070 {
00071 }
00072 
00073 SVGPaint* SVGPaint::defaultFill()
00074 {
00075     static SVGPaint* _defaultFill = new SVGPaint(Qt::black/*Color::black*/);
00076     return _defaultFill;
00077 }
00078 
00079 SVGPaint* SVGPaint::defaultStroke()
00080 {
00081     static SVGPaint* _defaultStroke = new SVGPaint(SVG_PAINTTYPE_NONE);
00082     return _defaultStroke;
00083 }
00084 
00085 String SVGPaint::uri() const
00086 {
00087     return m_uri;
00088 }
00089 
00090 void SVGPaint::setUri(const String& uri)
00091 {
00092     m_uri = uri;
00093 }
00094 
00095 void SVGPaint::setPaint(SVGPaintType paintType, const String& uri, const String& rgbPaint, const String&, ExceptionCode&)
00096 {
00097     m_paintType = paintType;
00098 
00099     if (m_paintType == SVG_PAINTTYPE_URI)
00100         setUri(uri);
00101     else if (m_paintType == SVG_PAINTTYPE_RGBCOLOR)
00102         setRGBColor(rgbPaint);
00103 }
00104 
00105 String SVGPaint::cssText() const
00106 {
00107     if (m_paintType == SVG_PAINTTYPE_NONE)
00108         return "none";
00109     else if (m_paintType == SVG_PAINTTYPE_CURRENTCOLOR)
00110         return "currentColor";
00111     else if (m_paintType == SVG_PAINTTYPE_URI)
00112         return m_uri; //return "url(" + m_uri + ")";
00113 
00114     return SVGColor::cssText();
00115 }
00116 
00117 }
00118 
00119 // vim:ts=4
00120 #endif // ENABLE(SVG)
00121 

KHTML

Skip menu "KHTML"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal