Initial Stable Commit
[synfig.git] / synfig-core / trunk / src / modules / mod_gradient / curvegradient.h
1 /*! ========================================================================
2 ** Sinfg
3 ** Template Header File
4 ** $Id: curvegradient.h,v 1.1.1.1 2005/01/04 01:23:10 darco Exp $
5 **
6 ** Copyright (c) 2002 Robert B. Quattlebaum Jr.
7 **
8 ** This software and associated documentation
9 ** are CONFIDENTIAL and PROPRIETARY property of
10 ** the above-mentioned copyright holder.
11 **
12 ** You may not copy, print, publish, or in any
13 ** other way distribute this software without
14 ** a prior written agreement with
15 ** the copyright holder.
16 **
17 ** === N O T E S ===========================================================
18 **
19 ** ========================================================================= */
20
21 /* === S T A R T =========================================================== */
22
23 #ifndef __SINFG_CURVEGRADIENT_H
24 #define __SINFG_CURVEGRADIENT_H
25
26 /* === H E A D E R S ======================================================= */
27
28 #include <sinfg/vector.h>
29 #include <sinfg/layer_composite.h>
30 #include <sinfg/gradient.h>
31 #include <sinfg/blinepoint.h>
32
33 /* === M A C R O S ========================================================= */
34
35 /* === T Y P E D E F S ===================================================== */
36
37 /* === C L A S S E S & S T R U C T S ======================================= */
38
39 using namespace sinfg;
40 using namespace std;
41 using namespace etl;
42
43 class CurveGradient : public Layer_Composite, public Layer_NoDeform
44 {
45         SINFG_LAYER_MODULE_EXT
46
47 private:
48         std::vector<sinfg::BLinePoint> bline;
49
50         Point p1,p2;
51         Point offset;
52         Real width;
53         Vector diff;
54         Gradient gradient;
55         Real    curve_length_;
56
57         bool loop;
58         bool zigzag;
59         bool bline_loop;
60         bool perpendicular;
61
62         void sync();
63
64         sinfg::Color color_func(const sinfg::Point &x, int quality=10, float supersample=0)const;
65
66         float calc_supersample(const sinfg::Point &x, float pw,float ph)const;
67
68 public:
69         CurveGradient();
70         
71         virtual bool set_param(const String &param, const ValueBase &value);
72         virtual ValueBase get_param(const String &param)const;
73         virtual Color get_color(Context context, const Point &pos)const;
74         virtual bool accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const;
75         sinfg::Layer::Handle hit_check(sinfg::Context context, const sinfg::Point &point)const; 
76
77         virtual Vocab get_param_vocab()const;
78 };
79
80 /* === E N D =============================================================== */
81
82 #endif