|
Carlos Lopez |
a09598 |
/* === S Y N F I G ========================================================= */
|
|
Carlos Lopez |
a09598 |
/*! \file layer_shape.h
|
|
Carlos Lopez |
a09598 |
** \brief Header file for implementation of the "Shape" 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) 2007-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_LAYER_SHAPE_H
|
|
Carlos Lopez |
a09598 |
#define __SYNFIG_LAYER_SHAPE_H
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
/* === H E A D E R S ======================================================= */
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
#include "layer_composite.h"
|
|
Diego Barrios Romero |
dcc14d |
#include <synfig color.h=""></synfig>
|
|
Diego Barrios Romero |
dcc14d |
#include <synfig vector.h=""></synfig>
|
|
Diego Barrios Romero |
dcc14d |
#include <synfig blur.h=""></synfig>
|
|
Carlos Lopez |
a09598 |
|
|
|
563c13 |
#include <synfig contour.h="" primitive="" rendering=""></synfig>
|
|
|
bac702 |
|
|
Carlos Lopez |
a09598 |
#include <vector></vector>
|
|
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 |
|
|
Carlos Lopez |
a09598 |
/*! \class Layer_Shape
|
|
Carlos Lopez |
a09598 |
** \brief writeme */
|
|
Carlos Lopez |
a09598 |
class Layer_Shape : public Layer_Composite, public Layer_NoDeform
|
|
Carlos Lopez |
a09598 |
{
|
|
Carlos Lopez |
a09598 |
SYNFIG_LAYER_MODULE_EXT
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
533c93 |
protected:
|
|
Carlos Lopez |
519b30 |
//!Parameter: (Color) Color of the shape
|
|
Carlos Lopez |
519b30 |
ValueBase param_color;
|
|
Carlos Lopez |
519b30 |
//!Parameter: (Point) Origin of the shape definition
|
|
Carlos Lopez |
519b30 |
ValueBase param_origin;
|
|
Carlos Lopez |
519b30 |
//!Parameter: (bool) Whether the shape is inverted or not
|
|
Carlos Lopez |
519b30 |
ValueBase param_invert;
|
|
Carlos Lopez |
519b30 |
//!Parameter: (bool) Whether the shape has antialiased edge
|
|
Carlos Lopez |
519b30 |
ValueBase param_antialias;
|
|
Carlos Lopez |
519b30 |
//!Parameter: (Blur::Type) The type of blur used for the feather
|
|
Carlos Lopez |
519b30 |
ValueBase param_blurtype;
|
|
Carlos Lopez |
519b30 |
//!Parameter: (Real) Amount of feather of the shape
|
|
Carlos Lopez |
519b30 |
ValueBase param_feather;
|
|
Carlos Lopez |
519b30 |
//!Parameter: (WindingStyle) How shape is rendered when crosses it self
|
|
|
bac702 |
ValueBase param_winding_style;
|
|
Carlos Lopez |
a09598 |
|
|
|
bac702 |
private:
|
|
|
bac702 |
rendering::Contour::Handle contour;
|
|
|
dd9f4e |
Vector feather;
|
|
Carlos Lopez |
a09598 |
|
|
|
dd97a8 |
mutable Time last_sync_time;
|
|
|
dd97a8 |
mutable Real last_sync_outline_grow;
|
|
|
dd97a8 |
|
|
Carlos Lopez |
a09598 |
protected:
|
|
Carlos Lopez |
a09598 |
Layer_Shape(const Real &a = 1.0, const Color::BlendMethod m = Color::BLEND_COMPOSITE);
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
public:
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
~Layer_Shape();
|
|
Carlos Lopez |
a09598 |
|
|
|
8bba01 |
protected:
|
|
|
76d914 |
rendering::Contour& shape_contour()
|
|
|
76d914 |
{ return *contour; }
|
|
|
76d914 |
|
|
Carlos Lopez |
a09598 |
void clear();
|
|
Carlos Lopez |
a09598 |
void move_to(Real x, Real y);
|
|
Carlos Lopez |
a09598 |
void line_to(Real x, Real y);
|
|
|
864ec3 |
void conic_to(Real x, Real y, Real x1, Real y1);
|
|
|
864ec3 |
void cubic_to(Real x, Real y, Real x1, Real y1, Real x2, Real y2);
|
|
Carlos Lopez |
a09598 |
void close();
|
|
Carlos Lopez |
a09598 |
|
|
|
3476ed |
void move_to(const Vector &p)
|
|
|
3476ed |
{ move_to(p[0], p[1]); }
|
|
|
3476ed |
void line_to(const Vector &p)
|
|
|
3476ed |
{ line_to(p[0], p[1]); }
|
|
|
3476ed |
void conic_to(const Vector &p, const Vector &p1)
|
|
|
3476ed |
{ conic_to(p[0], p[1], p1[0], p1[1]); }
|
|
|
3476ed |
void cubic_to(const Vector &p, const Vector &p1, const Vector &p2)
|
|
|
3476ed |
{ cubic_to(p[0], p[1], p1[0], p1[1], p2[0], p2[1]); }
|
|
|
3476ed |
|
|
|
8c834e |
void add(const rendering::Contour::Chunk &chunk);
|
|
|
8c834e |
void add(const rendering::Contour::ChunkList &chunks);
|
|
|
90788e |
|
|
|
90788e |
//! list will attached as line
|
|
|
90788e |
//! curve information for first segment of incoming list will ignored
|
|
|
8c834e |
void add_reverse(const rendering::Contour::ChunkList &list);
|
|
|
90788e |
|
|
|
dd9f4e |
Vector get_feather() const { return feather; }
|
|
|
dd9f4e |
void set_feather(const Vector &x) { feather = x; }
|
|
|
dd9f4e |
|
|
|
8bba01 |
public:
|
|
|
dd97a8 |
void sync(bool force = false) const;
|
|
|
dd97a8 |
void force_sync() const { sync(true); }
|
|
|
dd97a8 |
|
|
|
dd97a8 |
virtual bool set_shape_param(const String & param, const synfig::ValueBase &value);
|
|
Carlos Lopez |
a09598 |
virtual bool set_param(const String & param, const synfig::ValueBase &value);
|
|
Carlos Lopez |
a09598 |
virtual ValueBase get_param(const String & param)const;
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
virtual Vocab get_param_vocab()const;
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
virtual Color get_color(Context context, const Point &pos)const;
|
|
Carlos Lopez |
a09598 |
virtual synfig::Layer::Handle hit_check(synfig::Context context, const synfig::Point &point)const;
|
|
Carlos Lopez |
a09598 |
virtual Rect get_bounding_rect()const;
|
|
Carlos Lopez |
a09598 |
|
|
|
bac702 |
protected:
|
|
|
dd97a8 |
virtual void sync_vfunc();
|
|
|
dd97a8 |
virtual void set_time_vfunc(IndependentContext context, Time time)const;
|
|
|
8bbd89 |
virtual rendering::Task::Handle build_composite_task_vfunc(ContextParams context_params)const;
|
|
|
bac702 |
|
|
Carlos Lopez |
a09598 |
private:
|
|
|
bac702 |
bool render_shape(Surface *surface, bool useblend, const RendDesc &renddesc) const;
|
|
Carlos Lopez |
a09598 |
}; // END of Layer_Shape
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
}; // END of namespace synfig
|
|
Carlos Lopez |
a09598 |
/* === E N D =============================================================== */
|
|
Carlos Lopez |
a09598 |
|
|
Carlos Lopez |
a09598 |
#endif
|