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
9 ** Copyright (c) 2007 Chris Moore
11 ** This package is free software; you can redistribute it and/or
12 ** modify it under the terms of the GNU General Public License as
13 ** published by the Free Software Foundation; either version 2 of
14 ** the License, or (at your option) any later version.
16 ** This package is distributed in the hope that it will be useful,
17 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ** General Public License for more details.
22 ** === N O T E S ===========================================================
24 ** ========================================================================= */
26 /* === H E A D E R S ======================================================= */
36 #include <synfig/time.h>
37 #include <synfig/context.h>
38 #include <synfig/paramdesc.h>
39 #include <synfig/renddesc.h>
40 #include <synfig/value.h>
44 using namespace synfig;
48 /* === M A C R O S ========================================================= */
50 /* === G L O B A L S ======================================================= */
52 SYNFIG_LAYER_INIT(Layer_TimeLoop);
53 SYNFIG_LAYER_SET_NAME(Layer_TimeLoop,"timeloop");
54 SYNFIG_LAYER_SET_LOCAL_NAME(Layer_TimeLoop,N_("Time Loop"));
55 SYNFIG_LAYER_SET_CATEGORY(Layer_TimeLoop,N_("Other"));
56 SYNFIG_LAYER_SET_VERSION(Layer_TimeLoop,"0.1");
57 SYNFIG_LAYER_SET_CVS_ID(Layer_TimeLoop,"$Id$");
59 /* === P R O C E D U R E S ================================================= */
61 /* === M E T H O D S ======================================================= */
63 Layer_TimeLoop::Layer_TimeLoop()
69 Layer_TimeLoop::~Layer_TimeLoop()
74 Layer_TimeLoop::set_param(const String & param, const ValueBase &value)
78 return Layer::set_param(param,value);
82 Layer_TimeLoop::get_param(const String & param)const
89 return Layer::get_param(param);
93 Layer_TimeLoop::get_param_vocab()const
95 Layer::Vocab ret(Layer::get_param_vocab());
97 ret.push_back(ParamDesc("start_time")
98 .set_local_name(_("Start Time"))
101 ret.push_back(ParamDesc("end_time")
102 .set_local_name(_("End Time"))
109 Layer_TimeLoop::set_time(Context context, Time time)const
111 Real diff(end_time-start_time);
113 time-=int(Real(time-start_time)/diff)*diff+start_time;
114 context.set_time(time);
118 Layer_TimeLoop::get_color(Context context, const Point &pos)const
120 return context.get_color(pos);
124 Layer_TimeLoop::accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const
126 return context.accelerated_render(surface,quality,renddesc,cb);