KHtml

SVGFEConvolveMatrix.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 "SVGRenderTreeAsText.h"
24 #include "SVGFEConvolveMatrix.h"
25 
26 namespace WebCore
27 {
28 
29 SVGFEConvolveMatrix::SVGFEConvolveMatrix(SVGResourceFilter *filter)
30  : SVGFilterEffect(filter)
31  , m_kernelSize()
32  , m_divisor(0.0f)
33  , m_bias(0.0f)
34  , m_targetOffset()
35  , m_edgeMode(SVG_EDGEMODE_UNKNOWN)
36  , m_kernelUnitLength()
37  , m_preserveAlpha(false)
38 {
39 }
40 
41 FloatSize SVGFEConvolveMatrix::kernelSize() const
42 {
43  return m_kernelSize;
44 }
45 
46 void SVGFEConvolveMatrix::setKernelSize(FloatSize kernelSize)
47 {
48  m_kernelSize = kernelSize;
49 }
50 
51 const Vector<float> &SVGFEConvolveMatrix::kernel() const
52 {
53  return m_kernelMatrix;
54 }
55 
56 void SVGFEConvolveMatrix::setKernel(const Vector<float> &kernel)
57 {
58  m_kernelMatrix = kernel;
59 }
60 
61 float SVGFEConvolveMatrix::divisor() const
62 {
63  return m_divisor;
64 }
65 
66 void SVGFEConvolveMatrix::setDivisor(float divisor)
67 {
68  m_divisor = divisor;
69 }
70 
71 float SVGFEConvolveMatrix::bias() const
72 {
73  return m_bias;
74 }
75 
76 void SVGFEConvolveMatrix::setBias(float bias)
77 {
78  m_bias = bias;
79 }
80 
81 FloatSize SVGFEConvolveMatrix::targetOffset() const
82 {
83  return m_targetOffset;
84 }
85 
86 void SVGFEConvolveMatrix::setTargetOffset(FloatSize targetOffset)
87 {
88  m_targetOffset = targetOffset;
89 }
90 
91 SVGEdgeModeType SVGFEConvolveMatrix::edgeMode() const
92 {
93  return m_edgeMode;
94 }
95 
96 void SVGFEConvolveMatrix::setEdgeMode(SVGEdgeModeType edgeMode)
97 {
98  m_edgeMode = edgeMode;
99 }
100 
101 FloatPoint SVGFEConvolveMatrix::kernelUnitLength() const
102 {
103  return m_kernelUnitLength;
104 }
105 
106 void SVGFEConvolveMatrix::setKernelUnitLength(FloatPoint kernelUnitLength)
107 {
108  m_kernelUnitLength = kernelUnitLength;
109 }
110 
111 bool SVGFEConvolveMatrix::preserveAlpha() const
112 {
113  return m_preserveAlpha;
114 }
115 
116 void SVGFEConvolveMatrix::setPreserveAlpha(bool preserveAlpha)
117 {
118  m_preserveAlpha = preserveAlpha;
119 }
120 
121 static TextStream &operator<<(TextStream &ts, SVGEdgeModeType t)
122 {
123  switch (t) {
124  case SVG_EDGEMODE_UNKNOWN:
125  ts << "UNKNOWN"; break;
126  case SVG_EDGEMODE_DUPLICATE:
127  ts << "DUPLICATE"; break;
128  case SVG_EDGEMODE_WRAP:
129  ts << "WRAP"; break;
130  case SVG_EDGEMODE_NONE:
131  ts << "NONE"; break;
132  }
133  return ts;
134 }
135 
136 TextStream &SVGFEConvolveMatrix::externalRepresentation(TextStream &ts) const
137 {
138  ts << "[type=CONVOLVE-MATRIX] ";
139  SVGFilterEffect::externalRepresentation(ts);
140  ts << " [order " << m_kernelSize << "]"
141  << " [kernel matrix=" << m_kernelMatrix << "]"
142  << " [divisor=" << m_divisor << "]"
143  << " [bias=" << m_bias << "]"
144  << " [target " << m_targetOffset << "]"
145  << " [edge mode=" << m_edgeMode << "]"
146  << " [kernel unit length " << m_kernelUnitLength << "]"
147  << " [preserve alpha=" << m_preserveAlpha << "]";
148  return ts;
149 }
150 
151 }; // namespace WebCore
152 
153 #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.