# synfig::Canvas Class Reference

`#include <canvas.h>`

Inheritance diagram for synfig::Canvas:

List of all members.

## Public Types

typedef etl::handle< Canvas > | Handle
typedef etl::loose_handle< Canvas > | LooseHandle
typedef etl::handle< const Canvas > | ConstHandle
typedef std::list< Handle > | Children

## Public Member Functions

sigc::signal< void, String, etl::handle< synfig::Layer > > & | signal_group_pair_added ()
sigc::signal< void, String, etl::handle< synfig::Layer > > & | signal_group_pair_removed ()
sigc::signal< void, String > & | signal_group_added ()
| Group Added.
sigc::signal< void, String > & | signal_group_removed ()
| Group Removed.
sigc::signal< void, String > & | signal_group_changed ()
| Group Changed.
sigc::signal< void, int * > & | signal_layers_reordered ()
| Layers Reordered.
sigc::signal< void > & | signal_rend_desc_changed ()
| RendDesc Changed.
sigc::signal< void > & | signal_id_changed ()
| ID Changed.
sigc::signal< void > & | signal_file_name_changed ()
| File name Changed.
sigc::signal< void, String > & | signal_meta_data_changed ()
| Metadata Changed.
sigc::signal< void > & | signal_meta_data_changed (const String &key)
| Metadata Changed.
sigc::signal< void, etl::handle< ValueNode > > & | signal_value_node_changed ()
sigc::signal< void, etl::handle< ValueNode > > & | signal_value_node_renamed ()
sigc::signal< void > & | signal_dirty ()
| Dirty.
sigc::signal< void, etl::handle< ValueNode > , etl::handle< ValueNode > > & | signal_value_node_child_added ()
sigc::signal< void, etl::handle< ValueNode > , etl::handle< ValueNode > > & | signal_value_node_child_removed ()
| ~Canvas ()
std::set< etl::handle< Layer > > | get_layers_in_group (const String &group)
| Returns the set of layers in group.
std::set< String > | get_groups () const
| Gets all the groups.
int | get_group_count () const
| Gets the number of groups in this canvas.
void | rename_group (const String &old_name, const String &new_name)
| Renames the given group.
bool | is_inline () const
RendDesc & | rend_desc ()
| Returns a handle to the RendDesc for this Canvas.
const RendDesc & | rend_desc () const
| Returns a handle to the RendDesc for this Canvas.
const String & | get_name () const
| Gets the name of the canvas.
void | set_name (const String &x)
| Sets the name of the canvas.
const String | get_version () const
| Gets the version string of the canvas.
void | set_version (const String &x)
| Sets the version string of the canvas.
const String & | get_author () const
| Gets the author of the canvas.
void | set_author (const String &x)
| Sets the author of the canvas.
const String & | get_description () const
| Gets the description of the canvas.
void | set_description (const String &x)
| Sets the name of the canvas.
const String & | get_id () const
| Gets the ID of the canvas.
void | set_id (const String &x)
| Sets the ID of the canvas.
String | get_meta_data (const String &key) const
| Returns the data string for the given meta data key.
std::list< String > | get_meta_data_keys () const
| Returns a list of meta data keys.
void | set_meta_data (const String &key, const String &data)
| Sets a meta data key to a specific string.
void | erase_meta_data (const String &key)
| Removes a meta data key.
String | get_relative_id (etl::loose_handle< const Canvas > x) const
String | _get_relative_id (etl::loose_handle< const Canvas > x) const
bool | is_root () const
| Returns `true` if the Canvas is a root Canvas. `false` otherwise.
LooseHandle | parent () const
| Returns a handle to the parent Canvas.
LooseHandle | get_root () const
std::list< Handle > & | children ()
| Returns a list of all child canvases in this canvas.
const std::list< Handle > & | children () const
| Returns a list of all child canvases in this canvas.
void | set_time (Time t) const
| Gets the color at the specified point.
Time | get_time () const
int | size () const
| Returns the number of layers in the canvas.
void | clear ()
| Removes all the layers from the canvas.
bool | empty () const
| Returns true if the canvas has no layers.
const ValueNodeList & | value_node_list () const
| Returns a reference to the ValueNodeList for this Canvas.
KeyframeList & | keyframe_list ()
| Returns a reference to the KeyframeList for this Canvas.
const KeyframeList & | keyframe_list () const
| Returns a reference to the KeyframeList for this Canvas.
ValueNode::Handle | find_value_node (const String &id)
| Finds the ValueNode in the Canvas with the given id.
ValueNode::Handle | surefind_value_node (const String &id)
ValueNode::ConstHandle | find_value_node (const String &id) const
| Finds the ValueNode in the Canvas with the given id.
void | add_value_node (ValueNode::Handle x, const String &id)
void | remove_value_node (ValueNode::Handle x)
| writeme
void | remove_value_node (const String &id)
Handle | surefind_canvas (const String &id, String &warnings)
| Finds a child Canvas in the Canvas with the given name.
Handle | find_canvas (const String &id, String &warnings)
| Finds a child Canvas in the Canvas with the given id.
ConstHandle | find_canvas (const String &id, String &warnings) const
| Finds a child Canvas in the Canvas with the given id.
String | get_file_path () const
| Sets the file path for the Canvas.
void | set_file_name (const String &)
| Sets the filename (with path).
String | get_file_name () const
| Gets the filename (with path).
Handle | new_child_canvas ()
| Creates a new child canvas, and returns its handle.
Handle | new_child_canvas (const String &id)
| Creates a new child canvas with an ID of id, and returns its handle.
Handle | add_child_canvas (Handle child_canvas, const String &id)
| Adds the given canvas as a child.
void | remove_child_canvas (Handle child_canvas)
etl::handle< Layer > | find_layer (const Point &pos)
int | get_depth (etl::handle< Layer >) const
Context | get_context () const
iterator | end ()
const_iterator | end () const
reverse_iterator | rbegin ()
const_reverse_iterator | rbegin () const
etl::handle< Layer > & | back ()
void | push_back (etl::handle< Layer > x)
void | push_front (etl::handle< Layer > x)
void | push_back_simple (etl::handle< Layer > x)
void | insert (iterator iter, etl::handle< Layer > x)
void | erase (iterator iter)
const etl::handle< Layer > & | back () const
void | set_inline (LooseHandle parent)
Handle | clone (const GUID &deriv_guid=GUID()) const
void | register_external_canvas (String file, Handle canvas)

## Static Public Member Functions

static Handle | create ()
static Handle | create_inline (Handle parent)

## Protected Member Functions

| Canvas (const String &name)
virtual void | on_changed ()
virtual void | get_times_vfunc (Node::time_set &set) const

## Friends

void | optimize_layers (Time, Context, Canvas::Handle, bool seen_motion_blur)

## Detailed Description

Todo:
  writeme

## Member Typedef Documentation

typedef etl::handle<Canvas> synfig::Canvas::Handle

typedef etl::loose_handle<Canvas> synfig::Canvas::LooseHandle

typedef etl::handle<const Canvas> synfig::Canvas::ConstHandle

typedef std::list<Handle> synfig::Canvas::Children

## Constructor & Destructor Documentation

Canvas::Canvas | ( | const String & | name | ) | `[protected]`

References clear().

Referenced by clone(), create(), and create_inline().

Canvas::~Canvas | ( |  | ) |

References synfig::Node::begin_delete(), clear(), synfig::Node::parent_set, synfig::Layer_PasteCanvas::set_sub_canvas(), and synfig::warning().

## Member Function Documentation

sigc::signal<void,String,etl::handle<synfig::Layer> >& synfig::Canvas::signal_group_pair_added | ( |  | ) | `[inline]`

sigc::signal<void,String,etl::handle<synfig::Layer> >& synfig::Canvas::signal_group_pair_removed | ( |  | ) | `[inline]`

sigc::signal<void,String>& synfig::Canvas::signal_group_added | ( |  | ) | `[inline]`

Group Added.

sigc::signal<void,String>& synfig::Canvas::signal_group_removed | ( |  | ) | `[inline]`

Group Removed.

sigc::signal<void,String>& synfig::Canvas::signal_group_changed | ( |  | ) | `[inline]`

Group Changed.

sigc::signal<void,int*>& synfig::Canvas::signal_layers_reordered | ( |  | ) | `[inline]`

Layers Reordered.

sigc::signal<void>& synfig::Canvas::signal_rend_desc_changed | ( |  | ) | `[inline]`

RendDesc Changed.

sigc::signal<void>& synfig::Canvas::signal_id_changed | ( |  | ) | `[inline]`

ID Changed.

sigc::signal< void > & Canvas::signal_file_name_changed | ( |  | ) |

File name Changed.

References parent().

sigc::signal<void, String>& synfig::Canvas::signal_meta_data_changed | ( |  | ) | `[inline]`

Metadata Changed.

Referenced by erase_meta_data(), set_author(), set_description(), set_meta_data(), and set_name().

sigc::signal<void>& synfig::Canvas::signal_meta_data_changed | ( | const String & | key | ) | `[inline]`

Metadata Changed.

sigc::signal<void, etl::handle<ValueNode> >& synfig::Canvas::signal_value_node_changed | ( |  | ) | `[inline]`

sigc::signal<void, etl::handle<ValueNode> >& synfig::Canvas::signal_value_node_renamed | ( |  | ) | `[inline]`

sigc::signal<void>& synfig::Canvas::signal_dirty | ( |  | ) | `[inline]`

Dirty.

References synfig::Node::signal_changed().

sigc::signal<void, etl::handle<ValueNode>, etl::handle<ValueNode> >& synfig::Canvas::signal_value_node_child_added | ( |  | ) | `[inline]`

Todo:
  This needs to be documented further.

sigc::signal<void, etl::handle<ValueNode>, etl::handle<ValueNode> >& synfig::Canvas::signal_value_node_child_removed | ( |  | ) | `[inline]`

Todo:
  This needs to be documented further.

std::set< etl::handle< Layer > > Canvas::get_layers_in_group | ( | const String & | group | ) |

Returns the set of layers in group.

References is_inline().

Referenced by rename_group().

std::set< String > Canvas::get_groups | ( |  | ) | const

Gets all the groups.

References is_inline().

int Canvas::get_group_count | ( |  | ) | const

Gets the number of groups in this canvas.

References is_inline().

void Canvas::rename_group | ( | const String & | old_name,
|  | const String & | new_name |
| ) |  |  |

Renames the given group.

References get_layers_in_group(), and is_inline().

bool synfig::Canvas::is_inline | ( |  | ) | const`[inline]`

Todo:
  This needs to be documented further.

Referenced by _get_relative_id(), add_child_canvas(), add_value_node(), clone(), find_canvas(), find_value_node(), get_group_count(), get_groups(), get_layers_in_group(), get_relative_id(), keyframe_list(), new_child_canvas(), remove_child_canvas(), remove_value_node(), rename_group(), synfig::ValueBase::set(), set_id(), surefind_canvas(), surefind_value_node(), and value_node_list().

RendDesc& synfig::Canvas::rend_desc | ( |  | ) | `[inline]`

Returns a handle to the RendDesc for this Canvas.

Referenced by clone(), new_child_canvas(), and set_inline().

const RendDesc& synfig::Canvas::rend_desc | ( |  | ) | const`[inline]`

Returns a handle to the RendDesc for this Canvas.

const String& synfig::Canvas::get_name | ( |  | ) | const`[inline]`

Gets the name of the canvas.

void Canvas::set_name | ( | const String & | x | ) |

Sets the name of the canvas.

References signal_meta_data_changed().

const String synfig::Canvas::get_version | ( |  | ) | const`[inline]`

Gets the version string of the canvas.

void synfig::Canvas::set_version | ( | const String & | x | ) | `[inline]`

Sets the version string of the canvas.

const String& synfig::Canvas::get_author | ( |  | ) | const`[inline]`

Gets the author of the canvas.

void Canvas::set_author | ( | const String & | x | ) |

Sets the author of the canvas.

References signal_meta_data_changed().

const String& synfig::Canvas::get_description | ( |  | ) | const`[inline]`

Gets the description of the canvas.

void Canvas::set_description | ( | const String & | x | ) |

Sets the name of the canvas.

References signal_meta_data_changed().

const String& synfig::Canvas::get_id | ( |  | ) | const`[inline]`

Gets the ID of the canvas.

Referenced by _get_relative_id(), and clone().

void Canvas::set_id | ( | const String & | x | ) |

Sets the ID of the canvas.

References is_inline(), and valid_id().

String Canvas::get_meta_data | ( | const String & | key | ) | const

Returns the data string for the given meta data key.

std::list< String > Canvas::get_meta_data_keys | ( |  | ) | const

Returns a list of meta data keys.

void Canvas::set_meta_data | ( | const String & | key,
|  | const String & | data |
| ) |  |  |

Sets a meta data key to a specific string.

References signal_meta_data_changed().

void Canvas::erase_meta_data | ( | const String & | key | ) |

Removes a meta data key.

References signal_meta_data_changed().

String Canvas::get_relative_id | ( | etl::loose_handle< const Canvas > | x | ) | const

Todo:
  This needs to be documented further.

References _get_relative_id(), and is_inline().

String Canvas::_get_relative_id | ( | etl::loose_handle< const Canvas > | x | ) | const

For internal use only.

Todo:
  This needs to be documented further.

References get_file_name(), get_id(), get_root(), is_inline(), is_root(), and parent().

Referenced by get_relative_id().

bool synfig::Canvas::is_root | ( |  | ) | const`[inline]`

Returns `true` if the Canvas is a root Canvas. `false` otherwise.

Referenced by _get_relative_id(), and set_time().

LooseHandle synfig::Canvas::parent | ( |  | ) | const`[inline]`

Returns a handle to the parent Canvas.

The returned handle will be empty if this is a root canvas

Referenced by _get_relative_id(), clone(), get_file_name(), get_file_path(), set_file_name(), and signal_file_name_changed().

Canvas::LooseHandle Canvas::get_root | ( |  | ) | const

Referenced by _get_relative_id(), find_canvas(), and surefind_canvas().

std::list<Handle>& synfig::Canvas::children | ( |  | ) | `[inline]`

Returns a list of all child canvases in this canvas.

Referenced by add_child_canvas(), find_canvas(), new_child_canvas(), remove_child_canvas(), and surefind_canvas().

const std::list<Handle>& synfig::Canvas::children | ( |  | ) | const`[inline]`

Returns a list of all child canvases in this canvas.

void Canvas::set_time | ( | Time | t | ) | const

Gets the color at the specified point.

Sets the time for all the layers in the canvas

References get_context(), get_time(), synfig::info(), is_root(), and synfig::Context::set_time().

Time synfig::Canvas::get_time | ( |  | ) | const`[inline]`

Todo:
  This needs to be documented further.

Referenced by set_time().

int Canvas::size | ( |  | ) | const

Returns the number of layers in the canvas.

Referenced by clone().

void Canvas::clear | ( |  | ) |

Removes all the layers from the canvas.

References synfig::Node::changed(), empty(), and erase().

Referenced by Canvas(), and ~Canvas().

bool Canvas::empty | ( |  | ) | const

Returns true if the canvas has no layers.

Referenced by add_value_node(), clear(), find_canvas(), find_value_node(), surefind_canvas(), and surefind_value_node().

const ValueNodeList & Canvas::value_node_list | ( |  | ) | const

Returns a reference to the ValueNodeList for this Canvas.

Returns a reference to the ValueNodeList for this Canvas

References is_inline().

KeyframeList & Canvas::keyframe_list | ( |  | ) |

Returns a reference to the KeyframeList for this Canvas.

References is_inline().

const KeyframeList & Canvas::keyframe_list | ( |  | ) | const

Returns a reference to the KeyframeList for this Canvas.

References is_inline().

ValueNode::Handle Canvas::find_value_node | ( | const String & | id | ) |

Finds the ValueNode in the Canvas with the given id.

Returns:
  If found, returns a handle to the ValueNode. Otherwise, returns an empty handle.

Referenced by remove_value_node().

ValueNode::Handle Canvas::surefind_value_node | ( | const String & | id | ) |

For internal use only.

Todo:
  This needs to be documented further.

References empty(), is_inline(), synfig::ValueNodeList::surefind(), and surefind_canvas().

ValueNode::ConstHandle Canvas::find_value_node | ( | const String & | id | ) | const

Finds the ValueNode in the Canvas with the given id.

Returns:
  If found, returns a handle to the ValueNode. Otherwise, returns an empty handle.

References empty(), synfig::ValueNodeList::find(), find_canvas(), and is_inline().

void Canvas::add_value_node | ( | ValueNode::Handle | x,
|  | const String & | id |
| ) |  |  |

Todo:
  This needs to be documented further.

References synfig::ValueNodeList::add(), empty(), synfig::error(), synfig::ValueNodeList::find(), and is_inline().

void Canvas::remove_value_node | ( | ValueNode::Handle | x | ) |

writeme

Todo:
  This needs to be documented further.

References synfig::ValueNodeList::erase(), and is_inline().

Referenced by remove_value_node().

void synfig::Canvas::remove_value_node | ( | const String & | id | ) | `[inline]`

Todo:
  This needs to be documented further.

References find_value_node(), and remove_value_node().

Canvas::Handle Canvas::surefind_canvas | ( | const String & | id,
|  | String & | warnings |
| ) |  |  |

Finds a child Canvas in the Canvas with the given name.

Returns:
  If found, returns a handle to the child Canvas. If not found, it creates a new Canvas and returns it If an error occurs, it returns an empty handle

Todo:
  This needs a lot more optimization

References children(), empty(), get_file_path(), get_root(), is_inline(), new_child_canvas(), and synfig::open_canvas().

Referenced by surefind_value_node().

Canvas::Handle Canvas::find_canvas | ( | const String & | id,
|  | String & | warnings |
| ) |  |  |

Finds a child Canvas in the Canvas with the given id.

Returns:
  If found, returns a handle to the child Canvas. Otherwise, returns an empty handle.

Referenced by add_child_canvas(), find_canvas(), and find_value_node().

Canvas::ConstHandle Canvas::find_canvas | ( | const String & | id,
|  | String & | warnings |
| ) |  |  | const

Finds a child Canvas in the Canvas with the given id.

Returns:
  If found, returns a handle to the child Canvas. Otherwise, returns an empty handle.

Todo:
  This needs a lot more optimization

References children(), empty(), find_canvas(), get_file_path(), get_root(), is_inline(), and synfig::open_canvas().

String Canvas::get_file_path | ( |  | ) | const

Sets the file path for the Canvas.

Returns the file path from the file name

References parent().

Referenced by find_canvas(), register_external_canvas(), and surefind_canvas().

void Canvas::set_file_name | ( | const String & | file_name | ) |

Sets the filename (with path).

References synfig::get_open_canvas_map(), parent(), and synfig::CanvasParser::register_canvas_in_map().

String Canvas::get_file_name | ( |  | ) | const

Gets the filename (with path).

References parent().

Referenced by _canvas_file_name_changed(), _get_relative_id(), and _remove_from_open_canvas_map().

Canvas::Handle Canvas::new_child_canvas | ( |  | ) |

Creates a new child canvas, and returns its handle.

References back(), children(), create(), is_inline(), and rend_desc().

Referenced by surefind_canvas().

Canvas::Handle Canvas::new_child_canvas | ( | const String & | id | ) |

Creates a new child canvas with an ID of id, and returns its handle.

References back(), children(), create(), is_inline(), and rend_desc().

Canvas::Handle Canvas::add_child_canvas | ( | Canvas::Handle | child_canvas,
|  | const String & | id |
| ) |  |  |

Adds the given canvas as a child.

References children(), find_canvas(), is_inline(), and valid_id().

void Canvas::remove_child_canvas | ( | Canvas::Handle | child_canvas | ) |

References children(), end(), and is_inline().

etl::handle< Layer > Canvas::find_layer | ( | const Point & | pos | ) |

References get_context(), and synfig::Context::hit_check().

int Canvas::get_depth | ( | etl::handle< Layer > | layer | ) | const

References end().

Context Canvas::get_context | ( |  | ) | const

Referenced by find_layer(), and set_time().

Canvas::iterator Canvas::end | ( |  | ) |

Referenced by clone(), get_depth(), get_times_vfunc(), push_back(), push_back_simple(), and remove_child_canvas().

Canvas::const_iterator Canvas::end | ( |  | ) | const

Canvas::reverse_iterator Canvas::rbegin | ( |  | ) |

Canvas::const_reverse_iterator Canvas::rbegin | ( |  | ) | const

Layer::Handle & Canvas::back | ( |  | ) |

Referenced by new_child_canvas().

void Canvas::push_back | ( | etl::handle< Layer > | x | ) |

References end(), and insert().

void Canvas::push_front | ( | etl::handle< Layer > | x | ) |

References insert().

void Canvas::push_back_simple | ( | etl::handle< Layer > | x | ) |

References synfig::Node::changed(), and end().

void Canvas::insert | ( | iterator | iter,
|  | etl::handle< Layer > | x |
| ) |  |  |

References synfig::Node::add_child(), and synfig::Node::changed().

Referenced by push_back(), and push_front().

void Canvas::erase | ( | iterator | iter | ) |

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

Referenced by clear().

const Layer::Handle & Canvas::back | ( |  | ) | const

void Canvas::set_inline | ( | LooseHandle | parent | ) |

References rend_desc().

Canvas::Handle Canvas::create | ( |  | ) | `[static]`

References Canvas().

Referenced by new_child_canvas(), synfig::open_canvas_as(), synfig::Target_Tile::render(), and synfig::Target_Scanline::render().

Canvas::Handle Canvas::create_inline | ( | Handle | parent | ) | `[static]`

References Canvas().

Referenced by synfig::optimize_layers().

Canvas::Handle Canvas::clone | ( | const GUID & | deriv_guid = `GUID()` | ) | const

References Canvas(), end(), synfig::error(), synfig::Node::get_guid(), get_id(), is_inline(), parent(), rend_desc(), and size().

void Canvas::register_external_canvas | ( | String | file,
|  | Handle | canvas |
| ) |  |  |

References get_file_path().

void Canvas::on_changed | ( |  | ) | `[protected, virtual]`

Reimplemented from synfig::Node.

References synfig::Node::on_changed().

void Canvas::get_times_vfunc | ( | Node::time_set & | set | ) | const`[protected, virtual]`

Function to be overloaded that fills

Implements synfig::Node.

References end().

## Friends And Related Function Documentation

void optimize_layers | ( | Time | ,
|  | Context | ,
|  | Canvas::Handle | ,
|  | bool | seen_motion_blur |
| ) |  |  | `[friend]`

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

- canvas.h
- canvas.cpp