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

KHTML

  • sources
  • kde-4.12
  • kdelibs
  • khtml
  • svg
  • graphics
  • filters
SVGFEComponentTransfer.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3  2004, 2005 Rob Buis <buis@kde.org>
4  2005 Eric Seidel <eric@webkit.org>
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  aint 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 #include "config.h"
23 
24 #if ENABLE(SVG) && ENABLE(SVG_FILTERS)
25 #include "SVGFEComponentTransfer.h"
26 #include "TextStream.h"
27 
28 namespace WebCore {
29 
30 SVGFEComponentTransfer::SVGFEComponentTransfer(SVGResourceFilter* filter)
31  : SVGFilterEffect(filter)
32 {
33 }
34 
35 SVGComponentTransferFunction SVGFEComponentTransfer::redFunction() const
36 {
37  return m_redFunc;
38 }
39 
40 void SVGFEComponentTransfer::setRedFunction(const SVGComponentTransferFunction& func)
41 {
42  m_redFunc = func;
43 }
44 
45 SVGComponentTransferFunction SVGFEComponentTransfer::greenFunction() const
46 {
47  return m_greenFunc;
48 }
49 
50 void SVGFEComponentTransfer::setGreenFunction(const SVGComponentTransferFunction& func)
51 {
52  m_greenFunc = func;
53 }
54 
55 SVGComponentTransferFunction SVGFEComponentTransfer::blueFunction() const
56 {
57  return m_blueFunc;
58 }
59 
60 void SVGFEComponentTransfer::setBlueFunction(const SVGComponentTransferFunction& func)
61 {
62  m_blueFunc = func;
63 }
64 
65 SVGComponentTransferFunction SVGFEComponentTransfer::alphaFunction() const
66 {
67  return m_alphaFunc;
68 }
69 
70 void SVGFEComponentTransfer::setAlphaFunction(const SVGComponentTransferFunction& func)
71 {
72  m_alphaFunc = func;
73 }
74 
75 static TextStream& operator<<(TextStream& ts, SVGComponentTransferType t)
76 {
77  switch (t)
78  {
79  case SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN:
80  ts << "UNKNOWN"; break;
81  case SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY:
82  ts << "IDENTITY"; break;
83  case SVG_FECOMPONENTTRANSFER_TYPE_TABLE:
84  ts << "TABLE"; break;
85  case SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE:
86  ts << "DISCRETE"; break;
87  case SVG_FECOMPONENTTRANSFER_TYPE_LINEAR:
88  ts << "LINEAR"; break;
89  case SVG_FECOMPONENTTRANSFER_TYPE_GAMMA:
90  ts << "GAMMA"; break;
91  }
92  return ts;
93 }
94 
95 static TextStream& operator<<(TextStream& ts, const SVGComponentTransferFunction &func)
96 {
97  ts << "[type=" << func.type << "]";
98  switch (func.type) {
99  case SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN:
100  case SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY:
101  break;
102  case SVG_FECOMPONENTTRANSFER_TYPE_TABLE:
103  case SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE:
104  {
105  ts << " [table values=";
106  Vector<float>::const_iterator itr=func.tableValues.begin();
107  if (itr != func.tableValues.end()) {
108  ts << *itr++;
109  for (; itr!=func.tableValues.end(); itr++) {
110  ts << " " << *itr;
111  }
112  }
113  ts << "]";
114  break;
115  }
116  case SVG_FECOMPONENTTRANSFER_TYPE_LINEAR:
117  ts << " [slope=" << func.slope << "]"
118  << " [intercept=" << func.intercept << "]";
119  break;
120  case SVG_FECOMPONENTTRANSFER_TYPE_GAMMA:
121  ts << " [amplitude=" << func.amplitude << "]"
122  << " [exponent=" << func.exponent << "]"
123  << " [offset=" << func.offset << "]";
124  break;
125  }
126  return ts;
127 }
128 
129 TextStream& SVGFEComponentTransfer::externalRepresentation(TextStream& ts) const
130 {
131  ts << "[type=COMPONENT-TRANSFER] ";
132  SVGFilterEffect::externalRepresentation(ts);
133  ts << " [red func=" << redFunction() << "]"
134  << " [green func=" << greenFunction() << "]"
135  << " [blue func=" << blueFunction() << "]"
136  << " [alpha func=" << alphaFunction() << "]";
137  return ts;
138 }
139 
140 } // namespace WebCore
141 
142 #endif // ENABLE(SVG) && ENABLE(SVG_FILTERS)
operator<<
QDebug operator<<(QDebug s, KDebugStreamFunction f)
SVGFEComponentTransfer.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:51:22 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KHTML

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal