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