Ginga  0.13.6.2086-83aa
The iTV middleware.
PlayerAnimator.h
1 /* Copyright (C) 2006-2018 PUC-Rio/Laboratorio TeleMidia
2 
3 This file is part of Ginga (Ginga-NCL).
4 
5 Ginga is free software: you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 2 of the License, or
8 (at your option) any later version.
9 
10 Ginga is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with Ginga. If not, see <https://www.gnu.org/licenses/>. */
17 
18 #ifndef PLAYER_ANIMATOR_H
19 #define PLAYER_ANIMATOR_H
20 
21 #include "Formatter.h"
22 
23 GINGA_NAMESPACE_BEGIN
24 
25 // Entry in scheduled animations list.
26 class AnimInfo
27 {
28 public:
29  AnimInfo (const string &, double, double, Time);
30  ~AnimInfo ();
31 
32  string getName ();
33  double getCurrent ();
34  double getTarget ();
35  Time getDuration ();
36  double getSpeed ();
37  int getStateNode ();
38  void setStateNode (int);
39  void update (const string &, double, double, Time);
40  bool isDone ();
41  bool isInit ();
42 
43  void init (double current, Time time);
44  void update (Time time);
45 
46 private:
47  string _name; // property name
48  double _current; // current value
49  double _target; // target value
50  Time _duration; // animation duration
51  Time _last_update; // time of the last update
52  double _speed; // animation speed
53  bool _done; // true if animation is done
54  bool _init; // true if animation is initialized
55  int _stateNode; // for complex animations
56 };
57 
59 {
60 public:
61  TransitionInfo (const string &, const string &, Time, gdouble, gdouble,
62  const string &, Color, guint32, guint32, guint32, Color);
63  ~TransitionInfo ();
64 
65  string getType ();
66  string getSubType ();
67  Time getDur ();
68  gdouble getStartProgress ();
69  gdouble getEndProgress ();
70  string getDirection ();
71  Color getFadeColor ();
72  guint32 getHorzRepeat ();
73  guint32 getVertRepeat ();
74  guint32 getBorderWidth ();
75  Color getBorderColor ();
76 
77 private:
78  string _type;
79  string _subtype;
80  Time _dur;
81  gdouble _startProgress;
82  gdouble _endProgress;
83  string _direction;
84  Color _fadeColor;
85  guint32 _horzRepeat;
86  guint32 _vertRepeat;
87  guint32 _borderWidth;
88  Color _borderColor;
89 };
90 
92 {
93 public:
94  PlayerAnimator (Formatter *, Time *);
95  ~PlayerAnimator ();
96  void clear ();
97  void schedule (const string &, const string &, const string &, Time);
98  void update (Rect *, Color *, guint8 *, list<int> *);
99  void setTransitionProperties (const string &, const string &);
100  void scheduleTransition (const string &, Rect *, Color *, guint8 *,
101  list<int> *);
102 
103 private:
104  Formatter *_formatter; // formatter handle
105  list<AnimInfo *> _scheduled; // scheduled animations
106  TransitionInfo *_transIn;
107  TransitionInfo *_transOut;
108  Time *_time;
109 
110  void doSchedule (const string &, const string &, const string &, Time);
111  void updateSchedule (AnimInfo *, const string &, const string &,
112  const string &, Time);
113 };
114 
115 GINGA_NAMESPACE_END
116 
117 #endif // PLAYER_ANIMATOR_H
Definition: PlayerAnimator.h:91
Interface between libginga and the external world.
Definition: Formatter.h:37
Definition: PlayerAnimator.h:26
Definition: PlayerAnimator.h:58