pdf export fix (when no frame exists), text rendering fixed (alpha channel was ignored), bmp export fix (paddings when width%2==1), export in all formats for debugging

This commit is contained in:
honfika@gmail.com
2015-05-10 12:49:48 +02:00
parent 7ea4f2663e
commit c324efb1c5
7 changed files with 1730 additions and 1601 deletions

View File

@@ -1,246 +1,247 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
package com.jpexs.decompiler.flash.helpers;
import java.awt.Component;
import java.awt.Image;
import java.awt.image.PixelGrabber;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
/**
* Adapted from
* http://www.javaworld.com/article/2077561/learn-java/java-tip-60--saving-bitmap-files-in-java.html
*/
public class BMPFile extends Component {
//--- Private constants
private final static int BITMAPFILEHEADER_SIZE = 14;
private final static int BITMAPINFOHEADER_SIZE = 40;
//--- Private variable declaration
//--- Bitmap file header
private final byte[] bitmapFileHeader = new byte[14];
private final byte[] bfType = {'B', 'M'};
private int bfSize = 0;
private final int bfReserved1 = 0;
private final int bfReserved2 = 0;
private final int bfOffBits = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE;
//--- Bitmap info header
private final byte[] bitmapInfoHeader = new byte[40];
private final int biSize = BITMAPINFOHEADER_SIZE;
private int biWidth = 0;
private int biHeight = 0;
private final int biPlanes = 1;
private final int biBitCount = 24;
private final int biCompression = 0;
private int biSizeImage = 0x030000;
private final int biXPelsPerMeter = 0x0;
private final int biYPelsPerMeter = 0x0;
private final int biClrUsed = 0;
private final int biClrImportant = 0;
//--- Bitmap raw data
private int[] bitmap;
//--- File section
private OutputStream fo;
//--- Private constructor
private BMPFile() {
}
public static void saveBitmap(Image image, File file) throws IOException {
BMPFile b = new BMPFile();
try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(file))) {
b.fo = fos;
b.save(image, image.getWidth(null), image.getHeight(null));
}
}
/*
* The saveMethod is the main method of the process. This method
* will call the convertImage method to convert the memory image to
* a byte array; method writeBitmapFileHeader creates and writes
* the bitmap file header; writeBitmapInfoHeader creates the
* information header; and writeBitmap writes the image.
*
*/
private void save(Image parImage, int parWidth, int parHeight) throws IOException {
convertImage(parImage, parWidth, parHeight);
writeBitmapFileHeader();
writeBitmapInfoHeader();
writeBitmap();
}
/*
* convertImage converts the memory image to the bitmap format (BRG).
* It also computes some information for the bitmap info header.
*
*/
private boolean convertImage(Image parImage, int parWidth, int parHeight) {
int pad;
bitmap = new int[parWidth * parHeight];
PixelGrabber pg = new PixelGrabber(parImage, 0, 0, parWidth, parHeight,
bitmap, 0, parWidth);
try {
pg.grabPixels();
} catch (InterruptedException e) {
return (false);
}
pad = (4 - ((parWidth * 3) % 4)) * parHeight;
biSizeImage = ((parWidth * parHeight) * 3) + pad;
bfSize = biSizeImage + BITMAPFILEHEADER_SIZE
+ BITMAPINFOHEADER_SIZE;
biWidth = parWidth;
biHeight = parHeight;
return (true);
}
/*
* writeBitmap converts the image returned from the pixel grabber to
* the format required. Remember: scan lines are inverted in
* a bitmap file!
*
* Each scan line must be padded to an even 4-byte boundary.
*/
private void writeBitmap() throws IOException {
int size;
int value;
int j;
int i;
int rowCount;
int rowIndex;
int lastRowIndex;
int pad;
int padCount;
byte[] rgb = new byte[3];
size = (biWidth * biHeight);
pad = (biWidth * 3) % 4;
rowCount = 1;
padCount = 0;
rowIndex = size - biWidth;
lastRowIndex = rowIndex;
for (j = 0; j < size; j++) {
value = bitmap[rowIndex];
rgb[0] = (byte) (value & 0xFF);
rgb[1] = (byte) ((value >> 8) & 0xFF);
rgb[2] = (byte) ((value >> 16) & 0xFF);
fo.write(rgb);
if (rowCount == biWidth) {
padCount += pad;
for (i = 1; i <= pad; i++) {
fo.write(0x00);
}
rowCount = 1;
rowIndex = lastRowIndex - biWidth;
lastRowIndex = rowIndex;
} else {
rowCount++;
}
rowIndex++;
}
//--- Update the size of the file
bfSize += padCount - pad;
biSizeImage += padCount - pad;
}
/*
* writeBitmapFileHeader writes the bitmap file header to the file.
*
*/
private void writeBitmapFileHeader() throws IOException {
fo.write(bfType);
fo.write(intToDWord(bfSize));
fo.write(intToWord(bfReserved1));
fo.write(intToWord(bfReserved2));
fo.write(intToDWord(bfOffBits));
}
/*
*
* writeBitmapInfoHeader writes the bitmap information header
* to the file.
*
*/
private void writeBitmapInfoHeader() throws IOException {
fo.write(intToDWord(biSize));
fo.write(intToDWord(biWidth));
fo.write(intToDWord(biHeight));
fo.write(intToWord(biPlanes));
fo.write(intToWord(biBitCount));
fo.write(intToDWord(biCompression));
fo.write(intToDWord(biSizeImage));
fo.write(intToDWord(biXPelsPerMeter));
fo.write(intToDWord(biYPelsPerMeter));
fo.write(intToDWord(biClrUsed));
fo.write(intToDWord(biClrImportant));
}
/*
*
* intToWord converts an int to a word, where the return
* value is stored in a 2-byte array.
*
*/
private byte[] intToWord(int parValue) {
byte[] retValue = new byte[2];
retValue[0] = (byte) (parValue & 0x00FF);
retValue[1] = (byte) ((parValue >> 8) & 0x00FF);
return (retValue);
}
/*
*
* intToDWord converts an int to a double word, where the return
* value is stored in a 4-byte array.
*
*/
private byte[] intToDWord(int parValue) {
byte[] retValue = new byte[4];
retValue[0] = (byte) (parValue & 0x00FF);
retValue[1] = (byte) ((parValue >> 8) & 0x000000FF);
retValue[2] = (byte) ((parValue >> 16) & 0x000000FF);
retValue[3] = (byte) ((parValue >> 24) & 0x000000FF);
return (retValue);
}
}
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
package com.jpexs.decompiler.flash.helpers;
import java.awt.Component;
import java.awt.Image;
import java.awt.image.PixelGrabber;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
/**
* Adapted from
* http://www.javaworld.com/article/2077561/learn-java/java-tip-60--saving-bitmap-files-in-java.html
*/
public class BMPFile extends Component {
//--- Private constants
private final static int BITMAPFILEHEADER_SIZE = 14;
private final static int BITMAPINFOHEADER_SIZE = 40;
//--- Private variable declaration
//--- Bitmap file header
private final byte[] bitmapFileHeader = new byte[14];
private final byte[] bfType = {'B', 'M'};
private int bfSize = 0;
private final int bfReserved1 = 0;
private final int bfReserved2 = 0;
private final int bfOffBits = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE;
//--- Bitmap info header
private final byte[] bitmapInfoHeader = new byte[40];
private final int biSize = BITMAPINFOHEADER_SIZE;
private int biWidth = 0;
private int biHeight = 0;
private final int biPlanes = 1;
private final int biBitCount = 24;
private final int biCompression = 0;
private int biSizeImage = 0x030000;
private final int biXPelsPerMeter = 0x0;
private final int biYPelsPerMeter = 0x0;
private final int biClrUsed = 0;
private final int biClrImportant = 0;
//--- Bitmap raw data
private int[] bitmap;
//--- File section
private OutputStream fo;
//--- Private constructor
private BMPFile() {
}
public static void saveBitmap(Image image, File file) throws IOException {
BMPFile b = new BMPFile();
try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(file))) {
b.fo = fos;
b.save(image, image.getWidth(null), image.getHeight(null));
}
}
/*
* The saveMethod is the main method of the process. This method
* will call the convertImage method to convert the memory image to
* a byte array; method writeBitmapFileHeader creates and writes
* the bitmap file header; writeBitmapInfoHeader creates the
* information header; and writeBitmap writes the image.
*
*/
private void save(Image parImage, int parWidth, int parHeight) throws IOException {
convertImage(parImage, parWidth, parHeight);
writeBitmapFileHeader();
writeBitmapInfoHeader();
writeBitmap();
}
/*
* convertImage converts the memory image to the bitmap format (BRG).
* It also computes some information for the bitmap info header.
*
*/
private boolean convertImage(Image parImage, int parWidth, int parHeight) {
int pad;
bitmap = new int[parWidth * parHeight];
PixelGrabber pg = new PixelGrabber(parImage, 0, 0, parWidth, parHeight,
bitmap, 0, parWidth);
try {
pg.grabPixels();
} catch (InterruptedException e) {
return (false);
}
pad = ((4 - ((parWidth * 3) % 4)) % 4) * parHeight;
biSizeImage = ((parWidth * parHeight) * 3) + pad;
bfSize = biSizeImage + BITMAPFILEHEADER_SIZE
+ BITMAPINFOHEADER_SIZE;
biWidth = parWidth;
biHeight = parHeight;
return (true);
}
/*
* writeBitmap converts the image returned from the pixel grabber to
* the format required. Remember: scan lines are inverted in
* a bitmap file!
*
* Each scan line must be padded to an even 4-byte boundary.
*/
private void writeBitmap() throws IOException {
int size;
int value;
int j;
int i;
int rowCount;
int rowIndex;
int lastRowIndex;
int pad;
int padCount;
byte[] rgb = new byte[3];
size = biWidth * biHeight;
pad = ((4 - ((biWidth * 3) % 4)) % 4);
rowCount = 1;
padCount = 0;
rowIndex = size - biWidth;
lastRowIndex = rowIndex;
for (j = 0; j < size; j++) {
value = bitmap[rowIndex];
rgb[0] = (byte) (value & 0xFF);
rgb[1] = (byte) ((value >> 8) & 0xFF);
rgb[2] = (byte) ((value >> 16) & 0xFF);
fo.write(rgb);
if (rowCount == biWidth) {
padCount += pad;
for (i = 1; i <= pad; i++) {
fo.write(0x00);
}
rowCount = 1;
rowIndex = lastRowIndex - biWidth;
lastRowIndex = rowIndex;
} else {
rowCount++;
}
rowIndex++;
}
//--- Update the size of the file
bfSize += padCount - pad;
biSizeImage += padCount - pad;
}
/*
* writeBitmapFileHeader writes the bitmap file header to the file.
*
*/
private void writeBitmapFileHeader() throws IOException {
fo.write(bfType);
fo.write(intToDWord(bfSize));
fo.write(intToWord(bfReserved1));
fo.write(intToWord(bfReserved2));
fo.write(intToDWord(bfOffBits));
}
/*
*
* writeBitmapInfoHeader writes the bitmap information header
* to the file.
*
*/
private void writeBitmapInfoHeader() throws IOException {
fo.write(intToDWord(biSize));
fo.write(intToDWord(biWidth));
fo.write(intToDWord(biHeight));
fo.write(intToWord(biPlanes));
fo.write(intToWord(biBitCount));
fo.write(intToDWord(biCompression));
fo.write(intToDWord(biSizeImage));
fo.write(intToDWord(biXPelsPerMeter));
fo.write(intToDWord(biYPelsPerMeter));
fo.write(intToDWord(biClrUsed));
fo.write(intToDWord(biClrImportant));
}
/*
*
* intToWord converts an int to a word, where the return
* value is stored in a 2-byte array.
*
*/
private byte[] intToWord(int parValue) {
byte[] retValue = new byte[2];
retValue[0] = (byte) (parValue & 0x00FF);
retValue[1] = (byte) ((parValue >> 8) & 0x00FF);
return (retValue);
}
/*
*
* intToDWord converts an int to a double word, where the return
* value is stored in a 4-byte array.
*
*/
private byte[] intToDWord(int parValue) {
byte[] retValue = new byte[4];
retValue[0] = (byte) (parValue & 0x00FF);
retValue[1] = (byte) ((parValue >> 8) & 0x000000FF);
retValue[2] = (byte) ((parValue >> 16) & 0x000000FF);
retValue[3] = (byte) ((parValue >> 24) & 0x000000FF);
return (retValue);
}
}

View File

@@ -429,7 +429,7 @@ public abstract class TextTag extends CharacterTag implements DrawableTag {
double rat = textHeight / 1024.0 / (font == null ? 1 : font.getDivider());
Color textColor2 = new Color(textColor);
Color textColor2 = new Color(textColor, true);
for (GLYPHENTRY entry : rec.glyphEntries) {
Matrix mat = transformation.clone();
mat = mat.concatenate(new Matrix(textMatrix));

View File

@@ -1,22 +1,24 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.types.filters.Filtering;
import com.jpexs.helpers.SerializableImage;
import java.awt.Color;
import java.awt.image.RescaleOp;
/**
@@ -52,6 +54,13 @@ public class ColorTransform implements Cloneable {
return new RGBA(Filtering.colorEffect(color.toInt(), getRedAdd(), getGreenAdd(), getBlueAdd(), getAlphaAdd(), getRedMulti(), getGreenMulti(), getBlueMulti(), getAlphaMulti()));
}
public Color apply(Color color) {
if (color == null) {
return null;
}
return new Color(Filtering.colorEffect(color.getRGB(), getRedAdd(), getGreenAdd(), getBlueAdd(), getAlphaAdd(), getRedMulti(), getGreenMulti(), getBlueMulti(), getAlphaMulti()));
}
public GRADRECORD[] apply(GRADRECORD[] gradRecords) {
GRADRECORD[] ret = new GRADRECORD[gradRecords.length];
for (int i = 0; i < gradRecords.length; i++) {

View File

@@ -41,7 +41,19 @@ public class GuiAbortRetryIgnoreHandler implements AbortRetryIgnoreHandler {
return AbortRetryIgnoreHandler.IGNORE;
}
int result = View.showOptionDialog(null, AppStrings.translate("error.occured").replace("%error%", thrown.getLocalizedMessage()), AppStrings.translate("error"), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, options, "");
String msg = null;
if (thrown != null) {
msg = thrown.getLocalizedMessage();
if (msg == null) {
msg = thrown.toString();
}
}
if (msg == null) {
msg = "";
}
int result = View.showOptionDialog(null, AppStrings.translate("error.occured").replace("%error%", msg), AppStrings.translate("error"), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, options, "");
if (result == AbortRetryIgnoreHandler.IGNORE_ALL) {
ignoreAll = true;
result = AbortRetryIgnoreHandler.IGNORE;

View File

@@ -1222,42 +1222,42 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
EventListener evl = swf.getExportEventListener();
if (export.isOptionEnabled(ImageExportMode.class)) {
new ImageExporter().exportImages(handler, selFile + File.separator + "images", swf.tags,
new ImageExporter().exportImages(handler, Path.combine(selFile, "images"), swf.tags,
new ImageExportSettings(export.getValue(ImageExportMode.class)), evl);
}
if (export.isOptionEnabled(ShapeExportMode.class)) {
new ShapeExporter().exportShapes(handler, selFile + File.separator + "shapes", swf.tags,
new ShapeExporter().exportShapes(handler, Path.combine(selFile, "shapes"), swf.tags,
new ShapeExportSettings(export.getValue(ShapeExportMode.class), export.getZoom()), evl);
}
if (export.isOptionEnabled(MorphShapeExportMode.class)) {
new MorphShapeExporter().exportMorphShapes(handler, selFile + File.separator + "morphshapes", swf.tags,
new MorphShapeExporter().exportMorphShapes(handler, Path.combine(selFile, "morphshapes"), swf.tags,
new MorphShapeExportSettings(export.getValue(MorphShapeExportMode.class), export.getZoom()), evl);
}
if (export.isOptionEnabled(TextExportMode.class)) {
new TextExporter().exportTexts(handler, selFile + File.separator + TextExportSettings.EXPORT_FOLDER_NAME, swf.tags,
new TextExporter().exportTexts(handler, Path.combine(selFile, TextExportSettings.EXPORT_FOLDER_NAME), swf.tags,
new TextExportSettings(export.getValue(TextExportMode.class), Configuration.textExportSingleFile.get(), export.getZoom()), evl);
}
if (export.isOptionEnabled(MovieExportMode.class)) {
new MovieExporter().exportMovies(handler, selFile + File.separator + "movies", swf.tags,
new MovieExporter().exportMovies(handler, Path.combine(selFile, "movies"), swf.tags,
new MovieExportSettings(export.getValue(MovieExportMode.class)), evl);
}
if (export.isOptionEnabled(SoundExportMode.class)) {
new SoundExporter().exportSounds(handler, selFile + File.separator + "sounds", swf.tags,
new SoundExporter().exportSounds(handler, Path.combine(selFile, "sounds"), swf.tags,
new SoundExportSettings(export.getValue(SoundExportMode.class)), evl);
}
if (export.isOptionEnabled(BinaryDataExportMode.class)) {
new BinaryDataExporter().exportBinaryData(handler, selFile + File.separator + "binaryData", swf.tags,
new BinaryDataExporter().exportBinaryData(handler, Path.combine(selFile, "binaryData"), swf.tags,
new BinaryDataExportSettings(export.getValue(BinaryDataExportMode.class)), evl);
}
if (export.isOptionEnabled(FontExportMode.class)) {
new FontExporter().exportFonts(handler, selFile + File.separator + "fonts", swf.tags,
new FontExporter().exportFonts(handler, Path.combine(selFile, "fonts"), swf.tags,
new FontExportSettings(export.getValue(FontExportMode.class)), evl);
}
@@ -1272,7 +1272,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
frameExporter.exportFrames(handler, selFile + File.separator + "frames", swf, 0, null, fes, evl);
for (CharacterTag c : swf.getCharacters().values()) {
if (c instanceof DefineSpriteTag) {
frameExporter.exportFrames(handler, selFile + File.separator + "sprites", swf, c.getCharacterId(), null, fes, evl);
frameExporter.exportFrames(handler, Path.combine(selFile, "sprites"), swf, c.getCharacterId(), null, fes, evl);
}
}
}
@@ -1283,7 +1283,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
if (c instanceof ButtonTag) {
List<Integer> frameNums = new ArrayList<>();
frameNums.add(0); // todo: export all frames
frameExporter.exportFrames(handler, selFile + File.separator + "buttons", swf, c.getCharacterId(), frameNums, bes, evl);
frameExporter.exportFrames(handler, Path.combine(selFile, "buttons"), swf, c.getCharacterId(), frameNums, bes, evl);
}
}
}
@@ -1301,6 +1301,113 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
}
}
public void exportAllDebug(SWF swf, AbortRetryIgnoreHandler handler, String selFile, ExportDialog export) throws IOException {
EventListener evl = swf.getExportEventListener();
if (export.isOptionEnabled(ImageExportMode.class)) {
for (ImageExportMode exportMode : ImageExportMode.values()) {
new ImageExporter().exportImages(handler, Path.combine(selFile, "images", exportMode.name()), swf.tags,
new ImageExportSettings(exportMode), evl);
}
}
if (export.isOptionEnabled(ShapeExportMode.class)) {
for (ShapeExportMode exportMode : ShapeExportMode.values()) {
new ShapeExporter().exportShapes(handler, Path.combine(selFile, "shapes", exportMode.name()), swf.tags,
new ShapeExportSettings(exportMode, export.getZoom()), evl);
}
}
if (export.isOptionEnabled(MorphShapeExportMode.class)) {
for (MorphShapeExportMode exportMode : MorphShapeExportMode.values()) {
new MorphShapeExporter().exportMorphShapes(handler, Path.combine(selFile, "morphshapes", exportMode.name()), swf.tags,
new MorphShapeExportSettings(exportMode, export.getZoom()), evl);
}
}
if (export.isOptionEnabled(TextExportMode.class)) {
for (TextExportMode exportMode : TextExportMode.values()) {
new TextExporter().exportTexts(handler, Path.combine(selFile, TextExportSettings.EXPORT_FOLDER_NAME, exportMode.name()), swf.tags,
new TextExportSettings(exportMode, Configuration.textExportSingleFile.get(), export.getZoom()), evl);
}
}
if (export.isOptionEnabled(MovieExportMode.class)) {
for (MovieExportMode exportMode : MovieExportMode.values()) {
new MovieExporter().exportMovies(handler, Path.combine(selFile, "movies", exportMode.name()), swf.tags,
new MovieExportSettings(exportMode), evl);
}
}
if (export.isOptionEnabled(SoundExportMode.class)) {
for (SoundExportMode exportMode : SoundExportMode.values()) {
new SoundExporter().exportSounds(handler, Path.combine(selFile, "sounds", exportMode.name()), swf.tags,
new SoundExportSettings(exportMode), evl);
}
}
if (export.isOptionEnabled(BinaryDataExportMode.class)) {
for (BinaryDataExportMode exportMode : BinaryDataExportMode.values()) {
new BinaryDataExporter().exportBinaryData(handler, Path.combine(selFile, "binaryData", exportMode.name()), swf.tags,
new BinaryDataExportSettings(exportMode), evl);
}
}
if (export.isOptionEnabled(FontExportMode.class)) {
for (FontExportMode exportMode : FontExportMode.values()) {
new FontExporter().exportFonts(handler, Path.combine(selFile, "fonts", exportMode.name()), swf.tags,
new FontExportSettings(exportMode), evl);
}
}
if (export.isOptionEnabled(SymbolClassExportMode.class)) {
for (SymbolClassExportMode exportMode : SymbolClassExportMode.values()) {
new SymbolClassExporter().exportNames(selFile, swf.tags, evl);
}
}
FrameExporter frameExporter = new FrameExporter();
if (export.isOptionEnabled(FramesExportMode.class)) {
for (FramesExportMode exportMode : FramesExportMode.values()) {
FramesExportSettings fes = new FramesExportSettings(exportMode, export.getZoom());
frameExporter.exportFrames(handler, Path.combine(selFile, "frames", exportMode.name()), swf, 0, null, fes, evl);
for (CharacterTag c : swf.getCharacters().values()) {
if (c instanceof DefineSpriteTag) {
frameExporter.exportFrames(handler, Path.combine(selFile, "sprites", exportMode.name()), swf, c.getCharacterId(), null, fes, evl);
}
}
}
}
if (export.isOptionEnabled(ButtonExportMode.class)) {
for (ButtonExportMode exportMode : ButtonExportMode.values()) {
ButtonExportSettings bes = new ButtonExportSettings(exportMode, export.getZoom());
for (CharacterTag c : swf.getCharacters().values()) {
if (c instanceof ButtonTag) {
List<Integer> frameNums = new ArrayList<>();
frameNums.add(0); // todo: export all frames
frameExporter.exportFrames(handler, Path.combine(selFile, "buttons", exportMode.name()), swf, c.getCharacterId(), frameNums, bes, evl);
}
}
}
}
if (export.isOptionEnabled(ScriptExportMode.class)) {
boolean parallel = Configuration.parallelSpeedUp.get();
for (ScriptExportMode exportMode : ScriptExportMode.values()) {
String scriptsFolder = Path.combine(selFile, ScriptExportSettings.EXPORT_FOLDER_NAME, exportMode.name());
Path.createDirectorySafe(new File(scriptsFolder));
ScriptExportSettings scriptExportSettings = new ScriptExportSettings(exportMode, !parallel && Configuration.scriptExportSingleFile.get());
String singleFileName = Path.combine(scriptsFolder, swf.getShortFileName() + scriptExportSettings.getFileExtension());
try (FileTextWriter writer = scriptExportSettings.singleFile ? new FileTextWriter(Configuration.getCodeFormatting(), new FileOutputStream(singleFileName)) : null) {
scriptExportSettings.singleFileWriter = writer;
swf.exportActionScript(handler, scriptsFolder, scriptExportSettings, parallel, evl);
}
}
}
}
public List<SWFList> getSwfs() {
return swfs;
}

File diff suppressed because it is too large Load Diff