00001
00025
00026
00027 #ifndef __SYNFIG_INTERPOLATION_LINEARGRADIENT_H
00028 #define __SYNFIG_INTERPOLATION_LINEARGRADIENT_H
00029
00030
00031
00032 #include <synfig/vector.h>
00033 #include <synfig/layer_composite.h>
00034 #include <synfig/gradient.h>
00035
00036
00037
00038
00039
00040
00041
00042 using namespace synfig;
00043 using namespace std;
00044 using namespace etl;
00045
00046 class LinearGradient : public Layer_Composite, public Layer_NoDeform
00047 {
00048 SYNFIG_LAYER_MODULE_EXT
00049
00050 private:
00051
00052 Point p1,p2;
00053 Vector diff;
00054 Gradient gradient;
00055
00056 bool loop;
00057 bool zigzag;
00058
00059 void sync();
00060
00061 synfig::Color color_func(const synfig::Point &x, float supersample=0)const;
00062
00063 float calc_supersample(const synfig::Point &x, float pw,float ph)const;
00064
00065 public:
00066 LinearGradient();
00067
00068 virtual bool set_param(const String ¶m, const ValueBase &value);
00069 virtual ValueBase get_param(const String ¶m)const;
00070 virtual Color get_color(Context context, const Point &pos)const;
00071 virtual bool accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const;
00072 synfig::Layer::Handle hit_check(synfig::Context context, const synfig::Point &point)const;
00073
00074 virtual Vocab get_param_vocab()const;
00075 };
00076
00077
00078
00079 #endif