Blame synfig-core/src/synfig/target_cairo.h

Carlos Lopez 33e2f1
/* === S Y N F I G ========================================================= */
Carlos Lopez de6bcb
/*!	\file target_cairo.h
Carlos Lopez de6bcb
**	\brief Template Header for the Target Cairo class
Carlos Lopez 33e2f1
**
Carlos Lopez 33e2f1
**	$Id$
Carlos Lopez 33e2f1
**
Carlos Lopez 33e2f1
**	\legal
Carlos Lopez 33e2f1
**	Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
Carlos Lopez e83454
**	Copyright (c) 2012-2013 Carlos Lรณpez
Carlos Lopez 33e2f1
**
Carlos Lopez 33e2f1
**	This package is free software; you can redistribute it and/or
Carlos Lopez 33e2f1
**	modify it under the terms of the GNU General Public License as
Carlos Lopez 33e2f1
**	published by the Free Software Foundation; either version 2 of
Carlos Lopez 33e2f1
**	the License, or (at your option) any later version.
Carlos Lopez 33e2f1
**
Carlos Lopez 33e2f1
**	This package is distributed in the hope that it will be useful,
Carlos Lopez 33e2f1
**	but WITHOUT ANY WARRANTY; without even the implied warranty of
Carlos Lopez 33e2f1
**	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Carlos Lopez 33e2f1
**	General Public License for more details.
Carlos Lopez 33e2f1
**	\endlegal
Carlos Lopez 33e2f1
*/
Carlos Lopez 33e2f1
/* ========================================================================= */
Carlos Lopez 33e2f1
Carlos Lopez 33e2f1
/* === S T A R T =========================================================== */
Carlos Lopez 33e2f1
Carlos Lopez de6bcb
#ifndef __SYNFIG_TARGET_CAIRO_H
Carlos Lopez de6bcb
#define __SYNFIG_TARGET_CAIRO_H
Carlos Lopez 33e2f1
Carlos Lopez 33e2f1
/* === H E A D E R S ======================================================= */
Carlos Lopez 33e2f1
Carlos Lopez 33e2f1
#include "target.h"
Carlos Lopez 623fab
#include "cairo.h"
Carlos Lopez 33e2f1
Carlos Lopez de6bcb
Carlos Lopez 33e2f1
/* === M A C R O S ========================================================= */
Carlos Lopez 33e2f1
Carlos Lopez 33e2f1
/* === T Y P E D E F S ===================================================== */
Carlos Lopez 33e2f1
Carlos Lopez 33e2f1
/* === C L A S S E S & S T R U C T S ======================================= */
Carlos Lopez 33e2f1
Carlos Lopez 33e2f1
namespace synfig {
Carlos Lopez 33e2f1
Carlos Lopez de6bcb
class CairoSurface;
Carlos Lopez de6bcb
Carlos Lopez de6bcb
/*!	\class Target_Cairo
luz.paz 99f3ef
**	\brief This is a Target class that implements the render function
luz.paz 99f3ef
**     for a CairoSurface
Carlos Lopez 33e2f1
*/
Carlos Lopez de6bcb
class Target_Cairo : public Target
Carlos Lopez 33e2f1
{
Carlos Lopez 33e2f1
	//! Number of threads to use
Carlos Lopez ec95a1
	// int threads_;
Carlos Lopez 33e2f1
Carlos Lopez 33e2f1
public:
Carlos Lopez de6bcb
	typedef etl::handle<target_cairo> Handle;</target_cairo>
Carlos Lopez de6bcb
	typedef etl::loose_handle<target_cairo> LooseHandle;</target_cairo>
Carlos Lopez de6bcb
	typedef etl::handle<const target_cairo=""> ConstHandle;</const>
Carlos Lopez de6bcb
	//! Default constructor (current frame = 0)
Carlos Lopez de6bcb
	Target_Cairo();
Carlos Lopez 33e2f1
Carlos Lopez 33e2f1
	//! Renders the canvas to the target
Carlos Lopez 33e2f1
	virtual bool render(ProgressCallback *cb=NULL);
Carlos Lopez 33e2f1
	
Carlos Lopez 33e2f1
	//! Obtain a surface pointer based on the render method
Carlos Lopez 33e2f1
	//! this function has to be overrrided by the derived targets 
Carlos Lopez 33e2f1
	//! to create the proper Cairo backend surface for each target type.
Nikita Kitaev 7de048
	virtual bool obtain_surface(cairo_surface_t*&)=0; 
Carlos Lopez 33e2f1
	
Carlos Lopez 33e2f1
	//! Returns the number of peniding frames to render. If it is zero it
Carlos Lopez 33e2f1
	//! stops rendering frames.
Carlos Lopez 33e2f1
	virtual int next_frame(Time& time);
Carlos Lopez 33e2f1
Carlos Lopez 33e2f1
	//! Puts the rendered surface onto the target.
Carlos Lopez 623fab
	virtual bool put_surface(cairo_surface_t *surface, ProgressCallback *cb=NULL);
a4bbdd
	//! Filters the cairo surface based on gamma
e198f4
	static void gamma_filter(cairo_surface_t* surface, const synfig::Gamma &gamma);
Carlos Lopez c03706
Carlos Lopez 33e2f1
private:
Carlos Lopez de6bcb
}; // END of class Target_Cairo
Carlos Lopez 33e2f1
Carlos Lopez 33e2f1
}; // END of namespace synfig
Carlos Lopez 33e2f1
Carlos Lopez 33e2f1
/* === E N D =============================================================== */
Carlos Lopez 33e2f1
Carlos Lopez 33e2f1
#endif