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

KHTML

SVGPaintServerGradient.cpp

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 #include "config.h"
00027 #include "wtf/Platform.h"
00028 
00029 #if ENABLE(SVG)
00030 #include "SVGPaintServerGradient.h"
00031 
00032 #include "SVGGradientElement.h"
00033 /*#include "SVGRenderTreeAsText.h"*/
00034 
00035 namespace WebCore {
00036 
00037 /*TextStream& operator<<(TextStream& ts, SVGGradientSpreadMethod m)
00038 {
00039     switch (m) {
00040         case SPREADMETHOD_PAD:
00041             ts << "PAD"; break;
00042         case SPREADMETHOD_REPEAT:
00043             ts << "REPEAT"; break;
00044         case SPREADMETHOD_REFLECT:
00045             ts << "REFLECT"; break;
00046     }
00047 
00048     return ts;
00049 }
00050 
00051 TextStream& operator<<(TextStream& ts, const Vector<SVGGradientStop>& l)
00052 {
00053     ts << "[";
00054     for (Vector<SVGGradientStop>::const_iterator it = l.begin(); it != l.end(); ++it) {
00055         ts << "(" << it->first << "," << it->second << ")";
00056         if (it + 1 != l.end())
00057             ts << ", ";
00058     }
00059     ts << "]";
00060     return ts;
00061 }*/
00062 
00063 SVGPaintServerGradient::SVGPaintServerGradient(const SVGGradientElement* owner)
00064     : m_spreadMethod(SPREADMETHOD_PAD)
00065     , m_boundingBoxMode(true)
00066     , m_ownerElement(owner)
00067 
00068 #if PLATFORM(CG)
00069     , m_stopsCache(0)
00070     , m_shadingCache(0)
00071     , m_savedContext(0)
00072     , m_imageBuffer(0)
00073 #endif
00074 {
00075     ASSERT(owner);
00076 }
00077 
00078 SVGPaintServerGradient::~SVGPaintServerGradient()
00079 {
00080 #if PLATFORM(CG)
00081     CGShadingRelease(m_shadingCache);
00082 #endif
00083 }
00084 
00085 const Vector<SVGGradientStop>& SVGPaintServerGradient::gradientStops() const
00086 {
00087     return m_stops;
00088 }
00089 
00090 void SVGPaintServerGradient::setGradientStops(const Vector<SVGGradientStop>& stops)
00091 {
00092     m_stops = stops;
00093 }
00094 
00095 SVGGradientSpreadMethod SVGPaintServerGradient::spreadMethod() const
00096 {
00097     return m_spreadMethod;
00098 }
00099 
00100 void SVGPaintServerGradient::setGradientSpreadMethod(const SVGGradientSpreadMethod& method)
00101 {
00102     m_spreadMethod = method;
00103 }
00104 
00105 bool SVGPaintServerGradient::boundingBoxMode() const
00106 {
00107     return m_boundingBoxMode;
00108 }
00109 
00110 void SVGPaintServerGradient::setBoundingBoxMode(bool mode)
00111 {
00112     m_boundingBoxMode = mode;
00113 }
00114 
00115 AffineTransform SVGPaintServerGradient::gradientTransform() const
00116 {
00117     return m_gradientTransform;
00118 }
00119 
00120 void SVGPaintServerGradient::setGradientTransform(const AffineTransform& transform)
00121 {
00122     m_gradientTransform = transform;
00123 }
00124 
00125 /*TextStream& SVGPaintServerGradient::externalRepresentation(TextStream& ts) const
00126 {
00127     // Gradients/patterns aren't setup, until they are used for painting. Work around that fact.
00128     m_ownerElement->buildGradient();
00129 
00130     // abstract, don't stream type
00131     ts  << "[stops=" << gradientStops() << "]";
00132     if (spreadMethod() != SPREADMETHOD_PAD)
00133         ts << "[method=" << spreadMethod() << "]";
00134     if (!boundingBoxMode())
00135         ts << " [bounding box mode=" << boundingBoxMode() << "]";
00136     if (!gradientTransform().isIdentity())
00137         ts << " [transform=" << gradientTransform() << "]";
00138 
00139     return ts;
00140 }*/
00141 
00142 } // namespace WebCore
00143 
00144 #endif

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
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
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