KHTML
SVGPaintServer.h
Go to the documentation of this file.
00001 /* 00002 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> 00003 * 00004 * Redistribution and use in source and binary forms, with or without 00005 * modification, are permitted provided that the following conditions 00006 * are met: 00007 * 1. Redistributions of source code must retain the above copyright 00008 * notice, this list of conditions and the following disclaimer. 00009 * 2. Redistributions in binary form must reproduce the above copyright 00010 * notice, this list of conditions and the following disclaimer in the 00011 * documentation and/or other materials provided with the distribution. 00012 * 00013 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 00014 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00015 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00016 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 00017 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00018 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00019 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00020 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00021 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00022 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00023 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00024 */ 00025 00026 #ifndef SVGPaintServer_h 00027 #define SVGPaintServer_h 00028 00029 #if ENABLE(SVG) 00030 00031 #include "SVGResource.h" 00032 00033 #include "RenderObject.h" 00034 #include "RenderStyle.h" 00035 00036 #if PLATFORM(CG) 00037 #include <ApplicationServices/ApplicationServices.h> 00038 #endif 00039 00040 #if PLATFORM(QT) 00041 #include <qglobal.h> 00042 QT_BEGIN_NAMESPACE 00043 class QPen; 00044 QT_END_NAMESPACE 00045 #endif 00046 00047 #if PLATFORM(CG) 00048 typedef Vector<CGFloat> DashArray; 00049 #else 00050 typedef Vector<float> DashArray; 00051 #endif 00052 00053 namespace WebCore { 00054 00055 enum SVGPaintServerType { 00056 // Painting mode 00057 SolidPaintServer = 0, 00058 PatternPaintServer = 1, 00059 LinearGradientPaintServer = 2, 00060 RadialGradientPaintServer = 3 00061 }; 00062 00063 enum SVGPaintTargetType { 00064 // Target mode 00065 ApplyToFillTargetType = 1, 00066 ApplyToStrokeTargetType = 2 00067 }; 00068 00069 /*class GraphicsContext; 00070 class RenderObject; 00071 class RenderStyle;*/ 00072 class SVGPaintServerSolid; 00073 00074 class SVGPaintServer : public SVGResource { 00075 public: 00076 virtual ~SVGPaintServer(); 00077 00078 virtual SVGResourceType resourceType() const { return PaintServerResourceType; } 00079 00080 virtual SVGPaintServerType type() const = 0; 00081 /* FIXME khtml virtual TextStream& externalRepresentation(TextStream&) const = 0;*/ 00082 00083 // To be implemented in platform specific code. 00084 virtual void draw(QPainter* painter, QPainterPath* painterPath, const RenderObject*, SVGPaintTargetType) const; 00085 virtual void teardown(QPainter* painter, QPainterPath* painterPath, const RenderObject*, SVGPaintTargetType, bool isPaintingText = false) const; 00086 virtual void renderPath(QPainter* painter, QPainterPath* painterPath, const RenderObject*, SVGPaintTargetType) const; 00087 00088 virtual bool setup(QPainter* painter, QPainterPath* painterPath, const RenderObject*, SVGPaintTargetType, bool isPaintingText = false) const = 0; 00089 00090 static SVGPaintServer* strokePaintServer(const RenderStyle*, const RenderObject*); 00091 static SVGPaintServer* fillPaintServer(const RenderStyle*, const RenderObject*); 00092 static SVGPaintServerSolid* sharedSolidPaintServer(); 00093 00094 protected: 00095 #if PLATFORM(CG) 00096 void strokePath(CGContextRef, const RenderObject*) const; 00097 void clipToStrokePath(CGContextRef, const RenderObject*) const; 00098 void fillPath(CGContextRef, const RenderObject*) const; 00099 void clipToFillPath(CGContextRef, const RenderObject*) const; 00100 #endif 00101 00102 #if PLATFORM(QT) 00103 void setPenProperties(const RenderObject*, const RenderStyle*, QPen&) const; 00104 #endif 00105 protected: 00106 SVGPaintServer(); 00107 }; 00108 00109 /*khtml TextStream& operator<<(TextStream&, const SVGPaintServer&);*/ 00110 00111 SVGPaintServer* getPaintServerById(Document*, const AtomicString&); 00112 00113 DashArray dashArrayFromRenderingStyle(const RenderStyle* style); 00114 } // namespace WebCore 00115 00116 #endif 00117 00118 #endif // SVGPaintServer_h
KDE 4.6 API Reference