KHTML
SVGFEBlend.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 "SVGFEBlend.h" 00026 #include "TextStream.h" 00027 00028 namespace WebCore { 00029 00030 SVGFEBlend::SVGFEBlend(SVGResourceFilter* filter) 00031 : SVGFilterEffect(filter) 00032 , m_mode(SVG_FEBLEND_MODE_UNKNOWN) 00033 { 00034 } 00035 00036 String SVGFEBlend::in2() const 00037 { 00038 return m_in2; 00039 } 00040 00041 void SVGFEBlend::setIn2(const String& in2) 00042 { 00043 m_in2 = in2; 00044 } 00045 00046 SVGBlendModeType SVGFEBlend::blendMode() const 00047 { 00048 return m_mode; 00049 } 00050 00051 void SVGFEBlend::setBlendMode(SVGBlendModeType mode) 00052 { 00053 m_mode = mode; 00054 } 00055 00056 static TextStream& operator<<(TextStream& ts, SVGBlendModeType t) 00057 { 00058 switch (t) 00059 { 00060 case SVG_FEBLEND_MODE_UNKNOWN: 00061 ts << "UNKNOWN"; break; 00062 case SVG_FEBLEND_MODE_NORMAL: 00063 ts << "NORMAL"; break; 00064 case SVG_FEBLEND_MODE_MULTIPLY: 00065 ts << "MULTIPLY"; break; 00066 case SVG_FEBLEND_MODE_SCREEN: 00067 ts << "SCREEN"; break; 00068 case SVG_FEBLEND_MODE_DARKEN: 00069 ts << "DARKEN"; break; 00070 case SVG_FEBLEND_MODE_LIGHTEN: 00071 ts << "LIGHTEN"; break; 00072 } 00073 return ts; 00074 } 00075 00076 TextStream& SVGFEBlend::externalRepresentation(TextStream& ts) const 00077 { 00078 ts << "[type=BLEND] "; 00079 SVGFilterEffect::externalRepresentation(ts); 00080 if (!m_in2.isEmpty()) 00081 ts << " [in2=\"" << m_in2 << "\"]"; 00082 ts << " [blend mode=" << m_mode << "]"; 00083 return ts; 00084 } 00085 00086 } // namespace WebCore 00087 00088 #endif // ENABLE(SVG) && ENABLE(SVG_FILTERS)
KDE 4.6 API Reference