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 blink {
     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     FloatPoint3D position() const;
     40     FloatPoint3D pointsAt() const;
     41 
     42     SVGAnimatedNumber* azimuth() { return m_azimuth.get(); }
     43     const SVGAnimatedNumber* azimuth() const { return m_azimuth.get(); }
     44     SVGAnimatedNumber* elevation() { return m_elevation.get(); }
     45     const SVGAnimatedNumber* elevation() const { return m_elevation.get(); }
     46     SVGAnimatedNumber* x() { return m_x.get(); }
     47     const SVGAnimatedNumber* x() const { return m_x.get(); }
     48     SVGAnimatedNumber* y() { return m_y.get(); }
     49     const SVGAnimatedNumber* y() const { return m_y.get(); }
     50     SVGAnimatedNumber* z() { return m_z.get(); }
     51     const SVGAnimatedNumber* z() const { return m_z.get(); }
     52     SVGAnimatedNumber* pointsAtX() { return m_pointsAtX.get(); }
     53     const SVGAnimatedNumber* pointsAtX() const { return m_pointsAtX.get(); }
     54     SVGAnimatedNumber* pointsAtY() { return m_pointsAtY.get(); }
     55     const SVGAnimatedNumber* pointsAtY() const { return m_pointsAtY.get(); }
     56     SVGAnimatedNumber* pointsAtZ() { return m_pointsAtZ.get(); }
     57     const SVGAnimatedNumber* pointsAtZ() const { return m_pointsAtZ.get(); }
     58     SVGAnimatedNumber* specularExponent() { return m_specularExponent.get(); }
     59     const SVGAnimatedNumber* specularExponent() const { return m_specularExponent.get(); }
     60     SVGAnimatedNumber* limitingConeAngle() { return m_limitingConeAngle.get(); }
     61     const SVGAnimatedNumber* limitingConeAngle() const { return m_limitingConeAngle.get(); }
     62 
     63 protected:
     64     SVGFELightElement(const QualifiedName&, Document&);
     65 
     66 private:
     67     bool isSupportedAttribute(const QualifiedName&);
     68     virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE FINAL;
     69     virtual void svgAttributeChanged(const QualifiedName&) OVERRIDE FINAL;
     70     virtual void childrenChanged(const ChildrenChange&) OVERRIDE FINAL;
     71 
     72     virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; }
     73 
     74     RefPtr<SVGAnimatedNumber> m_azimuth;
     75     RefPtr<SVGAnimatedNumber> m_elevation;
     76     RefPtr<SVGAnimatedNumber> m_x;
     77     RefPtr<SVGAnimatedNumber> m_y;
     78     RefPtr<SVGAnimatedNumber> m_z;
     79     RefPtr<SVGAnimatedNumber> m_pointsAtX;
     80     RefPtr<SVGAnimatedNumber> m_pointsAtY;
     81     RefPtr<SVGAnimatedNumber> m_pointsAtZ;
     82     RefPtr<SVGAnimatedNumber> m_specularExponent;
     83     RefPtr<SVGAnimatedNumber> m_limitingConeAngle;
     84 };
     85 
     86 inline bool isSVGFELightElement(const SVGElement& element)
     87 {
     88     return element.hasTagName(SVGNames::feDistantLightTag) || element.hasTagName(SVGNames::fePointLightTag) || element.hasTagName(SVGNames::feSpotLightTag);
     89 }
     90 
     91 DEFINE_SVGELEMENT_TYPE_CASTS_WITH_FUNCTION(SVGFELightElement);
     92 
     93 } // namespace blink
     94 
     95 #endif
     96