Fix bugs in previous commit that caused FTBFS in synfig and ETL FTBFS with older...
[synfig.git] / synfig-core / tags / synfig_0_61_07_rc3 / src / synfig / target_scanline.h
1 /* === S Y N F I G ========================================================= */
2 /*!     \file target_scanline.h
3 **      \brief Template Header
4 **
5 **      $Id$
6 **
7 **      \legal
8 **      Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 **
10 **      This package is free software; you can redistribute it and/or
11 **      modify it under the terms of the GNU General Public License as
12 **      published by the Free Software Foundation; either version 2 of
13 **      the License, or (at your option) any later version.
14 **
15 **      This package is distributed in the hope that it will be useful,
16 **      but WITHOUT ANY WARRANTY; without even the implied warranty of
17 **      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 **      General Public License for more details.
19 **      \endlegal
20 */
21 /* ========================================================================= */
22
23 /* === S T A R T =========================================================== */
24
25 #ifndef __SYNFIG_TARGET_SCANLINE_H
26 #define __SYNFIG_TARGET_SCANLINE_H
27
28 /* === H E A D E R S ======================================================= */
29
30 #include "target.h"
31
32 /* === M A C R O S ========================================================= */
33
34 /* === T Y P E D E F S ===================================================== */
35
36 /* === C L A S S E S & S T R U C T S ======================================= */
37
38 namespace synfig {
39
40 /*!     \class Target_Scanline
41 **      \brief Render-target
42 **      \todo writeme
43 */
44 class Target_Scanline : public Target
45 {
46         int threads_;
47         int curr_frame_;
48
49 public:
50         typedef etl::handle<Target_Scanline> Handle;
51         typedef etl::loose_handle<Target_Scanline> LooseHandle;
52         typedef etl::handle<const Target_Scanline> ConstHandle;
53
54         Target_Scanline();
55
56         //! Renders the canvas to the target
57         virtual bool render(ProgressCallback *cb=NULL);
58
59         //! Marks the start of a frame
60         /*! \return \c true on success, \c false upon an error.
61         **      \see end_frame(), start_scanline()
62         */
63         virtual bool start_frame(ProgressCallback *cb=NULL)=0;
64
65         virtual int next_frame(Time& time);
66
67         //! Marks the end of a frame
68         /*! \see start_frame() */
69         virtual void end_frame()=0;
70
71         //! Marks the start of a scanline
72         /*!     \param scanline Which scanline is going to be rendered.
73         **      \return The address where the target wants the scanline
74         **              to be written.
75         **      \warning Must be called after start_frame()
76         **      \see end_scanline(), start_frame()
77         */
78         virtual Color * start_scanline(int scanline)=0;
79
80         //! Marks the end of a scanline
81         /*! Takes the data that was put at the address returned to by start_scanline()
82         **      and does whatever it is supose to do with it.
83         **      \return \c true on success, \c false on failure.
84         **      \see start_scanline()
85         */
86         virtual bool end_scanline()=0;
87
88         void set_threads(int x) { threads_=x; }
89
90         int get_threads()const { return threads_; }
91
92         bool add_frame(const synfig::Surface *surface);
93 private:
94 }; // END of class Target_Scanline
95
96 }; // END of namespace synfig
97
98 /* === E N D =============================================================== */
99
100 #endif