target_tile.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_TARGET_TILE_H
00026 #define __SYNFIG_TARGET_TILE_H
00027 
00028 /* === H E A D E R S ======================================================= */
00029 
00030 #include "target.h"
00031 
00032 /* === M A C R O S ========================================================= */
00033 
00034 /* === T Y P E D E F S ===================================================== */
00035 
00036 /* === C L A S S E S & S T R U C T S ======================================= */
00037 
00038 namespace synfig {
00039 
00044 class Target_Tile : public Target
00045 {
00046     int threads_;
00047     int tile_w_;
00048     int tile_h_;
00049     int curr_tile_;
00050     int curr_frame_;
00051     bool clipping_;
00052 public:
00053     typedef etl::handle<Target_Tile> Handle;
00054     typedef etl::loose_handle<Target_Tile> LooseHandle;
00055     typedef etl::handle<const Target_Tile> ConstHandle;
00056 
00057     Target_Tile();
00058 
00060     virtual bool render(ProgressCallback *cb=NULL);
00061 
00063 
00069     virtual int next_tile(int& x, int& y);
00070 
00071     virtual int next_frame(Time& time);
00072 
00074     virtual bool add_tile(const synfig::Surface &surface, int x, int y)=0;
00075 
00076     virtual int total_tiles()const
00077     {
00078         // Width of the image(in tiles)
00079         const int tw(rend_desc().get_w()/tile_w_+(rend_desc().get_w()%tile_w_?1:0));
00080         const int th(rend_desc().get_h()/tile_h_+(rend_desc().get_h()%tile_h_?1:0));
00081         
00082         return tw*th;
00083     }
00084 
00086 
00089     virtual bool start_frame(ProgressCallback *cb=NULL)=0;
00090 
00092 
00093     virtual void end_frame()=0;
00094     
00095     void set_threads(int x) { threads_=x; }
00096 
00097     int get_threads()const { return threads_; }
00098 
00099     void set_tile_w(int w) { tile_w_=w; }
00100 
00101     int get_tile_w()const { return tile_w_; }
00102 
00103     void set_tile_h(int h) { tile_h_=h; }
00104 
00105     int get_tile_h()const { return tile_h_; }
00106     
00107     bool get_clipping()const { return clipping_; }
00108 
00109     void set_clipping(bool x) { clipping_=x; }
00110     
00111 private:
00112     
00113     bool render_frame_(Context context,ProgressCallback *cb=0);
00114     
00115 }; // END of class Target_Tile
00116 
00117 }; // END of namespace synfig
00118 
00119 /* === E N D =============================================================== */
00120 
00121 #endif

Generated on Fri Jun 23 15:20:50 2006 for synfig by  doxygen 1.4.6