• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KHTML

  • sources
  • kde-4.12
  • kdelibs
  • khtml
  • svg
SVGAnimationElement.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
3  2004, 2005, 2006 Rob Buis <buis@kde.org>
4  Copyright (C) 2007 Eric Seidel <eric@webkit.org>
5  Copyright (C) 2008 Apple Inc. All rights reserved.
6 
7  This file is part of the KDE project
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Library General Public
11  License as published by the Free Software Foundation; either
12  version 2 of the License, or (at your option) any later version.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Library General Public License for more details.
18 
19  You should have received a copy of the GNU Library General Public License
20  along with this library; see the file COPYING.LIB. If not, write to
21  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  Boston, MA 02110-1301, USA.
23 */
24 
25 #ifndef SVGAnimationElement_h
26 #define SVGAnimationElement_h
27 #if ENABLE(SVG_ANIMATION)
28 
29 #include "ElementTimeControl.h"
30 #include "Path.h"
31 #include "SMILTime.h"
32 #include "SVGSMILElement.h"
33 #include "SVGExternalResourcesRequired.h"
34 #include "SVGStringList.h"
35 #include "SVGTests.h"
36 #include "UnitBezier.h"
37 
38 namespace WebCore {
39 
40  class ConditionEventListener;
41  class TimeContainer;
42 
43  class SVGAnimationElement : public SVGSMILElement,
44  public SVGTests,
45  public SVGExternalResourcesRequired,
46  public ElementTimeControl
47  {
48  public:
49  SVGAnimationElement(const QualifiedName&, Document*);
50  virtual ~SVGAnimationElement();
51 
52  virtual void parseMappedAttribute(MappedAttribute*);
53  virtual void attributeChanged(Attribute*, bool preserveDecls);
54 
55  // SVGAnimationElement
56  float getStartTime() const;
57  float getCurrentTime() const;
58  float getSimpleDuration(ExceptionCode&) const;
59 
60  // ElementTimeControl
61  virtual bool beginElement(ExceptionCode&);
62  virtual bool beginElementAt(float offset, ExceptionCode&);
63  virtual bool endElement(ExceptionCode&);
64  virtual bool endElementAt(float offset, ExceptionCode&);
65 
66  static bool attributeIsCSS(const String& attributeName);
67 
68 protected:
69 
70  enum CalcMode { CalcModeDiscrete, CalcModeLinear, CalcModePaced, CalcModeSpline };
71  CalcMode calcMode() const;
72 
73  enum AttributeType { AttributeTypeCSS, AttributeTypeXML, AttributeTypeAuto };
74  AttributeType attributeType() const;
75 
76  String toValue() const;
77  String byValue() const;
78  String fromValue() const;
79 
80  enum AnimationMode { NoAnimation, ToAnimation, ByAnimation, ValuesAnimation, FromToAnimation, FromByAnimation, PathAnimation };
81  AnimationMode animationMode() const;
82 
83  virtual bool hasValidTarget() const;
84 
85  String targetAttributeBaseValue() const;
86  void setTargetAttributeAnimatedValue(const String&);
87  bool targetAttributeIsCSS() const;
88 
89  bool isAdditive() const;
90  bool isAccumulated() const;
91 
92  // from SVGSMILElement
93  virtual void startedActiveInterval();
94  virtual void updateAnimation(float percent, unsigned repeat, SVGSMILElement* resultElement);
95  virtual void endedActiveInterval();
96 
97  ANIMATED_PROPERTY_FORWARD_DECLARATIONS(SVGExternalResourcesRequired, bool, ExternalResourcesRequired, externalResourcesRequired)
98 private:
99  virtual bool calculateFromAndToValues(const String& fromString, const String& toString) = 0;
100  virtual bool calculateFromAndByValues(const String& fromString, const String& byString) = 0;
101  virtual void calculateAnimatedValue(float percentage, unsigned repeat, SVGSMILElement* resultElement) = 0;
102  virtual float calculateDistance(const String& fromString, const String& toString) { return -1.f; }
103  virtual Path animationPath() const { return Path(); }
104 
105  void currentValuesForValuesAnimation(float percent, float& effectivePercent, String& from, String& to) const;
106  void calculateKeyTimesForCalcModePaced();
107  float calculatePercentFromKeyPoints(float percent) const;
108  void currentValuesFromKeyPoints(float percent, float& effectivePercent, String& from, String& to) const;
109  float calculatePercentForSpline(float percent, unsigned splineIndex) const;
110 
111 protected:
112  bool m_animationValid;
113 
114  Vector<String> m_values;
115  Vector<float> m_keyTimes;
116  Vector<float> m_keyPoints;
117  Vector<UnitBezier> m_keySplines;
118  String m_lastValuesAnimationFrom;
119  String m_lastValuesAnimationTo;
120  };
121 
122 } // namespace WebCore
123 
124 #endif // ENABLE(SVG)
125 #endif // SVGAnimationElement_h
SMILTime.h
SVGExternalResourcesRequired.h
SVGSMILElement.h
ElementTimeControl.h
WebCore::Path
khtml::Path Path
Definition: PathTraversalState.h:37
SVGStringList.h
SVGTests.h
Path.h
WebCore::String
DOM::DOMString String
Definition: PlatformString.h:8
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:51:22 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KHTML

Skip menu "KHTML"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal