use of org.apache.batik.anim.dom.SVGStylableElement in project yamcs-studio by yamcs.
the class SimpleImageTranscoder method recursiveCC.
private void recursiveCC(Element elmt, Color oldColor, Color newColor, Pattern fillPattern, Pattern strokePattern, String fillReplace, String strokeReplace) {
if (elmt == null) {
return;
}
Matcher matcher = null;
var styleList = elmt.getChildNodes();
if (styleList != null) {
for (var i = 0; i < styleList.getLength(); i++) {
var child = styleList.item(i);
if (child instanceof SVGStylableElement) {
recursiveCC((Element) child, oldColor, newColor, fillPattern, strokePattern, fillReplace, strokeReplace);
}
}
}
if (elmt instanceof SVGStylableElement) {
var style = elmt.getAttribute("style");
matcher = fillPattern.matcher(style);
style = matcher.replaceAll(fillReplace);
matcher = strokePattern.matcher(style);
style = matcher.replaceAll(strokeReplace);
style = replaceRGB(oldColor, newColor, style);
elmt.setAttribute("style", style);
}
}
Aggregations