diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/ShapeImporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/ShapeImporter.java index 0222cbcac..86ef51b0e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/ShapeImporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/ShapeImporter.java @@ -27,7 +27,9 @@ import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.decompiler.flash.tags.base.ImageTag; import com.jpexs.decompiler.flash.tags.base.ShapeTag; import com.jpexs.decompiler.flash.tags.enums.ImageFormat; +import com.jpexs.decompiler.flash.types.RECT; import com.jpexs.decompiler.flash.types.SHAPEWITHSTYLE; +import java.awt.Dimension; import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -39,10 +41,10 @@ import java.io.IOException; public class ShapeImporter { public Tag importImage(ShapeTag st, byte[] newData) throws IOException { - return importImage(st, newData, 0); + return importImage(st, newData, 0, true); } - public Tag importImage(ShapeTag st, byte[] newData, int tagType) throws IOException { + public Tag importImage(ShapeTag st, byte[] newData, int tagType, boolean fill) throws IOException { SWF swf = st.getSwf(); if (newData[0] == 'B' && newData[1] == 'M') { @@ -99,8 +101,15 @@ public class ShapeImporter { swf.updateCharacters(); st.setModified(true); - SHAPEWITHSTYLE shapes = imageTag.getShape(st.getRect(), true); + RECT rect = st.getRect(); + if (!fill) { + Dimension dimension = imageTag.getImageDimension(); + rect.Xmax = rect.Xmin + (int) (SWF.unitDivisor * dimension.getWidth()); + rect.Ymax = rect.Ymin + (int) (SWF.unitDivisor * dimension.getHeight()); + } + + SHAPEWITHSTYLE shapes = imageTag.getShape(rect, fill); st.shapes = shapes; return (Tag) st; } diff --git a/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java b/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java index f1453b744..f466c11c4 100644 --- a/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java +++ b/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java @@ -386,8 +386,9 @@ public class CommandLineArgumentParser { } if (filter == null || filter.equals("replace")) { - out.println(" " + (cnt++) + ") -replace (|) ([][]) [(|) ([][])]..."); + out.println(" " + (cnt++) + ") -replace (|) [nofill] ([][]) [(|) [nofill] ([][])]..."); out.println(" ...replaces the data of the specified BinaryData, Image, Shape, Text, DefineSound tag or Script"); + out.println(" ...nofill parameter can be specified only for shape replace"); out.println(" ... parameter can be specified for Image and Shape tags"); out.println(" ...valid formats: lossless, lossless2, jpeg2, jpeg3, jpeg4"); out.println(" ... parameter should be specified if and only if the imported entity is an AS3 P-Code"); @@ -1911,9 +1912,14 @@ public class CommandLineArgumentParser { ImageTag imageTag = (ImageTag) characterTag; new ImageImporter().importImage(imageTag, data, format); } else if (characterTag instanceof ShapeTag) { + boolean fill = true; + if (!args.isEmpty() && args.peek().equals("nofill")) { + args.pop(); + fill = false; + } int format = parseImageFormat(args); ShapeTag shapeTag = (ShapeTag) characterTag; - new ShapeImporter().importImage(shapeTag, data, format); + new ShapeImporter().importImage(shapeTag, data, format, fill); } else if (characterTag instanceof TextTag) { TextTag textTag = (TextTag) characterTag; new TextImporter(new MissingCharacterHandler(), new TextImportErrorHandler() {