moreupdates
[synfig.git] / synfig-core / trunk / src / modules / mod_gradient / lineargradient.h
1 /*! ========================================================================
2 ** Synfig
3 ** Template Header File
4 ** $Id: lineargradient.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 __SYNFIG_INTERPOLATION_LINEARGRADIENT_H
24 #define __SYNFIG_INTERPOLATION_LINEARGRADIENT_H
25
26 /* === H E A D E R S ======================================================= */
27
28 #include <synfig/vector.h>
29 #include <synfig/layer_composite.h>
30 #include <synfig/gradient.h>
31
32 /* === M A C R O S ========================================================= */
33
34 /* === T Y P E D E F S ===================================================== */
35
36 /* === C L A S S E S & S T R U C T S ======================================= */
37
38 using namespace synfig;
39 using namespace std;
40 using namespace etl;
41
42 class LinearGradient : public Layer_Composite, public Layer_NoDeform
43 {
44         SYNFIG_LAYER_MODULE_EXT
45
46 private:
47
48         Point p1,p2;
49         Vector diff;
50         Gradient gradient;
51
52         bool loop;
53         bool zigzag;
54
55         void sync();
56
57         synfig::Color color_func(const synfig::Point &x, float supersample=0)const;
58
59         float calc_supersample(const synfig::Point &x, float pw,float ph)const;
60
61 public:
62         LinearGradient();
63         
64         virtual bool set_param(const String &param, const ValueBase &value);
65         virtual ValueBase get_param(const String &param)const;
66         virtual Color get_color(Context context, const Point &pos)const;
67         virtual bool accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const;
68         synfig::Layer::Handle hit_check(synfig::Context context, const synfig::Point &point)const;      
69
70         virtual Vocab get_param_vocab()const;
71 };
72
73 /* === E N D =============================================================== */
74
75 #endif