mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-09 01:59:33 +00:00
nofill parameter for shape import (repace)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -386,8 +386,9 @@ public class CommandLineArgumentParser {
|
||||
}
|
||||
|
||||
if (filter == null || filter.equals("replace")) {
|
||||
out.println(" " + (cnt++) + ") -replace <infile> <outfile> (<characterId1>|<scriptName1>) <importDataFile1> ([<format1>][<methodBodyIndex1>]) [(<characterId2>|<scriptName2>) <importDataFile2> ([<format2>][<methodBodyIndex2>])]...");
|
||||
out.println(" " + (cnt++) + ") -replace <infile> <outfile> (<characterId1>|<scriptName1>) <importDataFile1> [nofill] ([<format1>][<methodBodyIndex1>]) [(<characterId2>|<scriptName2>) <importDataFile2> [nofill] ([<format2>][<methodBodyIndex2>])]...");
|
||||
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(" ...<format> parameter can be specified for Image and Shape tags");
|
||||
out.println(" ...valid formats: lossless, lossless2, jpeg2, jpeg3, jpeg4");
|
||||
out.println(" ...<methodBodyIndexN> 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() {
|
||||
|
||||
Reference in New Issue
Block a user