mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-14 15:11:53 +00:00
merge
This commit is contained in:
@@ -93,6 +93,7 @@ import com.jpexs.decompiler.flash.tags.base.TextTag;
|
||||
import com.jpexs.decompiler.flash.timeline.DepthState;
|
||||
import com.jpexs.decompiler.flash.timeline.Frame;
|
||||
import com.jpexs.decompiler.flash.timeline.Timeline;
|
||||
import com.jpexs.decompiler.flash.timeline.Timelined;
|
||||
import com.jpexs.decompiler.flash.treeitems.AS2PackageNodeItem;
|
||||
import com.jpexs.decompiler.flash.treeitems.AS3PackageNodeItem;
|
||||
import com.jpexs.decompiler.flash.treeitems.FrameNodeItem;
|
||||
@@ -162,7 +163,6 @@ import java.util.logging.Logger;
|
||||
import java.util.zip.DeflaterOutputStream;
|
||||
import java.util.zip.InflaterInputStream;
|
||||
import javax.imageio.ImageIO;
|
||||
import com.jpexs.decompiler.flash.timeline.Timelined;
|
||||
|
||||
/**
|
||||
* Class representing SWF file
|
||||
@@ -1641,7 +1641,7 @@ public final class SWF implements TreeItem, Timelined {
|
||||
new RetryTask(new RunnableIOEx() {
|
||||
@Override
|
||||
public void run() throws IOException {
|
||||
ImageIO.write(((ImageTag) t).getImage(ttags).getBufferedImage(), ((ImageTag) t).getImageFormat().toUpperCase(Locale.ENGLISH), file);
|
||||
ImageIO.write(((ImageTag) t).getImage().getBufferedImage(), ((ImageTag) t).getImageFormat().toUpperCase(Locale.ENGLISH), file);
|
||||
}
|
||||
}, handler).run();
|
||||
ret.add(file);
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
package com.jpexs.decompiler.flash.action.parser.script;
|
||||
|
||||
import com.jpexs.decompiler.flash.action.parser.ParseException;
|
||||
import java.util.Stack;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
|
||||
/**
|
||||
* This class is a scanner generated by
|
||||
|
||||
@@ -297,7 +297,7 @@ public class BitmapExporter extends ShapeExporterBase implements IShapeExporter
|
||||
}
|
||||
}
|
||||
if (image != null) {
|
||||
SerializableImage img = image.getImage(swf.tags);
|
||||
SerializableImage img = image.getImage();
|
||||
if (img != null) {
|
||||
img = colorTransform.apply(img);
|
||||
fillPaint = new TexturePaint(img.getBufferedImage(), new java.awt.Rectangle(img.getWidth(), img.getHeight()));
|
||||
|
||||
@@ -174,7 +174,7 @@ public class SVGShapeExporter extends DefaultSVGShapeExporter {
|
||||
}
|
||||
}
|
||||
if (image != null) {
|
||||
SerializableImage img = image.getImage(swf.tags);
|
||||
SerializableImage img = image.getImage();
|
||||
if (img != null) {
|
||||
colorTransform.apply(img);
|
||||
int width = img.getWidth();
|
||||
|
||||
@@ -219,11 +219,19 @@ public final class ImagePanel extends JPanel implements ActionListener, FlashDis
|
||||
if (rect == null) { //??? Why?
|
||||
rect = new RECT(0, 0, 1, 1);
|
||||
}
|
||||
SerializableImage image = new SerializableImage((int) (rect.getWidth() / SWF.unitDivisor) + 1,
|
||||
(int) (rect.getHeight() / SWF.unitDivisor) + 1, SerializableImage.TYPE_INT_ARGB);
|
||||
int width = rect.getWidth();
|
||||
int height = rect.getHeight();
|
||||
double scale = 1.0;
|
||||
if (width > swf.displayRect.getWidth()) {
|
||||
scale = (double) swf.displayRect.getWidth() / (double) width;
|
||||
width = swf.displayRect.getWidth();
|
||||
}
|
||||
SerializableImage image = new SerializableImage((int) (width / SWF.unitDivisor) + 1,
|
||||
(int) (height / SWF.unitDivisor) + 1, SerializableImage.TYPE_INT_ARGB);
|
||||
image.fillTransparent();
|
||||
Matrix m = new Matrix();
|
||||
m.translate(-rect.Xmin, -rect.Ymin);
|
||||
m.scale(scale);
|
||||
drawable.toImage(frame, frame, swf.tags, characters, new Stack<Integer>(), image, m, new ColorTransform());
|
||||
img = image;
|
||||
} else if (drawable instanceof FontTag) {
|
||||
|
||||
@@ -2466,7 +2466,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
ImageTag imageTag = (ImageTag) tagObj;
|
||||
showHideImageReplaceButton(imageTag.importSupported());
|
||||
showCard(CARDIMAGEPANEL);
|
||||
imagePanel.setImage(imageTag.getImage(imageTag.getSwf().tags));
|
||||
imagePanel.setImage(imageTag.getImage());
|
||||
} else if ((tagObj instanceof DrawableTag) && (!(tagObj instanceof TextTag)) && (!(tagObj instanceof FontTag)) && (mainMenu.isInternalFlashViewerSelected())) {
|
||||
Tag tag = (Tag) tagObj;
|
||||
showCard(CARDDRAWPREVIEWPANEL);
|
||||
|
||||
@@ -29,7 +29,6 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
public class DefineBitsJPEG2Tag extends ImageTag implements AloneTag {
|
||||
@@ -61,7 +60,7 @@ public class DefineBitsJPEG2Tag extends ImageTag implements AloneTag {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SerializableImage getImage(List<Tag> tags) {
|
||||
public SerializableImage getImage() {
|
||||
try {
|
||||
return new SerializableImage(ImageIO.read(getImageData()));
|
||||
} catch (IOException ex) {
|
||||
|
||||
@@ -29,7 +29,6 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
public class DefineBitsJPEG3Tag extends ImageTag implements AloneTag {
|
||||
@@ -80,7 +79,7 @@ public class DefineBitsJPEG3Tag extends ImageTag implements AloneTag {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SerializableImage getImage(List<Tag> tags) {
|
||||
public SerializableImage getImage() {
|
||||
try {
|
||||
InputStream stream;
|
||||
if (SWF.hasErrorHeader(imageData)) {
|
||||
|
||||
@@ -29,8 +29,6 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
/**
|
||||
@@ -72,7 +70,7 @@ public class DefineBitsJPEG4Tag extends ImageTag implements AloneTag {
|
||||
public void setImage(byte[] data) {
|
||||
imageData = data;
|
||||
if (ImageTag.getImageFormat(data).equals("jpg")) {
|
||||
SerializableImage image = getImage(new ArrayList<Tag>());
|
||||
SerializableImage image = getImage();
|
||||
byte[] ba = new byte[image.getWidth() * image.getHeight()];
|
||||
for (int i = 0; i < ba.length; i++) {
|
||||
ba[i] = (byte) 255;
|
||||
@@ -89,7 +87,7 @@ public class DefineBitsJPEG4Tag extends ImageTag implements AloneTag {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SerializableImage getImage(List<Tag> tags) {
|
||||
public SerializableImage getImage() {
|
||||
try {
|
||||
SerializableImage img = new SerializableImage(ImageIO.read(new ByteArrayInputStream(imageData)));
|
||||
if (bitmapAlphaData.length == 0) {
|
||||
|
||||
@@ -34,7 +34,6 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.zip.InflaterInputStream;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
@@ -186,7 +185,7 @@ public class DefineBitsLossless2Tag extends ImageTag implements AloneTag {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SerializableImage getImage(List<Tag> tags) {
|
||||
public SerializableImage getImage() {
|
||||
SerializableImage bi = new SerializableImage(bitmapWidth, bitmapHeight, SerializableImage.TYPE_INT_ARGB);
|
||||
ALPHACOLORMAPDATA colorMapData = null;
|
||||
ALPHABITMAPDATA bitmapData = null;
|
||||
|
||||
@@ -36,7 +36,6 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.zip.InflaterInputStream;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
@@ -112,7 +111,7 @@ public class DefineBitsLosslessTag extends ImageTag implements AloneTag {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SerializableImage getImage(List<Tag> tags) {
|
||||
public SerializableImage getImage() {
|
||||
SerializableImage bi = new SerializableImage(bitmapWidth, bitmapHeight, SerializableImage.TYPE_INT_RGB);
|
||||
COLORMAPDATA colorMapData = null;
|
||||
BITMAPDATA bitmapData = null;
|
||||
|
||||
@@ -29,7 +29,6 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
public class DefineBitsTag extends ImageTag {
|
||||
@@ -62,9 +61,9 @@ public class DefineBitsTag extends ImageTag {
|
||||
jpegData = sis.readBytesEx(sis.available());
|
||||
}
|
||||
|
||||
private void getJPEGTables(List<Tag> tags) {
|
||||
private void getJPEGTables() {
|
||||
if (jtt == null) {
|
||||
for (Tag t : tags) {
|
||||
for (Tag t : swf.tags) {
|
||||
if (t instanceof JPEGTablesTag) {
|
||||
jtt = (JPEGTablesTag) t;
|
||||
break;
|
||||
@@ -79,8 +78,8 @@ public class DefineBitsTag extends ImageTag {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SerializableImage getImage(List<Tag> tags) {
|
||||
getJPEGTables(tags);
|
||||
public SerializableImage getImage() {
|
||||
getJPEGTables();
|
||||
if ((jtt != null)) {
|
||||
try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
|
||||
byte[] jttdata = jtt.getData();
|
||||
|
||||
@@ -31,7 +31,6 @@ import com.jpexs.decompiler.flash.tags.base.ContainerItem;
|
||||
import com.jpexs.decompiler.flash.timeline.DepthState;
|
||||
import com.jpexs.decompiler.flash.timeline.Frame;
|
||||
import com.jpexs.decompiler.flash.timeline.Timeline;
|
||||
import com.jpexs.decompiler.flash.timeline.Timelined;
|
||||
import com.jpexs.decompiler.flash.types.BUTTONCONDACTION;
|
||||
import com.jpexs.decompiler.flash.types.BUTTONRECORD;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
@@ -61,7 +60,7 @@ import java.util.logging.Logger;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class DefineButton2Tag extends CharacterTag implements Container, BoundedTag, ButtonTag, Timelined {
|
||||
public class DefineButton2Tag extends CharacterTag implements Container, BoundedTag, ButtonTag {
|
||||
|
||||
/**
|
||||
* ID for this character
|
||||
|
||||
@@ -34,7 +34,6 @@ import com.jpexs.decompiler.flash.tags.base.CharacterTag;
|
||||
import com.jpexs.decompiler.flash.timeline.DepthState;
|
||||
import com.jpexs.decompiler.flash.timeline.Frame;
|
||||
import com.jpexs.decompiler.flash.timeline.Timeline;
|
||||
import com.jpexs.decompiler.flash.timeline.Timelined;
|
||||
import com.jpexs.decompiler.flash.types.BUTTONRECORD;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.ColorTransform;
|
||||
@@ -65,7 +64,7 @@ import java.util.logging.Logger;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class DefineButtonTag extends CharacterTag implements ASMSource, BoundedTag, ButtonTag, Timelined {
|
||||
public class DefineButtonTag extends CharacterTag implements ASMSource, BoundedTag, ButtonTag {
|
||||
|
||||
/**
|
||||
* ID for this character
|
||||
@@ -328,12 +327,19 @@ public class DefineButtonTag extends CharacterTag implements ASMSource, BoundedT
|
||||
}
|
||||
timeline = new Timeline(swf, new ArrayList<Tag>(), buttonId);
|
||||
|
||||
ColorTransform clrTrans = null;
|
||||
for (Tag t : swf.tags) {
|
||||
if (t instanceof DefineButtonCxformTag) {
|
||||
DefineButtonCxformTag cx = (DefineButtonCxformTag) t;
|
||||
clrTrans = cx.buttonColorTransform;
|
||||
}
|
||||
}
|
||||
int maxDepth = 0;
|
||||
Frame fr = new Frame();
|
||||
for (BUTTONRECORD r : this.characters) {
|
||||
if (r.buttonStateUp) {
|
||||
DepthState layer = new DepthState();
|
||||
layer.colorTransForm = r.colorTransform;
|
||||
layer.colorTransForm = clrTrans;
|
||||
layer.blendMode = r.blendMode;
|
||||
layer.filters = r.filterList;
|
||||
layer.matrix = r.placeMatrix;
|
||||
|
||||
@@ -196,7 +196,8 @@ public class DefineMorphShape2Tag extends CharacterTag implements BoundedTag, Mo
|
||||
return 2;
|
||||
}
|
||||
|
||||
private SHAPEWITHSTYLE getShapeAtRatio(int ratio) {
|
||||
@Override
|
||||
public SHAPEWITHSTYLE getShapeAtRatio(int ratio) {
|
||||
List<SHAPERECORD> finalRecords = new ArrayList<>();
|
||||
FILLSTYLEARRAY fillStyles = morphFillStyles.getFillStylesAt(ratio);
|
||||
LINESTYLEARRAY lineStyles = morphLineStyles.getLineStylesAt(getShapeNum(), ratio);
|
||||
|
||||
@@ -179,7 +179,8 @@ public class DefineMorphShapeTag extends CharacterTag implements BoundedTag, Mor
|
||||
return 1;
|
||||
}
|
||||
|
||||
private SHAPEWITHSTYLE getShapeAtRatio(int ratio) {
|
||||
@Override
|
||||
public SHAPEWITHSTYLE getShapeAtRatio(int ratio) {
|
||||
List<SHAPERECORD> finalRecords = new ArrayList<>();
|
||||
FILLSTYLEARRAY fillStyles = morphFillStyles.getFillStylesAt(ratio);
|
||||
LINESTYLEARRAY lineStyles = morphLineStyles.getLineStylesAt(getShapeNum(), ratio);
|
||||
|
||||
@@ -26,8 +26,8 @@ import java.io.OutputStream;
|
||||
|
||||
public class FrameLabelTag extends Tag {
|
||||
|
||||
private final String name;
|
||||
private boolean namedAnchor = false;
|
||||
public String name;
|
||||
public boolean namedAnchor = false;
|
||||
public static final int ID = 43;
|
||||
|
||||
public String getLabelName() {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.tags.base;
|
||||
|
||||
import com.jpexs.decompiler.flash.timeline.Timelined;
|
||||
import com.jpexs.decompiler.flash.types.BUTTONRECORD;
|
||||
import java.util.List;
|
||||
|
||||
@@ -23,7 +24,7 @@ import java.util.List;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public interface ButtonTag extends DrawableTag {
|
||||
public interface ButtonTag extends DrawableTag, Timelined {
|
||||
|
||||
public List<BUTTONRECORD> getRecords();
|
||||
|
||||
|
||||
@@ -17,12 +17,10 @@
|
||||
package com.jpexs.decompiler.flash.tags.base;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.helpers.SerializableImage;
|
||||
import java.awt.Color;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -36,7 +34,7 @@ public abstract class ImageTag extends CharacterTag {
|
||||
|
||||
public abstract InputStream getImageData();
|
||||
|
||||
public abstract SerializableImage getImage(List<Tag> tags);
|
||||
public abstract SerializableImage getImage();
|
||||
|
||||
public abstract void setImage(byte[] data) throws IOException;
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.types.MORPHFILLSTYLEARRAY;
|
||||
import com.jpexs.decompiler.flash.types.MORPHLINESTYLEARRAY;
|
||||
import com.jpexs.decompiler.flash.types.RECT;
|
||||
import com.jpexs.decompiler.flash.types.SHAPE;
|
||||
import com.jpexs.decompiler.flash.types.SHAPEWITHSTYLE;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -40,4 +41,6 @@ public interface MorphShapeTag {
|
||||
public SHAPE getEndEdges();
|
||||
|
||||
public int getShapeNum();
|
||||
|
||||
public SHAPEWITHSTYLE getShapeAtRatio(int ratio);
|
||||
}
|
||||
|
||||
@@ -1336,7 +1336,7 @@ public class XFLConverter {
|
||||
} else if (symbol instanceof ImageTag) {
|
||||
ImageTag imageTag = (ImageTag) symbol;
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
SerializableImage image = imageTag.getImage(tags);
|
||||
SerializableImage image = imageTag.getImage();
|
||||
String format = imageTag.getImageFormat();
|
||||
try {
|
||||
ImageIO.write(image.getBufferedImage(), format.toUpperCase(), baos);
|
||||
@@ -1675,7 +1675,7 @@ public class XFLConverter {
|
||||
ret += " soundSync=\"stop\"";
|
||||
} else if (startSound.soundInfo.syncNoMultiple) {
|
||||
ret += " soundSync=\"start\"";
|
||||
};
|
||||
}
|
||||
soundEnvelopeStr += "<SoundEnvelope>";
|
||||
if (startSound.soundInfo.hasEnvelope) {
|
||||
for (SOUNDENVELOPE env : startSound.soundInfo.envelopeRecords) {
|
||||
|
||||
Reference in New Issue
Block a user