more updates
[synfig.git] / synfig-core / trunk / src / synfig / target_scanline.h
1 /* === S I N F G =========================================================== */
2 /*!     \file target_scanline.h
3 **      \brief Template Header
4 **
5 **      $Id: target_scanline.h,v 1.1.1.1 2005/01/04 01:23:15 darco Exp $
6 **
7 **      \legal
8 **      Copyright (c) 2002 Robert B. Quattlebaum Jr.
9 **
10 **      This software and associated documentation
11 **      are CONFIDENTIAL and PROPRIETARY property of
12 **      the above-mentioned copyright holder.
13 **
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.
18 **      \endlegal
19 */
20 /* ========================================================================= */
21
22 /* === S T A R T =========================================================== */
23
24 #ifndef __SINFG_TARGET_SCANLINE_H
25 #define __SINFG_TARGET_SCANLINE_H
26
27 /* === H E A D E R S ======================================================= */
28
29 #include "target.h"
30
31 /* === M A C R O S ========================================================= */
32
33 /* === T Y P E D E F S ===================================================== */
34
35 /* === C L A S S E S & S T R U C T S ======================================= */
36
37 namespace sinfg {
38
39 /*!     \class Target_Scanline
40 **      \brief Render-target
41 **      \todo writeme
42 */
43 class Target_Scanline : public Target
44 {
45         int threads_;
46         int curr_frame_;
47
48 public:
49         typedef etl::handle<Target_Scanline> Handle;
50         typedef etl::loose_handle<Target_Scanline> LooseHandle;
51         typedef etl::handle<const Target_Scanline> ConstHandle;
52
53         Target_Scanline();
54
55         //! Renders the canvas to the target
56         virtual bool render(ProgressCallback *cb=NULL);
57
58         //! Marks the start of a frame
59         /*! \return \c true on success, \c false upon an error.
60         **      \see end_frame(), start_scanline()
61         */
62         virtual bool start_frame(ProgressCallback *cb=NULL)=0;
63
64         virtual int next_frame(Time& time);
65
66         //! Marks the end of a frame
67         /*! \see start_frame() */
68         virtual void end_frame()=0;
69
70         //! Marks the start of a scanline
71         /*!     \param scanline Which scanline is going to be rendered.
72         **      \return The address where the target wants the scanline
73         **              to be written.
74         **      \warning Must be called after start_frame()
75         **      \see end_scanline(), start_frame()
76         */
77         virtual Color * start_scanline(int scanline)=0;
78
79         //! Marks the end of a scanline
80         /*! Takes the data that was put at the address returned to by start_scanline()
81         **      and does whatever it is supose to do with it.
82         **      \return \c true on success, \c false on failure.
83         **      \see start_scanline()
84         */
85         virtual bool end_scanline()=0;
86         
87         void set_threads(int x) { threads_=x; }
88
89         int get_threads()const { return threads_; }
90
91         bool add_frame(const sinfg::Surface *surface);
92 private:
93 }; // END of class Target_Scanline
94
95 }; // END of namespace sinfg
96
97 /* === E N D =============================================================== */
98
99 #endif