1 /* === S I N F G =========================================================== */
2 /*! \file target_tile.h
3 ** \brief Template Header
5 ** $Id: target_tile.h,v 1.1.1.1 2005/01/04 01:23:15 darco Exp $
8 ** Copyright (c) 2002 Robert B. Quattlebaum Jr.
10 ** This software and associated documentation
11 ** are CONFIDENTIAL and PROPRIETARY property of
12 ** the above-mentioned copyright holder.
14 ** You may not copy, print, publish, or in any
15 ** other way distribute this software without
16 ** a prior written agreement with
17 ** the copyright holder.
20 /* ========================================================================= */
22 /* === S T A R T =========================================================== */
24 #ifndef __SINFG_TARGET_TILE_H
25 #define __SINFG_TARGET_TILE_H
27 /* === H E A D E R S ======================================================= */
31 /* === M A C R O S ========================================================= */
33 /* === T Y P E D E F S ===================================================== */
35 /* === C L A S S E S & S T R U C T S ======================================= */
39 /*! \class Target_Tile
40 ** \brief Render-target
43 class Target_Tile : public Target
52 typedef etl::handle<Target_Tile> Handle;
53 typedef etl::loose_handle<Target_Tile> LooseHandle;
54 typedef etl::handle<const Target_Tile> ConstHandle;
58 //! Renders the canvas to the target
59 virtual bool render(ProgressCallback *cb=NULL);
61 //! Determines which tile needs to be rendered next.
62 /*! Most cases will not have to redefine this function.
63 ** The default should be adequate in nearly all situations.
64 ** \returns The number of tiles left to go <i>plus one</i>.
65 ** This means that whenever this function returns zero,
66 ** there are no more tiles to render and that any value
67 ** in \a x or \a y should be disregarded. */
68 virtual int next_tile(int& x, int& y);
70 virtual int next_frame(Time& time);
72 //! Adds the tile at \a x , \a y contained in \a surface
73 virtual bool add_tile(const sinfg::Surface &surface, int x, int y)=0;
75 virtual int total_tiles()const
77 // Width of the image(in tiles)
78 const int tw(rend_desc().get_w()/tile_w_+(rend_desc().get_w()%tile_w_?1:0));
79 const int th(rend_desc().get_h()/tile_h_+(rend_desc().get_h()%tile_h_?1:0));
84 //! Marks the start of a frame
85 /*! \return \c true on success, \c false upon an error.
86 ** \see end_frame(), start_scanline()
88 virtual bool start_frame(ProgressCallback *cb=NULL)=0;
90 //! Marks the end of a frame
91 /*! \see start_frame() */
92 virtual void end_frame()=0;
94 void set_threads(int x) { threads_=x; }
96 int get_threads()const { return threads_; }
98 void set_tile_w(int w) { tile_w_=w; }
100 int get_tile_w()const { return tile_w_; }
102 void set_tile_h(int h) { tile_h_=h; }
104 int get_tile_h()const { return tile_h_; }
106 bool get_clipping()const { return clipping_; }
108 void set_clipping(bool x) { clipping_=x; }
112 bool render_frame_(Context context,ProgressCallback *cb=0);
114 }; // END of class Target_Tile
116 }; // END of namespace sinfg
118 /* === E N D =============================================================== */