|
Carlos Lopez |
a09598 |
/* === S Y N F I G ========================================================= */
|
|
Carlos Lopez |
a09598 |
/*! \file target_scanline.h
|
|
Carlos Lopez |
592722 |
** \brief Template Header for the Target Scanline class
|
|
Carlos Lopez |
a09598 |
**
|
|
Carlos Lopez |
a09598 |
** $Id$
|
|
Carlos Lopez |
a09598 |
**
|
|
Carlos Lopez |
a09598 |
** \legal
|
|
Carlos Lopez |
a09598 |
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
|
|
Carlos Lopez |
e83454 |
** Copyright (c) 2012-2013 Carlos Lรณpez
|
|
Carlos Lopez |
a09598 |
**
|
|
Carlos Lopez |
a09598 |
** This package is free software; you can redistribute it and/or
|
|
Carlos Lopez |
a09598 |
** modify it under the terms of the GNU General Public License as
|
|
Carlos Lopez |
a09598 |
** published by the Free Software Foundation; either version 2 of
|
|
Carlos Lopez |
a09598 |
** the License, or (at your option) any later version.
|
|
Carlos Lopez |
a09598 |
**
|
|
Carlos Lopez |
a09598 |
** This package is distributed in the hope that it will be useful,
|
|
Carlos Lopez |
a09598 |
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Carlos Lopez |
a09598 |
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Carlos Lopez |
a09598 |
** General Public License for more details.
|
|
Carlos Lopez |
a09598 |
** \endlegal
|
|
Carlos Lopez |
a09598 |
*/
|
|
Carlos Lopez |
a09598 |
/* ========================================================================= */
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
/* === S T A R T =========================================================== */
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
#ifndef __SYNFIG_TARGET_SCANLINE_H
|
|
Carlos Lopez |
a09598 |
#define __SYNFIG_TARGET_SCANLINE_H
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
/* === H E A D E R S ======================================================= */
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
#include "target.h"
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
/* === M A C R O S ========================================================= */
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
/* === T Y P E D E F S ===================================================== */
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
/* === C L A S S E S & S T R U C T S ======================================= */
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
namespace synfig {
|
|
Carlos Lopez |
a09598 |
|
|
|
5e2754 |
namespace rendering { class SurfaceResource; }
|
|
|
371bd9 |
|
|
Carlos Lopez |
a09598 |
/*! \class Target_Scanline
|
|
luz.paz |
99f3ef |
** \brief This is a Target class that implements the render function
|
|
luz.paz |
99f3ef |
** for a line by line render procedure
|
|
Carlos Lopez |
a09598 |
*/
|
|
Carlos Lopez |
a09598 |
class Target_Scanline : public Target
|
|
Carlos Lopez |
a09598 |
{
|
|
Carlos Lopez |
592722 |
//! Number of threads to use
|
|
Carlos Lopez |
a09598 |
int threads_;
|
|
Carlos Lopez |
a09598 |
|
|
|
371bd9 |
String engine_;
|
|
|
371bd9 |
|
|
|
a4bbdd |
bool call_renderer(
|
|
|
a4bbdd |
const etl::handle<rendering::surfaceresource> &surface,</rendering::surfaceresource>
|
|
|
a4bbdd |
Canvas &canvas,
|
|
|
a4bbdd |
const ContextParams &context_params,
|
|
|
a4bbdd |
const RendDesc &renddesc );
|
|
|
371bd9 |
|
|
Carlos Lopez |
a09598 |
public:
|
|
Carlos Lopez |
a09598 |
typedef etl::handle<target_scanline> Handle;</target_scanline>
|
|
Carlos Lopez |
a09598 |
typedef etl::loose_handle<target_scanline> LooseHandle;</target_scanline>
|
|
Carlos Lopez |
a09598 |
typedef etl::handle<const target_scanline=""> ConstHandle;</const>
|
|
Carlos Lopez |
592722 |
//! Default constructor (threads = 2 current frame = 0)
|
|
Carlos Lopez |
a09598 |
Target_Scanline();
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
//! Renders the canvas to the target
|
|
Carlos Lopez |
a09598 |
virtual bool render(ProgressCallback *cb=NULL);
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
//! Marks the start of a frame
|
|
Carlos Lopez |
a09598 |
/*! \return \c true on success, \c false upon an error.
|
|
Carlos Lopez |
a09598 |
** \see end_frame(), start_scanline()
|
|
Carlos Lopez |
a09598 |
*/
|
|
Carlos Lopez |
a09598 |
virtual bool start_frame(ProgressCallback *cb=NULL)=0;
|
|
Carlos Lopez |
4fdecc |
|
|
Carlos Lopez |
592722 |
//! Returns the number of peniding frames to render. If it is zero it
|
|
Carlos Lopez |
592722 |
//! stops rendering frames.
|
|
Carlos Lopez |
a09598 |
virtual int next_frame(Time& time);
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
//! Marks the end of a frame
|
|
Carlos Lopez |
a09598 |
/*! \see start_frame() */
|
|
Carlos Lopez |
a09598 |
virtual void end_frame()=0;
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
//! Marks the start of a scanline
|
|
Carlos Lopez |
a09598 |
/*! \param scanline Which scanline is going to be rendered.
|
|
Carlos Lopez |
a09598 |
** \return The address where the target wants the scanline
|
|
Carlos Lopez |
a09598 |
** to be written.
|
|
Carlos Lopez |
a09598 |
** \warning Must be called after start_frame()
|
|
Carlos Lopez |
a09598 |
** \see end_scanline(), start_frame()
|
|
Carlos Lopez |
a09598 |
*/
|
|
Carlos Lopez |
a09598 |
virtual Color * start_scanline(int scanline)=0;
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
//! Marks the end of a scanline
|
|
Carlos Lopez |
a09598 |
/*! Takes the data that was put at the address returned to by start_scanline()
|
|
Carlos Lopez |
a09598 |
** and does whatever it is supposed to do with it.
|
|
Carlos Lopez |
a09598 |
** \return \c true on success, \c false on failure.
|
|
Carlos Lopez |
a09598 |
** \see start_scanline()
|
|
Carlos Lopez |
a09598 |
*/
|
|
Carlos Lopez |
a09598 |
virtual bool end_scanline()=0;
|
|
Carlos Lopez |
592722 |
//! Sets the number of threads
|
|
|
371bd9 |
|
|
Carlos Lopez |
a09598 |
void set_threads(int x) { threads_=x; }
|
|
Carlos Lopez |
592722 |
//! Gets the number of threads
|
|
Carlos Lopez |
a09598 |
int get_threads()const { return threads_; }
|
|
|
371bd9 |
//! Gets engine
|
|
|
371bd9 |
const String& get_engine()const { return engine_; }
|
|
|
371bd9 |
//! Sets engine
|
|
|
371bd9 |
void set_engine(const String &x) { engine_=x; }
|
|
|
371bd9 |
|
|
Carlos Lopez |
592722 |
//! Puts the rendered surface onto the target.
|
|
Carlos Lopez |
a09598 |
bool add_frame(const synfig::Surface *surface);
|
|
Carlos Lopez |
a09598 |
private:
|
|
Carlos Lopez |
a09598 |
}; // END of class Target_Scanline
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
}; // END of namespace synfig
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
/* === E N D =============================================================== */
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
#endif
|