mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-01 19:04:38 +00:00
merge
This commit is contained in:
@@ -2089,7 +2089,9 @@ public final class SWF implements TreeItem {
|
||||
}
|
||||
|
||||
public static void putToCache(String key, SerializableImage img) {
|
||||
frameCache.put(key, img);
|
||||
if (Configuration.useFrameCache.get()) {
|
||||
frameCache.put(key, img);
|
||||
}
|
||||
}
|
||||
|
||||
public static void clearImageCache() {
|
||||
@@ -2131,9 +2133,9 @@ public final class SWF implements TreeItem {
|
||||
|
||||
public static SerializableImage frameToImage(int containerId, int frame, List<Tag> allTags, List<Tag> controlTags, RECT displayRect, int totalFrameCount, Stack<Integer> visited, Matrix transformation) {
|
||||
String key = "frame_" + frame + "_" + containerId + "_" + allTags.get(0).getSwf().hashCode();
|
||||
if (frameCache.contains(key)) {
|
||||
SerializableImage ciret = ((SerializableImage) frameCache.get(key));
|
||||
return ciret;
|
||||
SerializableImage image = getFromCache(key);
|
||||
if (image != null) {
|
||||
return image;
|
||||
}
|
||||
|
||||
List<FrameInfo> frameInfos = getFrameInfo(frame, frame, allTags, controlTags, totalFrameCount);
|
||||
@@ -2144,12 +2146,12 @@ public final class SWF implements TreeItem {
|
||||
FrameInfo fi = frameInfos.get(0);
|
||||
|
||||
RECT rect = displayRect;
|
||||
SerializableImage image = new SerializableImage((int) (rect.getWidth() / SWF.unitDivisor) + 1,
|
||||
image = new SerializableImage((int) (rect.getWidth() / SWF.unitDivisor) + 1,
|
||||
(int) (rect.getHeight() / SWF.unitDivisor) + 1, SerializableImage.TYPE_INT_ARGB);
|
||||
Matrix m = new Matrix();
|
||||
m.translate(-rect.Xmin, -rect.Ymin);
|
||||
frameToImage(containerId, fi.maxDepth, fi.layers, fi.backgroundColor, fi.characters, fi.frame, allTags, controlTags, displayRect, visited, image, m);
|
||||
frameCache.put(key, image);
|
||||
putToCache(key, image);
|
||||
return image;
|
||||
}
|
||||
|
||||
@@ -2326,11 +2328,16 @@ public final class SWF implements TreeItem {
|
||||
RECT boundRect = bounded.getRect(characters, new Stack<Integer>());
|
||||
ExportRectangle rect = new ExportRectangle(boundRect);
|
||||
rect = mat.transform(rect);
|
||||
img = new SerializableImage((int) (rect.getWidth() / SWF.unitDivisor) + 1,
|
||||
(int) (rect.getHeight() / SWF.unitDivisor) + 1, SerializableImage.TYPE_INT_ARGB);
|
||||
Matrix m = mat.clone();
|
||||
m.translate(-rect.xMin, -rect.yMin);
|
||||
drawMatrix.translate(rect.xMin, rect.yMin);
|
||||
if (layer.filters != null) {
|
||||
// needs the whole size because of the filters
|
||||
img = new SerializableImage(image.getWidth(), image.getHeight(), SerializableImage.TYPE_INT_ARGB);
|
||||
} else {
|
||||
img = new SerializableImage((int) (rect.getWidth() / SWF.unitDivisor) + 1,
|
||||
(int) (rect.getHeight() / SWF.unitDivisor) + 1, SerializableImage.TYPE_INT_ARGB);
|
||||
m.translate(-rect.xMin, -rect.yMin);
|
||||
drawMatrix.translate(rect.xMin, rect.yMin);
|
||||
}
|
||||
drawable.toImage(layer.ratio < 0 ? 0 : layer.ratio/*layer.duration*/, allTags, characters, visited, img, m);
|
||||
} else {
|
||||
// only DefineFont tags
|
||||
|
||||
@@ -91,6 +91,8 @@ public class Configuration {
|
||||
@ConfigurationDefaultBoolean(false)
|
||||
public static final ConfigurationItem<Boolean> showAllAddresses = null;
|
||||
@ConfigurationDefaultBoolean(true)
|
||||
public static final ConfigurationItem<Boolean> useFrameCache = null;
|
||||
@ConfigurationDefaultBoolean(true)
|
||||
public static final ConfigurationItem<Boolean> useRibbonInterface = null;
|
||||
@ConfigurationDefaultBoolean(false)
|
||||
public static final ConfigurationItem<Boolean> openFolderAfterFlaExport = null;
|
||||
|
||||
@@ -110,7 +110,6 @@ public class BitmapExporter extends ShapeExporterBase implements IShapeExporter
|
||||
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
defaultStroke = graphics.getStroke();
|
||||
super.export();
|
||||
image.bounds = new Rectangle2D.Double(deltaX, deltaY, width, height);
|
||||
}
|
||||
|
||||
private void exportTo(SerializableImage image, Matrix transformation) {
|
||||
|
||||
@@ -143,9 +143,6 @@ public final class ImagePanel extends JPanel implements ActionListener, FlashDis
|
||||
}
|
||||
SWF.putToCache(key, img);
|
||||
}
|
||||
if (img != null && img.bounds != null && mat != null) {
|
||||
mat.translate(img.bounds.getMinX(), img.bounds.getMinY());
|
||||
}
|
||||
if (img != null) {
|
||||
setImage(img);
|
||||
}
|
||||
@@ -217,7 +214,6 @@ public final class ImagePanel extends JPanel implements ActionListener, FlashDis
|
||||
}
|
||||
SWF.putToCache(key, img);
|
||||
}
|
||||
mat.translate(img.bounds.getMinX(), img.bounds.getMinY());
|
||||
ImageIcon icon = new ImageIcon(img.getBufferedImage());
|
||||
label.setIcon(icon);
|
||||
frame = nframe;
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
package com.jpexs.helpers;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.ColorModel;
|
||||
import java.awt.image.IndexColorModel;
|
||||
import java.awt.image.WritableRaster;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
@@ -42,7 +42,6 @@ public class SerializableImage implements Serializable {
|
||||
|
||||
static int imageid = 0;
|
||||
private BufferedImage image;
|
||||
public Rectangle2D bounds = new Rectangle2D.Double();
|
||||
|
||||
public SerializableImage() {
|
||||
}
|
||||
@@ -63,11 +62,6 @@ public class SerializableImage implements Serializable {
|
||||
image = new BufferedImage(i, i1, i2, icm);
|
||||
}
|
||||
|
||||
public void setBufferedImage(BufferedImage image, Rectangle2D bounds) {
|
||||
this.image = image;
|
||||
this.bounds = bounds;
|
||||
}
|
||||
|
||||
public BufferedImage getBufferedImage() {
|
||||
/*try {
|
||||
ImageIO.write(image, "png", new File("c:\\10\\x\\imageid" + String.format("%03d", imageid++) + ".png"));
|
||||
@@ -80,8 +74,6 @@ public class SerializableImage implements Serializable {
|
||||
protected Object clone() throws CloneNotSupportedException {
|
||||
SerializableImage retImage = new SerializableImage();
|
||||
retImage.image = image;
|
||||
retImage.bounds = new Rectangle2D.Double(bounds.getMinX(), bounds.getMinY(),
|
||||
bounds.getWidth(), bounds.getHeight());
|
||||
return retImage;
|
||||
}
|
||||
|
||||
@@ -131,12 +123,12 @@ public class SerializableImage implements Serializable {
|
||||
}
|
||||
|
||||
private void writeObject(ObjectOutputStream out) throws IOException {
|
||||
out.writeObject(bounds);
|
||||
// out.writeObject(bounds);
|
||||
ImageIO.write(image, "png", out);
|
||||
}
|
||||
|
||||
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
|
||||
bounds = (Rectangle2D) in.readObject();
|
||||
// bounds = (Rectangle2D) in.readObject();
|
||||
image = ImageIO.read(in);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user