From 24a893a71c3053ded724657f3ee51fbfa8f757d3 Mon Sep 17 00:00:00 2001 From: fourst4r Date: Sat, 28 Aug 2021 11:55:01 +1200 Subject: [PATCH] export image instances correctly --- .../decompiler/flash/xfl/XFLConverter.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java index 85f306b6e..3a809c5e6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java @@ -1697,6 +1697,8 @@ public class XFLConverter { convertText(null, (TextTag) character, matrix, filters, null, recCharWriter); } else if (character instanceof DefineVideoStreamTag) { convertVideoInstance(null, matrix, (DefineVideoStreamTag) character, null, recCharWriter); + } else if (character instanceof ImageTag) { + convertImageInstance(null, matrix, (ImageTag) character, null, recCharWriter); } else { convertSymbolInstance(null, matrix, colorTransformAlpha, false, blendMode, filters, true, null, null, null, characters.get(rec.characterId), characters, tags, flaVersion, recCharWriter); } @@ -2295,6 +2297,23 @@ public class XFLConverter { writer.writeEndElement(); writer.writeEndElement(); } + + private static void convertImageInstance(String instanceName, MATRIX matrix, ImageTag bitmap, CLIPACTIONS clipActions, XFLXmlWriter writer) throws XMLStreamException { + writer.writeStartElement("DOMBitmapInstance", new String[]{ + "libraryItemName", "bitmap" + bitmap.characterID + bitmap.getImageFormat().getExtension(), + }); + if (instanceName != null) { + writer.writeAttribute("name", instanceName); + } + + writer.writeStartElement("matrix"); + convertMatrix(matrix, writer); + writer.writeEndElement(); + writer.writeStartElement("transformationPoint"); + writer.writeEmptyElement("Point"); + writer.writeEndElement(); + writer.writeEndElement(); + } private static void convertFrames(List onlyFrames, int startFrame, int endFrame, String prevStr, String afterStr, List nonLibraryShapes, ReadOnlyTagList tags, ReadOnlyTagList timelineTags, HashMap characters, int depth, FLAVersion flaVersion, HashMap files, XFLXmlWriter writer) throws XMLStreamException { boolean lastIn = true; @@ -2462,6 +2481,8 @@ public class XFLConverter { convertText(instanceName, (TextTag) character, matrix, filters, clipActions, elementsWriter); } else if (character instanceof DefineVideoStreamTag) { convertVideoInstance(instanceName, matrix, (DefineVideoStreamTag) character, clipActions, elementsWriter); + } else if (character instanceof ImageTag) { + convertImageInstance(instanceName, matrix, (ImageTag) character, clipActions, elementsWriter); } else { convertSymbolInstance(instanceName, matrix, colorTransForm, cacheAsBitmap, blendMode, filters, isVisible, backGroundColor, clipActions, metadata, character, characters, tags, flaVersion, elementsWriter); }