layer_shape.h

Go to the documentation of this file.
00001 /* === S Y N F I G ========================================================= */
00022 /* ========================================================================= */
00023 
00024 /* === S T A R T =========================================================== */
00025 
00026 #ifndef __SYNFIG_LAYER_SHAPE_H
00027 #define __SYNFIG_LAYER_SHAPE_H
00028 
00029 /* === H E A D E R S ======================================================= */
00030 
00031 #include "layer_composite.h"
00032 #include "color.h"
00033 #include "vector.h"
00034 #include "blur.h"
00035 
00036 #include <vector>
00037 
00038 /* === M A C R O S ========================================================= */
00039 
00040 /* === T Y P E D E F S ===================================================== */
00041 
00042 /* === C L A S S E S & S T R U C T S ======================================= */
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     //internal cacheing
00063     struct Intersector;
00064     Intersector *edge_table;
00065 
00066     //exported data
00067     Color                   color;
00068 
00069     Point   offset;
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     //for use in creating the bytestream
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     //void sync();
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);               //x1,y1 derived from current tangent
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); //x1,y1 derived from current tangent
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 }; // END of Layer_Shape
00124 
00125 }; // END of namespace synfig
00126 /* === E N D =============================================================== */
00127 
00128 #endif

Generated on Wed Dec 12 03:11:41 2007 for synfig by  doxygen 1.5.4