KHtml

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

KDE's Doxygen guidelines are available online.