mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-25 13:05:33 +00:00
This commit is contained in:
@@ -3605,7 +3605,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
||||
renderContext.cursorPosition = cursorPosition;
|
||||
renderContext.mouseButton = mouseButton;
|
||||
ExportRectangle viewRect = new ExportRectangle(rect);
|
||||
timeline.toImage(frame, time, renderContext, image, image, false, m, new Matrix(), m, colorTransform, zoom, false, viewRect, m, true, Timeline.DRAW_MODE_ALL, 0, canUseSmoothing);
|
||||
timeline.toImage(frame, time, renderContext, image, image, false, m, new Matrix(), m, colorTransform, zoom, true, viewRect, m, true, Timeline.DRAW_MODE_ALL, 0, canUseSmoothing);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
@@ -1001,6 +1001,10 @@ public final class Configuration {
|
||||
@ConfigurationCategory("display")
|
||||
public static ConfigurationItem<Boolean> previewResampleSound = null;
|
||||
|
||||
@ConfigurationDefaultBoolean(false)
|
||||
@ConfigurationCategory("export")
|
||||
public static ConfigurationItem<Boolean> lastExportTransparentBackground = null;
|
||||
|
||||
private enum OSId {
|
||||
WINDOWS, OSX, UNIX
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public class FrameExporter {
|
||||
frames.add(0); // todo: export all frames
|
||||
}
|
||||
|
||||
FrameExportSettings fes = new FrameExportSettings(fem, settings.zoom);
|
||||
FrameExportSettings fes = new FrameExportSettings(fem, settings.zoom, true);
|
||||
return exportFrames(handler, outdir, swf, containerId, frames, fes, evl);
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ public class FrameExporter {
|
||||
throw new Error("Unsupported sprite export mode");
|
||||
}
|
||||
|
||||
FrameExportSettings fes = new FrameExportSettings(fem, settings.zoom);
|
||||
FrameExportSettings fes = new FrameExportSettings(fem, settings.zoom, true);
|
||||
return exportFrames(handler, outdir, swf, containerId, frames, fes, evl);
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ public class FrameExporter {
|
||||
}
|
||||
|
||||
int fframe = fframes.get(pos++);
|
||||
BufferedImage result = SWF.frameToImageGet(tim, fframe, 0, null, 0, tim.displayRect, new Matrix(), null, usesTransparency ? null : backgroundColor, settings.zoom, true).getBufferedImage();
|
||||
BufferedImage result = SWF.frameToImageGet(tim, fframe, 0, null, 0, tim.displayRect, new Matrix(), null, backgroundColor == null && !usesTransparency ? Color.white : backgroundColor, settings.zoom, true).getBufferedImage();
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
return null;
|
||||
}
|
||||
@@ -286,7 +286,7 @@ public class FrameExporter {
|
||||
|
||||
Color backgroundColor = null;
|
||||
SetBackgroundColorTag setBgColorTag = swf.getBackgroundColor();
|
||||
if (setBgColorTag != null) {
|
||||
if (!settings.transparentBackground && setBgColorTag != null) {
|
||||
backgroundColor = setBgColorTag.backgroundColor.toColor();
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ public class FrameExporter {
|
||||
}
|
||||
|
||||
final int fi = i;
|
||||
final Color fbackgroundColor = null;
|
||||
final Color fbackgroundColor = backgroundColor;
|
||||
for (File foutdir : foutdirs) {
|
||||
new RetryTask(() -> {
|
||||
int frame = fframes.get(fi);
|
||||
@@ -309,11 +309,8 @@ public class FrameExporter {
|
||||
rect.yMax *= settings.zoom;
|
||||
rect.xMin *= settings.zoom;
|
||||
rect.yMin *= settings.zoom;
|
||||
SVGExporter exporter = new SVGExporter(rect, settings.zoom, "frame");
|
||||
if (fbackgroundColor != null) {
|
||||
exporter.setBackGroundColor(fbackgroundColor);
|
||||
}
|
||||
|
||||
SVGExporter exporter = new SVGExporter(rect, settings.zoom, "frame", fbackgroundColor);
|
||||
|
||||
tim.toSVG(frame, 0, null, 0, exporter, null, 0);
|
||||
fos.write(Utf8Helper.getBytes(exporter.getSVG()));
|
||||
}
|
||||
@@ -379,7 +376,7 @@ public class FrameExporter {
|
||||
}
|
||||
sb.append("\r\n");
|
||||
RGB backgroundColor1 = new RGB(255, 255, 255);
|
||||
if (setBgColorTag != null) {
|
||||
if (!settings.transparentBackground && setBgColorTag != null) {
|
||||
backgroundColor1 = setBgColorTag.backgroundColor;
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,10 @@ public class SVGExporter {
|
||||
public boolean useTextTag = Configuration.textExportExportFontFace.get();
|
||||
|
||||
public SVGExporter(ExportRectangle bounds, double zoom, String objectType) {
|
||||
this(bounds, zoom, objectType, null);
|
||||
}
|
||||
|
||||
public SVGExporter(ExportRectangle bounds, double zoom, String objectType, Color backgroundColor) {
|
||||
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
||||
try {
|
||||
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
|
||||
@@ -109,8 +112,22 @@ public class SVGExporter {
|
||||
svgRoot.setAttribute("height", (bounds.getHeight() / SWF.unitDivisor) + "px");
|
||||
}
|
||||
createDefGroup(bounds, null, zoom);
|
||||
|
||||
if (backgroundColor != null) {
|
||||
Element rect = _svg.createElement("rect");
|
||||
rect.setAttribute("fill", new RGBA(backgroundColor).toHexRGB());
|
||||
if (Configuration.svgRetainBounds.get()) {
|
||||
rect.setAttribute("width", (bounds.xMax / SWF.unitDivisor) + "px");
|
||||
rect.setAttribute("height", (bounds.yMax / SWF.unitDivisor) + "px");
|
||||
} else {
|
||||
rect.setAttribute("width", (bounds.getWidth() / SWF.unitDivisor) + "px");
|
||||
rect.setAttribute("height", (bounds.getHeight() / SWF.unitDivisor) + "px");
|
||||
}
|
||||
_svgGs.peek().appendChild(rect);
|
||||
}
|
||||
}
|
||||
svgRoot.setAttribute("ffdec:objectType", objectType);
|
||||
|
||||
} catch (ParserConfigurationException ex) {
|
||||
Logger.getLogger(SVGExporter.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
@@ -227,10 +244,10 @@ public class SVGExporter {
|
||||
return writer.toString();
|
||||
}
|
||||
|
||||
public void setBackGroundColor(Color backGroundColor) {
|
||||
/*public void setBackGroundColor(Color backGroundColor) {
|
||||
Attr attr = _svg.createAttribute("style");
|
||||
attr.setValue("background: " + new RGBA(backGroundColor).toHexARGB());
|
||||
}
|
||||
}*/
|
||||
|
||||
private String addClip(String path) {
|
||||
lastClipId++;
|
||||
|
||||
@@ -29,9 +29,12 @@ public class FrameExportSettings {
|
||||
public FrameExportMode mode;
|
||||
|
||||
public double zoom;
|
||||
|
||||
public boolean transparentBackground;
|
||||
|
||||
public FrameExportSettings(FrameExportMode mode, double zoom) {
|
||||
public FrameExportSettings(FrameExportMode mode, double zoom, boolean transparentBackground) {
|
||||
this.mode = mode;
|
||||
this.zoom = zoom;
|
||||
this.transparentBackground = transparentBackground;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user