separated sprite export settings

This commit is contained in:
honfika@gmail.com
2015-06-14 10:55:05 +02:00
parent e11e546095
commit 6356d37e75
6 changed files with 148 additions and 7 deletions

View File

@@ -28,6 +28,7 @@ import com.jpexs.decompiler.flash.exporters.commonshape.SVGExporter;
import com.jpexs.decompiler.flash.exporters.modes.FrameExportMode;
import com.jpexs.decompiler.flash.exporters.settings.ButtonExportSettings;
import com.jpexs.decompiler.flash.exporters.settings.FrameExportSettings;
import com.jpexs.decompiler.flash.exporters.settings.SpriteExportSettings;
import com.jpexs.decompiler.flash.exporters.shape.CanvasShapeExporter;
import com.jpexs.decompiler.flash.helpers.BMPFile;
import com.jpexs.decompiler.flash.helpers.ImageHelper;
@@ -110,6 +111,38 @@ public class FrameExporter {
return exportFrames(handler, outdir, swf, containerId, frames, fes, evl);
}
public List<File> exportFrames(AbortRetryIgnoreHandler handler, String outdir, SWF swf, int containerId, List<Integer> frames, SpriteExportSettings settings, EventListener evl) throws IOException {
FrameExportMode fem;
switch (settings.mode) {
case PNG:
fem = FrameExportMode.PNG;
break;
case GIF:
fem = FrameExportMode.GIF;
break;
case AVI:
fem = FrameExportMode.AVI;
break;
case SVG:
fem = FrameExportMode.SVG;
break;
case CANVAS:
fem = FrameExportMode.CANVAS;
break;
case PDF:
fem = FrameExportMode.PDF;
break;
case BMP:
fem = FrameExportMode.BMP;
break;
default:
throw new Error("Unsupported sprite export mode");
}
FrameExportSettings fes = new FrameExportSettings(fem, settings.zoom);
return exportFrames(handler, outdir, swf, containerId, frames, fes, evl);
}
public List<File> exportFrames(AbortRetryIgnoreHandler handler, String outdir, final SWF swf, int containerId, List<Integer> frames, final FrameExportSettings settings, final EventListener evl) throws IOException {
final List<File> ret = new ArrayList<>();
if (swf.tags.isEmpty()) {

View File

@@ -0,0 +1,32 @@
/*
* 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.exporters.modes;
/**
*
* @author JPEXS
*/
public enum SpriteExportMode {
PNG,
GIF,
AVI,
SVG,
CANVAS,
PDF,
BMP
}

View File

@@ -26,8 +26,6 @@ public class FrameExportSettings {
public static final String EXPORT_FOLDER_NAME = "frames";
public static final String EXPORT_FOLDER_NAME_SPRITE = "sprites";
public FrameExportMode mode;
public double zoom;

View File

@@ -0,0 +1,37 @@
/*
* 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.exporters.settings;
import com.jpexs.decompiler.flash.exporters.modes.SpriteExportMode;
/**
*
* @author JPEXS
*/
public class SpriteExportSettings {
public static final String EXPORT_FOLDER_NAME = "sprites";
public SpriteExportMode mode;
public double zoom;
public SpriteExportSettings(SpriteExportMode mode, double zoom) {
this.mode = mode;
this.zoom = zoom;
}
}