synfig-core  1.0.3
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
synfig::Layer Class Reference

#include <layer.h>

Inheritance diagram for synfig::Layer:
synfig::Node CurveWarp InsideOut Julia Layer_Stroboscope Layer_TimeLoop Mandelbrot Rotate SuperSample synfig::Layer_Clamp synfig::Layer_ColorCorrect synfig::Layer_Composite synfig::Layer_Mime synfig::Layer_SphereDistort synfig::Layer_Stretch Translate Warp Zoom

Classes

struct  BookEntry

Public Types

typedef Layer *(* Factory )()
 Type that represents a pointer to a Layer's constructor.
typedef std::map< String,
BookEntry
Book
 Book of types of layers indexed by layer type name.
typedef std::map< String,
ValueBase
ParamList
 Map of Value Base parameters indexed by name.
typedef etl::handle< LayerHandle
typedef etl::loose_handle< LayerLooseHandle
typedef etl::handle< const LayerConstHandle
typedef std::map< String,
etl::rhandle< ValueNode > > 
DynamicParamList
 Map of parameters that are animated Value Nodes indexed by the param name.
typedef ParamVocab Vocab
 A list type which describes all the parameters that a layer has.
- Public Types inherited from synfig::Node
typedef TimePointSet time_set

Public Member Functions

sigc::signal< void > & signal_status_changed ()
 Status Changed.
sigc::signal< void, String > & signal_param_changed ()
 Parameter changed.
sigc::signal< void > & signal_description_changed ()
 Description Changed.
sigc::signal< void, int,
etl::handle< Canvas > > & 
signal_moved ()
 Moved.
sigc::signal< void, String > & signal_added_to_group ()
sigc::signal< void, String > & signal_removed_from_group ()
virtual ~Layer ()
virtual void on_canvas_set ()
void add_to_group (const String &)
 Adds this layer to the given layer group.
void remove_from_group (const String &)
 Removes this layer from the given layer group.
void remove_from_all_groups ()
 Removes this layer from all layer groups.
String get_group () const
 Gets the name of the group that this layer belongs to.
const DynamicParamListdynamic_param_list () const
void enable ()
 Enables the layer for rendering (Making it active)
void disable ()
 Disables the layer for rendering. (Making it inactive)
void set_active (bool x)
 Sets the 'active' flag for the Layer to the state described by x.
bool active () const
 Returns that status of the 'active' flag.
bool optimized () const
 flag to prevent re-apply optimization features
void set_optimized (bool x)
 set flag to prevent re-apply optimization features
void set_exclude_from_rendering (bool x)
 Sets the 'exclude_from_rendering' flag for the Layer.
bool get_exclude_from_rendering () const
 Returns that status of the 'exclude_from_rendering' flag.
int get_depth () const
 Returns the position of the layer in the canvas.
float get_z_depth () const
 Gets the non animated z depth of the layer.
float get_z_depth (const synfig::Time &t) const
 Gets the z depth of the layer at a time t.
float get_true_z_depth (const synfig::Time &t=Time(0)) const
 Gets the true z depth of the layer (index + parameter)
void set_z_depth (float x)
 Sets the z depth of the layer (non animated)
void set_canvas (etl::loose_handle< Canvas > canvas)
 Sets the Canvas that this Layer is a part of.
etl::loose_handle< Canvasget_canvas () const
 Returns a handle to the Canvas to which this Layer belongs.
const Stringget_description () const
 Returns the description of the layer.
String get_string () const
void set_description (const String &x)
 Sets the description of the layer.
const String get_non_empty_description () const
 Returns the layer's description if it's not empty, else its local name.
const String get_param_local_name (const String &param_name) const
 Returns the localised version of the given layer parameter.
Layer::LooseHandle get_parent_paste_canvas_layer () const
 Returns a handle to the Parent PasteCanvas layer or NULL if layer belongs to root canvas.
virtual Rect get_bounding_rect () const
virtual Rect get_full_bounding_rect (Context context) const
virtual String get_name () const
 Returns a string containing the name of the Layer.
virtual String get_local_name () const
 Returns a string containing the localized name of the Layer.
virtual Vocab get_param_vocab () const
 Gets the parameter vocabulary.
virtual String get_version () const
 Gets the version string for this layer.
virtual etl::handle< Transformget_transform () const
virtual bool set_version (const String &ver)
 Sets the virtual version to use for backwards-compatibility.
virtual void reset_version ()
 Resets the virtual version.
virtual bool set_param (const String &param, const ValueBase &value)
 Sets the parameter described by param to value.
virtual bool set_param_list (const ParamList &)
 Sets a list of parameters.
virtual ValueBase get_param (const String &param) const
 Get the value of the specified parameter.
virtual ParamList get_param_list () const
 Get a list of all of the parameters and their values.
virtual void set_time (IndependentContext context, Time time) const
 Sets the time for the Layer and those under it.
virtual void set_time (IndependentContext context, Time time, const Point &point) const
 Sets the time for the selected Layer and those under it for a specific point.
virtual Color get_color (Context context, const Point &pos) const
 Gets the blend color of the Layer in the context at pos.
virtual CairoColor get_cairocolor (Context context, const Point &pos) const
virtual void set_render_method (Context context, RenderMethod x)
 Sets the render method to the layer. Not all layers uses this virtual member.
virtual bool accelerated_render (Context context, Surface *surface, int quality, const RendDesc &renddesc, ProgressCallback *cb) const
 Renders the Canvas to the given Surface in an accelerated manner.
virtual bool accelerated_cairorender (Context context, cairo_t *cr, int quality, const RendDesc &renddesc, ProgressCallback *cb) const
virtual Handle hit_check (Context context, const Point &point) const
 Checks to see if a part of the layer is directly under point.
virtual Handle clone (etl::loose_handle< Canvas > canvas, const GUID &deriv_guid=GUID()) const
 Duplicates the Layer.
virtual bool reads_context () const
 Returns true if the layer needs to be able to examine its context.
virtual Handle simple_clone () const
 Duplicates the Layer without duplicating the value nodes.
virtual bool connect_dynamic_param (const String &param, etl::loose_handle< ValueNode >)
 Connects the parameter to another Value Node.
virtual bool disconnect_dynamic_param (const String &param)
 Disconnects the parameter from any Value Node.
Real get_parent_canvas_grow_value () const
 Retrieves the grow value from its parent canvas.
virtual void fill_sound_processor (SoundProcessor &soundProcessor) const
- Public Member Functions inherited from synfig::Node
sigc::signal< void > & signal_deleted ()
sigc::signal< void > & signal_changed ()
sigc::signal< void, GUID > & signal_guid_changed ()
 GUID Changed.
virtual ~Node ()
void changed ()
const GUIDget_guid () const
 Gets the GUID for this Node.
virtual void set_guid (const GUID &x)
 Sets the GUID for this Node.
int get_time_last_changed () const
 Gets the time when the Node was changed.
void add_child (Node *x)
 Adds the parameter as the child of the current Node.
void remove_child (Node *x)
 Removes the parameter as a child of the current Node.
int parent_count () const
 Returns how many parenst has the current Node.
const time_setget_times () const
 Returns the cached times values for all the children.
RWLockget_rw_lock () const
 Writeme!

Static Public Member Functions

static void register_in_book (const BookEntry &)
static Bookbook ()
static bool subsys_init ()
static bool subsys_stop ()
 Stops the layer system by deleting the book of registered layers.
static bool render_transformed (const Layer *layer, Context context, Surface *surface, int quality, const RendDesc &renddesc, ProgressCallback *cb, const char *file, int line)
static Layer::LooseHandle create (const String &type)
 Creates a Layer of type type.

Protected Member Functions

 Layer ()
virtual void on_changed ()
 This is called whenever a parameter is changed.
virtual void get_times_vfunc (Node::time_set &set) const
 Called to figure out the animation time information.
- Protected Member Functions inherited from synfig::Node
 Node ()
void begin_delete ()
virtual void on_guid_changed (GUID guid)

Friends

class ValueNode
class IndependentContext
class Context

Additional Inherited Members

- Public Attributes inherited from synfig::Node
std::set< Node * > parent_set

Detailed Description

Todo:
writeme
See Also
Canvas

Member Typedef Documentation

typedef Layer*(* synfig::Layer::Factory)()

Type that represents a pointer to a Layer's constructor.

As a pointer to the constructor, it represents a "factory" of layers.

Book of types of layers indexed by layer type name.

While the sifz file is read, each time a new layer entry is found, the factory constructor that the "factory" pointer member of the "BookEntry" struct points to, is called, and a new layer of that type is created.

See Also
Layer::Factory

Map of Value Base parameters indexed by name.

typedef etl::handle<Layer> synfig::Layer::Handle
typedef etl::loose_handle<Layer> synfig::Layer::LooseHandle
typedef etl::handle<const Layer> synfig::Layer::ConstHandle
typedef std::map<String,etl::rhandle<ValueNode> > synfig::Layer::DynamicParamList

Map of parameters that are animated Value Nodes indexed by the param name.

A list type which describes all the parameters that a layer has.

See Also
get_param_vocab()

Constructor & Destructor Documentation

Layer::Layer ( )
protected
synfig::Layer::~Layer ( )
virtual

Member Function Documentation

void Layer::register_in_book ( const BookEntry entry)
static
Layer::Book & Layer::book ( )
static
bool Layer::subsys_init ( )
static

Inits the book of layers and inserts in it the basic layers that doesn't depend on modules

Todo:
motionblur should be in the mod_filter module

References _layer_book, INCLUDE_LAYER, and LAYER_ALIAS.

Referenced by synfig::Main::Main().

bool Layer::subsys_stop ( )
static

Stops the layer system by deleting the book of registered layers.

References _layer_book.

Referenced by synfig::Main::Main(), and synfig::Main::~Main().

sigc::signal<void>& synfig::Layer::signal_status_changed ( )
inline

Status Changed.

sigc::signal<void,String>& synfig::Layer::signal_param_changed ( )
inline

Parameter changed.

sigc::signal<void>& synfig::Layer::signal_description_changed ( )
inline

Description Changed.

sigc::signal<void, int, etl::handle<Canvas> >& synfig::Layer::signal_moved ( )
inline

Moved.

sigc::signal<void, String>& synfig::Layer::signal_added_to_group ( )
inline

Referenced by add_to_group().

sigc::signal<void, String>& synfig::Layer::signal_removed_from_group ( )
inline

Referenced by remove_from_all_groups().

void synfig::Layer::on_canvas_set ( )
virtual

Reimplemented in synfig::Layer_PasteCanvas, and Import.

void Layer::add_to_group ( const String x)

Adds this layer to the given layer group.

References remove_from_all_groups(), and signal_added_to_group().

void Layer::remove_from_group ( const String x)

Removes this layer from the given layer group.

References remove_from_all_groups().

void Layer::remove_from_all_groups ( )

Removes this layer from all layer groups.

References signal_removed_from_group().

Referenced by add_to_group(), and remove_from_group().

String Layer::get_group ( ) const

Gets the name of the group that this layer belongs to.

const DynamicParamList& synfig::Layer::dynamic_param_list ( ) const
inline
void synfig::Layer::enable ( )
inline

Enables the layer for rendering (Making it active)

References set_active().

void synfig::Layer::disable ( )
inline

Disables the layer for rendering. (Making it inactive)

When a layer is disabled, it will be skipped when the canvas is rendered.

References set_active().

void Layer::set_active ( bool  x)

Sets the 'active' flag for the Layer to the state described by x.

When a layer is disabled, it will be skipped when the canvas is rendered.

References on_changed().

Referenced by disable(), and enable().

bool synfig::Layer::active ( ) const
inline

Returns that status of the 'active' flag.

Referenced by synfig::Context::active(), clone(), synfig::Layer_PasteCanvas::fill_sound_processor(), and simple_clone().

bool synfig::Layer::optimized ( ) const
inline

flag to prevent re-apply optimization features

Referenced by clone(), and simple_clone().

void synfig::Layer::set_optimized ( bool  x)
inline

set flag to prevent re-apply optimization features

void Layer::set_exclude_from_rendering ( bool  x)

Sets the 'exclude_from_rendering' flag for the Layer.

When set, layer will skipped while final rendering but will still present onto work view.

References on_changed().

Referenced by synfig::Layer_Skeleton::Layer_Skeleton().

bool synfig::Layer::get_exclude_from_rendering ( ) const
inline

Returns that status of the 'exclude_from_rendering' flag.

Referenced by synfig::Context::active(), clone(), and simple_clone().

int Layer::get_depth ( ) const

Returns the position of the layer in the canvas.

Returns negative on error

References get_canvas().

Referenced by get_true_z_depth().

float synfig::Layer::get_z_depth ( ) const
inline

Gets the non animated z depth of the layer.

References synfig::ValueBase::get().

Referenced by get_true_z_depth().

float Layer::get_z_depth ( const synfig::Time t) const

Gets the z depth of the layer at a time t.

References dynamic_param_list(), and synfig::ValueBase::get().

float Layer::get_true_z_depth ( const synfig::Time t = Time(0)) const

Gets the true z depth of the layer (index + parameter)

References get_depth(), and get_z_depth().

Referenced by synfig::Context::z_depth_visibility().

void synfig::Layer::set_z_depth ( float  x)
inline

Sets the z depth of the layer (non animated)

void synfig::Layer::set_canvas ( etl::loose_handle< Canvas canvas)

Sets the Canvas that this Layer is a part of.

etl::loose_handle< synfig::Canvas > synfig::Layer::get_canvas ( ) const
const String& synfig::Layer::get_description ( ) const
inline

Returns the description of the layer.

Referenced by clone(), get_non_empty_description(), simple_clone(), and Advanced_Outline::sync().

String Layer::get_string ( void  ) const
virtual

Implements synfig::Node.

References get_non_empty_description().

void Layer::set_description ( const String x)

Sets the description of the layer.

Referenced by synfig::Layer_Sound::get_param_vocab(), synfig::Layer_Duplicate::get_param_vocab(), Blur_Layer::get_param_vocab(), synfig::Layer_SolidColor::get_param_vocab(), Zoom::get_param_vocab(), InsideOut::get_param_vocab(), Translate::get_param_vocab(), synfig::Layer_Skeleton::get_param_vocab(), XORPattern::get_param_vocab(), CheckerBoard::get_param_vocab(), SuperSample::get_param_vocab(), Layer_Shade::get_param_vocab(), synfig::Layer_MotionBlur::get_param_vocab(), RadialBlur::get_param_vocab(), synfig::Layer_Stretch::get_param_vocab(), Rotate::get_param_vocab(), Import::get_param_vocab(), synfig::Layer_Clamp::get_param_vocab(), SimpleCircle::get_param_vocab(), Star::get_param_vocab(), synfig::Layer_Bitmap::get_param_vocab(), Rectangle::get_param_vocab(), Twirl::get_param_vocab(), synfig::Layer_SkeletonDeformation::get_param_vocab(), SpiralGradient::get_param_vocab(), FilledRect::get_param_vocab(), Layer_Bevel::get_param_vocab(), ConicalGradient::get_param_vocab(), RadialGradient::get_param_vocab(), synfig::Layer_SphereDistort::get_param_vocab(), CurveWarp::get_param_vocab(), synfig::Layer_Composite::get_param_vocab(), NoiseDistort::get_param_vocab(), LinearGradient::get_param_vocab(), CurveGradient::get_param_vocab(), synfig::Layer_Polygon::get_param_vocab(), Advanced_Outline::get_param_vocab(), Warp::get_param_vocab(), Noise::get_param_vocab(), Mandelbrot::get_param_vocab(), Julia::get_param_vocab(), synfig::Layer_Shape::get_param_vocab(), Circle::get_param_vocab(), Plant::get_param_vocab(), synfig::Layer_PasteCanvas::get_param_vocab(), and get_param_vocab().

const String synfig::Layer::get_non_empty_description ( ) const
inline

Returns the layer's description if it's not empty, else its local name.

References get_description(), and get_local_name().

Referenced by get_string(), and synfig::Layer_Composite::set_param().

const String Layer::get_param_local_name ( const String param_name) const

Returns the localised version of the given layer parameter.

References get_param_vocab().

synfig::Layer::LooseHandle synfig::Layer::get_parent_paste_canvas_layer ( ) const

Returns a handle to the Parent PasteCanvas layer or NULL if layer belongs to root canvas.

Notice that it could return the wrong handle to PasteCanvas if the layer

belongs to a exported canvas (canvas can be referenced multiple times)

References get_canvas(), synfig::Layer_PasteCanvas::get_sub_canvas(), and synfig::warning().

Rect Layer::get_bounding_rect ( ) const
virtual
Rect Layer::get_full_bounding_rect ( Context  context) const
virtual
String Layer::get_name ( ) const
virtual

Returns a string containing the name of the Layer.

References synfig::ValueBase::get(), and get_param().

Referenced by clone(), synfig::Layer_Mime::get_local_name(), synfig::optimize_layers(), and simple_clone().

String Layer::get_local_name ( ) const
virtual

Returns a string containing the localized name of the Layer.

Reimplemented in synfig::Layer_PasteCanvas, synfig::Layer_SkeletonDeformation, synfig::Layer_Mime, synfig::Layer_Group, and synfig::Layer_Switch.

References synfig::ValueBase::get(), and get_param().

Referenced by get_non_empty_description().

Layer::Vocab Layer::get_param_vocab ( void  ) const
virtual
String Layer::get_version ( ) const
virtual

Gets the version string for this layer.

Reimplemented in synfig::Layer_Mime.

References synfig::ValueBase::get(), and get_param().

etl::handle< Transform > Layer::get_transform ( ) const
virtual

Returns a handle to the Transform class of the layer

See Also
synfig::Transform

Reimplemented in Warp, synfig::Layer_SphereDistort, Twirl, Rotate, synfig::Layer_Stretch, synfig::Layer_MeshTransform, Translate, Zoom, and InsideOut.

bool Layer::set_version ( const String ver)
virtual

Sets the virtual version to use for backwards-compatibility.

See Also
reset_version()

Reimplemented in Layer_Freetype, Plant, Advanced_Outline, Outline, Layer_TimeLoop, and synfig::Layer_Mime.

void Layer::reset_version ( )
virtual

Resets the virtual version.

See Also
set_version()

Reimplemented in Layer_Freetype, Outline, and Layer_TimeLoop.

bool Layer::set_param ( const String param,
const ValueBase value 
)
virtual
bool Layer::set_param_list ( const ParamList list)
virtual

Sets a list of parameters.

References set_param().

ValueBase Layer::get_param ( const String param) const
virtual
Layer::ParamList Layer::get_param_list ( ) const
virtual

Get a list of all of the parameters and their values.

References get_param(), and get_param_vocab().

Referenced by clone(), synfig::optimize_layers(), and simple_clone().

void Layer::set_time ( IndependentContext  context,
Time  time 
) const
virtual

Sets the time for the Layer and those under it.

Parameters
contextContext iterator referring to next Layer.
timewriteme
See Also
Context::set_time()

Reimplemented in synfig::Layer_PasteCanvas, Advanced_Outline, Noise, Outline, NoiseDistort, Layer_TimeLoop, Import, Region, synfig::Layer_Skeleton, Layer_Stroboscope, synfig::Layer_MotionBlur, and synfig::Layer_Duplicate.

References synfig::IndependentContext::set_time().

void Layer::set_time ( IndependentContext  context,
Time  time,
const Point point 
) const
virtual

Sets the time for the selected Layer and those under it for a specific point.

Parameters
contextContext iterator referring to next Layer.
timewriteme
pointwriteme
See Also
Context::set_time()
Todo:
point should be of the type const Point &

Reimplemented in Noise, NoiseDistort, Import, synfig::Layer_Skeleton, synfig::Layer_MotionBlur, and synfig::Layer_Duplicate.

References synfig::IndependentContext::set_time().

Color Layer::get_color ( Context  context,
const Point pos 
) const
virtual
CairoColor Layer::get_cairocolor ( Context  context,
const Point pos 
) const
virtual
void Layer::set_render_method ( Context  context,
RenderMethod  x 
)
virtual

Sets the render method to the layer. Not all layers uses this virtual member.

Reimplemented in synfig::Layer_PasteCanvas, synfig::Layer_Bitmap, and Import.

References synfig::Context::set_render_method().

bool Layer::render_transformed ( const Layer layer,
Context  context,
Surface surface,
int  quality,
const RendDesc renddesc,
ProgressCallback cb,
const char *  file,
int  line 
)
static
bool Layer::accelerated_render ( Context  context,
Surface surface,
int  quality,
const RendDesc renddesc,
ProgressCallback cb 
) const
virtual
bool Layer::accelerated_cairorender ( Context  context,
cairo_t *  cr,
int  quality,
const RendDesc renddesc,
ProgressCallback cb 
) const
virtual
synfig::Layer::Handle Layer::hit_check ( synfig::Context  context,
const Point point 
) const
virtual

Checks to see if a part of the layer is directly under point.

Parameters
contextContext iterator referring to next Layer.
pointThe point to check
Returns
The handle of the layer under point. If there is not a layer under point, then returns an empty handle.
See Also
Context::hit_check

Reimplemented in synfig::Layer_PasteCanvas, Circle, synfig::Layer_Shape, Warp, Noise, Halftone3, CurveGradient, LinearGradient, Halftone2, synfig::Layer_Bitmap, FilledRect, NoiseDistort, CurveWarp, Metaballs, RadialGradient, ConicalGradient, SpiralGradient, synfig::Layer_SphereDistort, Twirl, Rectangle, SimpleCircle, Rotate, CheckerBoard, synfig::Layer_Stretch, Translate, synfig::Layer_MeshTransform, XORPattern, synfig::Layer_SolidColor, LumaKey, InsideOut, and Zoom.

References synfig::Context::hit_check().

Layer::Handle Layer::clone ( etl::loose_handle< Canvas canvas,
const GUID deriv_guid = GUID() 
) const
virtual
bool Layer::reads_context ( ) const
virtual

Returns true if the layer needs to be able to examine its context.

context to render itself, other than for simple blending. For example, the blur layer will return true - it can't do its job if it can't see its context, and the circle layer will return false - rendering a circle doesn't depend on the underlying context until the final blend operation.

Reimplemented in Halftone3, Halftone2, NoiseDistort, Layer_Bevel, Twirl, LumaKey, Layer_Shade, RadialBlur, synfig::Layer_MotionBlur, Blur_Layer, and synfig::Layer_Duplicate.

Referenced by synfig::Layer_Composite::set_param().

Layer::Handle Layer::simple_clone ( ) const
virtual

Duplicates the Layer without duplicating the value nodes.

References active(), book(), create(), dynamic_param_list(), get_description(), get_exclude_from_rendering(), get_name(), get_param_list(), and optimized().

bool Layer::connect_dynamic_param ( const String param,
etl::loose_handle< ValueNode value_node 
)
virtual
bool Layer::disconnect_dynamic_param ( const String param)
virtual

Disconnects the parameter from any Value Node.

References synfig::Node::changed(), dynamic_param_list(), and synfig::Node::remove_child().

Real Layer::get_parent_canvas_grow_value ( ) const
void Layer::fill_sound_processor ( SoundProcessor soundProcessor) const
virtual
void Layer::on_changed ( )
protectedvirtual

This is called whenever a parameter is changed.

Reimplemented from synfig::Node.

References synfig::Time::end().

Referenced by set_active(), and set_exclude_from_rendering().

void Layer::get_times_vfunc ( Node::time_set set) const
protectedvirtual

Called to figure out the animation time information.

Implements synfig::Node.

Reimplemented in synfig::Layer_PasteCanvas.

References synfig::TimePointSet::insert().

Layer::LooseHandle synfig::Layer::create ( const String type)
static

Creates a Layer of type type.

If the Layer type is unknown, then a Mime layer is created in its place.

Parameters
typeA string describing the name of the layer to construct.
Returns
Always returns a handle to a new Layer.
See Also
Mime

Referenced by clone(), synfig::Layer_Duplicate::Layer_Duplicate(), synfig::optimize_layers(), OptionsProcessor::process_info_options(), and simple_clone().

Friends And Related Function Documentation

friend class ValueNode
friend
friend class IndependentContext
friend
friend class Context
friend

The documentation for this class was generated from the following files: