1 /* === S Y N F I G ========================================================= */
3 ** \brief Image Layer_TimeLoop Layer Implementation
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
10 ** This package is free software; you can redistribute it and/or
11 ** modify it under the terms of the GNU General Public License as
12 ** published by the Free Software Foundation; either version 2 of
13 ** the License, or (at your option) any later version.
15 ** This package is distributed in the hope that it will be useful,
16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ** General Public License for more details.
21 ** === N O T E S ===========================================================
23 ** ========================================================================= */
25 /* === H E A D E R S ======================================================= */
35 #include <synfig/time.h>
36 #include <synfig/context.h>
37 #include <synfig/paramdesc.h>
38 #include <synfig/renddesc.h>
39 #include <synfig/value.h>
43 using namespace synfig;
47 /* === M A C R O S ========================================================= */
49 /* === G L O B A L S ======================================================= */
51 SYNFIG_LAYER_INIT(Layer_TimeLoop);
52 SYNFIG_LAYER_SET_NAME(Layer_TimeLoop,"timeloop");
53 SYNFIG_LAYER_SET_LOCAL_NAME(Layer_TimeLoop,_("TimeLoop"));
54 SYNFIG_LAYER_SET_CATEGORY(Layer_TimeLoop,_("Other"));
55 SYNFIG_LAYER_SET_VERSION(Layer_TimeLoop,"0.1");
56 SYNFIG_LAYER_SET_CVS_ID(Layer_TimeLoop,"$Id$");
58 /* === P R O C E D U R E S ================================================= */
60 /* === M E T H O D S ======================================================= */
62 Layer_TimeLoop::Layer_TimeLoop()
68 Layer_TimeLoop::~Layer_TimeLoop()
73 Layer_TimeLoop::set_param(const String & param, const ValueBase &value)
77 return Layer::set_param(param,value);
81 Layer_TimeLoop::get_param(const String & param)const
88 return Layer::get_param(param);
92 Layer_TimeLoop::get_param_vocab()const
94 Layer::Vocab ret(Layer::get_param_vocab());
96 ret.push_back(ParamDesc("start_time")
97 .set_local_name(_("Start Time"))
100 ret.push_back(ParamDesc("end_time")
101 .set_local_name(_("End Time"))
108 Layer_TimeLoop::set_time(Context context, Time time)const
110 Real diff(end_time-start_time);
112 time-=int(Real(time-start_time)/diff)*diff+start_time;
113 context.set_time(time);
117 Layer_TimeLoop::get_color(Context context, const Point &pos)const
119 return context.get_color(pos);
123 Layer_TimeLoop::accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const
125 return context.accelerated_render(surface,quality,renddesc,cb);