Home | History | Annotate | Download | only in svg
      1 /*
      2  * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann (at) kde.org>
      3  * Copyright (C) 2004, 2005, 2006 Rob Buis <buis (at) kde.org>
      4  * Copyright (C) 2005 Oliver Hunt <oliver (at) nerget.com>
      5  *
      6  * This library is free software; you can redistribute it and/or
      7  * modify it under the terms of the GNU Library General Public
      8  * License as published by the Free Software Foundation; either
      9  * version 2 of the License, or (at your option) any later version.
     10  *
     11  * This library is distributed in the hope that it will be useful,
     12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     14  * Library General Public License for more details.
     15  *
     16  * You should have received a copy of the GNU Library General Public License
     17  * along with this library; see the file COPYING.LIB.  If not, write to
     18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     19  * Boston, MA 02110-1301, USA.
     20  */
     21 
     22 #ifndef SVGFELightElement_h
     23 #define SVGFELightElement_h
     24 
     25 #include "core/SVGNames.h"
     26 #include "core/svg/SVGAnimatedNumber.h"
     27 #include "core/svg/SVGElement.h"
     28 #include "platform/graphics/filters/LightSource.h"
     29 
     30 namespace WebCore {
     31 
     32 class Filter;
     33 
     34 class SVGFELightElement : public SVGElement {
     35 public:
     36     virtual PassRefPtr<LightSource> lightSource(Filter*) const = 0;
     37     static SVGFELightElement* findLightElement(const SVGElement&);
     38 
     39     SVGAnimatedNumber* azimuth() { return m_azimuth.get(); }
     40     const SVGAnimatedNumber* azimuth() const { return m_azimuth.get(); }
     41     SVGAnimatedNumber* elevation() { return m_elevation.get(); }
     42     const SVGAnimatedNumber* elevation() const { return m_elevation.get(); }
     43     SVGAnimatedNumber* x() { return m_x.get(); }
     44     const SVGAnimatedNumber* x() const { return m_x.get(); }
     45     SVGAnimatedNumber* y() { return m_y.get(); }
     46     const SVGAnimatedNumber* y() const { return m_y.get(); }
     47     SVGAnimatedNumber* z() { return m_z.get(); }
     48     const SVGAnimatedNumber* z() const { return m_z.get(); }
     49     SVGAnimatedNumber* pointsAtX() { return m_pointsAtX.get(); }
     50     const SVGAnimatedNumber* pointsAtX() const { return m_pointsAtX.get(); }
     51     SVGAnimatedNumber* pointsAtY() { return m_pointsAtY.get(); }
     52     const SVGAnimatedNumber* pointsAtY() const { return m_pointsAtY.get(); }
     53     SVGAnimatedNumber* pointsAtZ() { return m_pointsAtZ.get(); }
     54     const SVGAnimatedNumber* pointsAtZ() const { return m_pointsAtZ.get(); }
     55     SVGAnimatedNumber* specularExponent() { return m_specularExponent.get(); }
     56     const SVGAnimatedNumber* specularExponent() const { return m_specularExponent.get(); }
     57     SVGAnimatedNumber* limitingConeAngle() { return m_limitingConeAngle.get(); }
     58     const SVGAnimatedNumber* limitingConeAngle() const { return m_limitingConeAngle.get(); }
     59 
     60 protected:
     61     SVGFELightElement(const QualifiedName&, Document&);
     62 
     63 private:
     64     bool isSupportedAttribute(const QualifiedName&);
     65     virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE FINAL;
     66     virtual void svgAttributeChanged(const QualifiedName&) OVERRIDE FINAL;
     67     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0) OVERRIDE FINAL;
     68 
     69     virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; }
     70 
     71     RefPtr<SVGAnimatedNumber> m_azimuth;
     72     RefPtr<SVGAnimatedNumber> m_elevation;
     73     RefPtr<SVGAnimatedNumber> m_x;
     74     RefPtr<SVGAnimatedNumber> m_y;
     75     RefPtr<SVGAnimatedNumber> m_z;
     76     RefPtr<SVGAnimatedNumber> m_pointsAtX;
     77     RefPtr<SVGAnimatedNumber> m_pointsAtY;
     78     RefPtr<SVGAnimatedNumber> m_pointsAtZ;
     79     RefPtr<SVGAnimatedNumber> m_specularExponent;
     80     RefPtr<SVGAnimatedNumber> m_limitingConeAngle;
     81 };
     82 
     83 inline bool isSVGFELightElement(const Node& node)
     84 {
     85     return node.hasTagName(SVGNames::feDistantLightTag) || node.hasTagName(SVGNames::fePointLightTag) || node.hasTagName(SVGNames::feSpotLightTag);
     86 }
     87 
     88 DEFINE_ELEMENT_TYPE_CASTS_WITH_FUNCTION(SVGFELightElement);
     89 
     90 } // namespace WebCore
     91 
     92 #endif
     93