1 /* === S Y N F I G ========================================================= */
3 ** \brief Header file for implementation of the "Circle" layer
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 ** Copyright (c) 2008 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 /* ========================================================================= */
24 /* === H E A D E R S ======================================================= */
26 #ifndef __SYNFIG_LAYER_CIRCLE_H__
27 #define __SYNFIG_LAYER_CIRCLE_H__
29 /* -- H E A D E R S --------------------------------------------------------- */
31 #include <synfig/layer_composite.h>
32 #include <synfig/color.h>
33 #include <synfig/vector.h>
35 using namespace synfig;
39 /* -- M A C R O S ----------------------------------------------------------- */
41 /* -- T Y P E D E F S ------------------------------------------------------- */
43 /* -- S T R U C T S & C L A S S E S ----------------------------------------- */
45 class Circle : public synfig::Layer_Composite, public synfig::Layer_NoDeform
47 SYNFIG_LAYER_MODULE_EXT
56 //Caching system for circle
57 struct CircleDataCache
62 Real inner_radius_sqd;
63 Real outer_radius_sqd;
69 typedef Real FALLOFF_FUNC(const CircleDataCache &c, const Real &mag_sqd);
71 FALLOFF_FUNC *falloff_func;
72 CircleDataCache cache;
74 void constructcache();
76 static Real SqdFalloff(const CircleDataCache &c, const Real &mag_sqd);
77 static Real InvSqdFalloff(const CircleDataCache &c, const Real &mag_sqd);
78 static Real SqrtFalloff(const CircleDataCache &c, const Real &mag_sqd);
79 static Real InvSqrtFalloff(const CircleDataCache &c, const Real &mag_sqd);
80 static Real LinearFalloff(const CircleDataCache &c, const Real &mag_sqd);
81 static Real InvLinearFalloff(const CircleDataCache &c, const Real &mag_sqd);
82 static Real SigmondFalloff(const CircleDataCache &c, const Real &mag_sqd);
83 static Real InvSigmondFalloff(const CircleDataCache &c, const Real &mag_sqd);
84 static Real CosineFalloff(const CircleDataCache &c, const Real &mag_sqd);
85 static Real InvCosineFalloff(const CircleDataCache &c, const Real &mag_sqd);
87 FALLOFF_FUNC *GetFalloffFunc()const;
88 bool ImportParameters(const String ¶m, const ValueBase &value);
94 FALLOFF_INTERPOLATION_LINEAR =1,
103 virtual bool set_param(const String ¶m, const ValueBase &value);
105 virtual ValueBase get_param(const String ¶m)const;
107 virtual Color get_color(Context context, const Point &pos)const;
109 virtual bool accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const;
111 virtual synfig::Rect get_full_bounding_rect(synfig::Context context)const;
112 virtual synfig::Rect get_bounding_rect()const;
114 synfig::Layer::Handle hit_check(synfig::Context context, const synfig::Point &point)const;
116 virtual Vocab get_param_vocab()const;
119 /* -- E X T E R N S --------------------------------------------------------- */
122 /* -- E N D ----------------------------------------------------------------- */