1 /* === S Y N F I G ========================================================= */
3 ** \brief Template Header
5 ** $Id: circle.h,v 1.2 2005/01/24 03:08:17 darco Exp $
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 /* ========================================================================= */
23 /* === H E A D E R S ======================================================= */
25 #ifndef __SYNFIG_LAYER_CIRCLE_H__
26 #define __SYNFIG_LAYER_CIRCLE_H__
28 /* -- H E A D E R S --------------------------------------------------------- */
30 #include <synfig/layer_composite.h>
31 #include <synfig/color.h>
32 #include <synfig/vector.h>
34 using namespace synfig;
38 /* -- M A C R O S ----------------------------------------------------------- */
40 /* -- T Y P E D E F S ------------------------------------------------------- */
42 /* -- S T R U C T S & C L A S S E S ----------------------------------------- */
44 class Circle : public synfig::Layer_Composite, public synfig::Layer_NoDeform
46 SYNFIG_LAYER_MODULE_EXT
55 //Caching system for circle
56 struct CircleDataCache
61 Real inner_radius_sqd;
62 Real outer_radius_sqd;
68 typedef Real FALLOFF_FUNC(const CircleDataCache &c, const Real &mag_sqd);
70 FALLOFF_FUNC *falloff_func;
71 CircleDataCache cache;
73 void constructcache();
75 static Real SqdFalloff(const CircleDataCache &c, const Real &mag_sqd);
76 static Real InvSqdFalloff(const CircleDataCache &c, const Real &mag_sqd);
77 static Real SqrtFalloff(const CircleDataCache &c, const Real &mag_sqd);
78 static Real InvSqrtFalloff(const CircleDataCache &c, const Real &mag_sqd);
79 static Real LinearFalloff(const CircleDataCache &c, const Real &mag_sqd);
80 static Real InvLinearFalloff(const CircleDataCache &c, const Real &mag_sqd);
81 static Real SigmondFalloff(const CircleDataCache &c, const Real &mag_sqd);
82 static Real InvSigmondFalloff(const CircleDataCache &c, const Real &mag_sqd);
83 static Real CosineFalloff(const CircleDataCache &c, const Real &mag_sqd);
84 static Real InvCosineFalloff(const CircleDataCache &c, const Real &mag_sqd);
86 FALLOFF_FUNC *GetFalloffFunc()const;
87 bool ImportParameters(const String ¶m, const ValueBase &value);
93 FALLOFF_INTERPOLATION_LINEAR =1,
102 virtual bool set_param(const String ¶m, const ValueBase &value);
104 virtual ValueBase get_param(const String ¶m)const;
106 virtual Color get_color(Context context, const Point &pos)const;
108 virtual bool accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const;
110 virtual synfig::Rect get_full_bounding_rect(synfig::Context context)const;
111 virtual synfig::Rect get_bounding_rect()const;
113 synfig::Layer::Handle hit_check(synfig::Context context, const synfig::Point &point)const;
115 virtual Vocab get_param_vocab()const;
118 /* -- E X T E R N S --------------------------------------------------------- */
121 /* -- E N D ----------------------------------------------------------------- */