00001
00021
00022
00023
00024
00025 #ifndef __SYNFIG_LAYER_SHAPE_H
00026 #define __SYNFIG_LAYER_SHAPE_H
00027
00028
00029
00030 #include "layer_composite.h"
00031 #include "color.h"
00032 #include "vector.h"
00033 #include "blur.h"
00034
00035 #include <vector>
00036
00037
00038
00039
00040
00041
00042
00043 namespace synfig {
00044
00047 class Layer_Shape : public Layer_Composite, public Layer_NoDeform
00048 {
00049 SYNFIG_LAYER_MODULE_EXT
00050
00051 private:
00052
00053
00054 struct Intersector;
00055 Intersector *edge_table;
00056
00057
00058 Color color;
00059
00060 Point offset;
00061 bool invert;
00062 bool antialias;
00063
00064 int blurtype;
00065 Real feather;
00066
00067 std::vector< char > bytestream;
00068
00069
00070 int lastbyteop;
00071 int lastoppos;
00072
00073 protected:
00074
00075 Layer_Shape(const Real &a = 1.0, const Color::BlendMethod m = Color::BLEND_COMPOSITE);
00076
00077 public:
00078
00079 ~Layer_Shape();
00080
00082
00084 void clear();
00085
00086
00087 void move_to(Real x, Real y);
00088 void line_to(Real x, Real y);
00089 void conic_to(Real x1, Real y1, Real x, Real y);
00090 void conic_to_smooth(Real x, Real y);
00091 void curve_to(Real x1, Real y1, Real x2, Real y2, Real x, Real y);
00092 void curve_to_smooth(Real x2, Real y2, Real x, Real y);
00093 void close();
00094 void endpath();
00095
00096 virtual bool set_param(const String & param, const synfig::ValueBase &value);
00097 virtual ValueBase get_param(const String & param)const;
00098
00099 virtual Vocab get_param_vocab()const;
00100
00101 virtual Color get_color(Context context, const Point &pos)const;
00102 virtual bool accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const;
00103 virtual synfig::Layer::Handle hit_check(synfig::Context context, const synfig::Point &point)const;
00104 virtual Rect get_bounding_rect()const;
00105
00106 private:
00107 class PolySpan;
00108 bool render_polyspan(Surface *surface,PolySpan &polyspan,
00109 Color::BlendMethod method,Color::value_type amount)const;
00110 bool render_polyspan(etl::surface<float> *surface,PolySpan &polyspan)const;
00111 virtual bool render_shape(Surface *surface,bool useblend,int quality,const RendDesc &renddesc, ProgressCallback *cb)const;
00112 virtual bool render_shape(etl::surface<float> *surface,int quality,const RendDesc &renddesc, ProgressCallback *cb)const;
00113 };
00114
00115 };
00116
00117
00118 #endif