KHTML
SVGFEDiffuseLighting.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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 }
00121
00122 #endif // ENABLE(SVG) && ENABLE(SVG_FILTERS)