KHTML
SVGFEDisplacementMap.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 "SVGRenderTreeAsText.h" 00026 #include "SVGFEDisplacementMap.h" 00027 00028 namespace WebCore { 00029 00030 SVGFEDisplacementMap::SVGFEDisplacementMap(SVGResourceFilter* filter) 00031 : SVGFilterEffect(filter) 00032 , m_xChannelSelector(SVG_CHANNEL_UNKNOWN) 00033 , m_yChannelSelector(SVG_CHANNEL_UNKNOWN) 00034 , m_scale(0) 00035 { 00036 } 00037 00038 String SVGFEDisplacementMap::in2() const 00039 { 00040 return m_in2; 00041 } 00042 00043 void SVGFEDisplacementMap::setIn2(const String &in2) 00044 { 00045 m_in2 = in2; 00046 } 00047 00048 SVGChannelSelectorType SVGFEDisplacementMap::xChannelSelector() const 00049 { 00050 return m_xChannelSelector; 00051 } 00052 00053 void SVGFEDisplacementMap::setXChannelSelector(const SVGChannelSelectorType xChannelSelector) 00054 { 00055 m_xChannelSelector = xChannelSelector; 00056 } 00057 00058 SVGChannelSelectorType SVGFEDisplacementMap::yChannelSelector() const 00059 { 00060 return m_yChannelSelector; 00061 } 00062 00063 void SVGFEDisplacementMap::setYChannelSelector(const SVGChannelSelectorType yChannelSelector) 00064 { 00065 m_yChannelSelector = yChannelSelector; 00066 } 00067 00068 float SVGFEDisplacementMap::scale() const 00069 { 00070 return m_scale; 00071 } 00072 00073 void SVGFEDisplacementMap::setScale(float scale) 00074 { 00075 m_scale = scale; 00076 } 00077 00078 static TextStream& operator<<(TextStream& ts, SVGChannelSelectorType t) 00079 { 00080 switch (t) 00081 { 00082 case SVG_CHANNEL_UNKNOWN: 00083 ts << "UNKNOWN"; break; 00084 case SVG_CHANNEL_R: 00085 ts << "RED"; break; 00086 case SVG_CHANNEL_G: 00087 ts << "GREEN"; break; 00088 case SVG_CHANNEL_B: 00089 ts << "BLUE"; break; 00090 case SVG_CHANNEL_A: 00091 ts << "ALPHA"; break; 00092 } 00093 return ts; 00094 } 00095 00096 TextStream& SVGFEDisplacementMap::externalRepresentation(TextStream& ts) const 00097 { 00098 ts << "[type=DISPLACEMENT-MAP] "; 00099 SVGFilterEffect::externalRepresentation(ts); 00100 if (!in2().isEmpty()) 00101 ts << " [in2=" << in2() << "]"; 00102 ts << " [scale=" << m_scale << "]" 00103 << " [x channel selector=" << m_xChannelSelector << "]" 00104 << " [y channel selector=" << m_yChannelSelector << "]"; 00105 return ts; 00106 } 00107 00108 } // namespace WebCore 00109 00110 #endif // ENABLE(SVG) && ENABLE(SVG_FILTERS)
KDE 4.6 API Reference