# savecanvas.cpp File Reference

Writeme. More...

`#include "savecanvas.h"`
`#include "general.h"`
`#include "valuenode.h"`
`#include "valuenode_subtract.h"`
`#include "valuenode_animated.h"`
`#include "valuenode_composite.h"`
`#include "valuenode_const.h"`
`#include "valuenode_linear.h"`
`#include "valuenode_dynamiclist.h"`
`#include "valuenode_reference.h"`
`#include "valuenode_segcalctangent.h"`
`#include "valuenode_segcalcvertex.h"`
`#include "valuenode_bline.h"`
`#include "time.h"`
`#include "keyframe.h"`
`#include "layer.h"`
`#include "string.h"`
`#include "paramdesc.h"`
`#include <libxml++/libxml++.h>`
`#include <ETL/stringf>`
`#include "gradient.h"`
`#include <errno.h>`
`#include <libxml/tree.h>`

## Defines

#define | COLOR_VALUE_TYPE_FORMAT "%f"
#define | VECTOR_VALUE_TYPE_FORMAT "%0.10f"
#define | TIME_TYPE_FORMAT "%0.3f"
#define | VIEW_BOX_FORMAT "%f %f %f %f"

## Functions

xmlpp::Element * | encode_canvas (xmlpp::Element *root, Canvas::ConstHandle canvas)
xmlpp::Element * | encode_value_node (xmlpp::Element *root, ValueNode::ConstHandle value_node, Canvas::ConstHandle canvas)
xmlpp::Element * | encode_keyframe (xmlpp::Element *root, const Keyframe &kf, float fps)
xmlpp::Element * | encode_real (xmlpp::Element *root, Real v)
xmlpp::Element * | encode_time (xmlpp::Element *root, Time t, float=0)
xmlpp::Element * | encode_integer (xmlpp::Element *root, int i)
xmlpp::Element * | encode_bool (xmlpp::Element *root, bool b)
xmlpp::Element * | encode_string (xmlpp::Element *root, const String &str)
xmlpp::Element * | encode_vector (xmlpp::Element *root, Vector vect)
xmlpp::Element * | encode_color (xmlpp::Element *root, Color color)
xmlpp::Element * | encode_angle (xmlpp::Element *root, Angle theta)
xmlpp::Element * | encode_segment (xmlpp::Element *root, Segment seg)
xmlpp::Element * | encode_bline_point (xmlpp::Element *root, BLinePoint bline_point)
xmlpp::Element * | encode_gradient (xmlpp::Element *root, Gradient x)
xmlpp::Element * | encode_value (xmlpp::Element *root, const ValueBase &data, Canvas::ConstHandle canvas=0)
xmlpp::Element * | encode_list (xmlpp::Element *root, std::list< ValueBase > list, Canvas::ConstHandle canvas=0)
xmlpp::Element * | encode_animated (xmlpp::Element *root, ValueNode_Animated::ConstHandle value_node, Canvas::ConstHandle canvas=0)
xmlpp::Element * | encode_subtract (xmlpp::Element *root, ValueNode_Subtract::ConstHandle value_node, Canvas::ConstHandle canvas=0)
xmlpp::Element * | encode_dynamic_list (xmlpp::Element *root, ValueNode_DynamicList::ConstHandle value_node, Canvas::ConstHandle canvas=0)
xmlpp::Element * | encode_linkable_value_node (xmlpp::Element *root, LinkableValueNode::ConstHandle value_node, Canvas::ConstHandle canvas=0)
xmlpp::Element * | encode_layer (xmlpp::Element *root, Layer::ConstHandle layer)
xmlpp::Element * | encode_canvas_toplevel (xmlpp::Element *root, Canvas::ConstHandle canvas)
bool | synfig::save_canvas (const String &filename, Canvas::ConstHandle canvas)
| Saves a canvas to filename.
String | synfig::canvas_to_string (Canvas::ConstHandle canvas)
| Stores a Canvas in a string in XML format.
void | synfig::set_file_version (ReleaseVersion version)
ReleaseVersion | synfig::get_file_version ()

## Variables

ReleaseVersion | save_canvas_version = ReleaseVersion(RELEASE_VERSION_END-1)
int | valuenode_too_new_count

## Detailed Description

Writeme.

$Id$

## Define Documentation

#define COLOR_VALUE_TYPE_FORMAT "%f"

Referenced by encode_color().

#define VECTOR_VALUE_TYPE_FORMAT "%0.10f"

Referenced by encode_real(), and encode_vector().

#define TIME_TYPE_FORMAT "%0.3f"

Referenced by encode_canvas().

#define VIEW_BOX_FORMAT "%f %f %f %f"

Referenced by encode_canvas().

## Function Documentation

xmlpp::Element * encode_canvas | ( | xmlpp::Element * | root,
|  | Canvas::ConstHandle | canvas |
| ) |  |  |

Todo:
  check where the parentheses should really go - around the && or the ||?

References encode_keyframe(), encode_layer(), encode_value(), encode_value_node(), synfig::Color::get_a(), synfig::RendDesc::get_antialias(), synfig::Color::get_b(), synfig::RendDesc::get_bg_color(), synfig::RendDesc::get_br(), synfig::RendDesc::get_frame_rate(), synfig::Color::get_g(), synfig::RendDesc::get_h(), synfig::Color::get_r(), synfig::Time::get_string(), synfig::RendDesc::get_time_end(), synfig::RendDesc::get_time_start(), synfig::RendDesc::get_tl(), synfig::RendDesc::get_w(), synfig::RendDesc::get_x_res(), synfig::RendDesc::get_y_res(), TIME_TYPE_FORMAT, and VIEW_BOX_FORMAT.

Referenced by encode_canvas_toplevel(), and encode_value().

xmlpp::Element * encode_value_node | ( | xmlpp::Element * | root,
|  | ValueNode::ConstHandle | value_node,
|  | Canvas::ConstHandle | canvas |
| ) |  |  |

References _, encode_animated(), encode_dynamic_list(), encode_linkable_value_node(), encode_subtract(), encode_value(), and synfig::error().

Referenced by encode_animated(), encode_canvas(), encode_dynamic_list(), encode_layer(), encode_linkable_value_node(), and encode_subtract().

xmlpp::Element* encode_keyframe | ( | xmlpp::Element * | root,
|  | const Keyframe & | kf,
|  | float | fps |
| ) |  |  |

References synfig::Keyframe::get_description(), synfig::Time::get_string(), and synfig::Keyframe::get_time().

Referenced by encode_canvas().

xmlpp::Element* encode_real | ( | xmlpp::Element * | root,
|  | Real | v |
| ) |  |  |

References VECTOR_VALUE_TYPE_FORMAT.

Referenced by encode_bline_point(), and encode_value().

xmlpp::Element* encode_time | ( | xmlpp::Element * | root,
|  | Time | t,
|  | float | = `0` |
| ) |  |  |

References synfig::Time::get_string().

Referenced by encode_value().

xmlpp::Element* encode_integer | ( | xmlpp::Element * | root,
|  | int | i |
| ) |  |  |

Referenced by encode_value().

xmlpp::Element* encode_bool | ( | xmlpp::Element * | root,
|  | bool | b |
| ) |  |  |

Referenced by encode_value().

xmlpp::Element* encode_string | ( | xmlpp::Element * | root,
|  | const String & | str |
| ) |  |  |

Referenced by encode_value().

xmlpp::Element* encode_vector | ( | xmlpp::Element * | root,
|  | Vector | vect |
| ) |  |  |

References VECTOR_VALUE_TYPE_FORMAT.

Referenced by encode_bline_point(), encode_segment(), and encode_value().

xmlpp::Element* encode_color | ( | xmlpp::Element * | root,
|  | Color | color |
| ) |  |  |

References COLOR_VALUE_TYPE_FORMAT, synfig::Color::get_a(), synfig::Color::get_b(), synfig::Color::get_g(), and synfig::Color::get_r().

Referenced by encode_gradient(), and encode_value().

xmlpp::Element* encode_angle | ( | xmlpp::Element * | root,
|  | Angle | theta |
| ) |  |  |

Referenced by encode_value().

xmlpp::Element* encode_segment | ( | xmlpp::Element * | root,
|  | Segment | seg |
| ) |  |  |

References encode_vector(), synfig::Segment::p1, synfig::Segment::p2, synfig::Segment::t1, and synfig::Segment::t2.

Referenced by encode_value().

xmlpp::Element* encode_bline_point | ( | xmlpp::Element * | root,
|  | BLinePoint | bline_point |
| ) |  |  |

References encode_real(), encode_vector(), synfig::BLinePoint::get_origin(), synfig::BLinePoint::get_split_tangent_flag(), synfig::BLinePoint::get_tangent1(), synfig::BLinePoint::get_tangent2(), synfig::BLinePoint::get_vertex(), and synfig::BLinePoint::get_width().

Referenced by encode_value().

xmlpp::Element* encode_gradient | ( | xmlpp::Element * | root,
|  | Gradient | x |
| ) |  |  |

References synfig::Gradient::begin(), encode_color(), synfig::Gradient::end(), and synfig::Gradient::sort().

Referenced by encode_value().

xmlpp::Element * encode_value | ( | xmlpp::Element * | root,
|  | const ValueBase & | data,
|  | Canvas::ConstHandle | canvas = `0` |
| ) |  |  |

References _, encode_angle(), encode_bline_point(), encode_bool(), encode_canvas(), encode_color(), encode_gradient(), encode_integer(), encode_list(), encode_real(), encode_segment(), encode_string(), encode_time(), encode_vector(), synfig::error(), synfig::ValueBase::get(), and synfig::ValueBase::get_type().

Referenced by encode_canvas(), encode_layer(), encode_linkable_value_node(), encode_list(), and encode_value_node().

xmlpp::Element* encode_list | ( | xmlpp::Element * | root,
|  | std::list< ValueBase > | list,
|  | Canvas::ConstHandle | canvas = `0` |
| ) |  |  |

References encode_value().

Referenced by encode_value().

xmlpp::Element* encode_animated | ( | xmlpp::Element * | root,
|  | ValueNode_Animated::ConstHandle | value_node,
|  | Canvas::ConstHandle | canvas = `0` |
| ) |  |  |

References encode_value_node(), synfig::error(), synfig::ValueBase::get(), synfig::ValueBase::get_type(), synfig::INTERPOLATION_CONSTANT, synfig::INTERPOLATION_HALT, synfig::INTERPOLATION_LINEAR, synfig::INTERPOLATION_MANUAL, and synfig::INTERPOLATION_TCB.

Referenced by encode_value_node().

xmlpp::Element* encode_subtract | ( | xmlpp::Element * | root,
|  | ValueNode_Subtract::ConstHandle | value_node,
|  | Canvas::ConstHandle | canvas = `0` |
| ) |  |  |

References encode_value_node(), and synfig::warning().

Referenced by encode_value_node().

xmlpp::Element* encode_dynamic_list | ( | xmlpp::Element * | root,
|  | ValueNode_DynamicList::ConstHandle | value_node,
|  | Canvas::ConstHandle | canvas = `0` |
| ) |  |  |

References encode_value_node().

Referenced by encode_value_node().

xmlpp::Element* encode_linkable_value_node | ( | xmlpp::Element * | root,
|  | LinkableValueNode::ConstHandle | value_node,
|  | Canvas::ConstHandle | canvas = `0` |
| ) |  |  |

References encode_value(), encode_value_node(), synfig::get_file_version(), valuenode_too_new_count, and synfig::warning().

Referenced by encode_value_node().

xmlpp::Element* encode_layer | ( | xmlpp::Element * | root,
|  | Layer::ConstHandle | layer |
| ) |  |  |

References encode_value(), encode_value_node(), synfig::error(), synfig::ValueBase::get(), synfig::ValueBase::get_type(), and synfig::ValueBase::is_valid().

Referenced by encode_canvas().

xmlpp::Element* encode_canvas_toplevel | ( | xmlpp::Element * | root,
|  | Canvas::ConstHandle | canvas |
| ) |  |  |

References encode_canvas(), valuenode_too_new_count, and synfig::warning().

Referenced by synfig::canvas_to_string(), and synfig::save_canvas().

## Variable Documentation

ReleaseVersion save_canvas_version = ReleaseVersion(RELEASE_VERSION_END-1)

Referenced by synfig::get_file_version(), and synfig::set_file_version().

int valuenode_too_new_count

Referenced by encode_canvas_toplevel(), and encode_linkable_value_node().