diff --git a/CHANGELOG.md b/CHANGELOG.md index ec9a50a70..6375dbde2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ All notable changes to this project will be documented in this file. - Save as EXE through context menu of SWF files (previously only in toolbar) - Slovenian translation - SVG export - video frames +- [#2592], [#2154], [#2591] - Better handling of antialias conflation artifacts (by scaling), + can be enabled in Advanced Settings / Display and Export. ### Fixed - [#2570] NullpointerException on SVG export of DefineEditText @@ -4068,6 +4070,9 @@ Major version of SWF to XML export changed to 2. [alpha 8]: https://github.com/jindrapetrik/jpexs-decompiler/compare/alpha7...alpha8 [alpha 7]: https://github.com/jindrapetrik/jpexs-decompiler/releases/tag/alpha7 [#2581]: https://www.free-decompiler.com/flash/issues/2581 +[#2592]: https://www.free-decompiler.com/flash/issues/2592 +[#2154]: https://www.free-decompiler.com/flash/issues/2154 +[#2591]: https://www.free-decompiler.com/flash/issues/2591 [#2570]: https://www.free-decompiler.com/flash/issues/2570 [#2571]: https://www.free-decompiler.com/flash/issues/2571 [#2575]: https://www.free-decompiler.com/flash/issues/2575 diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java index e8dc5f63d..95f9f2ca3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -186,9 +186,11 @@ import com.jpexs.helpers.utf8.Utf8Helper; import java.awt.AlphaComposite; import java.awt.Color; import java.awt.Graphics2D; +import java.awt.Image; import java.awt.Point; import java.awt.Rectangle; import java.awt.geom.AffineTransform; +import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; @@ -4948,17 +4950,19 @@ public final class SWF implements SWFContainerItem, Timelined, Openable { * @param backGroundColor Background color * @param zoom Zoom * @param canUseSmoothing Can use smoothing + * @param aaScale Antialias conflation reducing scale coefficient * @return Image */ - public static SerializableImage frameToImageGet(Timeline timeline, int frame, int time, Point cursorPosition, int mouseButton, RECT displayRect, Matrix transformation, ColorTransform colorTransform, Color backGroundColor, double zoom, boolean canUseSmoothing) { + public static SerializableImage frameToImageGet(Timeline timeline, int frame, int time, Point cursorPosition, int mouseButton, RECT displayRect, Matrix transformation, ColorTransform colorTransform, Color backGroundColor, double zoom, boolean canUseSmoothing, int aaScale) { if (timeline.getFrameCount() == 0) { return new SerializableImage(1, 1, SerializableImage.TYPE_INT_ARGB_PRE); } - - RECT rect = displayRect; + + RECT rect = displayRect; + SerializableImage image = new SerializableImage( - rect.getWidth() == 0 ? 1 /*FIXME: is this necessary?*/ : (int) (rect.getWidth() * zoom / SWF.unitDivisor), - rect.getHeight() == 0 ? 1 : (int) (rect.getHeight() * zoom / SWF.unitDivisor), SerializableImage.TYPE_INT_ARGB_PRE); + rect.getWidth() == 0 ? 1 /*FIXME: is this necessary?*/ : (int) (rect.getWidth() * zoom * aaScale / SWF.unitDivisor), + rect.getHeight() == 0 ? 1 : (int) (rect.getHeight() * zoom * aaScale / SWF.unitDivisor), SerializableImage.TYPE_INT_ARGB_PRE); if (backGroundColor == null) { image.fillTransparent(); } else { @@ -4969,14 +4973,27 @@ public final class SWF implements SWFContainerItem, Timelined, Openable { } Matrix m = transformation.clone(); - m.translate(-rect.Xmin * zoom, -rect.Ymin * zoom); - m.scale(zoom); + m.translate(-rect.Xmin * zoom * aaScale, -rect.Ymin * zoom * aaScale); + m.scale(zoom * aaScale); RenderContext renderContext = new RenderContext(); 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, true, viewRect, viewRect, m, true, Timeline.DRAW_MODE_ALL, 0, canUseSmoothing, new ArrayList<>()); + + viewRect.xMin *= aaScale; + viewRect.yMin *= aaScale; + viewRect.xMax *= aaScale; + viewRect.yMax *= aaScale; + + timeline.toImage(frame, time, renderContext, image, image, false, m, new Matrix(), m, colorTransform, zoom * aaScale, true, viewRect, viewRect, m, true, Timeline.DRAW_MODE_ALL, 0, canUseSmoothing, new ArrayList<>(), aaScale); + SerializableImage img2 = new SerializableImage(image.getWidth() / aaScale, image.getHeight() / aaScale, BufferedImage.TYPE_INT_ARGB_PRE); + img2.fillTransparent(); + Graphics2D g2 = (Graphics2D) img2.getGraphics(); + g2.drawImage(image.getBufferedImage().getScaledInstance(image.getWidth() / aaScale, image.getHeight() / aaScale, Image.SCALE_SMOOTH), 0, 0, null); + image = img2; + return image; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java index fdd9b2452..5412bf393 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java @@ -841,7 +841,23 @@ public final class Configuration { @ConfigurationCategory("display") @ConfigurationRemoved public static ConfigurationItem fixAntialiasConflation = null; + + @ConfigurationDefaultBoolean(false) + @ConfigurationCategory("display") + public static ConfigurationItem reduceAntialiasConflationByScalingForDisplay = null; + @ConfigurationDefaultInt(4) + @ConfigurationCategory("display") + public static ConfigurationItem reduceAntialiasConflationByScalingValueForDisplay = null; + + @ConfigurationDefaultBoolean(false) + @ConfigurationCategory("export") + public static ConfigurationItem reduceAntialiasConflationByScalingForExport = null; + + @ConfigurationDefaultInt(10) + @ConfigurationCategory("export") + public static ConfigurationItem reduceAntialiasConflationByScalingValueForExport = null; + @ConfigurationDefaultBoolean(true) @ConfigurationCategory("display") public static ConfigurationItem autoPlaySounds = null; @@ -1822,4 +1838,19 @@ public final class Configuration { return null; } + + public static int calculateRealAaScale(int imageWidth, int imageHeight, double zoom, int initialAaScale) { + + final int MAX_IMAGE_DIMENSION = 10000; + + int aaScale = initialAaScale; + while ( + aaScale > 1 + && (((long) imageWidth * zoom * aaScale / SWF.unitDivisor) > MAX_IMAGE_DIMENSION + || ((long) imageHeight * zoom * aaScale / SWF.unitDivisor) > MAX_IMAGE_DIMENSION) + ) { + aaScale--; + } + return aaScale; + } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FrameExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FrameExporter.java index 13db946d8..96a8d3ef7 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FrameExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FrameExporter.java @@ -140,7 +140,7 @@ public class FrameExporter { frames.add(0); // todo: export all frames } - FrameExportSettings fes = new FrameExportSettings(fem, settings.zoom, true); + FrameExportSettings fes = new FrameExportSettings(fem, settings.zoom, true, settings.aaScale); return exportFrames(handler, outdir, swf, containerId, frames, 1, fes, evl); } @@ -178,7 +178,7 @@ public class FrameExporter { throw new Error("Unsupported sprite export mode"); } - FrameExportSettings fes = new FrameExportSettings(fem, settings.zoom, true); + FrameExportSettings fes = new FrameExportSettings(fem, settings.zoom, true, settings.aaScale); return exportFrames(handler, outdir, swf, containerId, frames, subframesLength, fes, evl); } @@ -248,7 +248,8 @@ public class FrameExporter { int max = subFrameMode ? subframeLength : fframes.size(); int fframe = subFrameMode ? fframes.get(0) : fframes.get(pos++); - BufferedImage result = SWF.frameToImageGet(tim, fframe, subFrameMode ? pos++ : 0, null, 0, tim.displayRect, new Matrix(), null, backgroundColor == null && !usesTransparency ? Color.white : backgroundColor, settings.zoom, true).getBufferedImage(); + int realAaScale = Configuration.calculateRealAaScale(tim.displayRect.getWidth(), tim.displayRect.getHeight(), settings.zoom, settings.aaScale); + BufferedImage result = SWF.frameToImageGet(tim, fframe, subFrameMode ? pos++ : 0, null, 0, tim.displayRect, new Matrix(), null, backgroundColor == null && !usesTransparency ? Color.white : backgroundColor, settings.zoom, true, realAaScale).getBufferedImage(); if (CancellableWorker.isInterrupted()) { return null; } @@ -687,7 +688,7 @@ public class FrameExporter { renderContext.stateUnderCursor = new ArrayList<>(); try { - tim.toImage(fframe, subFramesLength > 1 ? pos : 0, renderContext, image, image, false, m, new Matrix(), m, null, zoom, true, new ExportRectangle(rect), new ExportRectangle(rect), m, true, Timeline.DRAW_MODE_ALL, 0, true, new ArrayList<>()); + tim.toImage(fframe, subFramesLength > 1 ? pos : 0, renderContext, image, image, false, m, new Matrix(), m, null, zoom, true, new ExportRectangle(rect), new ExportRectangle(rect), m, true, Timeline.DRAW_MODE_ALL, 0, true, new ArrayList<>(), 1); } catch (Exception ex) { ex.printStackTrace(); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/MorphShapeExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/MorphShapeExporter.java index 30d8711d2..cc65c2f04 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/MorphShapeExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/MorphShapeExporter.java @@ -49,7 +49,10 @@ import com.jpexs.helpers.Path; import com.jpexs.helpers.SerializableImage; import com.jpexs.helpers.utf8.Utf8Helper; import dev.matrixlab.webp4j.WebPCodec; +import java.awt.Graphics; import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.image.BufferedImage; import java.io.BufferedOutputStream; import java.io.ByteArrayOutputStream; import java.io.File; @@ -121,7 +124,7 @@ public class MorphShapeExporter { RECT rect = st.getRect(); m = Matrix.getScaleInstance(settings.zoom); m.translate(-rect.Xmin, -rect.Ymin); - + switch (settings.mode) { case SVG_START_END: try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(fileStart))) { @@ -163,8 +166,11 @@ public class MorphShapeExporter { double unzoom = settings.zoom; st = mst.getStartShapeTag(); rect = st.getRect(); - int newWidth = (int) (rect.getWidth() * settings.zoom / SWF.unitDivisor) + 1; - int newHeight = (int) (rect.getHeight() * settings.zoom / SWF.unitDivisor) + 1; + + int realAaScale = Configuration.calculateRealAaScale(rect.getWidth(), rect.getHeight(), settings.zoom, settings.aaScale); + + int newWidth = (int) (rect.getWidth() * settings.zoom * realAaScale / SWF.unitDivisor) + 1; + int newHeight = (int) (rect.getHeight() * settings.zoom * realAaScale / SWF.unitDivisor) + 1; SerializableImage img = new SerializableImage(newWidth, newHeight, SerializableImage.TYPE_INT_ARGB_PRE); img.fillTransparent(); if (settings.mode == MorphShapeExportMode.BMP_START_END) { @@ -175,23 +181,37 @@ public class MorphShapeExporter { g.fillRect(0, 0, img.getWidth(), img.getHeight()); } } - m = Matrix.getScaleInstance(settings.zoom); + m = Matrix.getScaleInstance(settings.zoom * realAaScale); m.translate(-rect.Xmin, -rect.Ymin); - st.toImage(0, 0, 0, new RenderContext(), img, img, false, m, m, m, m, new CXFORMWITHALPHA(), unzoom, false, new ExportRectangle(rect), new ExportRectangle(rect), true, Timeline.DRAW_MODE_ALL, 0, true); + st.toImage(0, 0, 0, new RenderContext(), img, img, false, m, m, m, m, new CXFORMWITHALPHA(), unzoom * realAaScale, false, new ExportRectangle(rect), new ExportRectangle(rect), true, Timeline.DRAW_MODE_ALL, 0, true, realAaScale); + + BufferedImage bim = img.getBufferedImage(); + + if (realAaScale > 1) { + SerializableImage img2 = new SerializableImage(((newWidth - 1) / realAaScale) + 1, + ((newHeight - 1) / realAaScale) + 1, SerializableImage.TYPE_INT_ARGB_PRE); + img2.fillTransparent(); + Graphics g2 = img2.getGraphics(); + g2.drawImage(img.getBufferedImage().getScaledInstance(img2.getWidth(), img2.getHeight(), Image.SCALE_SMOOTH), 0, 0, null); + bim = img2.getBufferedImage(); + } + if (settings.mode == MorphShapeExportMode.PNG_START_END) { - ImageHelper.write(img.getBufferedImage(), ImageFormat.PNG, fileStart); + ImageHelper.write(bim, ImageFormat.PNG, fileStart); } else if (settings.mode == MorphShapeExportMode.WEBP_START_END) { try (FileOutputStream fos = new FileOutputStream(fileStart)) { - fos.write(WebPCodec.encodeImage(img.getBufferedImage(), 100f)); + fos.write(WebPCodec.encodeImage(bim, 100f)); } } else { - BMPFile.saveBitmap(img.getBufferedImage(), fileStart); + BMPFile.saveBitmap(bim, fileStart); } st = mst.getEndShapeTag(); rect = st.getRect(); - newWidth = (int) (rect.getWidth() * settings.zoom / SWF.unitDivisor) + 1; - newHeight = (int) (rect.getHeight() * settings.zoom / SWF.unitDivisor) + 1; + realAaScale = Configuration.calculateRealAaScale(rect.getWidth(), rect.getHeight(), settings.zoom, settings.aaScale); + + newWidth = (int) (rect.getWidth() * settings.zoom * realAaScale / SWF.unitDivisor) + 1; + newHeight = (int) (rect.getHeight() * settings.zoom * realAaScale / SWF.unitDivisor) + 1; img = new SerializableImage(newWidth, newHeight, SerializableImage.TYPE_INT_ARGB_PRE); img.fillTransparent(); if (settings.mode == MorphShapeExportMode.BMP_START_END) { @@ -202,17 +222,29 @@ public class MorphShapeExporter { g.fillRect(0, 0, img.getWidth(), img.getHeight()); } } - m = Matrix.getScaleInstance(settings.zoom); + m = Matrix.getScaleInstance(settings.zoom * realAaScale); m.translate(-rect.Xmin, -rect.Ymin); - st.toImage(0, 0, 0, new RenderContext(), img, img, false, m, m, m, m, new CXFORMWITHALPHA(), unzoom, false, new ExportRectangle(rect), new ExportRectangle(rect), true, Timeline.DRAW_MODE_ALL, 0, true); + st.toImage(0, 0, 0, new RenderContext(), img, img, false, m, m, m, m, new CXFORMWITHALPHA(), unzoom, false, new ExportRectangle(rect), new ExportRectangle(rect), true, Timeline.DRAW_MODE_ALL, 0, true, settings.aaScale); + + bim = img.getBufferedImage(); + + if (realAaScale > 1) { + SerializableImage img2 = new SerializableImage(((newWidth - 1) / realAaScale) + 1, + ((newHeight - 1) / realAaScale) + 1, SerializableImage.TYPE_INT_ARGB_PRE); + img2.fillTransparent(); + Graphics g2 = img2.getGraphics(); + g2.drawImage(img.getBufferedImage().getScaledInstance(img2.getWidth(), img2.getHeight(), Image.SCALE_SMOOTH), 0, 0, null); + bim = img2.getBufferedImage(); + } + if (settings.mode == MorphShapeExportMode.PNG_START_END) { - ImageHelper.write(img.getBufferedImage(), ImageFormat.PNG, fileEnd); + ImageHelper.write(bim, ImageFormat.PNG, fileEnd); } else if (settings.mode == MorphShapeExportMode.WEBP_START_END) { try (FileOutputStream fos = new FileOutputStream(fileEnd)) { - fos.write(WebPCodec.encodeLosslessImage(img.getBufferedImage())); + fos.write(WebPCodec.encodeLosslessImage(bim)); } } else { - BMPFile.saveBitmap(img.getBufferedImage(), fileEnd); + BMPFile.saveBitmap(bim, fileEnd); } break; case CANVAS: diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/ShapeExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/ShapeExporter.java index 1407bb365..48351afa8 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/ShapeExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/ShapeExporter.java @@ -47,7 +47,10 @@ import com.jpexs.helpers.Path; import com.jpexs.helpers.SerializableImage; import com.jpexs.helpers.utf8.Utf8Helper; import dev.matrixlab.webp4j.WebPCodec; +import java.awt.Graphics; import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.image.BufferedImage; import java.io.BufferedOutputStream; import java.io.ByteArrayOutputStream; import java.io.File; @@ -71,7 +74,7 @@ import java.util.logging.Logger; */ public class ShapeExporter { - public List exportShapes(AbortRetryIgnoreHandler handler, final String outdir, final SWF swf, ReadOnlyTagList tags, final ShapeExportSettings settings, EventListener evl, double unzoom) throws IOException, InterruptedException { + public List exportShapes(AbortRetryIgnoreHandler handler, final String outdir, final SWF swf, ReadOnlyTagList tags, final ShapeExportSettings settings, EventListener evl, double unzoom, int aaScale) throws IOException, InterruptedException { List ret = new ArrayList<>(); if (CancellableWorker.isInterrupted()) { return ret; @@ -124,8 +127,9 @@ public class ShapeExporter { case PNG: case BMP: case WEBP: - int newWidth = (int) (rect.getWidth() * settings.zoom / SWF.unitDivisor) + 1; - int newHeight = (int) (rect.getHeight() * settings.zoom / SWF.unitDivisor) + 1; + int realAaScale = Configuration.calculateRealAaScale(rect.getWidth(), rect.getHeight(), settings.zoom, aaScale); + int newWidth = (int) (rect.getWidth() * settings.zoom * realAaScale / SWF.unitDivisor) + 1; + int newHeight = (int) (rect.getHeight() * settings.zoom * realAaScale / SWF.unitDivisor) + 1; SerializableImage img = new SerializableImage(newWidth, newHeight, SerializableImage.TYPE_INT_ARGB_PRE); img.fillTransparent(); if (settings.mode == ShapeExportMode.BMP) { @@ -135,16 +139,30 @@ public class ShapeExporter { g.setColor(backColor.toColor()); g.fillRect(0, 0, img.getWidth(), img.getHeight()); } - } - st.toImage(0, 0, 0, new RenderContext(), img, img, false, m, m, m, m, new CXFORMWITHALPHA(), unzoom, false, new ExportRectangle(rect), new ExportRectangle(rect), true, Timeline.DRAW_MODE_ALL, 0, true); + } + Matrix m2 = Matrix.getScaleInstance(settings.zoom * realAaScale); + m2.translate(-rect.Xmin, -rect.Ymin); + + st.toImage(0, 0, 0, new RenderContext(), img, img, false, m2, m2, m2, m2, new CXFORMWITHALPHA(), unzoom * realAaScale, false, new ExportRectangle(rect), new ExportRectangle(rect), true, Timeline.DRAW_MODE_ALL, 0, true, realAaScale); + + BufferedImage bim = img.getBufferedImage(); + if (realAaScale > 1) { + SerializableImage img2 = new SerializableImage(((newWidth - 1) / realAaScale) + 1, + ((newHeight - 1) / realAaScale) + 1, SerializableImage.TYPE_INT_ARGB_PRE); + img2.fillTransparent(); + Graphics g2 = img2.getGraphics(); + g2.drawImage(img.getBufferedImage().getScaledInstance(img2.getWidth(), img2.getHeight(), Image.SCALE_SMOOTH), 0, 0, null); + bim = img2.getBufferedImage(); + } + if (settings.mode == ShapeExportMode.PNG) { - ImageHelper.write(img.getBufferedImage(), ImageFormat.PNG, file); + ImageHelper.write(bim, ImageFormat.PNG, file); } else if (settings.mode == ShapeExportMode.WEBP) { try (FileOutputStream fos = new FileOutputStream(file)) { - fos.write(WebPCodec.encodeLosslessImage(img.getBufferedImage())); + fos.write(WebPCodec.encodeLosslessImage(bim)); } } else { - BMPFile.saveBitmap(img.getBufferedImage(), file); + BMPFile.saveBitmap(bim, file); } break; case CANVAS: diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/settings/ButtonExportSettings.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/settings/ButtonExportSettings.java index 52c0a6fa2..54a6f052a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/settings/ButtonExportSettings.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/settings/ButtonExportSettings.java @@ -39,14 +39,21 @@ public class ButtonExportSettings { * Zoom */ public double zoom; + + /** + * Antialias conflation reducing scale coefficient + */ + public int aaScale; /** * Constructor. * @param mode Mode * @param zoom Zoom + * @param aaScale Antialias conflation reducing scale coefficient */ - public ButtonExportSettings(ButtonExportMode mode, double zoom) { + public ButtonExportSettings(ButtonExportMode mode, double zoom, int aaScale) { this.mode = mode; this.zoom = zoom; + this.aaScale = aaScale; } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/settings/FrameExportSettings.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/settings/FrameExportSettings.java index cb3addb8b..2a95473a8 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/settings/FrameExportSettings.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/settings/FrameExportSettings.java @@ -44,16 +44,23 @@ public class FrameExportSettings { * Transparent background */ public boolean transparentBackground; + + /** + * Antialias conflation reducing scale coefficient + */ + public int aaScale; /** * Constructor. * @param mode Mode * @param zoom Zoom * @param transparentBackground Transparent background + * @param aaScale Antialias conflation reducing scale coefficient */ - public FrameExportSettings(FrameExportMode mode, double zoom, boolean transparentBackground) { + public FrameExportSettings(FrameExportMode mode, double zoom, boolean transparentBackground, int aaScale) { this.mode = mode; this.zoom = zoom; this.transparentBackground = transparentBackground; + this.aaScale = aaScale; } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/settings/MorphShapeExportSettings.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/settings/MorphShapeExportSettings.java index e7d9a6950..b20869533 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/settings/MorphShapeExportSettings.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/settings/MorphShapeExportSettings.java @@ -39,15 +39,22 @@ public class MorphShapeExportSettings { * Zoom */ public double zoom; + + /** + * Antialias conflation reducing scale coefficient + */ + public int aaScale; /** * Constructor. * @param mode Mode * @param zoom Zoom + * @param aaScale Antialias conflation reducing scale coefficient */ - public MorphShapeExportSettings(MorphShapeExportMode mode, double zoom) { + public MorphShapeExportSettings(MorphShapeExportMode mode, double zoom, int aaScale) { this.mode = mode; this.zoom = zoom; + this.aaScale = aaScale; } /** diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/settings/SpriteExportSettings.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/settings/SpriteExportSettings.java index bf204abd4..559102b58 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/settings/SpriteExportSettings.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/settings/SpriteExportSettings.java @@ -39,14 +39,21 @@ public class SpriteExportSettings { * Zoom */ public double zoom; + + /** + * Antialias conflation reducing scale coefficient + */ + public int aaScale; /** * Constructor. * @param mode Mode * @param zoom Zoom + * @param aaScale Antialias conflation reducing scale coefficient */ - public SpriteExportSettings(SpriteExportMode mode, double zoom) { + public SpriteExportSettings(SpriteExportMode mode, double zoom, int aaScale) { this.mode = mode; this.zoom = zoom; + this.aaScale = aaScale; } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/BitmapExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/BitmapExporter.java index 4d41b28bf..fd3267c76 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/BitmapExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/BitmapExporter.java @@ -101,6 +101,8 @@ public class BitmapExporter extends ShapeExporterBase { private double thicknessScaleY; private double unzoom; + + private int aaScale; private static boolean linearGradientColorWarningShown = false; @@ -171,11 +173,12 @@ public class BitmapExporter extends ShapeExporterBase { * @param colorTransform Color transform * @param scaleStrokes Scale strokes * @param canUseSmoothing Can use smoothing + * @param aaScale Antialias conflation reducing scale coefficient */ - public static void export(int windingRule, int shapeNum, SWF swf, SHAPE shape, Color defaultColor, SerializableImage image, double unzoom, Matrix transformation, Matrix strokeTransformation, ColorTransform colorTransform, boolean scaleStrokes, boolean canUseSmoothing) { + public static void export(int windingRule, int shapeNum, SWF swf, SHAPE shape, Color defaultColor, SerializableImage image, double unzoom, Matrix transformation, Matrix strokeTransformation, ColorTransform colorTransform, boolean scaleStrokes, boolean canUseSmoothing, int aaScale) { BitmapExporter exporter = new BitmapExporter(windingRule, shapeNum, swf, shape, defaultColor, colorTransform); exporter.setCanUseSmoothing(canUseSmoothing); - exporter.exportTo(shapeNum, image, unzoom, transformation, strokeTransformation, scaleStrokes); + exporter.exportTo(shapeNum, image, unzoom, transformation, strokeTransformation, scaleStrokes, aaScale); } private BitmapExporter(int windingRule, int shapeNum, SWF swf, SHAPE shape, Color defaultColor, ColorTransform colorTransform) { @@ -185,7 +188,7 @@ public class BitmapExporter extends ShapeExporterBase { path = new GeneralPath(windingRule == ShapeTag.WIND_NONZERO ? GeneralPath.WIND_NON_ZERO : GeneralPath.WIND_EVEN_ODD); } - private void exportTo(int shapeNum, SerializableImage image, double unzoom, Matrix transformation, Matrix strokeTransformation, boolean scaleStrokes) { + private void exportTo(int shapeNum, SerializableImage image, double unzoom, Matrix transformation, Matrix strokeTransformation, boolean scaleStrokes, int aaScale) { this.image = image; this.scaleStrokes = scaleStrokes; ExportRectangle bounds = new ExportRectangle(shape.getBounds(shapeNum)); @@ -198,6 +201,7 @@ public class BitmapExporter extends ShapeExporterBase { graphics.setTransform(at); defaultStroke = graphics.getStroke(); this.unzoom = unzoom; + this.aaScale = aaScale; super.export(); } @@ -411,8 +415,8 @@ public class BitmapExporter extends ShapeExporterBase { } //always display minimum stroke of 1 pixel, no matter how zoomed it is - if (thickness * unzoom < 1 * SWF.unitDivisor) { - thickness = 1 * SWF.unitDivisor / unzoom; + if (thickness * unzoom / aaScale < 1 * SWF.unitDivisor) { + thickness = 1 * SWF.unitDivisor / (unzoom / aaScale); } /* diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/svg/SvgImporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/svg/SvgImporter.java index 37b44b351..ad24e3534 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/svg/SvgImporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/svg/SvgImporter.java @@ -1480,7 +1480,7 @@ public class SvgImporter { st = (DefineShape4Tag) (new SvgImporter().importSvg(st, svgDataS, false)); swf.addTag(st); SerializableImage si = new SerializableImage(480, 360, BufferedImage.TYPE_4BYTE_ABGR); - BitmapExporter.export(st.getWindingRule(), st.getShapeNum(), swf, st.shapes, Color.yellow, si, 1, new Matrix(), new Matrix(), null, true, true); + BitmapExporter.export(st.getWindingRule(), st.getShapeNum(), swf, st.shapes, Color.yellow, si, 1, new Matrix(), new Matrix(), null, true, true, 1); List li = new ArrayList<>(); li.add(st); ImageIO.write(si.getBufferedImage(), "PNG", new File(name + ".imported.png")); @@ -1491,7 +1491,7 @@ public class SvgImporter { swf.assignExportNamesToSymbols(); st.shapeBounds.Xmax = (int) (si.getWidth() * SWF.unitDivisor); st.shapeBounds.Ymax = (int) (si.getHeight() * SWF.unitDivisor); - new ShapeExporter().exportShapes(null, "./outex/", swf, new ReadOnlyTagList(li), new ShapeExportSettings(ShapeExportMode.SVG, 1), null, 1); + new ShapeExporter().exportShapes(null, "./outex/", swf, new ReadOnlyTagList(li), new ShapeExportSettings(ShapeExportMode.SVG, 1), null, 1, 1); } /** diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java index 7eae29c9b..37be55c59 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java @@ -1278,8 +1278,8 @@ public class DefineEditTextTag extends TextTag { } @Override - public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, ExportRectangle viewRectRaw, boolean scaleStrokes, int drawMode, int blendMode, boolean canUseSmoothing) { - render(TextRenderMode.BITMAP, image, null, null, transformation, colorTransform, 1, renderContext.selectionText == this ? renderContext.selectionStart : 0, renderContext.selectionText == this ? renderContext.selectionEnd : 0); + public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, ExportRectangle viewRectRaw, boolean scaleStrokes, int drawMode, int blendMode, boolean canUseSmoothing, int aaScale) { + render(TextRenderMode.BITMAP, image, null, null, transformation, colorTransform, 1, renderContext.selectionText == this ? renderContext.selectionStart : 0, renderContext.selectionText == this ? renderContext.selectionEnd : 0, aaScale); } @Override @@ -1287,25 +1287,25 @@ public class DefineEditTextTag extends TextTag { int realTextId = getSwf().getCharacterId(this); if (exporter.getNormalizedTexts().containsKey(realTextId) && exporter.getNormalizedTexts().get(realTextId) instanceof DefineEditTextTag) { DefineEditTextTag normalizedText = (DefineEditTextTag) exporter.getNormalizedTexts().get(realTextId); - normalizedText.render(TextRenderMode.SVG, null, exporter, null, new Matrix(), colorTransform, 1, 0, 0); + normalizedText.render(TextRenderMode.SVG, null, exporter, null, new Matrix(), colorTransform, 1, 0, 0, 1); return; } - render(TextRenderMode.SVG, null, exporter, null, new Matrix(), colorTransform, 1, 0, 0); + render(TextRenderMode.SVG, null, exporter, null, new Matrix(), colorTransform, 1, 0, 0, 1); } @Override public void toHtmlCanvas(StringBuilder result, double unitDivisor) { - render(TextRenderMode.HTML5_CANVAS, null, null, result, new Matrix(), null, unitDivisor, 0, 0); + render(TextRenderMode.HTML5_CANVAS, null, null, result, new Matrix(), null, unitDivisor, 0, 0, 1); } - private void render(TextRenderMode renderMode, SerializableImage image, SVGExporter svgExporter, StringBuilder htmlCanvasBuilder, Matrix transformation, ColorTransform colorTransform, double zoom, int selectionStart, int selectionEnd) { + private void render(TextRenderMode renderMode, SerializableImage image, SVGExporter svgExporter, StringBuilder htmlCanvasBuilder, Matrix transformation, ColorTransform colorTransform, double zoom, int selectionStart, int selectionEnd, int aaScale) { if (image != null && image.getGraphics() instanceof RequiresNormalizedFonts) { RequiresNormalizedFonts g = (RequiresNormalizedFonts) image.getGraphics(); Map normalizedTexts = g.getNormalizedTexts(); int realTextId = getSwf().getCharacterId(this); if (normalizedTexts.containsKey(realTextId) && normalizedTexts.get(realTextId) instanceof DefineEditTextTag && normalizedTexts.get(realTextId) != this) { DefineEditTextTag normalizedText = (DefineEditTextTag) normalizedTexts.get(realTextId); - normalizedText.render(renderMode, image, svgExporter, htmlCanvasBuilder, transformation, colorTransform, zoom, selectionStart, selectionEnd); + normalizedText.render(renderMode, image, svgExporter, htmlCanvasBuilder, transformation, colorTransform, zoom, selectionStart, selectionEnd, aaScale); return; } } @@ -1315,7 +1315,7 @@ public class DefineEditTextTag extends TextTag { RGB fillColor = new RGBA(Color.white); switch (renderMode) { case BITMAP: - drawBorder(swf, image, borderColor, fillColor, getRect(), getTextMatrix(), transformation, colorTransform); + drawBorder(swf, image, borderColor, fillColor, getRect(), getTextMatrix(), transformation, colorTransform, aaScale); break; case HTML5_CANVAS: drawBorderHtmlCanvas(swf, htmlCanvasBuilder, borderColor, fillColor, getRect(), getTextMatrix(), colorTransform, zoom); @@ -1329,7 +1329,7 @@ public class DefineEditTextTag extends TextTag { List allTextRecords = getTextRecords(swf); switch (renderMode) { case BITMAP: - staticTextToImage(swf, allTextRecords, 2, image, getTextMatrix(), transformation, colorTransform, selectionStart, selectionEnd); + staticTextToImage(swf, allTextRecords, 2, image, getTextMatrix(), transformation, colorTransform, selectionStart, selectionEnd, aaScale); break; case HTML5_CANVAS: staticTextToHtmlCanvas(zoom, swf, allTextRecords, 2, htmlCanvasBuilder, getBounds(), getTextMatrix(), colorTransform); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java index 0248dcf5f..31ac93c2d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java @@ -461,8 +461,8 @@ public class DefineSpriteTag extends DrawableTag implements Timelined { } @Override - public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, ExportRectangle viewRectRaw, boolean scaleStrokes, int drawMode, int blendMode, boolean canUseSmoothing) { - getTimeline().toImage(frame, time, renderContext, image, fullImage, isClip, transformation, strokeTransformation, absoluteTransformation, colorTransform, unzoom, sameImage, viewRect, viewRectRaw, fullTransformation, scaleStrokes, drawMode, blendMode, canUseSmoothing, new ArrayList<>()); + public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, ExportRectangle viewRectRaw, boolean scaleStrokes, int drawMode, int blendMode, boolean canUseSmoothing, int aaScale) { + getTimeline().toImage(frame, time, renderContext, image, fullImage, isClip, transformation, strokeTransformation, absoluteTransformation, colorTransform, unzoom, sameImage, viewRect, viewRectRaw, fullTransformation, scaleStrokes, drawMode, blendMode, canUseSmoothing, new ArrayList<>(), aaScale); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineVideoStreamTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineVideoStreamTag.java index 0efd5e997..d82e3dd2b 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineVideoStreamTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineVideoStreamTag.java @@ -338,7 +338,7 @@ public class DefineVideoStreamTag extends DrawableTag implements BoundedTag, Tim } @Override - public synchronized void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix prevTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, ExportRectangle viewRectRaw, boolean scaleStrokes, int drawMode, int blendMode, boolean canUseSmoothing) { + public synchronized void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix prevTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, ExportRectangle viewRectRaw, boolean scaleStrokes, int drawMode, int blendMode, boolean canUseSmoothing, int aaScale) { if (renderingPaused || !SimpleMediaPlayer.isAvailable()) { Graphics2D g = (Graphics2D) image.getBufferedImage().getGraphics(); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/ButtonTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/ButtonTag.java index e1ffb3f28..298fc5cf9 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/ButtonTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/ButtonTag.java @@ -126,8 +126,8 @@ public abstract class ButtonTag extends DrawableTag implements Timelined { } @Override - public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, ExportRectangle viewRectRaw, boolean scaleStrokes, int drawMode, int blendMode, boolean canUseSmoothing) { - getTimeline().toImage(frame, time, renderContext, image, fullImage, isClip, transformation, strokeTransformation, absoluteTransformation, colorTransform, unzoom, sameImage, viewRect, viewRectRaw, fullTransformation, scaleStrokes, drawMode, blendMode, canUseSmoothing, new ArrayList<>()); + public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, ExportRectangle viewRectRaw, boolean scaleStrokes, int drawMode, int blendMode, boolean canUseSmoothing, int aaScale) { + getTimeline().toImage(frame, time, renderContext, image, fullImage, isClip, transformation, strokeTransformation, absoluteTransformation, colorTransform, unzoom, sameImage, viewRect, viewRectRaw, fullTransformation, scaleStrokes, drawMode, blendMode, canUseSmoothing, new ArrayList<>(), aaScale); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/DrawableTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/DrawableTag.java index 97b5e4cf1..325c955a2 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/DrawableTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/DrawableTag.java @@ -104,8 +104,9 @@ public abstract class DrawableTag extends CharacterTag implements BoundedTag { * @param drawMode Draw mode * @param blendMode Blend mode * @param canUseSmoothing Can use smoothing + * @param aaScale Antialias conflation reducing scale coefficient */ - public abstract void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix prevTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, ExportRectangle viewRectRaw, boolean scaleStrokes, int drawMode, int blendMode, boolean canUseSmoothing); + public abstract void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix prevTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, ExportRectangle viewRectRaw, boolean scaleStrokes, int drawMode, int blendMode, boolean canUseSmoothing, int aaScale); /** * Converts the drawable to SVG. diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/FontTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/FontTag.java index 98c8f5705..f2200329a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/FontTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/FontTag.java @@ -719,7 +719,7 @@ public abstract class FontTag extends DrawableTag implements AloneTag { } @Override - public synchronized void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, ExportRectangle viewRectRaw, boolean scaleStrokes, int drawMode, int blendMode, boolean canUseSmoothing) { + public synchronized void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, ExportRectangle viewRectRaw, boolean scaleStrokes, int drawMode, int blendMode, boolean canUseSmoothing, int aaScale) { SHAPERECORD.shapeListToImage(ShapeTag.WIND_EVEN_ODD, 1, swf, getGlyphShapeTable(), image, frame, Color.black, colorTransform); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/ImageTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/ImageTag.java index e1bc66a99..64e154ca6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/ImageTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/ImageTag.java @@ -341,8 +341,8 @@ public abstract class ImageTag extends DrawableTag { } @Override - public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, ExportRectangle viewRectRaw, boolean scaleStrokes, int drawMode, int blendMode, boolean canUseSmoothing) { - BitmapExporter.export(ShapeTag.WIND_EVEN_ODD, 1, swf, getShape(1), null, image, unzoom, transformation, strokeTransformation, colorTransform, true, canUseSmoothing); + public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, ExportRectangle viewRectRaw, boolean scaleStrokes, int drawMode, int blendMode, boolean canUseSmoothing, int aaScale) { + BitmapExporter.export(ShapeTag.WIND_EVEN_ODD, 1, swf, getShape(1), null, image, unzoom, transformation, strokeTransformation, colorTransform, true, canUseSmoothing, aaScale); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/MorphShapeTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/MorphShapeTag.java index 325e68867..a50cbc5e3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/MorphShapeTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/MorphShapeTag.java @@ -410,13 +410,13 @@ public abstract class MorphShapeTag extends DrawableTag { } @Override - public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, ExportRectangle viewRectRaw, boolean scaleStrokes, int drawMode, int blendMode, boolean canUseSmoothing) { + public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, ExportRectangle viewRectRaw, boolean scaleStrokes, int drawMode, int blendMode, boolean canUseSmoothing, int aaScale) { SHAPEWITHSTYLE shape = getShapeAtRatio(ratio); // morphShape using shapeNum=3, morphShape2 using shapeNum=4 // todo: Currently the generated image is not cached, because the cache // key contains the hashCode of the finalRecord object, and it is always // recreated - BitmapExporter.export(ShapeTag.WIND_EVEN_ODD /*??? FIXME*/, getShapeNum() == 2 ? 4 : 1, swf, shape, null, image, unzoom, transformation, strokeTransformation, colorTransform, scaleStrokes, canUseSmoothing); + BitmapExporter.export(ShapeTag.WIND_EVEN_ODD /*??? FIXME*/, getShapeNum() == 2 ? 4 : 1, swf, shape, null, image, unzoom, transformation, strokeTransformation, colorTransform, scaleStrokes, canUseSmoothing, aaScale); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/ShapeTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/ShapeTag.java index de062df83..e3c3b0c44 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/ShapeTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/ShapeTag.java @@ -233,8 +233,8 @@ public abstract class ShapeTag extends DrawableTag implements LazyObject { } @Override - public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, ExportRectangle viewRectRaw, boolean scaleStrokes, int drawMode, int blendMode, boolean canUseSmoothing) { - BitmapExporter.export(getWindingRule(), getShapeNum(), getSwf(), getShapes(), null, image, unzoom, transformation, strokeTransformation, colorTransform, scaleStrokes, canUseSmoothing); + public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, ExportRectangle viewRectRaw, boolean scaleStrokes, int drawMode, int blendMode, boolean canUseSmoothing, int aaScale) { + BitmapExporter.export(getWindingRule(), getShapeNum(), getSwf(), getShapes(), null, image, unzoom, transformation, strokeTransformation, colorTransform, scaleStrokes, canUseSmoothing, aaScale); if (Configuration._debugMode.get()) { // show control points List paths = PathExporter.export(getWindingRule(), getShapeNum(), swf, getShapes()); double[] coords = new double[6]; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/StaticTextTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/StaticTextTag.java index 27e42877b..e06912601 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/StaticTextTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/StaticTextTag.java @@ -1027,18 +1027,18 @@ public abstract class StaticTextTag extends TextTag { } @Override - public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, ExportRectangle viewRectRaw, boolean scaleStrokes, int drawMode, int blendMode, boolean canUseSmoothing) { + public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, ExportRectangle viewRectRaw, boolean scaleStrokes, int drawMode, int blendMode, boolean canUseSmoothing, int aaScale) { if (image.getGraphics() instanceof RequiresNormalizedFonts) { RequiresNormalizedFonts g = (RequiresNormalizedFonts) image.getGraphics(); Map normalizedTexts = g.getNormalizedTexts(); int realTextId = getSwf().getCharacterId(this); if (normalizedTexts.containsKey(realTextId) && normalizedTexts.get(realTextId) instanceof StaticTextTag) { StaticTextTag normalizedText = (StaticTextTag) normalizedTexts.get(realTextId); - staticTextToImage(swf, normalizedText.textRecords, getTextNum(), image, normalizedText.textMatrix, transformation, colorTransform, renderContext.selectionText == this ? renderContext.selectionStart : 0, renderContext.selectionText == this ? renderContext.selectionEnd : 0); + staticTextToImage(swf, normalizedText.textRecords, getTextNum(), image, normalizedText.textMatrix, transformation, colorTransform, renderContext.selectionText == this ? renderContext.selectionStart : 0, renderContext.selectionText == this ? renderContext.selectionEnd : 0, aaScale); return; } } - staticTextToImage(swf, textRecords, getTextNum(), image, textMatrix, transformation, colorTransform, renderContext.selectionText == this ? renderContext.selectionStart : 0, renderContext.selectionText == this ? renderContext.selectionEnd : 0); + staticTextToImage(swf, textRecords, getTextNum(), image, textMatrix, transformation, colorTransform, renderContext.selectionText == this ? renderContext.selectionStart : 0, renderContext.selectionText == this ? renderContext.selectionEnd : 0, aaScale); /*try { TextTag originalTag = (TextTag) getOriginalTag(); if (isModified()) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/TextTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/TextTag.java index 76612adfa..ba63d6b5d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/TextTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/TextTag.java @@ -610,11 +610,11 @@ public abstract class TextTag extends DrawableTag { * @param transformation Transformation * @param colorTransform Color transform */ - public static void drawBorder(SWF swf, SerializableImage image, RGB borderColor, RGB fillColor, RECT rect, MATRIX textMatrix, Matrix transformation, ColorTransform colorTransform) { + public static void drawBorder(SWF swf, SerializableImage image, RGB borderColor, RGB fillColor, RECT rect, MATRIX textMatrix, Matrix transformation, ColorTransform colorTransform, int aaScale) { Graphics2D g = (Graphics2D) image.getGraphics(); Matrix mat = transformation.clone(); mat = mat.concatenate(new Matrix(textMatrix)); - BitmapExporter.export(ShapeTag.WIND_EVEN_ODD, 1, swf, getBorderShape(borderColor, fillColor, rect), null, image, 1 /*FIXME??*/, mat, mat, colorTransform, true, false); + BitmapExporter.export(ShapeTag.WIND_EVEN_ODD, 1, swf, getBorderShape(borderColor, fillColor, rect), null, image, 1 /*FIXME??*/, mat, mat, colorTransform, true, false, aaScale); } /** @@ -674,7 +674,7 @@ public abstract class TextTag extends DrawableTag { * @param selectionStart Selection start * @param selectionEnd Selection end */ - public static void staticTextToImage(SWF swf, List textRecords, int numText, SerializableImage image, MATRIX textMatrix, Matrix transformation, ColorTransform colorTransform, int selectionStart, int selectionEnd) { + public static void staticTextToImage(SWF swf, List textRecords, int numText, SerializableImage image, MATRIX textMatrix, Matrix transformation, ColorTransform colorTransform, int selectionStart, int selectionEnd, int aaScale) { if (image.getGraphics() instanceof GraphicsTextDrawable) { //custom drawing ((GraphicsTextDrawable) image.getGraphics()).drawTextRecords(swf, textRecords, numText, textMatrix, transformation, colorTransform); @@ -789,17 +789,17 @@ public abstract class TextTag extends DrawableTag { //bounds.Ymin = (int) Math.round(-ascent); //bounds.Ymax = (int) Math.round(descent + leading); Matrix mat2 = Matrix.getTranslateInstance(bounds.Xmin, bounds.Ymin).preConcatenate(mat); - TextTag.drawBorder(swf, image, borderColor, fillColor, bounds, new MATRIX(), mat2, colorTransform); + TextTag.drawBorder(swf, image, borderColor, fillColor, bounds, new MATRIX(), mat2, colorTransform, aaScale); } if (shape != null) { - BitmapExporter.export(ShapeTag.WIND_EVEN_ODD, 1, swf, shape, pos >= selectionStart && pos < selectionEnd ? Color.white : textColor3, image, 1 /*FIXME??*/, mat, mat, colorTransform, true, false); + BitmapExporter.export(ShapeTag.WIND_EVEN_ODD, 1, swf, shape, pos >= selectionStart && pos < selectionEnd ? Color.white : textColor3, image, 1 /*FIXME??*/, mat, mat, colorTransform, true, false, aaScale); if (SHAPERECORD.DRAW_BOUNDING_BOX) { RGB borderColor = new RGBA(Color.black); RGB fillColor = new RGBA(new Color(255, 255, 255, 0)); RECT bounds = shape.getBounds(1); mat = Matrix.getTranslateInstance(bounds.Xmin, bounds.Ymin).preConcatenate(mat); - TextTag.drawBorder(swf, image, borderColor, fillColor, bounds, new MATRIX(), mat, colorTransform); + TextTag.drawBorder(swf, image, borderColor, fillColor, bounds, new MATRIX(), mat, colorTransform, aaScale); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java index 9de69f6ae..a3f0bede3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java @@ -1068,8 +1068,9 @@ public class Timeline { * @param scaleStrokes Scale strokes * @param drawMode Draw mode * @param canUseSmoothing Can use smoothing + * @param aaScale Antialias conflation reducing scale coefficient */ - private void drawDrawable(SWF swf, Matrix strokeTransform, DepthState layer, Matrix layerMatrix, Graphics2D g, ColorTransform colorTransForm, int blendMode, int parentBlendMode, List clips, Matrix transformation, boolean isClip, int clipDepth, Matrix absMat, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, DrawableTag drawable, List filters, double unzoom, ColorTransform mergedColorTransform, boolean sameImage, ExportRectangle viewRect, ExportRectangle viewRectRaw, Matrix fullTransformation, boolean scaleStrokes, int drawMode, boolean canUseSmoothing) { + private void drawDrawable(SWF swf, Matrix strokeTransform, DepthState layer, Matrix layerMatrix, Graphics2D g, ColorTransform colorTransForm, int blendMode, int parentBlendMode, List clips, Matrix transformation, boolean isClip, int clipDepth, Matrix absMat, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, DrawableTag drawable, List filters, double unzoom, ColorTransform mergedColorTransform, boolean sameImage, ExportRectangle viewRect, ExportRectangle viewRectRaw, Matrix fullTransformation, boolean scaleStrokes, int drawMode, boolean canUseSmoothing, int aaScale) { Matrix drawMatrix = new Matrix(); int drawableFrameCount = drawable.getNumFrames(); if (drawableFrameCount == 0) { @@ -1412,7 +1413,7 @@ public class Timeline { } if (!(drawable instanceof ImageTag) || (swf.isAS3() && layer.hasImage)) { - drawable.toImage(dframe, dtime, ratio, renderContext, img, fullImage, isClip || clipDepth > -1, m, strokeTransform, absMat, mfull, mergedColorTransform2, unzoom, sameImage, viewRect2, viewRectRaw, scaleStrokes, drawMode, layer.blendMode, canUseSmoothing); + drawable.toImage(dframe, dtime, ratio, renderContext, img, fullImage, isClip || clipDepth > -1, m, strokeTransform, absMat, mfull, mergedColorTransform2, unzoom, sameImage, viewRect2, viewRectRaw, scaleStrokes, drawMode, layer.blendMode, canUseSmoothing, aaScale); } else { // todo: show one time warning } @@ -1596,8 +1597,9 @@ public class Timeline { * @param blendMode Blend mode * @param canUseSmoothing Can use smoothing * @param ignoreDepths Ignore these depths when drawing + * @param aaScale Antialias conflation reducing scale coefficient */ - public void toImage(int frame, int time, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, ExportRectangle viewRectRaw, Matrix fullTransformation, boolean scaleStrokes, int drawMode, int blendMode, boolean canUseSmoothing, List ignoreDepths) { + public void toImage(int frame, int time, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, ExportRectangle viewRectRaw, Matrix fullTransformation, boolean scaleStrokes, int drawMode, int blendMode, boolean canUseSmoothing, List ignoreDepths, int aaScale) { if (getFrameCount() <= frame) { return; } @@ -1732,7 +1734,7 @@ public class Timeline { Rectangle2D r = new Rectangle2D.Double(p1.xMin, p1.yMin, p1.getWidth(), p1.getHeight()); g.setClip(r); - drawDrawable(swf, strokeTransformation, layer, transforms[s], g, colorTransform, layer.blendMode, blendMode, clips, transformation, isClip, layer.clipDepth, absMat, layer.time + time, layer.ratio, renderContext, image, fullImage, (DrawableTag) character, layer.filters, unzoom, clrTrans, sameImage, viewRect, viewRectRaw, fullTransformation, false, DRAW_MODE_SHAPES, canUseSmoothing); + drawDrawable(swf, strokeTransformation, layer, transforms[s], g, colorTransform, layer.blendMode, blendMode, clips, transformation, isClip, layer.clipDepth, absMat, layer.time + time, layer.ratio, renderContext, image, fullImage, (DrawableTag) character, layer.filters, unzoom, clrTrans, sameImage, viewRect, viewRectRaw, fullTransformation, false, DRAW_MODE_SHAPES, canUseSmoothing, aaScale); s++; } } @@ -1741,13 +1743,13 @@ public class Timeline { g.setTransform(origTransform); //draw all nonshapes (normally scaled) next - drawDrawable(swf, strokeTransformation, layer, layerMatrix, g, colorTransform, layer.blendMode, blendMode, clips, transformation, isClip, layer.clipDepth, absMat, layer.time + time, layer.ratio, renderContext, image, fullImage, (DrawableTag) character, layer.filters, unzoom, clrTrans, sameImage, viewRect, viewRectRaw, fullTransformation, scaleStrokes, DRAW_MODE_SPRITES, canUseSmoothing); + drawDrawable(swf, strokeTransformation, layer, layerMatrix, g, colorTransform, layer.blendMode, blendMode, clips, transformation, isClip, layer.clipDepth, absMat, layer.time + time, layer.ratio, renderContext, image, fullImage, (DrawableTag) character, layer.filters, unzoom, clrTrans, sameImage, viewRect, viewRectRaw, fullTransformation, scaleStrokes, DRAW_MODE_SPRITES, canUseSmoothing, aaScale); } else { boolean subScaleStrokes = scaleStrokes; if (character instanceof DefineSpriteTag) { subScaleStrokes = true; } - drawDrawable(swf, strokeTransformation, layer, layerMatrix, g, colorTransform, layer.blendMode, blendMode, clips, transformation, isClip, layer.clipDepth, absMat, layer.time + time, layer.ratio, renderContext, image, fullImage, (DrawableTag) character, layer.filters, unzoom, clrTrans, sameImage, viewRect, viewRectRaw, fullTransformation, subScaleStrokes, DRAW_MODE_ALL, canUseSmoothing); + drawDrawable(swf, strokeTransformation, layer, layerMatrix, g, colorTransform, layer.blendMode, blendMode, clips, transformation, isClip, layer.clipDepth, absMat, layer.time + time, layer.ratio, renderContext, image, fullImage, (DrawableTag) character, layer.filters, unzoom, clrTrans, sameImage, viewRect, viewRectRaw, fullTransformation, subScaleStrokes, DRAW_MODE_ALL, canUseSmoothing, aaScale); } } else if (character instanceof BoundedTag) { showPlaceholder = true; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/shaperecords/SHAPERECORD.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/shaperecords/SHAPERECORD.java index 61e592895..8e209ae09 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/shaperecords/SHAPERECORD.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/shaperecords/SHAPERECORD.java @@ -283,14 +283,14 @@ public abstract class SHAPERECORD implements Cloneable, NeedsCharacters, Seriali Matrix transformation = Matrix.getTranslateInstance(px, py); transformation.scale(ratio); - BitmapExporter.export(windingRule, shapeNum, swf, shape, color, image, 1 /*FIXME??*/, transformation, transformation, colorTransform, true, true); + BitmapExporter.export(windingRule, shapeNum, swf, shape, color, image, 1 /*FIXME??*/, transformation, transformation, colorTransform, true, true, 1 /*??*/); // draw bounding boxes if (DRAW_BOUNDING_BOX) { RGB borderColor = new RGBA(Color.black); RGB fillColor = new RGBA(new Color(255, 255, 255, 0)); transformation = Matrix.getTranslateInstance(bounds.Xmin, bounds.Ymin).preConcatenate(transformation); - TextTag.drawBorder(swf, image, borderColor, fillColor, bounds, new MATRIX(), transformation, colorTransform); + TextTag.drawBorder(swf, image, borderColor, fillColor, bounds, new MATRIX(), transformation, colorTransform, 1 /*??*/); } pos++; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/helpers/SerializableImage.java b/libsrc/ffdec_lib/src/com/jpexs/helpers/SerializableImage.java index 75451cb48..38a622336 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/helpers/SerializableImage.java +++ b/libsrc/ffdec_lib/src/com/jpexs/helpers/SerializableImage.java @@ -126,7 +126,7 @@ public class SerializableImage implements Serializable { Graphics2D g = (Graphics2D) image.getGraphics(); g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); - g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); + g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); return graphics = g; } diff --git a/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java b/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java index 3996bac9f..95547ea0d 100644 --- a/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java +++ b/src/com/jpexs/decompiler/flash/console/CommandLineArgumentParser.java @@ -2278,6 +2278,8 @@ public class CommandLineArgumentParser { } } + int aaScale = Configuration.reduceAntialiasConflationByScalingForExport.get() ? Configuration.reduceAntialiasConflationByScalingValueForExport.get() : 1; + // Here the exportFormats array should contain only validitems commandLineMode = true; boolean exportAll = exportFormats.contains("all"); @@ -2291,12 +2293,12 @@ public class CommandLineArgumentParser { if (exportAll || exportFormats.contains("shape")) { System.out.println("Exporting shapes..."); - new ShapeExporter().exportShapes(handler, outDir + (multipleExportTypes ? File.separator + ShapeExportSettings.EXPORT_FOLDER_NAME : ""), swf, new ReadOnlyTagList(extags), new ShapeExportSettings(enumFromStr(formats.get("shape"), ShapeExportMode.class), zoom), evl, zoom); + new ShapeExporter().exportShapes(handler, outDir + (multipleExportTypes ? File.separator + ShapeExportSettings.EXPORT_FOLDER_NAME : ""), swf, new ReadOnlyTagList(extags), new ShapeExportSettings(enumFromStr(formats.get("shape"), ShapeExportMode.class), zoom), evl, zoom, aaScale); } if (exportAll || exportFormats.contains("morphshape")) { System.out.println("Exporting morphshapes..."); - new MorphShapeExporter().exportMorphShapes(handler, outDir + (multipleExportTypes ? File.separator + MorphShapeExportSettings.EXPORT_FOLDER_NAME : ""), new ReadOnlyTagList(extags), new MorphShapeExportSettings(enumFromStr(formats.get("morphshape"), MorphShapeExportMode.class), zoom), evl); + new MorphShapeExporter().exportMorphShapes(handler, outDir + (multipleExportTypes ? File.separator + MorphShapeExportSettings.EXPORT_FOLDER_NAME : ""), new ReadOnlyTagList(extags), new MorphShapeExportSettings(enumFromStr(formats.get("morphshape"), MorphShapeExportMode.class), zoom, aaScale), evl); } if (exportAll || exportFormats.contains("movie")) { @@ -2348,13 +2350,13 @@ public class CommandLineArgumentParser { frames.add(i); } } - FrameExportSettings fes = new FrameExportSettings(enumFromStr(formats.get("frame"), FrameExportMode.class), zoom, transparentBackground); + FrameExportSettings fes = new FrameExportSettings(enumFromStr(formats.get("frame"), FrameExportMode.class), zoom, transparentBackground, aaScale); frameExporter.exportFrames(handler, outDir + (multipleExportTypes ? File.separator + FrameExportSettings.EXPORT_FOLDER_NAME : ""), swf, 0, frames, subFrameLength, fes, evl); } if (exportAll || exportFormats.contains("sprite")) { System.out.println("Exporting sprite..."); - SpriteExportSettings ses = new SpriteExportSettings(enumFromStr(formats.get("sprite"), SpriteExportMode.class), zoom); + SpriteExportSettings ses = new SpriteExportSettings(enumFromStr(formats.get("sprite"), SpriteExportMode.class), zoom, aaScale); for (Tag t : extags) { if (t instanceof DefineSpriteTag) { List frames = new ArrayList<>(); @@ -2371,7 +2373,7 @@ public class CommandLineArgumentParser { if (exportAll || exportFormats.contains("button")) { System.out.println("Exporting buttons..."); - ButtonExportSettings bes = new ButtonExportSettings(enumFromStr(formats.get("button"), ButtonExportMode.class), zoom); + ButtonExportSettings bes = new ButtonExportSettings(enumFromStr(formats.get("button"), ButtonExportMode.class), zoom, aaScale); for (Tag t : extags) { if (t instanceof ButtonTag) { frameExporter.exportButtonFrames(handler, outDir + (multipleExportTypes ? File.separator + ButtonExportSettings.EXPORT_FOLDER_NAME : ""), swf, ((ButtonTag) t).getCharacterId(), null, bes, evl); @@ -2950,6 +2952,8 @@ public class CommandLineArgumentParser { File inFile = new File(args.pop()); File outFile = new File(args.pop()); printHeader(); + + int aaScale = Configuration.reduceAntialiasConflationByScalingForExport.get() ? Configuration.reduceAntialiasConflationByScalingValueForExport.get() : 1; try (StdInAwareFileInputStream is = new StdInAwareFileInputStream(inFile)) { @@ -3035,7 +3039,7 @@ public class CommandLineArgumentParser { renderContext.stateUnderCursor = new ArrayList<>(); try { - tim.toImage(fframe, fframe, renderContext, image, image, false, m, new Matrix(), m, null, zoom, true, new ExportRectangle(rect), new ExportRectangle(rect), m, true, Timeline.DRAW_MODE_ALL, 0, true, new ArrayList<>()); + tim.toImage(fframe, fframe, renderContext, image, image, false, m, new Matrix(), m, null, zoom, true, new ExportRectangle(rect), new ExportRectangle(rect), m, true, Timeline.DRAW_MODE_ALL, 0, true, new ArrayList<>(), aaScale); } catch (Exception ex) { ex.printStackTrace(); } diff --git a/src/com/jpexs/decompiler/flash/gui/FolderPreviewPanel.java b/src/com/jpexs/decompiler/flash/gui/FolderPreviewPanel.java index dcc3a5579..d76baf298 100644 --- a/src/com/jpexs/decompiler/flash/gui/FolderPreviewPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/FolderPreviewPanel.java @@ -38,6 +38,7 @@ import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; +import java.awt.Image; import java.awt.Rectangle; import java.awt.SystemColor; import java.awt.event.MouseAdapter; @@ -306,6 +307,9 @@ public class FolderPreviewPanel extends JPanel { if (treeItem instanceof SceneFrame) { treeItem = ((SceneFrame) treeItem).getFrame(); } + + int aaScale = Configuration.reduceAntialiasConflationByScalingForDisplay.get() ? Configuration.reduceAntialiasConflationByScalingValueForDisplay.get() : 1; + if (treeItem instanceof Frame) { Frame fn = (Frame) treeItem; RECT rect = swf.displayRect; @@ -328,8 +332,10 @@ public class FolderPreviewPanel extends JPanel { Timeline timeline = swf.getTimeline(); String key = "frame_" + fn.frame + "_" + timeline.id + "_" + zoom; imgSrc = swf.getFromCache(key); - if (imgSrc == null) { - imgSrc = SWF.frameToImageGet(timeline, fn.frame, 0, null, 0, rect, new Matrix(), null, swf.getBackgroundColor() == null ? null : swf.getBackgroundColor().backgroundColor.toColor(), zoom, !Configuration.disableBitmapSmoothing.get()); + if (imgSrc == null) { + aaScale = Configuration.calculateRealAaScale(rect.getWidth(), rect.getHeight(), zoom, aaScale); + + imgSrc = SWF.frameToImageGet(timeline, fn.frame, 0, null, 0, rect, new Matrix(), null, swf.getBackgroundColor() == null ? null : swf.getBackgroundColor().backgroundColor.toColor(), zoom, !Configuration.disableBitmapSmoothing.get(), aaScale); swf.putToCache(key, imgSrc); } @@ -373,24 +379,39 @@ public class FolderPreviewPanel extends JPanel { scale = 1; } - m = m.preConcatenate(Matrix.getScaleInstance(scale)); width = (int) (scale * width); height = (int) (scale * height); if (width == 0 || height == 0) { return null; } - SerializableImage image = new SerializableImage(width, height, SerializableImage.TYPE_INT_ARGB); - image.fillTransparent(); + aaScale = Configuration.calculateRealAaScale(width, height, 1, aaScale); + if (imgSrc == null) { + m = m.preConcatenate(Matrix.getScaleInstance(scale * aaScale)); DrawableTag drawable = (DrawableTag) treeItem; ExportRectangle viewRectangle = new ExportRectangle(0, 0, ow, oh); - drawable.toImage(0, 0, 0, new RenderContext(), image, image, false, m, new Matrix(), m, m, null, scale, false, viewRectangle, viewRectangle, true, Timeline.DRAW_MODE_ALL, 0, !Configuration.disableBitmapSmoothing.get()); - } else { - Graphics2D g = (Graphics2D) image.getGraphics(); - g.setTransform(m.toTransform()); - g.drawImage(imgSrc.getBufferedImage(), 0, 0, null); - } + + SerializableImage imageLarger = new SerializableImage(width * aaScale, height * aaScale, SerializableImage.TYPE_INT_ARGB); + imageLarger.fillTransparent(); + drawable.toImage(0, 0, 0, new RenderContext(), imageLarger, imageLarger, false, m, new Matrix(), m, m, null, scale * aaScale, false, viewRectangle, viewRectangle, true, Timeline.DRAW_MODE_ALL, 0, !Configuration.disableBitmapSmoothing.get(), aaScale); + if (aaScale > 1) { + SerializableImage imageNormalSize = new SerializableImage(width, height, SerializableImage.TYPE_INT_ARGB); + imageNormalSize.fillTransparent(); + + imageNormalSize.getGraphics().drawImage(imageLarger.getBufferedImage().getScaledInstance(width, height, Image.SCALE_SMOOTH), 0, 0, null); + return imageNormalSize; + } + return imageLarger; + } + + m = m.preConcatenate(Matrix.getScaleInstance(scale)); + + SerializableImage image = new SerializableImage(width, height, SerializableImage.TYPE_INT_ARGB); + image.fillTransparent(); + Graphics2D g = (Graphics2D) image.getGraphics(); + g.setTransform(m.toTransform()); + g.drawImage(imgSrc.getBufferedImage(), 0, 0, null); return image; } diff --git a/src/com/jpexs/decompiler/flash/gui/ImagePanel.java b/src/com/jpexs/decompiler/flash/gui/ImagePanel.java index 8dd52d498..3db95b9c6 100644 --- a/src/com/jpexs/decompiler/flash/gui/ImagePanel.java +++ b/src/com/jpexs/decompiler/flash/gui/ImagePanel.java @@ -5033,10 +5033,14 @@ public final class ImagePanel extends JPanel implements MediaDisplay { image.fillTransparent(); Matrix m = Matrix.getTranslateInstance(-rect.Xmin * zoomDouble, -rect.Ymin * zoomDouble); m.scale(zoomDouble); - textTag.toImage(0, 0, 0, new RenderContext(), image, image, false, m, m, m, m, new ConstantColorColorTransform(0xFFC0C0C0), zoomDouble, false, new ExportRectangle(rect), new ExportRectangle(rect), true, Timeline.DRAW_MODE_ALL, 0, false); + + int aaScale = Configuration.reduceAntialiasConflationByScalingForDisplay.get() ? Configuration.reduceAntialiasConflationByScalingValueForDisplay.get() : 1; + + + textTag.toImage(0, 0, 0, new RenderContext(), image, image, false, m, m, m, m, new ConstantColorColorTransform(0xFFC0C0C0), zoomDouble, false, new ExportRectangle(rect), new ExportRectangle(rect), true, Timeline.DRAW_MODE_ALL, 0, false, aaScale); if (newTextTag != null) { - newTextTag.toImage(0, 0, 0, new RenderContext(), image, image, false, m, m, m, m, new ConstantColorColorTransform(0xFF000000), zoomDouble, false, new ExportRectangle(rect), new ExportRectangle(rect), true, Timeline.DRAW_MODE_ALL, 0, false); + newTextTag.toImage(0, 0, 0, new RenderContext(), image, image, false, m, m, m, m, new ConstantColorColorTransform(0xFF000000), zoomDouble, false, new ExportRectangle(rect), new ExportRectangle(rect), true, Timeline.DRAW_MODE_ALL, 0, false, aaScale); } iconPanel.setImg(image); @@ -5167,7 +5171,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay { ) { Timeline timeline = drawable.getTimeline(); SerializableImage img; - int aaScale = 10; + int aaScale = Configuration.reduceAntialiasConflationByScalingForDisplay.get() ? Configuration.reduceAntialiasConflationByScalingValueForDisplay.get() : 1; int width = aaScale * (int) (viewRect.getWidth() * zoom); int height = aaScale * (int) (viewRect.getHeight() * zoom); @@ -5240,7 +5244,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay { if (Configuration.halfTransparentParentLayersEasy.get()) { parentTimelined.getTimeline().toImage(parentFrames.get(i), 0, new RenderContext(), image, image, false, parentMatrix.preConcatenate(m), new Matrix(), parentMatrix.preConcatenate(m), null, zoom * aaScale, true, viewRect, viewRect, parentMatrix.preConcatenate(m), true, Timeline.DRAW_MODE_ALL, 0, !Configuration.disableBitmapSmoothing.get(), - ignoreDepths); + ignoreDepths, aaScale); } parentMatrix = parentMatrix.concatenate(new Matrix(parentDepthState.matrix)); ignoreDepths.clear(); @@ -5252,16 +5256,19 @@ public final class ImagePanel extends JPanel implements MediaDisplay { g.fillRect(realRectAA.x, realRectAA.y, realRectAA.width, realRectAA.height); } - timeline.toImage(frame, time, renderContext, image, image, false, parentMatrix.preConcatenate(m), new Matrix(), parentMatrix.preConcatenate(m), null, zoom * aaScale, true, viewRect, viewRect, parentMatrix.preConcatenate(m), true, Timeline.DRAW_MODE_ALL, 0, !Configuration.disableBitmapSmoothing.get(), ignoreDepths); + timeline.toImage(frame, time, renderContext, image, image, false, parentMatrix.preConcatenate(m), new Matrix(), parentMatrix.preConcatenate(m), null, zoom * aaScale, true, viewRect, viewRect, parentMatrix.preConcatenate(m), true, Timeline.DRAW_MODE_ALL, 0, !Configuration.disableBitmapSmoothing.get(), ignoreDepths, aaScale); - SerializableImage img2 = new SerializableImage(image.getWidth() / aaScale, image.getHeight() / aaScale, BufferedImage.TYPE_INT_ARGB_PRE); - img2.fillTransparent(); - Graphics2D g2 = (Graphics2D) img2.getGraphics(); - //g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - //g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); - //g2.drawImage(image.getBufferedImage(), 0, 0, img2.getWidth(), img2.getHeight(), 0, 0, image.getWidth(), image.getHeight(), null); - g2.drawImage(image.getBufferedImage().getScaledInstance(image.getWidth() / aaScale, image.getHeight() / aaScale, Image.SCALE_SMOOTH), 0, 0, null); - image = img2; + if (Configuration.reduceAntialiasConflationByScalingForDisplay.get()) { + SerializableImage img2 = new SerializableImage(image.getWidth() / aaScale, image.getHeight() / aaScale, BufferedImage.TYPE_INT_ARGB_PRE); + img2.fillTransparent(); + Graphics2D g2 = (Graphics2D) img2.getGraphics(); + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); + g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); + //g2.drawImage(image.getBufferedImage(), 0, 0, img2.getWidth(), img2.getHeight(), 0, 0, image.getWidth(), image.getHeight(), null); + g2.drawImage(image.getBufferedImage().getScaledInstance(image.getWidth() / aaScale, image.getHeight() / aaScale, Image.SCALE_SMOOTH), 0, 0, null); + image = img2; + } Graphics2D gg = (Graphics2D) image.getGraphics(); gg.setStroke(new BasicStroke(3)); diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 593e0e694..d9f572a4c 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -2269,6 +2269,10 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se selFile2 = selFile; } + + int aaScale = Configuration.reduceAntialiasConflationByScalingForExport.get() ? Configuration.reduceAntialiasConflationByScalingValueForExport.get() : 1; + + EventListener evl = swf.getExportEventListener(); if (export.isOptionEnabled(ImageExportMode.class)) { @@ -2278,12 +2282,12 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se if (export.isOptionEnabled(ShapeExportMode.class)) { ret.addAll(new ShapeExporter().exportShapes(handler, selFile2 + File.separator + ShapeExportSettings.EXPORT_FOLDER_NAME, swf, new ReadOnlyTagList(shapes), - new ShapeExportSettings(export.getValue(ShapeExportMode.class), export.getZoom()), evl, export.getZoom())); + new ShapeExportSettings(export.getValue(ShapeExportMode.class), export.getZoom()), evl, export.getZoom(), aaScale)); } if (export.isOptionEnabled(MorphShapeExportMode.class)) { ret.addAll(new MorphShapeExporter().exportMorphShapes(handler, selFile2 + File.separator + MorphShapeExportSettings.EXPORT_FOLDER_NAME, new ReadOnlyTagList(morphshapes), - new MorphShapeExportSettings(export.getValue(MorphShapeExportMode.class), export.getZoom()), evl)); + new MorphShapeExportSettings(export.getValue(MorphShapeExportMode.class), export.getZoom(), aaScale), evl)); } if (export.isOptionEnabled(TextExportMode.class)) { @@ -2324,7 +2328,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se FrameExporter frameExporter = new FrameExporter(); if (export.isOptionEnabled(FrameExportMode.class)) { - FrameExportSettings fes = new FrameExportSettings(export.getValue(FrameExportMode.class), export.getZoom(), export.isTransparentFrameBackgroundEnabled()); + FrameExportSettings fes = new FrameExportSettings(export.getValue(FrameExportMode.class), export.getZoom(), export.isTransparentFrameBackgroundEnabled(), aaScale); if (frames.containsKey(0)) { String subFolder = FrameExportSettings.EXPORT_FOLDER_NAME; ret.addAll(frameExporter.exportFrames(handler, selFile2 + File.separator + subFolder, swf, 0, frames.get(0), 1, fes, evl)); @@ -2332,7 +2336,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se } if (export.isOptionEnabled(SpriteExportMode.class)) { - SpriteExportSettings ses = new SpriteExportSettings(export.getValue(SpriteExportMode.class), export.getZoom()); + SpriteExportSettings ses = new SpriteExportSettings(export.getValue(SpriteExportMode.class), export.getZoom(), aaScale); for (Entry> entry : frames.entrySet()) { int containerId = entry.getKey(); if (containerId != 0) { @@ -2343,7 +2347,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se } if (export.isOptionEnabled(ButtonExportMode.class)) { - ButtonExportSettings bes = new ButtonExportSettings(export.getValue(ButtonExportMode.class), export.getZoom()); + ButtonExportSettings bes = new ButtonExportSettings(export.getValue(ButtonExportMode.class), export.getZoom(), aaScale); for (Tag tag : buttons) { ButtonTag button = (ButtonTag) tag; String subFolder = ButtonExportSettings.EXPORT_FOLDER_NAME; @@ -2387,6 +2391,8 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se return; } + int aaScale = Configuration.reduceAntialiasConflationByScalingForExport.get() ? Configuration.reduceAntialiasConflationByScalingValueForExport.get() : 1; + EventListener evl = swf.getExportEventListener(); if (export.isOptionEnabled(ImageExportMode.class)) { @@ -2396,12 +2402,12 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se if (export.isOptionEnabled(ShapeExportMode.class)) { new ShapeExporter().exportShapes(handler, Path.combine(selFile, ShapeExportSettings.EXPORT_FOLDER_NAME), swf, swf.getTags(), - new ShapeExportSettings(export.getValue(ShapeExportMode.class), export.getZoom()), evl, export.getZoom()); + new ShapeExportSettings(export.getValue(ShapeExportMode.class), export.getZoom()), evl, export.getZoom(), aaScale); } if (export.isOptionEnabled(MorphShapeExportMode.class)) { new MorphShapeExporter().exportMorphShapes(handler, Path.combine(selFile, MorphShapeExportSettings.EXPORT_FOLDER_NAME), swf.getTags(), - new MorphShapeExportSettings(export.getValue(MorphShapeExportMode.class), export.getZoom()), evl); + new MorphShapeExportSettings(export.getValue(MorphShapeExportMode.class), export.getZoom(), aaScale), evl); } if (export.isOptionEnabled(TextExportMode.class)) { @@ -2437,12 +2443,12 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se FrameExporter frameExporter = new FrameExporter(); if (export.isOptionEnabled(FrameExportMode.class)) { - FrameExportSettings fes = new FrameExportSettings(export.getValue(FrameExportMode.class), export.getZoom(), export.isTransparentFrameBackgroundEnabled()); + FrameExportSettings fes = new FrameExportSettings(export.getValue(FrameExportMode.class), export.getZoom(), export.isTransparentFrameBackgroundEnabled(), aaScale); frameExporter.exportFrames(handler, Path.combine(selFile, FrameExportSettings.EXPORT_FOLDER_NAME), swf, 0, null, 1, fes, evl); } if (export.isOptionEnabled(SpriteExportMode.class)) { - SpriteExportSettings ses = new SpriteExportSettings(export.getValue(SpriteExportMode.class), export.getZoom()); + SpriteExportSettings ses = new SpriteExportSettings(export.getValue(SpriteExportMode.class), export.getZoom(), aaScale); for (CharacterTag c : swf.getCharacters(false).values()) { if (c instanceof DefineSpriteTag) { frameExporter.exportSpriteFrames(handler, Path.combine(selFile, SpriteExportSettings.EXPORT_FOLDER_NAME), swf, c.getCharacterId(), null, 1, ses, evl); @@ -2451,7 +2457,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se } if (export.isOptionEnabled(ButtonExportMode.class)) { - ButtonExportSettings bes = new ButtonExportSettings(export.getValue(ButtonExportMode.class), export.getZoom()); + ButtonExportSettings bes = new ButtonExportSettings(export.getValue(ButtonExportMode.class), export.getZoom(), aaScale); for (CharacterTag c : swf.getCharacters(false).values()) { if (c instanceof ButtonTag) { frameExporter.exportButtonFrames(handler, Path.combine(selFile, ButtonExportSettings.EXPORT_FOLDER_NAME), swf, c.getCharacterId(), null, bes, evl); @@ -2481,6 +2487,8 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se public void exportAllDebug(SWF swf, AbortRetryIgnoreHandler handler, String selFile, ExportDialog export) throws IOException, InterruptedException { EventListener evl = swf.getExportEventListener(); + int aaScale = Configuration.reduceAntialiasConflationByScalingForExport.get() ? Configuration.reduceAntialiasConflationByScalingValueForExport.get() : 1; + if (export.isOptionEnabled(ImageExportMode.class)) { for (ImageExportMode exportMode : ImageExportMode.values()) { new ImageExporter().exportImages(handler, Path.combine(selFile, ImageExportSettings.EXPORT_FOLDER_NAME, exportMode.name()), swf.getTags(), @@ -2491,14 +2499,14 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se if (export.isOptionEnabled(ShapeExportMode.class)) { for (ShapeExportMode exportMode : ShapeExportMode.values()) { new ShapeExporter().exportShapes(handler, Path.combine(selFile, ShapeExportSettings.EXPORT_FOLDER_NAME, exportMode.name()), swf, swf.getTags(), - new ShapeExportSettings(exportMode, export.getZoom()), evl, export.getZoom()); + new ShapeExportSettings(exportMode, export.getZoom()), evl, export.getZoom(), aaScale); } } if (export.isOptionEnabled(MorphShapeExportMode.class)) { for (MorphShapeExportMode exportMode : MorphShapeExportMode.values()) { new MorphShapeExporter().exportMorphShapes(handler, Path.combine(selFile, MorphShapeExportSettings.EXPORT_FOLDER_NAME, exportMode.name()), swf.getTags(), - new MorphShapeExportSettings(exportMode, export.getZoom()), evl); + new MorphShapeExportSettings(exportMode, export.getZoom(), aaScale), evl); } } @@ -2548,14 +2556,14 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se if (export.isOptionEnabled(FrameExportMode.class)) { for (FrameExportMode exportMode : FrameExportMode.values()) { - FrameExportSettings fes = new FrameExportSettings(exportMode, export.getZoom(), export.isTransparentFrameBackgroundEnabled()); + FrameExportSettings fes = new FrameExportSettings(exportMode, export.getZoom(), export.isTransparentFrameBackgroundEnabled(), aaScale); frameExporter.exportFrames(handler, Path.combine(selFile, FrameExportSettings.EXPORT_FOLDER_NAME, exportMode.name()), swf, 0, null, 1, fes, evl); } } if (export.isOptionEnabled(SpriteExportMode.class)) { for (SpriteExportMode exportMode : SpriteExportMode.values()) { - SpriteExportSettings ses = new SpriteExportSettings(exportMode, export.getZoom()); + SpriteExportSettings ses = new SpriteExportSettings(exportMode, export.getZoom(), aaScale); for (CharacterTag c : swf.getCharacters(false).values()) { if (c instanceof DefineSpriteTag) { frameExporter.exportSpriteFrames(handler, Path.combine(selFile, SpriteExportSettings.EXPORT_FOLDER_NAME, exportMode.name()), swf, c.getCharacterId(), null, 1, ses, evl); @@ -2566,7 +2574,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se if (export.isOptionEnabled(ButtonExportMode.class)) { for (ButtonExportMode exportMode : ButtonExportMode.values()) { - ButtonExportSettings bes = new ButtonExportSettings(exportMode, export.getZoom()); + ButtonExportSettings bes = new ButtonExportSettings(exportMode, export.getZoom(), aaScale); for (CharacterTag c : swf.getCharacters(false).values()) { if (c instanceof ButtonTag) { frameExporter.exportButtonFrames(handler, Path.combine(selFile, ButtonExportSettings.EXPORT_FOLDER_NAME, exportMode.name()), swf, c.getCharacterId(), null, bes, evl); @@ -5592,8 +5600,11 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se try { AbortRetryIgnoreHandler errorHandler = new GuiAbortRetryIgnoreHandler(); + int aaScale = Configuration.reduceAntialiasConflationByScalingForExport.get() ? Configuration.reduceAntialiasConflationByScalingValueForExport.get() : 1; + + FrameExporter frameExporter = new FrameExporter(); - FrameExportSettings fes = new FrameExportSettings(mode, dialog.getZoom(), dialog.isTransparentFrameBackgroundEnabled()); + FrameExportSettings fes = new FrameExportSettings(mode, dialog.getZoom(), dialog.isTransparentFrameBackgroundEnabled(), aaScale); String subFolder = FrameExportSettings.EXPORT_FOLDER_NAME; if (fContainerId != 0) { subFolder = SpriteExportSettings.EXPORT_FOLDER_NAME; diff --git a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties index 332412490..41c5fc2ab 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties @@ -642,3 +642,15 @@ config.description.showVarsWithDontEnumerateFlag = While debugging ActionScript, config.name.allowDragAndDropFromResourcesTree = Allow drag and drop from resources view tree config.description.allowDragAndDropFromResourcesTree = Enable drag and drop items from tree of resources view to export them. On Mac OS, drag out is annoying as it requires all files to be exported before drag starts. Set this to false to avoid accidentally dragging and freezing the application. + +config.name.reduceAntialiasConflationByScalingForDisplay = Reduce antialias conflation by scaling (Display) +config.description.reduceAntialiasConflationByScalingForDisplay = Reduce conflation artifacts caused by antialiasing by producing larger image and then scaling it down. Used for display in the decompiler. + +config.name.reduceAntialiasConflationByScalingValueForDisplay = Max scale value for reducing antialias conflation (Display) +config.description.reduceAntialiasConflationByScalingValueForDisplay = Maximal scale coefficient for reducing antialias conflation. Used for display in the decompiler. Larger value = slower display, but more accurate result, also uses more memory. 1 = none, 10 = optimal, 20 = perfect. It's real value might be lower depending on dimension of images. + +config.name.reduceAntialiasConflationByScalingForExport = Reduce antialias conflation by scaling (Export) +config.description.reduceAntialiasConflationByScalingForExport = Reduce conflation artifacts caused by antialiasing by producing larger image and then scaling it down. Used for exporting. + +config.name.reduceAntialiasConflationByScalingValueForExport = Max scale value for reducing antialias conflation (Export) +config.description.reduceAntialiasConflationByScalingValueForExport = Maximal scale coefficient for reducing antialias conflation. Used for exporting. Larger value = slower export, but more accurate result, also uses more memory. 1 = none, 10 = optimal, 20 = perfect. It's real value might be lower depending on dimension of images. diff --git a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_cs.properties b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_cs.properties index 98f90d000..6bacedc3d 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_cs.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_cs.properties @@ -642,3 +642,15 @@ config.description.showVarsWithDontEnumerateFlag = B\u011bhem lad\u011bn\u00ed A config.name.allowDragAndDropFromResourcesTree = Povolit drag and drop ze stromu zobrazen\u00ed Zdroj\u016f config.description.allowDragAndDropFromResourcesTree = Povolit drag and drop polo\u017eek ze stromu v zobrazen\u00ed zdroj\u016f pro jejich export. Na Mac OS je ta\u017een\u00ed nep\u0159\u00edjemn\u00e9, jeliko\u017e vy\u017eaduje m\u00edt v\u0161echny soubory exportovan\u00e9 p\u0159edem ne\u017e ta\u017een\u00ed za\u010dne. Vypn\u011bte toto tedy pro zabr\u00e1n\u011bn\u00ed ta\u017een\u00ed omylem a zamrznut\u00ed aplikace. + +config.name.reduceAntialiasConflationByScalingForDisplay = Redukovat antialiasovou konflaci pomoc\u00ed \u0161k\u00e1lov\u00e1n\u00ed (Zobrazen\u00ed) +config.description.reduceAntialiasConflationByScalingForDisplay = Redukuje konfla\u010dn\u00ed artefakty zp\u016fsobovan\u00e9 antialiasingem pomoc\u00ed generov\u00e1n\u00ed velk\u00fdch obr\u00e1zk\u016f a pot\u00e9 jejich zmen\u0161en\u00edm. Pou\u017e\u00edvan\u00e9 pro zobrazen\u00ed v dekompil\u00e1toru. + +config.name.reduceAntialiasConflationByScalingValueForDisplay = Maxim\u00e1ln\u00ed hodnota \u0161k\u00e1lov\u00e1n\u00ed pro redukci antialiasov\u00e9 konflace (Zobrazen\u00ed) +config.description.reduceAntialiasConflationByScalingValueForDisplay = Maxim\u00e1ln\u00ed \u0161k\u00e1lovac\u00ed koeficient pro redukci antialiasingov\u00e9 konflace. Pou\u017e\u00edvan\u00e9 pro zobrazen\u00ed v dekompil\u00e1toru. V\u011bt\u0161\u00ed hodnota = pomalej\u0161\u00ed zobrazen\u00ed, ale p\u0159esn\u011bj\u0161\u00ed v\u00fdsledek a tak\u00e9 v\u00edc pou\u017eit\u00e9 pam\u011bti. 1 = nic, 10 = optim\u00e1ln\u00ed, 20 = perfektn\u00ed. Jeho re\u00e1ln\u00ed hodnota m\u016f\u017ee b\u00fdt ni\u017e\u0161\u00ed v z\u00e1vislosti na rozm\u011brech obr\u00e1zk\u016f. + +config.name.reduceAntialiasConflationByScalingForExport = Redukovat antialiasovou konflaci pomoc\u00ed \u0161k\u00e1lov\u00e1n\u00ed (Export) +config.description.reduceAntialiasConflationByScalingForExport = Redukuje konfla\u010dn\u00ed artefakty zp\u016fsobovan\u00e9 antialiasingem pomoc\u00ed generov\u00e1n\u00ed velk\u00fdch obr\u00e1zk\u016f a pot\u00e9 jejich zmen\u0161en\u00edm. Pou\u017e\u00edvan\u00e9 pro export. + +config.name.reduceAntialiasConflationByScalingValueForExport = Maxim\u00e1ln\u00ed hodnota \u0161k\u00e1lov\u00e1n\u00ed pro redukci antialiasov\u00e9 konflace (Export) +config.description.reduceAntialiasConflationByScalingValueForExport = Maxim\u00e1ln\u00ed \u0161k\u00e1lovac\u00ed koeficient pro redukci antialiasingov\u00e9 konflace. Pou\u017e\u00edvan\u00e9 pro export. V\u011bt\u0161\u00ed hodnota = pomalej\u0161\u00ed export, ale p\u0159esn\u011bj\u0161\u00ed v\u00fdsledek a tak\u00e9 v\u00edc pou\u017eit\u00e9 pam\u011bti. 1 = nic, 10 = optim\u00e1ln\u00ed, 20 = perfektn\u00ed. Jeho re\u00e1ln\u00ed hodnota m\u016f\u017ee b\u00fdt ni\u017e\u0161\u00ed v z\u00e1vislosti na rozm\u011brech obr\u00e1zk\u016f.