Blame synfig-core/src/modules/mod_filter/halftone3.h

Carlos Lopez a09598
/* === S Y N F I G ========================================================= */
Carlos Lopez a09598
/*!	\file halftone3.h
Carlos Lopez a09598
**	\brief Header file for implementation of the "Halftone 3" layer
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 a09598
**	Copyright (c) 2008 Chris Moore
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_HALFTONE3_H
Carlos Lopez a09598
#define __SYNFIG_HALFTONE3_H
Carlos Lopez a09598
Carlos Lopez a09598
/* === H E A D E R S ======================================================= */
Carlos Lopez a09598
Carlos Lopez a09598
#include <synfig vector.h=""></synfig>
Carlos Lopez a09598
#include <synfig valuenode.h=""></synfig>
e222d9
#include <synfig layer_composite_fork.h="" layers=""></synfig>
Carlos Lopez a09598
#include <synfig time.h=""></synfig>
Carlos Lopez a09598
#include <synfig angle.h=""></synfig>
Carlos Lopez a09598
#include "halftone.h"
Carlos Lopez a09598
Carlos Lopez a09598
/* === M A C R O S ========================================================= */
Carlos Lopez 154da9
#define HALFTONE3_IMPORT_VALUE(x)                                             \
Carlos Lopez 154da9
	if (#x=="tone[i].param_"+param && x.get_type()==value.get_type())         \
Carlos Lopez 154da9
		{                                                                     \
Carlos Lopez 154da9
			x=value;                                                          \
Carlos Lopez 154da9
			return true;                                                      \
Carlos Lopez 154da9
		}                                                                     \
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 e14313
using namespace synfig;
Carlos Lopez e14313
using namespace std;
Carlos Lopez e14313
using namespace etl;
Carlos Lopez a09598
e222d9
class Halftone3 : public Layer_CompositeFork
Carlos Lopez a09598
{
Carlos Lopez a09598
	SYNFIG_LAYER_MODULE_EXT
Carlos Lopez a09598
Carlos Lopez a09598
private:
Carlos Lopez 154da9
	//! Parameter: (Vector)
Carlos Lopez 154da9
	ValueBase param_size;
Carlos Lopez 154da9
	//! Parameter: (int)
Carlos Lopez 154da9
	ValueBase param_type;
Carlos Lopez 154da9
	//! Parameter: (class Halftone)
Carlos Lopez a09598
	Halftone tone[3];
Carlos Lopez 154da9
	//! Parameter: (Color)
Carlos Lopez 154da9
	ValueBase param_color[3];
Carlos Lopez 154da9
	//! Parameter: (bool)
Carlos Lopez 154da9
	ValueBase param_subtractive;
Carlos Lopez 154da9
Carlos Lopez a09598
	float inverse_matrix[3][3];
Carlos Lopez a09598
Carlos Lopez e14313
	Color color_func(const Point &x, float supersample,const Color &under_color)const;
Carlos Lopez a09598
Carlos Lopez e14313
	float calc_supersample(const Point &x, float pw,float ph)const;
Carlos Lopez a09598
Carlos Lopez e14313
	//float halftone_func(Point x)const;
Carlos Lopez a09598
Carlos Lopez a09598
	void sync();
Carlos Lopez a09598
Carlos Lopez a09598
public:
Carlos Lopez a09598
	Halftone3();
Carlos Lopez a09598
Carlos Lopez e14313
	virtual bool set_param(const String ¶m, const ValueBase &value);
Carlos Lopez e14313
	virtual ValueBase get_param(const String ¶m)const;
Carlos Lopez e14313
	virtual Color get_color(Context context, const Point &pos)const;
Carlos Lopez e14313
	virtual bool accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const;
Carlos Lopez a17b88
	virtual bool accelerated_cairorender(Context context, cairo_t *cr, int quality, const RendDesc &renddesc, ProgressCallback *cb)const;
Carlos Lopez e14313
	Layer::Handle hit_check(Context context, const Point &point)const;
Carlos Lopez a09598
	virtual Vocab get_param_vocab()const;
Carlos Lopez a09598
	virtual bool reads_context()const { return true; }
e222d9
e222d9
protected:
e222d9
	virtual rendering::Task::Handle build_rendering_task_vfunc(Context context) const;
Carlos Lopez a09598
}; // END of class Halftone3
Carlos Lopez a09598
Carlos Lopez a09598
/* === E N D =============================================================== */
Carlos Lopez a09598
Carlos Lopez a09598
#endif