layer_shape.h

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

Generated on Wed Aug 15 05:00:23 2007 for synfig by  doxygen 1.5.3