@@ -500,7 +500,12 @@ else if (aspectRatio.toLowerCase().equals("variable"))
500500 //16. compare the new style with the old one, and add the differences to the XML
501501 styleDiff = getStyleDiff (oldStyle , currStyle );
502502 }
503-
503+
504+ // if (currStyle.getStrokeColor() == "")
505+ // {
506+ // currStyle.setStrokeColor("none");
507+ // }
508+
504509 appendStyle (destDoc .getElementsByTagName ("foreground" ).item (0 ), styleDiff , destConfigDoc , nextElement );
505510
506511 //18. translate the SVG element into XML
@@ -667,11 +672,11 @@ static String getStrokeString(XmlStyle currStyle)
667672 String fc = currStyle .getFillColor ();
668673 String sc = currStyle .getStrokeColor ();
669674
670- if (!fc .equals ("none" ) && !sc .equals ("none" ))
675+ if (!fc .equals ("none" ) && !sc .equals ("none" ) && ! sc . equals ( "" ) )
671676 {
672677 return "fillstroke" ;
673678 }
674- else if (!fc .equals ("none" ) && sc . equals ( "none" ) )
679+ else if (!fc .equals ("none" ))
675680 {
676681 return "fill" ;
677682 }
@@ -1386,7 +1391,10 @@ private Map<String, String> parseFillDefs(Node root)
13861391 if (currEl .getNodeName ().equals ("linearGradient" ) || currEl .getNodeName ().equals ("radialGradient" ))
13871392 {
13881393 String avgColor = getAvgGradientColor (currEl );
1389- fillTable .put (currEl .getAttribute ("id" ), avgColor );
1394+ if (avgColor != null )
1395+ {
1396+ fillTable .put (currEl .getAttribute ("id" ), avgColor );
1397+ }
13901398 }
13911399
13921400 fillTable .putAll (parseFillDefs (currChild ));
@@ -1422,7 +1430,10 @@ private Map<String, String> parseStrokeDefs(Node root)
14221430 if (currEl .getNodeName ().equals ("linearGradient" ) || currEl .getNodeName ().equals ("radialGradient" ))
14231431 {
14241432 String avgColor = getAvgGradientColor (currEl );
1425- strokeTable .put (currEl .getAttribute ("id" ), avgColor );
1433+ if (avgColor != null )
1434+ {
1435+ strokeTable .put (currEl .getAttribute ("id" ), avgColor );
1436+ }
14261437 }
14271438
14281439 strokeTable .putAll (parseStrokeDefs (currChild ));
@@ -1462,13 +1473,13 @@ private String getAvgGradientColor(Element element)
14621473 Color col = new Color (0 , 0 , 0 );
14631474 String colS = currEl .getAttribute ("stop-color" );
14641475
1465- if (colS . charAt ( 0 ) == '#' )
1476+ if (colS == null || colS . equals ( "" ))
14661477 {
1467- col = Color . decode ( colS ) ;
1478+ return null ;
14681479 }
1469- else if (colS == null || colS . equals ( "" ))
1480+ else if (colS . charAt ( 0 ) == '#' )
14701481 {
1471- return null ;
1482+ col = Color . decode ( colS ) ;
14721483 }
14731484 else
14741485 {
0 commit comments