File indexing completed on 2024-04-28 15:24:31

0001 /*
0002     Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
0003                   2004, 2005, 2006 Rob Buis <buis@kde.org>
0004                   2005 Oliver Hunt <oliver@nerget.com>
0005 
0006     This library is free software; you can redistribute it and/or
0007     modify it under the terms of the GNU Library General Public
0008     License as published by the Free Software Foundation; either
0009     version 2 of the License, or (at your option) any later version.
0010 
0011     This library is distributed in the hope that it will be useful,
0012     but WITHOUT ANY WARRANTY; without even the implied warranty of
0013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014     Library General Public License for more details.
0015 
0016     You should have received a copy of the GNU Library General Public License
0017     along with this library; see the file COPYING.LIB.  If not, write to
0018     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0019     Boston, MA 02110-1301, USA.
0020 */
0021 
0022 #if ENABLE(SVG) && ENABLE(SVG_FILTERS)
0023 #include "SVGFELightElement.h"
0024 
0025 #include "SVGNames.h"
0026 
0027 namespace WebCore
0028 {
0029 
0030 SVGFELightElement::SVGFELightElement(const QualifiedName &tagName, Document *doc)
0031     : SVGElement(tagName, doc)
0032     , m_azimuth(0.0f)
0033     , m_elevation(0.0f)
0034     , m_x(0.0f)
0035     , m_y(0.0f)
0036     , m_z(0.0f)
0037     , m_pointsAtX(0.0f)
0038     , m_pointsAtY(0.0f)
0039     , m_pointsAtZ(0.0f)
0040     , m_specularExponent(1.0f)
0041     , m_limitingConeAngle(0.0f)
0042 {
0043 }
0044 
0045 SVGFELightElement::~SVGFELightElement()
0046 {
0047 }
0048 
0049 ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, Azimuth, azimuth, SVGNames::azimuthAttr, m_azimuth)
0050 ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, Elevation, elevation, SVGNames::elevationAttr, m_elevation)
0051 ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, X, x, SVGNames::xAttr, m_x)
0052 ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, Y, y, SVGNames::yAttr, m_y)
0053 
0054 ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, Z, z, SVGNames::zAttr, m_z)
0055 ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, PointsAtX, pointsAtX, SVGNames::pointsAtXAttr, m_pointsAtX)
0056 ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, PointsAtY, pointsAtY, SVGNames::pointsAtYAttr, m_pointsAtY)
0057 ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, PointsAtZ, pointsAtZ, SVGNames::pointsAtZAttr, m_pointsAtZ)
0058 ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, SpecularExponent, specularExponent, SVGNames::specularExponentAttr, m_specularExponent)
0059 ANIMATED_PROPERTY_DEFINITIONS(SVGFELightElement, float, Number, number, LimitingConeAngle, limitingConeAngle, SVGNames::limitingConeAngleAttr, m_limitingConeAngle)
0060 
0061 void SVGFELightElement::parseMappedAttribute(MappedAttribute *attr)
0062 {
0063     const String &value = attr->value();
0064     if (attr->name() == SVGNames::azimuthAttr) {
0065         setAzimuthBaseValue(value.toFloat());
0066     } else if (attr->name() == SVGNames::elevationAttr) {
0067         setElevationBaseValue(value.toFloat());
0068     } else if (attr->name() == SVGNames::xAttr) {
0069         setXBaseValue(value.toFloat());
0070     } else if (attr->name() == SVGNames::yAttr) {
0071         setYBaseValue(value.toFloat());
0072     } else if (attr->name() == SVGNames::zAttr) {
0073         setZBaseValue(value.toFloat());
0074     } else if (attr->name() == SVGNames::pointsAtXAttr) {
0075         setPointsAtXBaseValue(value.toFloat());
0076     } else if (attr->name() == SVGNames::pointsAtYAttr) {
0077         setPointsAtYBaseValue(value.toFloat());
0078     } else if (attr->name() == SVGNames::pointsAtZAttr) {
0079         setPointsAtZBaseValue(value.toFloat());
0080     } else if (attr->name() == SVGNames::specularExponentAttr) {
0081         setSpecularExponentBaseValue(value.toFloat());
0082     } else if (attr->name() == SVGNames::limitingConeAngleAttr) {
0083         setLimitingConeAngleBaseValue(value.toFloat());
0084     } else {
0085         SVGElement::parseMappedAttribute(attr);
0086     }
0087 }
0088 
0089 }
0090 
0091 #endif // ENABLE(SVG)
0092