Skip to content

Commit

Permalink
nested group colors a little different
Browse files Browse the repository at this point in the history
  • Loading branch information
madhephaestus committed Jan 3, 2021
1 parent 2266144 commit b2bd79c
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/main/java/eu/mihosoft/vrl/v3d/svg/SVGLoad.java
Original file line number Diff line number Diff line change
Expand Up @@ -432,32 +432,37 @@ private void loadPath(Node pathNode, double resolution, Transform startingFrame,
//
// }
Color c = null;

String []style = pathNode.getAttributes().getNamedItem( "style").getNodeValue().split(";");
//System.out.println("Layer "+encapsulatingLayer);
try {
String []style = pathNode.getAttributes().getNamedItem( "style").getNodeValue().split(";");
for(String s:style) {
if(s.startsWith("fill:")) {
c=Color.web(s.split(":")[1]);
String string = s.split(":")[1];
c=Color.web(string);
break;
}
}
}catch(java.lang.IllegalArgumentException ex) {
// this means the fill is set to "none"
}catch(Exception ex) {
//ex.printStackTrace();
}
if(c==null) {
try {
String []style = pathNode.getAttributes().getNamedItem( "style").getNodeValue().split(";");
for(String s:style) {
if(s.startsWith("stroke:")) {
c=Color.web(s.split(":")[1]);
String string = s.split(":")[1];
c=Color.web(string);
break;
}
}
}catch(java.lang.IllegalArgumentException ex1) {
// this means the stroke is set to "none" the default green color will be used

}catch(Exception ex1) {
ex1.printStackTrace();
//ex1.printStackTrace();
}
}catch(Exception ex) {
ex.printStackTrace();
}
MetaPostPath2 mpp = new MetaPostPath2(pathNode);
String code = mpp.toCode();
Expand Down

0 comments on commit b2bd79c

Please sign in to comment.