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

KHTML

SVGFEComponentTransfer.cpp

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
00003                   2004, 2005 Rob Buis <buis@kde.org>
00004                   2005 Eric Seidel <eric@webkit.org>
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public License
00017     aint with this library; see the file COPYING.LIB.  If not, write to
00018     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019     Boston, MA 02110-1301, USA.
00020 */
00021 
00022 #include "config.h"
00023 
00024 #if ENABLE(SVG) && ENABLE(SVG_FILTERS)
00025 #include "SVGFEComponentTransfer.h"
00026 #include "TextStream.h"
00027 
00028 namespace WebCore {
00029 
00030 SVGFEComponentTransfer::SVGFEComponentTransfer(SVGResourceFilter* filter)
00031     : SVGFilterEffect(filter)
00032 {
00033 }
00034 
00035 SVGComponentTransferFunction SVGFEComponentTransfer::redFunction() const
00036 {
00037     return m_redFunc;
00038 }
00039 
00040 void SVGFEComponentTransfer::setRedFunction(const SVGComponentTransferFunction& func)
00041 {
00042     m_redFunc = func;
00043 }
00044 
00045 SVGComponentTransferFunction SVGFEComponentTransfer::greenFunction() const
00046 {
00047     return m_greenFunc;
00048 }
00049 
00050 void SVGFEComponentTransfer::setGreenFunction(const SVGComponentTransferFunction& func)
00051 {
00052     m_greenFunc = func;
00053 }
00054 
00055 SVGComponentTransferFunction SVGFEComponentTransfer::blueFunction() const
00056 {
00057     return m_blueFunc;
00058 }
00059 
00060 void SVGFEComponentTransfer::setBlueFunction(const SVGComponentTransferFunction& func)
00061 {
00062     m_blueFunc = func;
00063 }
00064 
00065 SVGComponentTransferFunction SVGFEComponentTransfer::alphaFunction() const
00066 {
00067     return m_alphaFunc;
00068 }
00069 
00070 void SVGFEComponentTransfer::setAlphaFunction(const SVGComponentTransferFunction& func)
00071 {
00072     m_alphaFunc = func;
00073 }
00074 
00075 static TextStream& operator<<(TextStream& ts, SVGComponentTransferType t)
00076 {
00077     switch (t)
00078     {
00079         case SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN:
00080             ts << "UNKNOWN"; break;
00081         case SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY:
00082             ts << "IDENTITY"; break;
00083         case SVG_FECOMPONENTTRANSFER_TYPE_TABLE:
00084             ts << "TABLE"; break;
00085         case SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE:
00086             ts << "DISCRETE"; break;
00087         case SVG_FECOMPONENTTRANSFER_TYPE_LINEAR:
00088             ts << "LINEAR"; break;
00089         case SVG_FECOMPONENTTRANSFER_TYPE_GAMMA:
00090             ts << "GAMMA"; break;
00091     }
00092     return ts;
00093 }
00094 
00095 static TextStream& operator<<(TextStream& ts, const SVGComponentTransferFunction &func)
00096 {
00097     ts << "[type=" << func.type << "]";
00098     switch (func.type) {
00099         case SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN:
00100         case SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY:
00101             break;
00102         case SVG_FECOMPONENTTRANSFER_TYPE_TABLE:
00103         case SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE:
00104         {
00105             ts << " [table values=";
00106             Vector<float>::const_iterator itr=func.tableValues.begin();
00107             if (itr != func.tableValues.end()) {
00108                 ts << *itr++;
00109                 for (; itr!=func.tableValues.end(); itr++) {
00110                     ts << " " << *itr;
00111                 }
00112             }
00113             ts << "]";
00114             break;
00115         }
00116         case SVG_FECOMPONENTTRANSFER_TYPE_LINEAR:
00117             ts << " [slope=" << func.slope << "]"
00118                << " [intercept=" << func.intercept << "]";
00119             break;
00120         case SVG_FECOMPONENTTRANSFER_TYPE_GAMMA:
00121             ts << " [amplitude=" << func.amplitude << "]"
00122                << " [exponent=" << func.exponent << "]"
00123                << " [offset=" << func.offset << "]";
00124             break;
00125     }
00126     return ts;
00127 }
00128 
00129 TextStream& SVGFEComponentTransfer::externalRepresentation(TextStream& ts) const
00130 {
00131     ts << "[type=COMPONENT-TRANSFER] ";
00132     SVGFilterEffect::externalRepresentation(ts);
00133     ts << " [red func=" << redFunction() << "]"
00134         << " [green func=" << greenFunction() << "]"
00135         << " [blue func=" << blueFunction() << "]"
00136         << " [alpha func=" << alphaFunction() << "]";
00137     return ts;
00138 }
00139 
00140 } // namespace WebCore
00141 
00142 #endif // ENABLE(SVG) && ENABLE(SVG_FILTERS)

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