1 /* === S Y N F I G ========================================================= */
2 /*! \file target_scanline.h
3 ** \brief Template Header for the Target Scanline class
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
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.
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.
21 /* ========================================================================= */
23 /* === S T A R T =========================================================== */
25 #ifndef __SYNFIG_TARGET_SCANLINE_H
26 #define __SYNFIG_TARGET_SCANLINE_H
28 /* === H E A D E R S ======================================================= */
32 /* === M A C R O S ========================================================= */
34 /* === T Y P E D E F S ===================================================== */
36 /* === C L A S S E S & S T R U C T S ======================================= */
40 /*! \class Target_Scanline
41 ** \brief This is a Target class that implements the render fucntion
42 * for a line by line render procedure
44 class Target_Scanline : public Target
46 //! Number of threads to use
48 //! Current frame being rendered
52 typedef etl::handle<Target_Scanline> Handle;
53 typedef etl::loose_handle<Target_Scanline> LooseHandle;
54 typedef etl::handle<const Target_Scanline> ConstHandle;
55 //! Default constructor (threads = 2 current frame = 0)
58 //! Renders the canvas to the target
59 virtual bool render(ProgressCallback *cb=NULL);
61 //! Marks the start of a frame
62 /*! \return \c true on success, \c false upon an error.
63 ** \see end_frame(), start_scanline()
65 virtual bool start_frame(ProgressCallback *cb=NULL)=0;
66 //! Returns the number of peniding frames to render. If it is zero it
67 //! stops rendering frames.
68 /*! \todo Fix the calculation of frames to really render the last frame
69 ** When start frame= 1f and end frame = 1f it just render one frame (at 1f)
70 ** When start frame= 1f and end frame = 2f it just render one frame (at 1f)
73 virtual int next_frame(Time& time);
75 //! Marks the end of a frame
76 /*! \see start_frame() */
77 virtual void end_frame()=0;
79 //! Marks the start of a scanline
80 /*! \param scanline Which scanline is going to be rendered.
81 ** \return The address where the target wants the scanline
83 ** \warning Must be called after start_frame()
84 ** \see end_scanline(), start_frame()
86 virtual Color * start_scanline(int scanline)=0;
88 //! Marks the end of a scanline
89 /*! Takes the data that was put at the address returned to by start_scanline()
90 ** and does whatever it is supposed to do with it.
91 ** \return \c true on success, \c false on failure.
92 ** \see start_scanline()
94 virtual bool end_scanline()=0;
95 //! Sets the number of threads
96 void set_threads(int x) { threads_=x; }
97 //! Gets the number of threads
98 int get_threads()const { return threads_; }
99 //! Puts the rendered surface onto the target.
100 bool add_frame(const synfig::Surface *surface);
102 }; // END of class Target_Scanline
104 }; // END of namespace synfig
106 /* === E N D =============================================================== */