+void
+Svg_parser::rect_simple(const xmlpp::Element* nodeElement,xmlpp::Element* root,String fill, String fill_opacity, String opacity){
+ Glib::ustring rect_id =nodeElement->get_attribute_value("id");
+ Glib::ustring rect_x =nodeElement->get_attribute_value("x");
+ Glib::ustring rect_y =nodeElement->get_attribute_value("y");
+ Glib::ustring rect_width =nodeElement->get_attribute_value("width");
+ Glib::ustring rect_height =nodeElement->get_attribute_value("height");
+
+ xmlpp::Element *child_rect=root->add_child("layer");
+ child_rect->set_attribute("type","rectangle");
+ child_rect->set_attribute("active","true");
+ child_rect->set_attribute("version","0.2");
+ child_rect->set_attribute("desc",rect_id);
+
+ build_real(child_rect->add_child("param"),"z_depth",0.0);
+ build_real(child_rect->add_child("param"),"amount",1.0);
+ build_integer(child_rect->add_child("param"),"blend_method",0);
+ build_color (child_rect->add_child("param"),getRed (fill),getGreen (fill),getBlue(fill),atof(opacity.data())*atof(fill_opacity.data()));
+
+ float auxx=atof(rect_x.c_str());
+ float auxy=atof(rect_y.c_str());
+ coor2vect(&auxx,&auxy);
+ build_vector (child_rect->add_child("param"),"point1",auxx,auxy);
+ auxx= atof(rect_x.c_str()) + atof(rect_width.c_str());
+ auxy= atof(rect_y.c_str()) + atof(rect_height.c_str());
+ coor2vect(&auxx,&auxy);
+ build_vector (child_rect->add_child("param"),"point2",auxx,auxy);
+
+
+}
+
+void
+Svg_parser::parser_layer(const xmlpp::Node* node,xmlpp::Element* root,String parent_style,Matrix* mtx){
+ if(const xmlpp::Element* nodeElement = dynamic_cast<const xmlpp::Element*>(node)){
+ Glib::ustring label =nodeElement->get_attribute_value("label");
+ Glib::ustring style =nodeElement->get_attribute_value("style");
+ Glib::ustring fill =nodeElement->get_attribute_value("fill");
+
+ String layer_style;
+ if(!style.empty()){
+ layer_style=style;
+ }else if(!fill.empty()){
+ layer_style.append("fill:");
+ layer_style.append(fill);
+ }else if(!parent_style.empty()){
+ layer_style=parent_style;
+ }
+ //build
+ root->set_attribute("type","PasteCanvas");
+ root->set_attribute("active","true");
+ root->set_attribute("version","0.1");
+ if(!label.empty()) root->set_attribute("desc",label);
+ else root->set_attribute("desc","Inline Canvas");
+
+ build_real(root->add_child("param"),"z_depth",0.0);
+ build_real(root->add_child("param"),"amount",1.0);
+ build_integer(root->add_child("param"),"blend_method",0);
+ build_vector (root->add_child("param"),"origin",0,0);
+
+ //printf(" canvas attributes ");
+ //canvas
+ xmlpp::Element *child_canvas=root->add_child("param");
+ child_canvas->set_attribute("name","canvas");
+ child_canvas=child_canvas->add_child("canvas");
+ const xmlpp::ContentNode* nodeContent = dynamic_cast<const xmlpp::ContentNode*>(node);
+ if(!nodeContent){
+ xmlpp::Node::NodeList list = node->get_children();
+ for(xmlpp::Node::NodeList::iterator iter = list.begin(); iter != list.end(); ++iter){
+ Glib::ustring name =(*iter)->get_name();
+ parser_graphics (*iter,child_canvas,layer_style,mtx);
+ }
+ }
+ if (! SVG_SEP_TRANSFORMS) parser_effects(nodeElement,child_canvas,parent_style,mtx);
+ }
+}
+
+std::list<std::list<Vertice*> >
+Svg_parser::parser_polygon_path(Glib::ustring polygon_points, Matrix* mtx){
+ std::list<std::list<Vertice*> > k0;
+ if(polygon_points.empty())
+ return k0;
+ std::list<Vertice*> k;
+ std::vector<String> tokens=get_tokens_path (polygon_points);
+ unsigned int i;
+ float ax,ay; ax=ay=0;
+ for(i=0;i<tokens.size();i++){
+ ax=atof(tokens.at(i).data());
+ i++; if(tokens.at(i).compare(",")==0) i++;
+ ay=atof(tokens.at(i).data());
+ //mtx
+ if(mtx) transformPoint2D(mtx,&ax,&ay);
+ //adjust
+ coor2vect(&ax,&ay);
+ //save
+ k.push_back(newVertice(ax,ay));
+ }
+ k0.push_front(k);
+ return k0;
+}
+