1 /* === S I N F G =========================================================== */
3 ** \brief Template Header
5 ** $Id: circle.h,v 1.2 2005/01/24 03:08:17 darco Exp $
8 ** Copyright (c) 2002 Robert B. Quattlebaum Jr.
10 ** This software and associated documentation
11 ** are CONFIDENTIAL and PROPRIETARY property of
12 ** the above-mentioned copyright holder.
14 ** You may not copy, print, publish, or in any
15 ** other way distribute this software without
16 ** a prior written agreement with
17 ** the copyright holder.
20 /* ========================================================================= */
22 /* === H E A D E R S ======================================================= */
24 #ifndef __SINFG_LAYER_CIRCLE_H__
25 #define __SINFG_LAYER_CIRCLE_H__
27 /* -- H E A D E R S --------------------------------------------------------- */
29 #include <sinfg/layer_composite.h>
30 #include <sinfg/color.h>
31 #include <sinfg/vector.h>
33 using namespace sinfg;
37 /* -- M A C R O S ----------------------------------------------------------- */
39 /* -- T Y P E D E F S ------------------------------------------------------- */
41 /* -- S T R U C T S & C L A S S E S ----------------------------------------- */
43 class Circle : public sinfg::Layer_Composite, public sinfg::Layer_NoDeform
45 SINFG_LAYER_MODULE_EXT
54 //Caching system for circle
55 struct CircleDataCache
60 Real inner_radius_sqd;
61 Real outer_radius_sqd;
67 typedef Real FALLOFF_FUNC(const CircleDataCache &c, const Real &mag_sqd);
69 FALLOFF_FUNC *falloff_func;
70 CircleDataCache cache;
72 void constructcache();
74 static Real SqdFalloff(const CircleDataCache &c, const Real &mag_sqd);
75 static Real InvSqdFalloff(const CircleDataCache &c, const Real &mag_sqd);
76 static Real SqrtFalloff(const CircleDataCache &c, const Real &mag_sqd);
77 static Real InvSqrtFalloff(const CircleDataCache &c, const Real &mag_sqd);
78 static Real LinearFalloff(const CircleDataCache &c, const Real &mag_sqd);
79 static Real InvLinearFalloff(const CircleDataCache &c, const Real &mag_sqd);
80 static Real SigmondFalloff(const CircleDataCache &c, const Real &mag_sqd);
81 static Real InvSigmondFalloff(const CircleDataCache &c, const Real &mag_sqd);
82 static Real CosineFalloff(const CircleDataCache &c, const Real &mag_sqd);
83 static Real InvCosineFalloff(const CircleDataCache &c, const Real &mag_sqd);
85 FALLOFF_FUNC *GetFalloffFunc()const;
86 bool ImportParameters(const String ¶m, const ValueBase &value);
92 FALLOFF_INTERPOLATION_LINEAR =1,
101 virtual bool set_param(const String ¶m, const ValueBase &value);
103 virtual ValueBase get_param(const String ¶m)const;
105 virtual Color get_color(Context context, const Point &pos)const;
107 virtual bool accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const;
109 virtual sinfg::Rect get_full_bounding_rect(sinfg::Context context)const;
110 virtual sinfg::Rect get_bounding_rect()const;
112 sinfg::Layer::Handle hit_check(sinfg::Context context, const sinfg::Point &point)const;
114 virtual Vocab get_param_vocab()const;
117 /* -- E X T E R N S --------------------------------------------------------- */
120 /* -- E N D ----------------------------------------------------------------- */