(String xmlStr, int wide, int high, StringDict replacements)
| 795 | |
| 796 | |
| 797 | static public Image svgToImageMult(String xmlStr, int wide, int high, StringDict replacements) { |
| 798 | /* |
| 799 | for (StringDict.Entry entry : replacements.entries()) { |
| 800 | xmlStr = xmlStr.replace(entry.key, entry.value); |
| 801 | } |
| 802 | */ |
| 803 | // 2-pass version to avoid re-assigning identical colors |
| 804 | // (Otherwise, if a color is set to #666666 before #666666 is |
| 805 | // re-assigned to its new color, the swap will happen twice.) |
| 806 | for (StringDict.Entry entry : replacements.entries()) { |
| 807 | xmlStr = xmlStr.replace(entry.key, "$" + entry.key.hashCode() + "$"); |
| 808 | } |
| 809 | for (StringDict.Entry entry : replacements.entries()) { |
| 810 | xmlStr = xmlStr.replace("$" + entry.key.hashCode() + "$", entry.value); |
| 811 | } |
| 812 | return svgToImage(xmlStr, highResMultiply(wide), highResMultiply(high)); |
| 813 | } |
| 814 | |
| 815 | |
| 816 | /** |
no test coverage detected