|
|
a94d49 |
/* === S Y N F I G ========================================================= */
|
|
|
a94d49 |
/*! \file synfig/rendering/common/task/taskpixelprocessor.h
|
|
|
a94d49 |
** \brief TaskPixelProcessor Header
|
|
|
a94d49 |
**
|
|
|
a94d49 |
** $Id$
|
|
|
a94d49 |
**
|
|
|
a94d49 |
** \legal
|
|
|
da4398 |
** ......... ... 2016-2018 Ivan Mahonin
|
|
|
a94d49 |
**
|
|
|
a94d49 |
** This package is free software; you can redistribute it and/or
|
|
|
a94d49 |
** modify it under the terms of the GNU General Public License as
|
|
|
a94d49 |
** published by the Free Software Foundation; either version 2 of
|
|
|
a94d49 |
** the License, or (at your option) any later version.
|
|
|
a94d49 |
**
|
|
|
a94d49 |
** This package is distributed in the hope that it will be useful,
|
|
|
a94d49 |
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
a94d49 |
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
a94d49 |
** General Public License for more details.
|
|
|
a94d49 |
** \endlegal
|
|
|
a94d49 |
*/
|
|
|
a94d49 |
/* ========================================================================= */
|
|
|
a94d49 |
|
|
|
a94d49 |
/* === S T A R T =========================================================== */
|
|
|
a94d49 |
|
|
|
a94d49 |
#ifndef __SYNFIG_RENDERING_TASKPIXELPROCESSOR_H
|
|
|
a94d49 |
#define __SYNFIG_RENDERING_TASKPIXELPROCESSOR_H
|
|
|
a94d49 |
|
|
|
a94d49 |
/* === H E A D E R S ======================================================= */
|
|
|
a94d49 |
|
|
|
da4398 |
#include <synfig color="" colormatrix.h=""></synfig>
|
|
|
da4398 |
|
|
|
a94d49 |
#include "../../task.h"
|
|
|
da4398 |
#include "tasktransformation.h"
|
|
|
a94d49 |
|
|
|
a94d49 |
/* === M A C R O S ========================================================= */
|
|
|
a94d49 |
|
|
|
a94d49 |
/* === T Y P E D E F S ===================================================== */
|
|
|
a94d49 |
|
|
|
a94d49 |
/* === C L A S S E S & S T R U C T S ======================================= */
|
|
|
a94d49 |
|
|
|
a94d49 |
namespace synfig
|
|
|
a94d49 |
{
|
|
|
a94d49 |
namespace rendering
|
|
|
a94d49 |
{
|
|
|
a94d49 |
|
|
|
da4398 |
|
|
|
da4398 |
class TaskPixelProcessor: public Task,
|
|
|
da4398 |
public TaskInterfaceTransformationPass,
|
|
|
da4398 |
public TaskInterfaceConstant,
|
|
|
da4398 |
public TaskInterfaceSplit
|
|
|
a94d49 |
{
|
|
|
a94d49 |
public:
|
|
|
a94d49 |
typedef etl::handle<taskpixelprocessor> Handle;</taskpixelprocessor>
|
|
|
da4398 |
static Token token;
|
|
|
5e2754 |
virtual Token::Handle get_token() const { return token.handle(); }
|
|
|
a94d49 |
|
|
|
a94d49 |
const Task::Handle& sub_task() const { return Task::sub_task(0); }
|
|
|
a94d49 |
Task::Handle& sub_task() { return Task::sub_task(0); }
|
|
|
a94d49 |
|
|
|
a94d49 |
VectorInt get_offset() const;
|
|
|
a94d49 |
|
|
|
a94d49 |
virtual Rect calc_bounds() const;
|
|
|
da4398 |
|
|
|
78f7a3 |
virtual int get_pass_subtask_index() const
|
|
|
78f7a3 |
{
|
|
|
78f7a3 |
if (is_zero())
|
|
|
78f7a3 |
return PASSTO_NO_TASK;
|
|
|
ce743b |
if (!is_affects_transparent() && !sub_task())
|
|
|
78f7a3 |
return PASSTO_NO_TASK;
|
|
|
78f7a3 |
if (is_transparent())
|
|
|
ce743b |
return sub_task() ? 0 : PASSTO_NO_TASK;
|
|
|
78f7a3 |
if (is_constant())
|
|
|
78f7a3 |
return PASSTO_THIS_TASK_WITHOUT_SUBTASKS;
|
|
|
78f7a3 |
return PASSTO_THIS_TASK;
|
|
|
78f7a3 |
}
|
|
|
78f7a3 |
|
|
|
78f7a3 |
virtual bool is_zero() const
|
|
|
78f7a3 |
{ return false; }
|
|
|
da4398 |
virtual bool is_transparent() const
|
|
|
da4398 |
{ return false; }
|
|
|
da4398 |
virtual bool is_constant() const
|
|
|
da4398 |
{ return false; }
|
|
|
da4398 |
virtual bool is_affects_transparent() const
|
|
|
da4398 |
{ return false; }
|
|
|
a94d49 |
};
|
|
|
a94d49 |
|
|
|
da4398 |
|
|
|
da4398 |
class TaskPixelGamma: public TaskPixelProcessor
|
|
|
da4398 |
{
|
|
|
da4398 |
public:
|
|
|
da4398 |
typedef etl::handle<taskpixelgamma> Handle;</taskpixelgamma>
|
|
|
da4398 |
static Token token;
|
|
|
5e2754 |
virtual Token::Handle get_token() const { return token.handle(); }
|
|
|
da4398 |
|
|
|
a4bbdd |
Gamma gamma;
|
|
|
a4bbdd |
TaskPixelGamma() { }
|
|
|
78f7a3 |
|
|
|
78f7a3 |
virtual bool is_transparent() const
|
|
|
78f7a3 |
{
|
|
|
a4bbdd |
return approximate_equal_lp(gamma.get_r(), ColorReal(1.0))
|
|
|
a4bbdd |
&& approximate_equal_lp(gamma.get_g(), ColorReal(1.0))
|
|
|
a4bbdd |
&& approximate_equal_lp(gamma.get_b(), ColorReal(1.0));
|
|
|
78f7a3 |
}
|
|
|
da4398 |
};
|
|
|
da4398 |
|
|
|
da4398 |
|
|
|
da4398 |
class TaskPixelColorMatrix: public TaskPixelProcessor
|
|
|
da4398 |
{
|
|
|
da4398 |
public:
|
|
|
da4398 |
typedef etl::handle<taskpixelcolormatrix> Handle;</taskpixelcolormatrix>
|
|
|
da4398 |
static Token token;
|
|
|
5e2754 |
virtual Token::Handle get_token() const { return token.handle(); }
|
|
|
da4398 |
|
|
|
da4398 |
ColorMatrix matrix;
|
|
|
da4398 |
|
|
|
78f7a3 |
virtual bool is_zero() const
|
|
|
da4398 |
{ return matrix.is_transparent(); }
|
|
|
78f7a3 |
virtual bool is_transparent() const
|
|
|
78f7a3 |
{ return matrix.is_identity(); }
|
|
|
da4398 |
virtual bool is_constant() const
|
|
|
da4398 |
{ return matrix.is_constant(); }
|
|
|
da4398 |
virtual bool is_affects_transparent() const
|
|
|
da4398 |
{ return matrix.is_affects_transparent(); }
|
|
|
da4398 |
};
|
|
|
da4398 |
|
|
|
da4398 |
|
|
|
a94d49 |
} /* end namespace rendering */
|
|
|
a94d49 |
} /* end namespace synfig */
|
|
|
a94d49 |
|
|
|
a94d49 |
/* -- E N D ----------------------------------------------------------------- */
|
|
|
a94d49 |
|
|
|
a94d49 |
#endif
|