KHTML
SVGFEDiffuseLighting.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 "SVGLightSource.h" 00026 #include "SVGFEDiffuseLighting.h" 00027 #include "TextStream.h" 00028 00029 namespace WebCore { 00030 00031 SVGFEDiffuseLighting::SVGFEDiffuseLighting(SVGResourceFilter* filter) 00032 : SVGFilterEffect(filter) 00033 , m_lightingColor() 00034 , m_surfaceScale(0.0f) 00035 , m_diffuseConstant(0.0f) 00036 , m_kernelUnitLengthX(0.0f) 00037 , m_kernelUnitLengthY(0.0f) 00038 , m_lightSource(0) 00039 { 00040 } 00041 00042 SVGFEDiffuseLighting::~SVGFEDiffuseLighting() 00043 { 00044 delete m_lightSource; 00045 } 00046 00047 Color SVGFEDiffuseLighting::lightingColor() const 00048 { 00049 return m_lightingColor; 00050 } 00051 00052 void SVGFEDiffuseLighting::setLightingColor(const Color& lightingColor) 00053 { 00054 m_lightingColor = lightingColor; 00055 } 00056 00057 float SVGFEDiffuseLighting::surfaceScale() const 00058 { 00059 return m_surfaceScale; 00060 } 00061 00062 void SVGFEDiffuseLighting::setSurfaceScale(float surfaceScale) 00063 { 00064 m_surfaceScale = surfaceScale; 00065 } 00066 00067 float SVGFEDiffuseLighting::diffuseConstant() const 00068 { 00069 return m_diffuseConstant; 00070 } 00071 00072 void SVGFEDiffuseLighting::setDiffuseConstant(float diffuseConstant) 00073 { 00074 m_diffuseConstant = diffuseConstant; 00075 } 00076 00077 float SVGFEDiffuseLighting::kernelUnitLengthX() const 00078 { 00079 return m_kernelUnitLengthX; 00080 } 00081 00082 void SVGFEDiffuseLighting::setKernelUnitLengthX(float kernelUnitLengthX) 00083 { 00084 m_kernelUnitLengthX = kernelUnitLengthX; 00085 } 00086 00087 float SVGFEDiffuseLighting::kernelUnitLengthY() const 00088 { 00089 return m_kernelUnitLengthY; 00090 } 00091 00092 void SVGFEDiffuseLighting::setKernelUnitLengthY(float kernelUnitLengthY) 00093 { 00094 m_kernelUnitLengthY = kernelUnitLengthY; 00095 } 00096 00097 const SVGLightSource* SVGFEDiffuseLighting::lightSource() const 00098 { 00099 return m_lightSource; 00100 } 00101 00102 void SVGFEDiffuseLighting::setLightSource(SVGLightSource* lightSource) 00103 { 00104 if (m_lightSource != lightSource) { 00105 delete m_lightSource; 00106 m_lightSource = lightSource; 00107 } 00108 } 00109 00110 TextStream& SVGFEDiffuseLighting::externalRepresentation(TextStream& ts) const 00111 { 00112 ts << "[type=DIFFUSE-LIGHTING] "; 00113 SVGFilterEffect::externalRepresentation(ts); 00114 ts << " [surface scale=" << m_surfaceScale << "]" 00115 << " [diffuse constant=" << m_diffuseConstant << "]" 00116 << " [kernel unit length " << m_kernelUnitLengthX << ", " << m_kernelUnitLengthY << "]"; 00117 return ts; 00118 } 00119 00120 } // namespace WebCore 00121 00122 #endif // ENABLE(SVG) && ENABLE(SVG_FILTERS)
KDE 4.6 API Reference