From 88a44ce07df95b4bc8cb83053d899110153bb54a Mon Sep 17 00:00:00 2001 From: "honfika@gmail.com" Date: Tue, 9 Jun 2015 12:27:02 +0200 Subject: [PATCH] #920 Export instance name to SVG use element --- libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java | 4 ++-- .../decompiler/flash/exporters/commonshape/SVGExporter.java | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java index b6e970bed..464ce4018 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -2304,12 +2304,12 @@ public final class SWF implements SWFContainerItem, Timelined { clips.add(clip); prevClips.add(exporter.getClip()); Matrix mat = Matrix.getTranslateInstance(rect.xMin, rect.yMin).preConcatenate(new Matrix(layer.matrix)); - exporter.addUse(mat, boundRect, assetName); + exporter.addUse(mat, boundRect, assetName, layer.instanceName); exporter.setClip(clip.shape); exporter.endGroup(); } else { Matrix mat = Matrix.getTranslateInstance(rect.xMin, rect.yMin).preConcatenate(new Matrix(layer.matrix)); - exporter.addUse(mat, boundRect, assetName); + exporter.addUse(mat, boundRect, assetName, layer.instanceName); } } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/commonshape/SVGExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/commonshape/SVGExporter.java index 3ad4399c9..96940d93c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/commonshape/SVGExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/commonshape/SVGExporter.java @@ -207,13 +207,16 @@ public class SVGExporter { attr.setValue("background: " + new RGBA(backGroundColor).toHexARGB()); } - public Element addUse(Matrix transform, RECT boundRect, String href) { + public Element addUse(Matrix transform, RECT boundRect, String href, String instanceName) { Element image = _svg.createElement("use"); if (transform != null) { image.setAttribute("transform", transform.getTransformationString(SWF.unitDivisor, 1)); image.setAttribute("width", Double.toString(boundRect.getWidth() / (double) SWF.unitDivisor)); image.setAttribute("height", Double.toString(boundRect.getHeight() / (double) SWF.unitDivisor)); } + if (instanceName != null) { + image.setAttribute("id", instanceName); + } image.setAttribute("xlink:href", "#" + href); if (clip != null) { image.setAttribute("clip-path", "url(#" + clip + ")");