1 /* === S Y N F I G ========================================================= */
2 /*! \file stroboscope.cpp
3 ** \brief Implementation of the "Stroboscope" layer
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 ** Copyright (c) 2007, 2008 Chris Moore
10 ** Copyright (c) 2009 Ray Frederikson
12 ** This package is free software; you can redistribute it and/or
13 ** modify it under the terms of the GNU General Public License as
14 ** published by the Free Software Foundation; either version 2 of
15 ** the License, or (at your option) any later version.
17 ** This package is distributed in the hope that it will be useful,
18 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 ** General Public License for more details.
23 ** === N O T E S ===========================================================
25 ** ========================================================================= */
27 /* === H E A D E R S ======================================================= */
36 #include "stroboscope.h"
37 #include <synfig/valuenode.h>
38 #include <synfig/valuenode_const.h>
39 #include <synfig/valuenode_subtract.h>
40 #include <synfig/time.h>
41 #include <synfig/context.h>
42 #include <synfig/paramdesc.h>
43 #include <synfig/renddesc.h>
44 #include <synfig/value.h>
45 #include <synfig/canvas.h>
49 using namespace synfig;
53 /* === M A C R O S ========================================================= */
55 /* === G L O B A L S ======================================================= */
57 SYNFIG_LAYER_INIT(Layer_Stroboscope);
58 SYNFIG_LAYER_SET_NAME(Layer_Stroboscope,"stroboscope");
59 SYNFIG_LAYER_SET_LOCAL_NAME(Layer_Stroboscope,N_("Stroboscope"));
60 SYNFIG_LAYER_SET_CATEGORY(Layer_Stroboscope,N_("Other"));
61 SYNFIG_LAYER_SET_VERSION(Layer_Stroboscope,"0.1");
62 SYNFIG_LAYER_SET_CVS_ID(Layer_Stroboscope,"$Id$");
64 /* === P R O C E D U R E S ================================================= */
66 /* === M E T H O D S ======================================================= */
68 Layer_Stroboscope::Layer_Stroboscope()
73 Layer_Stroboscope::~Layer_Stroboscope()
78 Layer_Stroboscope::set_param(const String & param, const ValueBase &value)
82 return Layer::set_param(param,value);
86 Layer_Stroboscope::get_param(const String & param)const
92 return Layer::get_param(param);
96 Layer_Stroboscope::get_param_vocab()const
98 Layer::Vocab ret(Layer::get_param_vocab());
100 ret.push_back(ParamDesc("frequency")
101 .set_local_name(_("Frequency"))
102 .set_description(_("Frequency of the Strobe in times per second"))
109 Layer_Stroboscope::set_time(Context context, Time t)const
111 Time ret_time=Time::begin();
113 ret_time = Time(1.0)/frequency*floor(t*frequency);
115 context.set_time(ret_time);
119 Layer_Stroboscope::get_color(Context context, const Point &pos)const
121 return context.get_color(pos);
125 Layer_Stroboscope::accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const
127 return context.accelerated_render(surface,quality,renddesc,cb);