-Svg_parser::parser_polygon(const xmlpp::Node* node,xmlpp::Element* root,String parent_style,Matrix* mtx_parent){
- if(const xmlpp::Element* nodeElement = dynamic_cast<const xmlpp::Element*>(node)){
- //load sub-attributes
- Glib::ustring polygon_style =nodeElement->get_attribute_value("style");
- Glib::ustring polygon_id =nodeElement->get_attribute_value("id");
- Glib::ustring polygon_points =nodeElement->get_attribute_value("points");
- Glib::ustring polygon_transform =nodeElement->get_attribute_value("transform");
- Glib::ustring polygon_fill =nodeElement->get_attribute_value("fill");
- String fill =loadAttribute("fill",polygon_style,parent_style,polygon_fill,"none");
- String fill_rule =loadAttribute("fill-rule",polygon_style,parent_style,"evenodd");
- String fill_opacity =loadAttribute("fill-opacity",polygon_style,parent_style,"1");
- String opacity =loadAttribute("opacity",polygon_style,parent_style,"1");
-
- //transforms
- Matrix* mtx=NULL;
- if(!polygon_transform.empty())
- mtx=build_transform (polygon_transform);
- if(mtx_parent){
- if(mtx)
- composeMatrix(&mtx,mtx_parent,mtx);
- else
- mtx=newMatrix (mtx_parent);
- }
- //points
- if(polygon_points.empty())
- return;
- 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));
- }
- //escritura
- xmlpp::Element *child_polygon;
-
- //gradient
- int typeFill=0;
- if(fill.compare(0,3,"url")==0){
- typeFill=2;//gradient
- root=nodeStartBasicLayer(root->add_child("layer"));
- }
- child_polygon=root->add_child("layer");
- child_polygon->set_attribute("type","polygon");
- child_polygon->set_attribute("active","true");
- child_polygon->set_attribute("version","0.1");
- child_polygon->set_attribute("desc",polygon_id);
- build_param (child_polygon->add_child("param"),"z_depth","real","0.0000000000");
- build_param (child_polygon->add_child("param"),"amount","real","1.0000000000");
- build_param (child_polygon->add_child("param"),"blend_method","integer","0");
- build_color (child_polygon->add_child("param"),getRed(fill),getGreen(fill),getBlue(fill),atof(fill_opacity.data())*atof(opacity.data()));
- build_vector(child_polygon->add_child("param"),"offset",0,0);
- build_param (child_polygon->add_child("param"),"invert","bool","false");
- build_param (child_polygon->add_child("param"),"antialias","bool","true");
- build_param (child_polygon->add_child("param"),"feather","real","0.0000000000");
- build_param (child_polygon->add_child("param"),"blurtype","integer","1");
- if(fill_rule.compare("evenodd")==0) build_param (child_polygon->add_child("param"),"winding_style","integer","1");
- else build_param (child_polygon->add_child("param"),"winding_style","integer","0");
- build_points (child_polygon->add_child("param"),k);
-
- if(typeFill==2){
- build_url(root->add_child("layer"),fill,mtx);
- }
+Svg_parser::parser_polygon(const xmlpp::Element* nodeElement,xmlpp::Element* root,String parent_style,Matrix* mtx){
+ //load sub-attributes
+ Glib::ustring polygon_style =nodeElement->get_attribute_value("style");
+ Glib::ustring polygon_id =nodeElement->get_attribute_value("id");
+ Glib::ustring polygon_points =nodeElement->get_attribute_value("points");
+ Glib::ustring polygon_fill =nodeElement->get_attribute_value("fill");
+ String fill =loadAttribute("fill",polygon_style,parent_style,polygon_fill,"none");
+ String fill_rule =loadAttribute("fill-rule",polygon_style,parent_style,"evenodd");
+ String fill_opacity =loadAttribute("fill-opacity",polygon_style,parent_style,"1");
+ String opacity =loadAttribute("opacity",polygon_style,parent_style,"1");
+
+
+ //points
+ if(polygon_points.empty())
+ return;
+ 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));
+ }
+ //escritura
+ xmlpp::Element *child_polygon;
+
+ //gradient
+ int typeFill=0;
+ if(fill.compare(0,3,"url")==0){
+ typeFill=2;//gradient
+ root=nodeStartBasicLayer(root->add_child("layer"));