frame SVG export: morph shape ratio, hungarian translation

This commit is contained in:
Honfika
2014-04-19 18:18:08 +02:00
parent 1fa9e0e547
commit 2e8927afa9
19 changed files with 64 additions and 49 deletions
@@ -1872,7 +1872,7 @@ public final class SWF implements TreeItem, Timelined {
switch (mode) {
case SVG:
try (FileOutputStream fos = new FileOutputStream(file)) {
fos.write(Utf8Helper.getBytes(st.toSVG(new SVGExporterContext(outdir, "assets_" + fcharacterID), 0)));
fos.write(Utf8Helper.getBytes(st.toSVG(new SVGExporterContext(outdir, "assets_" + fcharacterID), -2, 0)));
}
break;
case PNG:
@@ -1928,7 +1928,7 @@ public final class SWF implements TreeItem, Timelined {
switch (mode) {
case SVG:
try (FileOutputStream fos = new FileOutputStream(file)) {
fos.write(Utf8Helper.getBytes(mst.toSVG(new SVGExporterContext(outdir, "assets_" + fcharacterID), 0)));
fos.write(Utf8Helper.getBytes(mst.toSVG(new SVGExporterContext(outdir, "assets_" + fcharacterID), -2, 0)));
}
break;
}
@@ -2662,7 +2662,7 @@ public final class SWF implements TreeItem, Timelined {
exporterContext.exportedTags.put(drawableTag, assetFileName);
File file = new File(assetsDir + File.separator + assetFileName);
try (FileOutputStream fos = new FileOutputStream(file)) {
fos.write(Utf8Helper.getBytes(drawable.toSVG(exporterContext, level + 1)));
fos.write(Utf8Helper.getBytes(drawable.toSVG(exporterContext, layer.ratio, level + 1)));
}
}
RECT boundRect = drawable.getRect();
@@ -234,9 +234,9 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
private static final String ACTION_EXPAND_RECURSIVE = "EXPANDRECURSIVE";
// play morph shape in 2 second(s)
public static final int morphShapeAnimationLength = 2;
public static final int MORPH_SHAPE_ANIMATION_LENGTH = 2;
public static final int morphShapeAnimationFrameRate = 30;
public static final int MORPH_SHAPE_ANIMATION_FRAME_RATE = 30;
private static final Logger logger = Logger.getLogger(MainPanel.class.getName());
@@ -2521,8 +2521,8 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
}
tim = new Timeline(tag.getSwf(), new ArrayList<Tag>(), ((CharacterTag) tag).getCharacterId(), getRect());
if (tag instanceof MorphShapeTag) {
tim.frameRate = morphShapeAnimationFrameRate;
int framesCnt = tim.frameRate * morphShapeAnimationLength;
tim.frameRate = MORPH_SHAPE_ANIMATION_FRAME_RATE;
int framesCnt = tim.frameRate * MORPH_SHAPE_ANIMATION_LENGTH;
for (int i = 0; i < framesCnt; i++) {
Frame f = new Frame(tim);
DepthState ds = new DepthState(tag.getSwf(), f);
@@ -504,8 +504,8 @@ public class PreviewPanel extends JSplitPane implements ActionListener {
}
if ((tagObj instanceof DefineMorphShapeTag) || (tagObj instanceof DefineMorphShape2Tag)) {
frameRate = MainPanel.morphShapeAnimationFrameRate;
frameCount = MainPanel.morphShapeAnimationLength * frameRate;
frameRate = MainPanel.MORPH_SHAPE_ANIMATION_FRAME_RATE;
frameCount = MainPanel.MORPH_SHAPE_ANIMATION_LENGTH * frameRate;
}
if (tagObj instanceof DefineSoundTag) {
@@ -467,4 +467,4 @@ button.next = Next
message.action.playerglobal.title = PlayerGlobal library needed
message.action.playerglobal.needed = For ActionScript 3 direct editation, a library called "PlayerGlobal.swc" needs to be downloaded from Adobe homepage.\r\n%adobehomepage%\r\nPress OK to go to the download page.
message.action.playerglobal.place = Download the library called PlayerGlobal(.swc), and place it to directory\r\n%libpath%\r\n Press OK to continue.
message.action.playerglobal.place = Download the library called PlayerGlobal(.swc), and place it to directory\r\n%libpath%\r\n Press OK to continue.
@@ -464,3 +464,7 @@ error.sound.invalid = \u00c9rv\u00e9nytelen hang.
button.prev = El\u0151z\u0151
button.next = K\u00f6vetkez\u0151
message.action.playerglobal.title = PlayerGlobal k\u00f6nyvt\u00e1r sz\u00fcks\u00e9ges
message.action.playerglobal.needed = Az ActionScript 3 k\u00f6zvetlen szerkeszt\u00e9s\u00e9hez a "PlayerGlobal.swc" nev\u0171 k\u00f6nyvt\u00e1rra van sz\u00fcks\u00e9g, melyet az Adobe honlapj\u00e1r\u00f3l lehet let\u00f6lteni.\r\n%adobehomepage%\r\nNyomjon OK-t a let\u00f6lt\u00e9si oldal megnyit\u00e1s\u00e1hoz.
message.action.playerglobal.place = T\u00f6ltse le a PlayerGlobal(.swc) nev\u0171 k\u00f6nyvt\u00e1rat \u00e9s helyezze el a k\u00f6vetkez\u0151 mapp\u00e1ban:\r\n%libpath%\r\n Nyomjon OK-t a folytat\u00e1shoz.
@@ -939,7 +939,7 @@ public class DefineEditTextTag extends TextTag {
}
@Override
public String toSVG(SVGExporterContext exporterContext, int level) {
public String toSVG(SVGExporterContext exporterContext, int ratio, int level) {
return "";
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@@ -25,8 +25,8 @@ import com.jpexs.decompiler.flash.exporters.Matrix;
import com.jpexs.decompiler.flash.exporters.Point;
import com.jpexs.decompiler.flash.exporters.SVGExporterContext;
import com.jpexs.decompiler.flash.exporters.morphshape.SVGMorphShapeExporter;
import com.jpexs.decompiler.flash.exporters.shape.SVGShapeExporter;
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
import com.jpexs.decompiler.flash.tags.base.DrawableTag;
import com.jpexs.decompiler.flash.tags.base.MorphShapeTag;
import com.jpexs.decompiler.flash.timeline.DepthState;
import com.jpexs.decompiler.flash.types.BasicType;
@@ -61,7 +61,7 @@ import java.util.Set;
*
* @author JPEXS
*/
public class DefineMorphShape2Tag extends CharacterTag implements MorphShapeTag, DrawableTag {
public class DefineMorphShape2Tag extends CharacterTag implements MorphShapeTag {
@SWFType(BasicType.UI16)
public int characterId;
@@ -99,16 +99,6 @@ public class DefineMorphShape2Tag extends CharacterTag implements MorphShapeTag,
return rect;
}
@Override
public String toSVG(SVGExporterContext exporterContext, int level) {
ExportRectangle rect = new ExportRectangle(getRect());
SHAPEWITHSTYLE beginShapes = getShapeAtRatio(0);
SHAPEWITHSTYLE endShapes = getShapeAtRatio(65535);
SVGMorphShapeExporter exporter = new SVGMorphShapeExporter(swf, beginShapes, endShapes, rect, new ColorTransform() /*FIXME?*/);
exporter.export();
return exporter.getSVG();
}
@Override
public int getCharacterId() {
return characterId;
@@ -338,6 +328,23 @@ public class DefineMorphShape2Tag extends CharacterTag implements MorphShapeTag,
BitmapExporter.export(swf, shape, null, image, transformation, colorTransform);
}
@Override
public String toSVG(SVGExporterContext exporterContext, int ratio, int level) {
ExportRectangle rect = new ExportRectangle(getRect());
if (ratio == -2) {
SHAPEWITHSTYLE beginShapes = getShapeAtRatio(0);
SHAPEWITHSTYLE endShapes = getShapeAtRatio(65535);
SVGMorphShapeExporter exporter = new SVGMorphShapeExporter(swf, beginShapes, endShapes, rect, new ColorTransform() /*FIXME?*/);
exporter.export();
return exporter.getSVG();
} else {
SHAPEWITHSTYLE shapes = getShapeAtRatio(ratio);
SVGShapeExporter exporter = new SVGShapeExporter(swf, shapes, rect, new ColorTransform() /*FIXME?*/);
exporter.export();
return exporter.getSVG();
}
}
@Override
public Point getImagePos(int frame) {
return new Point(
@@ -25,8 +25,8 @@ import com.jpexs.decompiler.flash.exporters.Matrix;
import com.jpexs.decompiler.flash.exporters.Point;
import com.jpexs.decompiler.flash.exporters.SVGExporterContext;
import com.jpexs.decompiler.flash.exporters.morphshape.SVGMorphShapeExporter;
import com.jpexs.decompiler.flash.exporters.shape.SVGShapeExporter;
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
import com.jpexs.decompiler.flash.tags.base.DrawableTag;
import com.jpexs.decompiler.flash.tags.base.MorphShapeTag;
import com.jpexs.decompiler.flash.timeline.DepthState;
import com.jpexs.decompiler.flash.types.BasicType;
@@ -60,7 +60,7 @@ import java.util.Set;
*
* @author JPEXS
*/
public class DefineMorphShapeTag extends CharacterTag implements MorphShapeTag, DrawableTag {
public class DefineMorphShapeTag extends CharacterTag implements MorphShapeTag {
@SWFType(BasicType.UI16)
public int characterId;
@@ -147,16 +147,6 @@ public class DefineMorphShapeTag extends CharacterTag implements MorphShapeTag,
return rect;
}
@Override
public String toSVG(SVGExporterContext exporterContext, int level) {
ExportRectangle rect = new ExportRectangle(getRect());
SHAPEWITHSTYLE beginShapes = getShapeAtRatio(0);
SHAPEWITHSTYLE endShapes = getShapeAtRatio(65535);
SVGMorphShapeExporter exporter = new SVGMorphShapeExporter(swf, beginShapes, endShapes, rect, new ColorTransform() /*FIXME?*/);
exporter.export();
return exporter.getSVG();
}
@Override
public RECT getStartBounds() {
return startBounds;
@@ -321,6 +311,23 @@ public class DefineMorphShapeTag extends CharacterTag implements MorphShapeTag,
BitmapExporter.export(swf, shape, null, image, transformation, colorTransform);
}
@Override
public String toSVG(SVGExporterContext exporterContext, int ratio, int level) {
ExportRectangle rect = new ExportRectangle(getRect());
if (ratio == -2) {
SHAPEWITHSTYLE beginShapes = getShapeAtRatio(0);
SHAPEWITHSTYLE endShapes = getShapeAtRatio(65535);
SVGMorphShapeExporter exporter = new SVGMorphShapeExporter(swf, beginShapes, endShapes, rect, new ColorTransform() /*FIXME?*/);
exporter.export();
return exporter.getSVG();
} else {
SHAPEWITHSTYLE shapes = getShapeAtRatio(ratio);
SVGShapeExporter exporter = new SVGShapeExporter(swf, shapes, rect, new ColorTransform() /*FIXME?*/);
exporter.export();
return exporter.getSVG();
}
}
@Override
public Point getImagePos(int frame) {
return new Point(
@@ -61,7 +61,7 @@ public class DefineShape2Tag extends ShapeTag {
}
@Override
public String toSVG(SVGExporterContext exporterContext, int level) {
public String toSVG(SVGExporterContext exporterContext, int ratio, int level) {
ExportRectangle rect = new ExportRectangle(getRect());
SVGShapeExporter exporter = new SVGShapeExporter(swf, getShapes(), rect, new ColorTransform() /*FIXME?*/);
exporter.export();
@@ -66,7 +66,7 @@ public class DefineShape3Tag extends ShapeTag {
}
@Override
public String toSVG(SVGExporterContext exporterContext, int level) {
public String toSVG(SVGExporterContext exporterContext, int ratio, int level) {
ExportRectangle rect = new ExportRectangle(getRect());
SVGShapeExporter exporter = new SVGShapeExporter(swf, getShapes(), rect, new ColorTransform() /*FIXME?*/);
exporter.export();
@@ -69,7 +69,7 @@ public class DefineShape4Tag extends ShapeTag {
}
@Override
public String toSVG(SVGExporterContext exporterContext, int level) {
public String toSVG(SVGExporterContext exporterContext, int ratio, int level) {
ExportRectangle rect = new ExportRectangle(getRect());
SVGShapeExporter exporter = new SVGShapeExporter(swf, getShapes(), rect, new ColorTransform() /*FIXME?*/);
exporter.export();
@@ -94,7 +94,7 @@ public class DefineShapeTag extends ShapeTag {
}
@Override
public String toSVG(SVGExporterContext exporterContext, int level) {
public String toSVG(SVGExporterContext exporterContext, int ratio, int level) {
ExportRectangle rect = new ExportRectangle(getRect());
SVGShapeExporter exporter = new SVGShapeExporter(swf, getShapes(), rect, new ColorTransform() /*FIXME?*/);
exporter.export();
@@ -290,7 +290,7 @@ public class DefineSpriteTag extends CharacterTag implements Container, Drawable
}
@Override
public String toSVG(SVGExporterContext exporterContext, int level) throws IOException {
public String toSVG(SVGExporterContext exporterContext, int ratio, int level) throws IOException {
return SWF.frameToSvg(getTimeline(), 0, 0, null, 0, exporterContext, getRect(), new ColorTransform(), null, level + 1);
}
@@ -494,7 +494,7 @@ public class DefineText2Tag extends TextTag {
}
@Override
public String toSVG(SVGExporterContext exporterContext, int level) {
public String toSVG(SVGExporterContext exporterContext, int ratio, int level) {
return "";
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@@ -510,7 +510,7 @@ public class DefineTextTag extends TextTag {
}
@Override
public String toSVG(SVGExporterContext exporterContext, int level) {
public String toSVG(SVGExporterContext exporterContext, int ratio, int level) {
return "";
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@@ -59,7 +59,7 @@ public abstract class ButtonTag extends CharacterTag implements DrawableTag, Tim
}
@Override
public String toSVG(SVGExporterContext exporterContext, int level) {
public String toSVG(SVGExporterContext exporterContext, int ratio, int level) {
return "";
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@@ -33,7 +33,7 @@ public interface DrawableTag extends BoundedTag {
public void toImage(int frame, int time, int ratio, DepthState stateUnderCursor, int mouseButton, SerializableImage image, Matrix transformation, ColorTransform colorTransform);
public String toSVG(SVGExporterContext exporterContext, int level) throws IOException;
public String toSVG(SVGExporterContext exporterContext, int ratio, int level) throws IOException;
public Point getImagePos(int frame);
@@ -260,7 +260,7 @@ public abstract class FontTag extends CharacterTag implements AloneTag, Drawable
}
@Override
public String toSVG(SVGExporterContext exporterContext, int level) {
public String toSVG(SVGExporterContext exporterContext, int ratio, int level) {
return "";
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@@ -16,7 +16,6 @@
*/
package com.jpexs.decompiler.flash.tags.base;
import com.jpexs.decompiler.flash.exporters.SVGExporterContext;
import com.jpexs.decompiler.flash.types.MORPHFILLSTYLEARRAY;
import com.jpexs.decompiler.flash.types.MORPHLINESTYLEARRAY;
import com.jpexs.decompiler.flash.types.RECT;
@@ -27,7 +26,7 @@ import com.jpexs.decompiler.flash.types.SHAPEWITHSTYLE;
*
* @author JPEXS
*/
public interface MorphShapeTag {
public interface MorphShapeTag extends DrawableTag {
public RECT getStartBounds();
@@ -41,8 +40,6 @@ public interface MorphShapeTag {
public SHAPE getEndEdges();
public String toSVG(SVGExporterContext exporterContext, int level);
public int getShapeNum();
public SHAPEWITHSTYLE getShapeAtRatio(int ratio);