From 610881a4278556c8d82224cdaef711b368caf13c Mon Sep 17 00:00:00 2001 From: Honfika Date: Fri, 18 Apr 2014 23:51:58 +0200 Subject: [PATCH] svg animation fixes, prepare for frame export --- trunk/src/com/jpexs/decompiler/flash/SWF.java | 135 +++++++++++++++++- .../flash/exporters/BitmapExporter.java | 1 + .../flash/exporters/PathExporter.java | 1 + .../flash/exporters/SVGExporter.java | 115 +++++++++++++++ .../flash/exporters/SVGExporterContext.java | 25 ++++ .../exporters/modes/FramesExportMode.java | 3 +- .../{ => morphshape}/CurvedMorphEdge.java | 4 +- .../DefaultSVGMorphShapeExporter.java | 7 +- .../{ => morphshape}/IMorphEdge.java | 4 +- .../{ => morphshape}/IMorphShapeExporter.java | 7 +- .../MorphShapeExporterBase.java | 6 +- .../SVGMorphShapeExporter.java | 56 +++++--- .../{ => morphshape}/StraightMorphEdge.java | 4 +- .../exporters/{ => shape}/CurvedEdge.java | 4 +- .../{ => shape}/DefaultSVGShapeExporter.java | 3 +- .../flash/exporters/{ => shape}/IEdge.java | 4 +- .../exporters/{ => shape}/IShapeExporter.java | 3 +- .../{ => shape}/SVGShapeExporter.java | 27 +++- .../{ => shape}/ShapeExporterBase.java | 4 +- .../exporters/{ => shape}/StraightEdge.java | 4 +- .../jpexs/decompiler/flash/gui/MainPanel.java | 6 +- .../decompiler/flash/gui/PreviewPanel.java | 8 +- .../flash/gui/locales/ExportDialog.properties | 3 +- .../gui/locales/ExportDialog_hu.properties | 23 ++- .../flash/gui/locales/MainFrame_hu.properties | 9 ++ .../flash/tags/DefineEditTextTag.java | 6 + .../flash/tags/DefineMorphShape2Tag.java | 5 +- .../flash/tags/DefineMorphShapeTag.java | 5 +- .../flash/tags/DefineShape2Tag.java | 5 +- .../flash/tags/DefineShape3Tag.java | 5 +- .../flash/tags/DefineShape4Tag.java | 5 +- .../decompiler/flash/tags/DefineShapeTag.java | 5 +- .../flash/tags/DefineSpriteTag.java | 6 + .../decompiler/flash/tags/DefineText2Tag.java | 6 + .../decompiler/flash/tags/DefineTextTag.java | 6 + .../decompiler/flash/tags/base/ButtonTag.java | 6 + .../flash/tags/base/DrawableTag.java | 3 + .../decompiler/flash/tags/base/FontTag.java | 6 + .../flash/tags/base/MorphShapeTag.java | 3 +- .../decompiler/flash/tags/base/ShapeTag.java | 2 - 40 files changed, 466 insertions(+), 74 deletions(-) create mode 100644 trunk/src/com/jpexs/decompiler/flash/exporters/SVGExporter.java create mode 100644 trunk/src/com/jpexs/decompiler/flash/exporters/SVGExporterContext.java rename trunk/src/com/jpexs/decompiler/flash/exporters/{ => morphshape}/CurvedMorphEdge.java (90%) rename trunk/src/com/jpexs/decompiler/flash/exporters/{ => morphshape}/DefaultSVGMorphShapeExporter.java (89%) rename trunk/src/com/jpexs/decompiler/flash/exporters/{ => morphshape}/IMorphEdge.java (87%) rename trunk/src/com/jpexs/decompiler/flash/exporters/{ => morphshape}/IMorphShapeExporter.java (80%) rename trunk/src/com/jpexs/decompiler/flash/exporters/{ => morphshape}/MorphShapeExporterBase.java (96%) rename trunk/src/com/jpexs/decompiler/flash/exporters/{ => morphshape}/SVGMorphShapeExporter.java (84%) rename trunk/src/com/jpexs/decompiler/flash/exporters/{ => morphshape}/StraightMorphEdge.java (91%) rename trunk/src/com/jpexs/decompiler/flash/exporters/{ => shape}/CurvedEdge.java (89%) rename trunk/src/com/jpexs/decompiler/flash/exporters/{ => shape}/DefaultSVGShapeExporter.java (94%) rename trunk/src/com/jpexs/decompiler/flash/exporters/{ => shape}/IEdge.java (86%) rename trunk/src/com/jpexs/decompiler/flash/exporters/{ => shape}/IShapeExporter.java (92%) rename trunk/src/com/jpexs/decompiler/flash/exporters/{ => shape}/SVGShapeExporter.java (92%) rename trunk/src/com/jpexs/decompiler/flash/exporters/{ => shape}/ShapeExporterBase.java (97%) rename trunk/src/com/jpexs/decompiler/flash/exporters/{ => shape}/StraightEdge.java (90%) diff --git a/trunk/src/com/jpexs/decompiler/flash/SWF.java b/trunk/src/com/jpexs/decompiler/flash/SWF.java index 7bc2540ee..2e74cf960 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWF.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWF.java @@ -55,6 +55,8 @@ import com.jpexs.decompiler.flash.ecma.Null; import com.jpexs.decompiler.flash.exporters.ExportRectangle; import com.jpexs.decompiler.flash.exporters.Matrix; import com.jpexs.decompiler.flash.exporters.PathExporter; +import com.jpexs.decompiler.flash.exporters.SVGExporter; +import com.jpexs.decompiler.flash.exporters.SVGExporterContext; import com.jpexs.decompiler.flash.exporters.modes.BinaryDataExportMode; import com.jpexs.decompiler.flash.exporters.modes.FontExportMode; import com.jpexs.decompiler.flash.exporters.modes.FramesExportMode; @@ -1512,7 +1514,7 @@ public final class SWF implements TreeItem, Timelined { } public List exportFrames(AbortRetryIgnoreHandler handler, String outdir, int containerId, List frames, final FramesExportMode mode) throws IOException { - List ret = new ArrayList<>(); + final List ret = new ArrayList<>(); if (tags.isEmpty()) { return ret; } @@ -1553,6 +1555,25 @@ public final class SWF implements TreeItem, Timelined { } } + if (mode == FramesExportMode.SVG) { + for (int i = 0; i < frames.size(); i++) { + final int fi = i; + final Timeline ftim = tim; + final Color fbackgroundColor = backgroundColor; + new RetryTask(new RunnableIOEx() { + @Override + public void run() throws IOException { + int frame = fframes.get(fi); + File f = new File(foutdir + File.separator + fframes.get(fi) + ".svg"); + try (FileOutputStream fos = new FileOutputStream(f)) { + fos.write(Utf8Helper.getBytes(frameToSvgGet(ftim, frame, 0, null, 0, ftim.displayRect, new Matrix(), new ColorTransform(), fbackgroundColor))); + } + ret.add(f); + } + }, handler).run(); + } + } + final List frameImages = new ArrayList<>(); for (int frame : frames) { frameImages.add(frameToImageGet(tim, frame, 0, null, 0, tim.displayRect, new Matrix(), new ColorTransform(), backgroundColor).getBufferedImage()); @@ -1562,7 +1583,9 @@ public final class SWF implements TreeItem, Timelined { new RetryTask(new RunnableIOEx() { @Override public void run() throws IOException { - makeGIF(frameImages, frameRate, new File(foutdir + File.separator + "frames.gif")); + File f = new File(foutdir + File.separator + "frames.gif"); + makeGIF(frameImages, frameRate, f); + ret.add(f); } }, handler).run(); break; @@ -1572,7 +1595,9 @@ public final class SWF implements TreeItem, Timelined { new RetryTask(new RunnableIOEx() { @Override public void run() throws IOException { - ImageIO.write(frameImages.get(fi), "PNG", new File(foutdir + File.separator + fframes.get(fi) + ".png")); + File f = new File(foutdir + File.separator + fframes.get(fi) + ".png"); + ImageIO.write(frameImages.get(fi), "PNG", f); + ret.add(f); } }, handler).run(); } @@ -1581,7 +1606,9 @@ public final class SWF implements TreeItem, Timelined { new RetryTask(new RunnableIOEx() { @Override public void run() throws IOException { - makeAVI(frameImages, frameRate, new File(foutdir + File.separator + "frames.avi")); + File f = new File(foutdir + File.separator + "frames.avi"); + makeAVI(frameImages, frameRate, f); + ret.add(f); } }, handler).run(); break; @@ -1843,7 +1870,7 @@ public final class SWF implements TreeItem, Timelined { switch (mode) { case SVG: try (FileOutputStream fos = new FileOutputStream(file)) { - fos.write(Utf8Helper.getBytes(st.toSVG())); + fos.write(Utf8Helper.getBytes(st.toSVG(new SVGExporterContext()))); } break; case PNG: @@ -1898,7 +1925,7 @@ public final class SWF implements TreeItem, Timelined { switch (mode) { case SVG: try (FileOutputStream fos = new FileOutputStream(file)) { - fos.write(Utf8Helper.getBytes(mst.toSVG())); + fos.write(Utf8Helper.getBytes(mst.toSVG(new SVGExporterContext()))); } break; } @@ -2557,6 +2584,102 @@ public final class SWF implements TreeItem, Timelined { return ret; } + public static String frameToSvgGet(Timeline timeline, int frame, int time, DepthState stateUnderCursor, int mouseButton, RECT displayRect, Matrix transformation, ColorTransform colorTransform, Color backGroundColor) { + RECT rect = displayRect; + SVGExporter exporter = new SVGExporter(timeline.swf, new ExportRectangle(rect), colorTransform); + if (backGroundColor != null) { + exporter.setBackGroundColor(backGroundColor); + } + Matrix m = new Matrix(); + m.translate(-rect.Xmin, -rect.Ymin); + if (timeline.frames.isEmpty()) { + frameToSvg(timeline, frame, time, stateUnderCursor, mouseButton, exporter, m, colorTransform); + } + return exporter.getSVG(); + } + + public static void frameToSvg(Timeline timeline, int frame, int time, DepthState stateUnderCursor, int mouseButton, SVGExporter exporter, Matrix transformation, ColorTransform colorTransform) { + float unzoom = (float) SWF.unitDivisor; + if (timeline.frames.size() <= frame) { + return; + } + Frame frameObj = timeline.frames.get(frame); + // TODO g.setTransform(transformation.toTransform()); + List clips = new ArrayList<>(); + List prevClips = new ArrayList<>(); + + for (int i = 1; i <= timeline.getMaxDepth(); i++) { + for (int c = 0; c < clips.size(); c++) { + if (clips.get(c).depth == i) { + // TODO exporter.setClip(prevClips.get(c)); + prevClips.remove(c); + clips.remove(c); + } + } + if (!frameObj.layers.containsKey(i)) { + continue; + } + DepthState layer = frameObj.layers.get(i); + if (!timeline.swf.characters.containsKey(layer.characterId)) { + continue; + } + if (!layer.isVisible) { + continue; + } + CharacterTag character = timeline.swf.characters.get(layer.characterId); + Matrix mat = new Matrix(layer.matrix); + mat = mat.preConcatenate(transformation); + + if (colorTransform == null) { + colorTransform = new ColorTransform(); + } + + ColorTransform clrTrans = Helper.deepCopy(colorTransform); + if (layer.colorTransForm != null && layer.blendMode <= 1) { //Normal blend mode + clrTrans = colorTransform.merge(layer.colorTransForm); + } + + if (character instanceof DrawableTag) { + DrawableTag drawable = (DrawableTag) character; + Matrix drawMatrix = new Matrix(); + int dframe = (time + layer.time) % drawable.getNumFrames(); + if (character instanceof ButtonTag) { + ButtonTag bt = (ButtonTag) character; + dframe = ButtonTag.FRAME_UP; + if (stateUnderCursor == layer) { + if (mouseButton > 0) { + dframe = ButtonTag.FRAME_DOWN; + } else { + dframe = ButtonTag.FRAME_OVER; + } + } + } + + RECT boundRect = drawable.getRect(); + ExportRectangle rect = new ExportRectangle(boundRect); + rect = mat.transform(rect); + Matrix m = mat.clone(); + + m.translate(-rect.xMin, -rect.yMin); + drawMatrix.translate(rect.xMin, rect.yMin); + + //drawable.toSVG(dframe, layer.time + time, layer.ratio, stateUnderCursor, mouseButton, exporter, m, clrTrans); + // TODO: drawable.toSVG(); + + // TODO: if (layer.filters != null) + // TODO: if (layer.blendMode > 1) + + drawMatrix.translateX /= unzoom; + drawMatrix.translateY /= unzoom; + AffineTransform trans = drawMatrix.toTransform(); + + // TODO: if (layer.clipDepth > -1)... + // TODO: g.setTransform(trans); + } + + } + } + public static SerializableImage frameToImageGet(Timeline timeline, int frame, int time, DepthState stateUnderCursor, int mouseButton, RECT displayRect, Matrix transformation, ColorTransform colorTransform, Color backGroundColor) { String key = "frame_" + frame + "_" + timeline.id + "_" + timeline.swf.hashCode(); SerializableImage image = getFromCache(key); diff --git a/trunk/src/com/jpexs/decompiler/flash/exporters/BitmapExporter.java b/trunk/src/com/jpexs/decompiler/flash/exporters/BitmapExporter.java index 8ebef0955..d900dc5ea 100644 --- a/trunk/src/com/jpexs/decompiler/flash/exporters/BitmapExporter.java +++ b/trunk/src/com/jpexs/decompiler/flash/exporters/BitmapExporter.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.exporters; +import com.jpexs.decompiler.flash.exporters.shape.ShapeExporterBase; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.decompiler.flash.tags.base.ImageTag; diff --git a/trunk/src/com/jpexs/decompiler/flash/exporters/PathExporter.java b/trunk/src/com/jpexs/decompiler/flash/exporters/PathExporter.java index 649567ee6..3e284502e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/exporters/PathExporter.java +++ b/trunk/src/com/jpexs/decompiler/flash/exporters/PathExporter.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.exporters; +import com.jpexs.decompiler.flash.exporters.shape.ShapeExporterBase; import com.jpexs.decompiler.flash.types.ColorTransform; import com.jpexs.decompiler.flash.types.GRADRECORD; import com.jpexs.decompiler.flash.types.RGB; diff --git a/trunk/src/com/jpexs/decompiler/flash/exporters/SVGExporter.java b/trunk/src/com/jpexs/decompiler/flash/exporters/SVGExporter.java new file mode 100644 index 000000000..fc5875ab9 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/exporters/SVGExporter.java @@ -0,0 +1,115 @@ +/* + * Copyright (C) 2010-2014 JPEXS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.jpexs.decompiler.flash.exporters; + +import com.jpexs.decompiler.flash.SWF; +import com.jpexs.decompiler.flash.types.ColorTransform; +import com.jpexs.decompiler.flash.types.RGBA; +import java.awt.Color; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import org.w3c.dom.Attr; +import org.w3c.dom.DOMImplementation; +import org.w3c.dom.Document; +import org.w3c.dom.DocumentType; +import org.w3c.dom.Element; + +/** + * + * @author JPEXS + */ +public class SVGExporter { + + protected static final String sNamespace = "http://www.w3.org/2000/svg"; + protected static final String xlinkNamespace = "http://www.w3.org/1999/xlink"; + + protected Document _svg; + protected Element _svgDefs; + protected Element _svgG; + protected Element path; + protected List gradients; + protected int lastPatternId; + private final SWF swf; + private double maxLineWidth; + private final ExportRectangle bounds; + + public SVGExporter(SWF swf, ExportRectangle bounds, ColorTransform colorTransform) { + this.swf = swf; + this.bounds = bounds; + + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + try { + DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); + DOMImplementation impl = docBuilder.getDOMImplementation(); + DocumentType svgDocType = impl.createDocumentType("svg", "-//W3C//DTD SVG 1.0//EN", + "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"); + _svg = impl.createDocument(sNamespace, "svg", svgDocType); + Element svgRoot = _svg.getDocumentElement(); + svgRoot.setAttribute("xmlns:xlink", xlinkNamespace); + _svgDefs = _svg.createElement("defs"); + svgRoot.appendChild(_svgDefs); + _svgG = _svg.createElement("g"); + _svgG.setAttribute("transform", "matrix(1, 0, 0, 1, " + + roundPixels20(-bounds.xMin / (double) SWF.unitDivisor) + ", " + roundPixels20(-bounds.yMin / (double) SWF.unitDivisor) + ")"); + svgRoot.appendChild(_svgG); + } catch (ParserConfigurationException ex) { + Logger.getLogger(SVGExporter.class.getName()).log(Level.SEVERE, null, ex); + } + gradients = new ArrayList<>(); + } + + public String getSVG() { + TransformerFactory transformerFactory = TransformerFactory.newInstance(); + StringWriter writer = new StringWriter(); + try { + Transformer transformer = transformerFactory.newTransformer(); + transformer.setOutputProperty(OutputKeys.INDENT, "yes"); + transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); + DOMSource source = new DOMSource(_svg); + StreamResult result = new StreamResult(writer); + transformer.transform(source, result); + } catch (TransformerException ex) { + Logger.getLogger(SVGExporter.class.getName()).log(Level.SEVERE, null, ex); + } + return writer.toString(); + } + + public void setBackGroundColor(Color backGroundColor) { + Attr attr = _svg.createAttribute("style"); + attr.setValue("background: " + new RGBA(backGroundColor).toHexARGB()); + } + + protected static double roundPixels20(double pixels) { + return Math.round(pixels * 100) / 100.0; + } + + protected static double roundPixels400(double pixels) { + return Math.round(pixels * 10000) / 10000.0; + } +} diff --git a/trunk/src/com/jpexs/decompiler/flash/exporters/SVGExporterContext.java b/trunk/src/com/jpexs/decompiler/flash/exporters/SVGExporterContext.java new file mode 100644 index 000000000..9cf194129 --- /dev/null +++ b/trunk/src/com/jpexs/decompiler/flash/exporters/SVGExporterContext.java @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2010-2014 JPEXS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.jpexs.decompiler.flash.exporters; + +/** + * + * @author JPEXS + */ +public class SVGExporterContext { + +} diff --git a/trunk/src/com/jpexs/decompiler/flash/exporters/modes/FramesExportMode.java b/trunk/src/com/jpexs/decompiler/flash/exporters/modes/FramesExportMode.java index 66b2dd76e..aa7adbc0d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/exporters/modes/FramesExportMode.java +++ b/trunk/src/com/jpexs/decompiler/flash/exporters/modes/FramesExportMode.java @@ -24,5 +24,6 @@ public enum FramesExportMode { PNG, GIF, - AVI + AVI, + SVG } diff --git a/trunk/src/com/jpexs/decompiler/flash/exporters/CurvedMorphEdge.java b/trunk/src/com/jpexs/decompiler/flash/exporters/morphshape/CurvedMorphEdge.java similarity index 90% rename from trunk/src/com/jpexs/decompiler/flash/exporters/CurvedMorphEdge.java rename to trunk/src/com/jpexs/decompiler/flash/exporters/morphshape/CurvedMorphEdge.java index 1987cc030..6c180c061 100644 --- a/trunk/src/com/jpexs/decompiler/flash/exporters/CurvedMorphEdge.java +++ b/trunk/src/com/jpexs/decompiler/flash/exporters/morphshape/CurvedMorphEdge.java @@ -14,7 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.jpexs.decompiler.flash.exporters; +package com.jpexs.decompiler.flash.exporters.morphshape; + +import com.jpexs.decompiler.flash.exporters.PointInt; /** * diff --git a/trunk/src/com/jpexs/decompiler/flash/exporters/DefaultSVGMorphShapeExporter.java b/trunk/src/com/jpexs/decompiler/flash/exporters/morphshape/DefaultSVGMorphShapeExporter.java similarity index 89% rename from trunk/src/com/jpexs/decompiler/flash/exporters/DefaultSVGMorphShapeExporter.java rename to trunk/src/com/jpexs/decompiler/flash/exporters/morphshape/DefaultSVGMorphShapeExporter.java index f3b679b43..857bca521 100644 --- a/trunk/src/com/jpexs/decompiler/flash/exporters/DefaultSVGMorphShapeExporter.java +++ b/trunk/src/com/jpexs/decompiler/flash/exporters/morphshape/DefaultSVGMorphShapeExporter.java @@ -14,9 +14,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.jpexs.decompiler.flash.exporters; +package com.jpexs.decompiler.flash.exporters.morphshape; import com.jpexs.decompiler.flash.SWF; +import com.jpexs.decompiler.flash.exporters.Matrix; import com.jpexs.decompiler.flash.types.ColorTransform; import com.jpexs.decompiler.flash.types.GRADRECORD; import com.jpexs.decompiler.flash.types.RGB; @@ -70,7 +71,7 @@ public abstract class DefaultSVGMorphShapeExporter extends MorphShapeExporterBas } @Override - public void beginGradientFill(int type, GRADRECORD[] gradientRecords, Matrix matrix, Matrix matrixEnd, int spreadMethod, int interpolationMethod, float focalPointRatio) { + public void beginGradientFill(int type, GRADRECORD[] gradientRecords, GRADRECORD[] gradientRecordsEnd, Matrix matrix, Matrix matrixEnd, int spreadMethod, int interpolationMethod, float focalPointRatio) { finalizePath(); } @@ -90,7 +91,7 @@ public abstract class DefaultSVGMorphShapeExporter extends MorphShapeExporterBas } @Override - public void lineGradientStyle(int type, GRADRECORD[] gradientRecords, Matrix matrix, Matrix matrixEnd, int spreadMethod, int interpolationMethod, float focalPointRatio) { + public void lineGradientStyle(int type, GRADRECORD[] gradientRecords, GRADRECORD[] gradientRecordsEnd, Matrix matrix, Matrix matrixEnd, int spreadMethod, int interpolationMethod, float focalPointRatio) { } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/exporters/IMorphEdge.java b/trunk/src/com/jpexs/decompiler/flash/exporters/morphshape/IMorphEdge.java similarity index 87% rename from trunk/src/com/jpexs/decompiler/flash/exporters/IMorphEdge.java rename to trunk/src/com/jpexs/decompiler/flash/exporters/morphshape/IMorphEdge.java index 96e5176f8..ceaf00d8b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/exporters/IMorphEdge.java +++ b/trunk/src/com/jpexs/decompiler/flash/exporters/morphshape/IMorphEdge.java @@ -14,7 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.jpexs.decompiler.flash.exporters; +package com.jpexs.decompiler.flash.exporters.morphshape; + +import com.jpexs.decompiler.flash.exporters.PointInt; /** * diff --git a/trunk/src/com/jpexs/decompiler/flash/exporters/IMorphShapeExporter.java b/trunk/src/com/jpexs/decompiler/flash/exporters/morphshape/IMorphShapeExporter.java similarity index 80% rename from trunk/src/com/jpexs/decompiler/flash/exporters/IMorphShapeExporter.java rename to trunk/src/com/jpexs/decompiler/flash/exporters/morphshape/IMorphShapeExporter.java index 98b8dc488..055f136b9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/exporters/IMorphShapeExporter.java +++ b/trunk/src/com/jpexs/decompiler/flash/exporters/morphshape/IMorphShapeExporter.java @@ -14,8 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.jpexs.decompiler.flash.exporters; +package com.jpexs.decompiler.flash.exporters.morphshape; +import com.jpexs.decompiler.flash.exporters.Matrix; import com.jpexs.decompiler.flash.types.ColorTransform; import com.jpexs.decompiler.flash.types.GRADRECORD; import com.jpexs.decompiler.flash.types.RGB; @@ -40,7 +41,7 @@ public interface IMorphShapeExporter { public void beginFill(RGB color, RGB colorEnd); - public void beginGradientFill(int type, GRADRECORD[] gradientRecords, Matrix matrix, Matrix matrixEnd, int spreadMethod, int interpolationMethod, float focalPointRatio); + public void beginGradientFill(int type, GRADRECORD[] gradientRecords, GRADRECORD[] gradientRecordsEnd, Matrix matrix, Matrix matrixEnd, int spreadMethod, int interpolationMethod, float focalPointRatio); public void beginBitmapFill(int bitmapId, Matrix matrix, boolean repeat, boolean smooth, ColorTransform colorTransform); @@ -48,7 +49,7 @@ public interface IMorphShapeExporter { public void lineStyle(double thickness, double thicknessEnd, RGB color, RGB colorEnd, boolean pixelHinting, String scaleMode, int startCaps, int endCaps, int joints, int miterLimit); - public void lineGradientStyle(int type, GRADRECORD[] gradientRecords, Matrix matrix, Matrix matrixEnd, int spreadMethod, int interpolationMethod, float focalPointRatio); + public void lineGradientStyle(int type, GRADRECORD[] gradientRecords, GRADRECORD[] gradientRecordsEnd, Matrix matrix, Matrix matrixEnd, int spreadMethod, int interpolationMethod, float focalPointRatio); public void moveTo(double x, double y, double x2, double y2); diff --git a/trunk/src/com/jpexs/decompiler/flash/exporters/MorphShapeExporterBase.java b/trunk/src/com/jpexs/decompiler/flash/exporters/morphshape/MorphShapeExporterBase.java similarity index 96% rename from trunk/src/com/jpexs/decompiler/flash/exporters/MorphShapeExporterBase.java rename to trunk/src/com/jpexs/decompiler/flash/exporters/morphshape/MorphShapeExporterBase.java index 7e30079d9..1c4d5083e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/exporters/MorphShapeExporterBase.java +++ b/trunk/src/com/jpexs/decompiler/flash/exporters/morphshape/MorphShapeExporterBase.java @@ -14,8 +14,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.jpexs.decompiler.flash.exporters; +package com.jpexs.decompiler.flash.exporters.morphshape; +import com.jpexs.decompiler.flash.exporters.Matrix; +import com.jpexs.decompiler.flash.exporters.PointInt; import com.jpexs.decompiler.flash.types.ColorTransform; import com.jpexs.decompiler.flash.types.FILLSTYLE; import com.jpexs.decompiler.flash.types.FOCALGRADIENT; @@ -314,6 +316,7 @@ public abstract class MorphShapeExporterBase implements IMorphShapeExporter { beginGradientFill( fillStyle.fillStyleType, colorTransform.apply(fillStyle.gradient.gradientRecords), + colorTransform.apply(fillStyleEnd.gradient.gradientRecords), matrix, matrixEnd, fillStyle.gradient.spreadMode, @@ -429,6 +432,7 @@ public abstract class MorphShapeExporterBase implements IMorphShapeExporter { lineGradientStyle( fillStyle.fillStyleType, fillStyle.gradient.gradientRecords, + fillStyleEnd.gradient.gradientRecords, matrix, matrixEnd, fillStyle.gradient.spreadMode, diff --git a/trunk/src/com/jpexs/decompiler/flash/exporters/SVGMorphShapeExporter.java b/trunk/src/com/jpexs/decompiler/flash/exporters/morphshape/SVGMorphShapeExporter.java similarity index 84% rename from trunk/src/com/jpexs/decompiler/flash/exporters/SVGMorphShapeExporter.java rename to trunk/src/com/jpexs/decompiler/flash/exporters/morphshape/SVGMorphShapeExporter.java index f9fa9fd0b..c81ddda53 100644 --- a/trunk/src/com/jpexs/decompiler/flash/exporters/SVGMorphShapeExporter.java +++ b/trunk/src/com/jpexs/decompiler/flash/exporters/morphshape/SVGMorphShapeExporter.java @@ -14,9 +14,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.jpexs.decompiler.flash.exporters; +package com.jpexs.decompiler.flash.exporters.morphshape; import com.jpexs.decompiler.flash.SWF; +import com.jpexs.decompiler.flash.exporters.ExportRectangle; +import com.jpexs.decompiler.flash.exporters.Matrix; import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.decompiler.flash.tags.base.ImageTag; import com.jpexs.decompiler.flash.types.ColorTransform; @@ -91,7 +93,7 @@ public class SVGMorphShapeExporter extends DefaultSVGMorphShapeExporter { StreamResult result = new StreamResult(writer); transformer.transform(source, result); } catch (TransformerException ex) { - Logger.getLogger(SVGShapeExporter.class.getName()).log(Level.SEVERE, null, ex); + Logger.getLogger(SVGMorphShapeExporter.class.getName()).log(Level.SEVERE, null, ex); } return writer.toString(); } @@ -114,7 +116,7 @@ public class SVGMorphShapeExporter extends DefaultSVGMorphShapeExporter { + roundPixels20(-bounds.xMin / (double) SWF.unitDivisor) + ", " + roundPixels20(-bounds.yMin / (double) SWF.unitDivisor) + ")"); svgRoot.appendChild(_svgG); } catch (ParserConfigurationException ex) { - Logger.getLogger(SVGShapeExporter.class.getName()).log(Level.SEVERE, null, ex); + Logger.getLogger(SVGMorphShapeExporter.class.getName()).log(Level.SEVERE, null, ex); } gradients = new ArrayList<>(); } @@ -130,22 +132,25 @@ public class SVGMorphShapeExporter extends DefaultSVGMorphShapeExporter { finalizePath(); path.setAttribute("stroke", "none"); path.setAttribute("fill", color.toHexRGB()); + path.setAttribute("fill-rule", "evenodd"); path.appendChild(createAnimateElement("fill", color.toHexRGB(), colorEnd.toHexRGB())); if (color instanceof RGBA) { RGBA colorA = (RGBA) color; if (colorA.alpha != 255) { path.setAttribute("fill-opacity", Float.toString(colorA.getAlphaFloat())); } + RGBA colorAEnd = (RGBA) colorEnd; + path.appendChild(createAnimateElement("fill-opacity", colorA.getAlphaFloat(), colorAEnd.getAlphaFloat())); } } @Override - public void beginGradientFill(int type, GRADRECORD[] gradientRecords, Matrix matrix, Matrix matrixEnd, int spreadMethod, int interpolationMethod, float focalPointRatio) { + public void beginGradientFill(int type, GRADRECORD[] gradientRecords, GRADRECORD[] gradientRecordsEnd, Matrix matrix, Matrix matrixEnd, int spreadMethod, int interpolationMethod, float focalPointRatio) { finalizePath(); Element gradient = (type == FILLSTYLE.LINEAR_GRADIENT) ? _svg.createElement("linearGradient") : _svg.createElement("radialGradient"); - populateGradientElement(gradient, type, gradientRecords, matrix, matrixEnd, spreadMethod, interpolationMethod, focalPointRatio); + populateGradientElement(gradient, type, gradientRecords, gradientRecordsEnd, matrix, matrixEnd, spreadMethod, interpolationMethod, focalPointRatio); int id = gradients.indexOf(gradient); if (id < 0) { // todo: filter same gradients @@ -155,6 +160,7 @@ public class SVGMorphShapeExporter extends DefaultSVGMorphShapeExporter { gradient.setAttribute("id", "gradient" + id); path.setAttribute("stroke", "none"); path.setAttribute("fill", "url(#gradient" + id + ")"); + path.setAttribute("fill-rule", "evenodd"); _svgDefs.appendChild(gradient); } @@ -271,12 +277,12 @@ public class SVGMorphShapeExporter extends DefaultSVGMorphShapeExporter { } @Override - public void lineGradientStyle(int type, GRADRECORD[] gradientRecords, Matrix matrix, Matrix matrixEnd, int spreadMethod, int interpolationMethod, float focalPointRatio) { + public void lineGradientStyle(int type, GRADRECORD[] gradientRecords, GRADRECORD[] gradientRecordsEnd, Matrix matrix, Matrix matrixEnd, int spreadMethod, int interpolationMethod, float focalPointRatio) { path.removeAttribute("stroke-opacity"); Element gradient = (type == FILLSTYLE.LINEAR_GRADIENT) ? _svg.createElement("linearGradient") : _svg.createElement("radialGradient"); - populateGradientElement(gradient, type, gradientRecords, matrix, matrixEnd, spreadMethod, interpolationMethod, focalPointRatio); + populateGradientElement(gradient, type, gradientRecords, gradientRecordsEnd, matrix, matrixEnd, spreadMethod, interpolationMethod, focalPointRatio); int id = gradients.indexOf(gradient); if (id < 0) { // todo: filter same gradients @@ -309,7 +315,7 @@ public class SVGMorphShapeExporter extends DefaultSVGMorphShapeExporter { super.finalizePath(); } - protected void populateGradientElement(Element gradient, int type, GRADRECORD[] gradientRecords, Matrix matrix, Matrix matrixEnd, int spreadMethod, int interpolationMethod, float focalPointRatio) { + protected void populateGradientElement(Element gradient, int type, GRADRECORD[] gradientRecords, GRADRECORD[] gradientRecordsEnd, Matrix matrix, Matrix matrixEnd, int spreadMethod, int interpolationMethod, float focalPointRatio) { gradient.setAttribute("gradientUnits", "userSpaceOnUse"); if (type == FILLSTYLE.LINEAR_GRADIENT) { gradient.setAttribute("x1", "-819.2"); @@ -340,17 +346,23 @@ public class SVGMorphShapeExporter extends DefaultSVGMorphShapeExporter { if (matrix != null) { double translateX = roundPixels400(matrix.translateX / SWF.unitDivisor); double translateY = roundPixels400(matrix.translateY / SWF.unitDivisor); - double rotateSkew0 = roundPixels400(matrix.rotateSkew0); - double rotateSkew1 = roundPixels400(matrix.rotateSkew1); - double scaleX = roundPixels400(matrix.scaleX); - double scaleY = roundPixels400(matrix.scaleY); + double a = roundPixels400(matrix.scaleX); + double b = roundPixels400(matrix.rotateSkew1); + double c = roundPixels400(matrix.rotateSkew0); + double d = roundPixels400(matrix.scaleY); + double rotate = Math.atan(c / d); + double scaleX = Math.signum(a) * Math.sqrt(a * a + b * b); + double scaleY = Math.signum(d) * Math.sqrt(c * c + d * d); double translateXEnd = roundPixels400(matrixEnd.translateX / SWF.unitDivisor); double translateYEnd = roundPixels400(matrixEnd.translateY / SWF.unitDivisor); - double rotateSkew0End = roundPixels400(matrixEnd.rotateSkew0); - double rotateSkew1End = roundPixels400(matrixEnd.rotateSkew1); - double scaleXEnd = roundPixels400(matrixEnd.scaleX); - double scaleYEnd = roundPixels400(matrixEnd.scaleY); + a = roundPixels400(matrixEnd.scaleX); + b = roundPixels400(matrixEnd.rotateSkew1); + c = roundPixels400(matrixEnd.rotateSkew0); + d = roundPixels400(matrixEnd.scaleY); + double rotateEnd = Math.atan(c / d); + double scaleXEnd = Math.signum(a) * Math.sqrt(a * a + b * b); + double scaleYEnd = Math.signum(d) * Math.sqrt(c * c + d * d); Element animateRotate = _svg.createElement("animateTransform"); animateRotate.setAttribute("dur", "2s"); // todo @@ -358,8 +370,8 @@ public class SVGMorphShapeExporter extends DefaultSVGMorphShapeExporter { animateRotate.setAttribute("attributeName", "gradientTransform"); animateRotate.setAttribute("type", "rotate"); animateRotate.setAttribute("additive", "sum"); - animateRotate.setAttribute("from", rotateSkew0 + " " + rotateSkew1); - animateRotate.setAttribute("to", rotateSkew0End + " " + rotateSkew1End); + animateRotate.setAttribute("from", Double.toString(rotate)); + animateRotate.setAttribute("to", Double.toString(rotateEnd)); Element animateScale = _svg.createElement("animateTransform"); animateScale.setAttribute("dur", "2s"); // todo @@ -380,22 +392,28 @@ public class SVGMorphShapeExporter extends DefaultSVGMorphShapeExporter { animateTranslate.setAttribute("to", translateXEnd + " " + translateYEnd); gradient.appendChild(animateTranslate); - gradient.appendChild(animateRotate); gradient.appendChild(animateScale); + gradient.appendChild(animateRotate); } for (int i = 0; i < gradientRecords.length; i++) { GRADRECORD record = gradientRecords[i]; + GRADRECORD recordEnd = gradientRecordsEnd[i]; Element gradientEntry = _svg.createElement("stop"); gradientEntry.setAttribute("offset", Double.toString(record.ratio / 255.0)); + gradientEntry.appendChild(createAnimateElement("offset", record.ratio / 255.0, recordEnd.ratio / 255.0)); RGB color = record.color; + RGB colorEnd = recordEnd.color; //if(colors.get(i) != 0) { gradientEntry.setAttribute("stop-color", color.toHexRGB()); + gradientEntry.appendChild(createAnimateElement("stop-color", color.toHexRGB(), colorEnd.toHexRGB())); //} if (color instanceof RGBA) { RGBA colorA = (RGBA) color; if (colorA.alpha != 255) { gradientEntry.setAttribute("stop-opacity", Float.toString(colorA.getAlphaFloat())); } + RGBA colorAEnd = (RGBA) colorEnd; + gradientEntry.appendChild(createAnimateElement("stop-opacity", colorA.getAlphaFloat(), colorAEnd.getAlphaFloat())); } gradient.appendChild(gradientEntry); } diff --git a/trunk/src/com/jpexs/decompiler/flash/exporters/StraightMorphEdge.java b/trunk/src/com/jpexs/decompiler/flash/exporters/morphshape/StraightMorphEdge.java similarity index 91% rename from trunk/src/com/jpexs/decompiler/flash/exporters/StraightMorphEdge.java rename to trunk/src/com/jpexs/decompiler/flash/exporters/morphshape/StraightMorphEdge.java index f216e95f0..8283c459f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/exporters/StraightMorphEdge.java +++ b/trunk/src/com/jpexs/decompiler/flash/exporters/morphshape/StraightMorphEdge.java @@ -14,7 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.jpexs.decompiler.flash.exporters; +package com.jpexs.decompiler.flash.exporters.morphshape; + +import com.jpexs.decompiler.flash.exporters.PointInt; /** * diff --git a/trunk/src/com/jpexs/decompiler/flash/exporters/CurvedEdge.java b/trunk/src/com/jpexs/decompiler/flash/exporters/shape/CurvedEdge.java similarity index 89% rename from trunk/src/com/jpexs/decompiler/flash/exporters/CurvedEdge.java rename to trunk/src/com/jpexs/decompiler/flash/exporters/shape/CurvedEdge.java index a9641a169..bfc6feb25 100644 --- a/trunk/src/com/jpexs/decompiler/flash/exporters/CurvedEdge.java +++ b/trunk/src/com/jpexs/decompiler/flash/exporters/shape/CurvedEdge.java @@ -14,7 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.jpexs.decompiler.flash.exporters; +package com.jpexs.decompiler.flash.exporters.shape; + +import com.jpexs.decompiler.flash.exporters.PointInt; /** * diff --git a/trunk/src/com/jpexs/decompiler/flash/exporters/DefaultSVGShapeExporter.java b/trunk/src/com/jpexs/decompiler/flash/exporters/shape/DefaultSVGShapeExporter.java similarity index 94% rename from trunk/src/com/jpexs/decompiler/flash/exporters/DefaultSVGShapeExporter.java rename to trunk/src/com/jpexs/decompiler/flash/exporters/shape/DefaultSVGShapeExporter.java index 581b7a90d..27b93580c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/exporters/DefaultSVGShapeExporter.java +++ b/trunk/src/com/jpexs/decompiler/flash/exporters/shape/DefaultSVGShapeExporter.java @@ -14,9 +14,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.jpexs.decompiler.flash.exporters; +package com.jpexs.decompiler.flash.exporters.shape; import com.jpexs.decompiler.flash.SWF; +import com.jpexs.decompiler.flash.exporters.Matrix; import com.jpexs.decompiler.flash.types.ColorTransform; import com.jpexs.decompiler.flash.types.GRADRECORD; import com.jpexs.decompiler.flash.types.RGB; diff --git a/trunk/src/com/jpexs/decompiler/flash/exporters/IEdge.java b/trunk/src/com/jpexs/decompiler/flash/exporters/shape/IEdge.java similarity index 86% rename from trunk/src/com/jpexs/decompiler/flash/exporters/IEdge.java rename to trunk/src/com/jpexs/decompiler/flash/exporters/shape/IEdge.java index fe3882f2e..4bb62e1fb 100644 --- a/trunk/src/com/jpexs/decompiler/flash/exporters/IEdge.java +++ b/trunk/src/com/jpexs/decompiler/flash/exporters/shape/IEdge.java @@ -14,7 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.jpexs.decompiler.flash.exporters; +package com.jpexs.decompiler.flash.exporters.shape; + +import com.jpexs.decompiler.flash.exporters.PointInt; /** * diff --git a/trunk/src/com/jpexs/decompiler/flash/exporters/IShapeExporter.java b/trunk/src/com/jpexs/decompiler/flash/exporters/shape/IShapeExporter.java similarity index 92% rename from trunk/src/com/jpexs/decompiler/flash/exporters/IShapeExporter.java rename to trunk/src/com/jpexs/decompiler/flash/exporters/shape/IShapeExporter.java index 3e2c4f216..8adcef870 100644 --- a/trunk/src/com/jpexs/decompiler/flash/exporters/IShapeExporter.java +++ b/trunk/src/com/jpexs/decompiler/flash/exporters/shape/IShapeExporter.java @@ -14,8 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.jpexs.decompiler.flash.exporters; +package com.jpexs.decompiler.flash.exporters.shape; +import com.jpexs.decompiler.flash.exporters.Matrix; import com.jpexs.decompiler.flash.types.ColorTransform; import com.jpexs.decompiler.flash.types.GRADRECORD; import com.jpexs.decompiler.flash.types.RGB; diff --git a/trunk/src/com/jpexs/decompiler/flash/exporters/SVGShapeExporter.java b/trunk/src/com/jpexs/decompiler/flash/exporters/shape/SVGShapeExporter.java similarity index 92% rename from trunk/src/com/jpexs/decompiler/flash/exporters/SVGShapeExporter.java rename to trunk/src/com/jpexs/decompiler/flash/exporters/shape/SVGShapeExporter.java index 2c4513ca6..f57e721b7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/exporters/SVGShapeExporter.java +++ b/trunk/src/com/jpexs/decompiler/flash/exporters/shape/SVGShapeExporter.java @@ -14,9 +14,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.jpexs.decompiler.flash.exporters; +package com.jpexs.decompiler.flash.exporters.shape; import com.jpexs.decompiler.flash.SWF; +import com.jpexs.decompiler.flash.exporters.ExportRectangle; +import com.jpexs.decompiler.flash.exporters.Matrix; import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.decompiler.flash.tags.base.ImageTag; import com.jpexs.decompiler.flash.types.ColorTransform; @@ -73,11 +75,17 @@ public class SVGShapeExporter extends DefaultSVGShapeExporter { private final SWF swf; private double maxLineWidth; private final ExportRectangle bounds; + private final String shapeId; public SVGShapeExporter(SWF swf, SHAPE shape, ExportRectangle bounds, ColorTransform colorTransform) { + this(swf, shape, bounds, colorTransform, ""); + } + + public SVGShapeExporter(SWF swf, SHAPE shape, ExportRectangle bounds, ColorTransform colorTransform, String shapeId) { super(shape, colorTransform); this.swf = swf; this.bounds = bounds; + this.shapeId = shapeId; } public String getSVG() { @@ -105,13 +113,13 @@ public class SVGShapeExporter extends DefaultSVGShapeExporter { DocumentType svgDocType = impl.createDocumentType("svg", "-//W3C//DTD SVG 1.0//EN", "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"); _svg = impl.createDocument(sNamespace, "svg", svgDocType); - _svgG.setAttribute("transform", "matrix(1, 0, 0, 1, " - + roundPixels20(-bounds.xMin / (double) SWF.unitDivisor) + ", " + roundPixels20(-bounds.yMin / (double) SWF.unitDivisor) + ")"); Element svgRoot = _svg.getDocumentElement(); svgRoot.setAttribute("xmlns:xlink", xlinkNamespace); _svgDefs = _svg.createElement("defs"); svgRoot.appendChild(_svgDefs); _svgG = _svg.createElement("g"); + _svgG.setAttribute("transform", "matrix(1, 0, 0, 1, " + + roundPixels20(-bounds.xMin / (double) SWF.unitDivisor) + ", " + roundPixels20(-bounds.yMin / (double) SWF.unitDivisor) + ")"); svgRoot.appendChild(_svgG); } catch (ParserConfigurationException ex) { Logger.getLogger(SVGShapeExporter.class.getName()).log(Level.SEVERE, null, ex); @@ -127,6 +135,7 @@ public class SVGShapeExporter extends DefaultSVGShapeExporter { finalizePath(); path.setAttribute("stroke", "none"); path.setAttribute("fill", color.toHexRGB()); + path.setAttribute("fill-rule", "evenodd"); if (color instanceof RGBA) { RGBA colorA = (RGBA) color; if (colorA.alpha != 255) { @@ -148,9 +157,11 @@ public class SVGShapeExporter extends DefaultSVGShapeExporter { id = gradients.size(); gradients.add(gradient); } - gradient.setAttribute("id", "gradient" + id); + String gradientId = "gradient" + shapeId + id; + gradient.setAttribute("id", gradientId); path.setAttribute("stroke", "none"); - path.setAttribute("fill", "url(#gradient" + id + ")"); + path.setAttribute("fill", "url(#" + gradientId + ")"); + path.setAttribute("fill-rule", "evenodd"); _svgDefs.appendChild(gradient); } @@ -174,7 +185,11 @@ public class SVGShapeExporter extends DefaultSVGShapeExporter { int width = img.getWidth(); int height = img.getHeight(); lastPatternId++; - String patternId = "PatternID_" + lastPatternId; + String patternId = "PatternID_"; + if (!shapeId.isEmpty()) { + patternId += shapeId + "_"; + } + patternId += lastPatternId; String format = image.getImageFormat(); InputStream imageStream = image.getImageData(); byte[] imageData; diff --git a/trunk/src/com/jpexs/decompiler/flash/exporters/ShapeExporterBase.java b/trunk/src/com/jpexs/decompiler/flash/exporters/shape/ShapeExporterBase.java similarity index 97% rename from trunk/src/com/jpexs/decompiler/flash/exporters/ShapeExporterBase.java rename to trunk/src/com/jpexs/decompiler/flash/exporters/shape/ShapeExporterBase.java index 85947a12e..ffe5e2863 100644 --- a/trunk/src/com/jpexs/decompiler/flash/exporters/ShapeExporterBase.java +++ b/trunk/src/com/jpexs/decompiler/flash/exporters/shape/ShapeExporterBase.java @@ -14,8 +14,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.jpexs.decompiler.flash.exporters; +package com.jpexs.decompiler.flash.exporters.shape; +import com.jpexs.decompiler.flash.exporters.Matrix; +import com.jpexs.decompiler.flash.exporters.PointInt; import com.jpexs.decompiler.flash.types.ColorTransform; import com.jpexs.decompiler.flash.types.FILLSTYLE; import com.jpexs.decompiler.flash.types.FOCALGRADIENT; diff --git a/trunk/src/com/jpexs/decompiler/flash/exporters/StraightEdge.java b/trunk/src/com/jpexs/decompiler/flash/exporters/shape/StraightEdge.java similarity index 90% rename from trunk/src/com/jpexs/decompiler/flash/exporters/StraightEdge.java rename to trunk/src/com/jpexs/decompiler/flash/exporters/shape/StraightEdge.java index 9f2728ee2..3982cf407 100644 --- a/trunk/src/com/jpexs/decompiler/flash/exporters/StraightEdge.java +++ b/trunk/src/com/jpexs/decompiler/flash/exporters/shape/StraightEdge.java @@ -14,7 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.jpexs.decompiler.flash.exporters; +package com.jpexs.decompiler.flash.exporters.shape; + +import com.jpexs.decompiler.flash.exporters.PointInt; /** * diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainPanel.java index f30d22a4f..4a007b36f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -234,11 +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) - // this settings should be synchronized with frameCount and frameRate - // settings in MainPanel.createAndShowTempSwf - static final int morphShapeAnimationLength = 2; + public static final int morphShapeAnimationLength = 2; - static final int morphShapeAnimationFrameRate = 30; + public static final int morphShapeAnimationFrameRate = 30; private static final Logger logger = Logger.getLogger(MainPanel.class.getName()); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java b/trunk/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java index 21bef3a14..47dd57af1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java @@ -504,9 +504,8 @@ public class PreviewPanel extends JSplitPane implements ActionListener { } if ((tagObj instanceof DefineMorphShapeTag) || (tagObj instanceof DefineMorphShape2Tag)) { - // this setting should be synchronized with ImagePanel.morphShapeAnimationLength - frameCount = 100; - frameRate = 50; + frameRate = MainPanel.morphShapeAnimationFrameRate; + frameCount = MainPanel.morphShapeAnimationLength * frameRate; } if (tagObj instanceof DefineSoundTag) { @@ -671,8 +670,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener { } else if ((tagObj instanceof DefineMorphShapeTag) || (tagObj instanceof DefineMorphShape2Tag)) { new PlaceObject2Tag(swf, false, false, false, true, false, true, true, false, 1, chtId, mat, null, 0, null, 0, null).writeTag(sos2); new ShowFrameTag(swf).writeTag(sos2); - int numFrames = 100; - for (int ratio = 0; ratio < 65536; ratio += 65536 / numFrames) { + for (int ratio = 0; ratio < 65536; ratio += 65536 / frameCount) { new PlaceObject2Tag(swf, false, false, false, true, false, true, false, true, 1, chtId, mat, null, ratio, null, 0, null).writeTag(sos2); new ShowFrameTag(swf).writeTag(sos2); } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/locales/ExportDialog.properties b/trunk/src/com/jpexs/decompiler/flash/gui/locales/ExportDialog.properties index 6db92cf47..781539ec9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/locales/ExportDialog.properties +++ b/trunk/src/com/jpexs/decompiler/flash/gui/locales/ExportDialog.properties @@ -56,6 +56,7 @@ frames = Frames frames.png = PNG frames.gif = GIF frames.avi = AVI +frames.svg = SVG fonts = Fonts -fonts.ttf = TTF \ No newline at end of file +fonts.ttf = TTF diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/locales/ExportDialog_hu.properties b/trunk/src/com/jpexs/decompiler/flash/gui/locales/ExportDialog_hu.properties index dc0fbb3bc..004c7a5a0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/locales/ExportDialog_hu.properties +++ b/trunk/src/com/jpexs/decompiler/flash/gui/locales/ExportDialog_hu.properties @@ -14,6 +14,7 @@ # along with this program. If not, see . shapes = Alakzatok shapes.svg = SVG +shapes.png = PNG texts = Sz\u00f6vegek texts.plain = Egyszer\u0171 sz\u00f6veg @@ -21,6 +22,8 @@ texts.formatted = Form\u00e1zott sz\u00f6veg images = K\u00e9pek images.png_jpeg = PNG/JPEG +images.png = PNG +images.jpeg = JPEG movies = Mozg\u00f3k\u00e9pek movies.flv = FLV (Hang n\u00e9lk\u00fcl) @@ -28,14 +31,32 @@ movies.flv = FLV (Hang n\u00e9lk\u00fcl) sounds = Hangok sounds.mp3_wav_flv = MP3/WAV/FLV sounds.flv = FLV (Csak hang) +sounds.mp3_wav = MP3/WAV +sounds.wav = WAV -scripts = Scripts +scripts = Szkriptek scripts.as = ActionScript scripts.pcode = P-code scripts.pcode_hex = P-code \u00e9s Hexa scripts.hex = Hexa +binaryData = Binary data +binaryData.raw = Nyers + dialog.title = Export\u00e1l\u00e1s... button.ok = OK button.cancel = M\u00e9gse + +morphshapes = Morph alakzatok +morphshapes.gif = GIF +morphshapes.svg = SVG + +frames = Keretek +frames.png = PNG +frames.gif = GIF +frames.avi = AVI +frames.svg = SVG + +fonts = Bet\u0171t\u00edpusok +fonts.ttf = TTF diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties index ec6129179..ff21decc6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties +++ b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties @@ -455,3 +455,12 @@ generictag.array.insertend = %item% besz\u00far\u00e1sa a v\u00e9g\u00e9re #after version 2.0.0 contextmenu.expandAll = Mindent kinyit binaryData.truncateWarning = %count% byte lev\u00e1gva. + +filter.sounds = T\u00e1mogatott hang form\u00e1tumok (*.wav, *.mp3) +filter.sounds.wav = Hanghull\u00e1m form\u00e1tum (*.wav) +filter.sounds.mp3 = MP3 t\u00f6m\u00f6r\u00edtett form\u00e1tum (*.mp3) + +error.sound.invalid = \u00c9rv\u00e9nytelen hang. + +button.prev = El\u0151z\u0151 +button.next = K\u00f6vetkez\u0151 diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java index 15eb671e4..c4c1c9768 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; 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.tags.base.FontTag; import com.jpexs.decompiler.flash.tags.base.MissingCharacterHandler; import com.jpexs.decompiler.flash.tags.base.TextTag; @@ -937,6 +938,11 @@ public class DefineEditTextTag extends TextTag { } } + @Override + public String toSVG(SVGExporterContext exporterContext) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + private FontTag getFontTag() { FontTag font = null; for (Tag tag : swf.tags) { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java index f09b5bb18..28cdfd6cf 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java @@ -23,7 +23,8 @@ import com.jpexs.decompiler.flash.exporters.BitmapExporter; import com.jpexs.decompiler.flash.exporters.ExportRectangle; import com.jpexs.decompiler.flash.exporters.Matrix; import com.jpexs.decompiler.flash.exporters.Point; -import com.jpexs.decompiler.flash.exporters.SVGMorphShapeExporter; +import com.jpexs.decompiler.flash.exporters.SVGExporterContext; +import com.jpexs.decompiler.flash.exporters.morphshape.SVGMorphShapeExporter; import com.jpexs.decompiler.flash.tags.base.CharacterTag; import com.jpexs.decompiler.flash.tags.base.DrawableTag; import com.jpexs.decompiler.flash.tags.base.MorphShapeTag; @@ -99,7 +100,7 @@ public class DefineMorphShape2Tag extends CharacterTag implements MorphShapeTag, } @Override - public String toSVG() { + public String toSVG(SVGExporterContext exporterContext) { ExportRectangle rect = new ExportRectangle(getRect()); SHAPEWITHSTYLE beginShapes = getShapeAtRatio(0); SHAPEWITHSTYLE endShapes = getShapeAtRatio(65535); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShapeTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShapeTag.java index 3fc3d647b..2daa28856 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShapeTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShapeTag.java @@ -23,7 +23,8 @@ import com.jpexs.decompiler.flash.exporters.BitmapExporter; import com.jpexs.decompiler.flash.exporters.ExportRectangle; import com.jpexs.decompiler.flash.exporters.Matrix; import com.jpexs.decompiler.flash.exporters.Point; -import com.jpexs.decompiler.flash.exporters.SVGMorphShapeExporter; +import com.jpexs.decompiler.flash.exporters.SVGExporterContext; +import com.jpexs.decompiler.flash.exporters.morphshape.SVGMorphShapeExporter; import com.jpexs.decompiler.flash.tags.base.CharacterTag; import com.jpexs.decompiler.flash.tags.base.DrawableTag; import com.jpexs.decompiler.flash.tags.base.MorphShapeTag; @@ -147,7 +148,7 @@ public class DefineMorphShapeTag extends CharacterTag implements MorphShapeTag, } @Override - public String toSVG() { + public String toSVG(SVGExporterContext exporterContext) { ExportRectangle rect = new ExportRectangle(getRect()); SHAPEWITHSTYLE beginShapes = getShapeAtRatio(0); SHAPEWITHSTYLE endShapes = getShapeAtRatio(65535); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape2Tag.java index d502387a9..9223dfa7a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape2Tag.java @@ -20,7 +20,8 @@ import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.exporters.ExportRectangle; import com.jpexs.decompiler.flash.exporters.Point; -import com.jpexs.decompiler.flash.exporters.SVGShapeExporter; +import com.jpexs.decompiler.flash.exporters.SVGExporterContext; +import com.jpexs.decompiler.flash.exporters.shape.SVGShapeExporter; import com.jpexs.decompiler.flash.tags.base.ShapeTag; import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.ColorTransform; @@ -60,7 +61,7 @@ public class DefineShape2Tag extends ShapeTag { } @Override - public String toSVG() { + public String toSVG(SVGExporterContext exporterContext) { ExportRectangle rect = new ExportRectangle(getRect()); SVGShapeExporter exporter = new SVGShapeExporter(swf, getShapes(), rect, new ColorTransform() /*FIXME?*/); exporter.export(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape3Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape3Tag.java index 10c039a29..34d0929fe 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape3Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape3Tag.java @@ -20,7 +20,8 @@ import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.exporters.ExportRectangle; import com.jpexs.decompiler.flash.exporters.Point; -import com.jpexs.decompiler.flash.exporters.SVGShapeExporter; +import com.jpexs.decompiler.flash.exporters.SVGExporterContext; +import com.jpexs.decompiler.flash.exporters.shape.SVGShapeExporter; import com.jpexs.decompiler.flash.tags.base.ShapeTag; import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.ColorTransform; @@ -65,7 +66,7 @@ public class DefineShape3Tag extends ShapeTag { } @Override - public String toSVG() { + public String toSVG(SVGExporterContext exporterContext) { ExportRectangle rect = new ExportRectangle(getRect()); SVGShapeExporter exporter = new SVGShapeExporter(swf, getShapes(), rect, new ColorTransform() /*FIXME?*/); exporter.export(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape4Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape4Tag.java index 112c7ce9d..32bbbb4c4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape4Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape4Tag.java @@ -20,7 +20,8 @@ import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.exporters.ExportRectangle; import com.jpexs.decompiler.flash.exporters.Point; -import com.jpexs.decompiler.flash.exporters.SVGShapeExporter; +import com.jpexs.decompiler.flash.exporters.SVGExporterContext; +import com.jpexs.decompiler.flash.exporters.shape.SVGShapeExporter; import com.jpexs.decompiler.flash.tags.base.ShapeTag; import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.ColorTransform; @@ -68,7 +69,7 @@ public class DefineShape4Tag extends ShapeTag { } @Override - public String toSVG() { + public String toSVG(SVGExporterContext exporterContext) { ExportRectangle rect = new ExportRectangle(getRect()); SVGShapeExporter exporter = new SVGShapeExporter(swf, getShapes(), rect, new ColorTransform() /*FIXME?*/); exporter.export(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShapeTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShapeTag.java index 09059e7e8..220941ed9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShapeTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShapeTag.java @@ -21,7 +21,8 @@ import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.exporters.ExportRectangle; import com.jpexs.decompiler.flash.exporters.Point; -import com.jpexs.decompiler.flash.exporters.SVGShapeExporter; +import com.jpexs.decompiler.flash.exporters.SVGExporterContext; +import com.jpexs.decompiler.flash.exporters.shape.SVGShapeExporter; import com.jpexs.decompiler.flash.tags.base.ShapeTag; import com.jpexs.decompiler.flash.types.BasicType; import com.jpexs.decompiler.flash.types.ColorTransform; @@ -93,7 +94,7 @@ public class DefineShapeTag extends ShapeTag { } @Override - public String toSVG() { + public String toSVG(SVGExporterContext exporterContext) { ExportRectangle rect = new ExportRectangle(getRect()); SVGShapeExporter exporter = new SVGShapeExporter(swf, getShapes(), rect, new ColorTransform() /*FIXME?*/); exporter.export(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java index 0851bddb8..463f100b6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java @@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.CopyOutputStream; import com.jpexs.decompiler.flash.configuration.Configuration; 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.tags.base.BoundedTag; import com.jpexs.decompiler.flash.tags.base.CharacterTag; import com.jpexs.decompiler.flash.tags.base.Container; @@ -288,6 +289,11 @@ public class DefineSpriteTag extends CharacterTag implements Container, Drawable SWF.frameToImage(getTimeline(), frame, time, stateUnderCursor, mouseButton, image, transformation, colorTransform); } + @Override + public String toSVG(SVGExporterContext exporterContext) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + @Override public Point getImagePos(int frame) { return new Point(0, 0); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java index 0a5b51e82..df039ba97 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java @@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; 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.tags.base.FontTag; import com.jpexs.decompiler.flash.tags.base.MissingCharacterHandler; import com.jpexs.decompiler.flash.tags.base.TextTag; @@ -492,6 +493,11 @@ public class DefineText2Tag extends TextTag { staticTextToImage(swf, textRecords, 2, image, getTextMatrix(), transformation, colorTransform); } + @Override + public String toSVG(SVGExporterContext exporterContext) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + @Override public Point getImagePos(int frame) { return new Point(textBounds.Xmin / 20, textBounds.Ymin / 20); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java index cb485c62e..a643f9903 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java @@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; 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.tags.base.FontTag; import com.jpexs.decompiler.flash.tags.base.MissingCharacterHandler; import com.jpexs.decompiler.flash.tags.base.TextTag; @@ -508,6 +509,11 @@ public class DefineTextTag extends TextTag { staticTextToImage(swf, textRecords, 1, image, getTextMatrix(), transformation, colorTransform); } + @Override + public String toSVG(SVGExporterContext exporterContext) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + @Override public Point getImagePos(int frame) { return new Point(textBounds.Xmin / SWF.unitDivisor, textBounds.Ymin / SWF.unitDivisor); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/base/ButtonTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/base/ButtonTag.java index e4ad5ba11..3e6837049 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/ButtonTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/ButtonTag.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.tags.base; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.exporters.Matrix; +import com.jpexs.decompiler.flash.exporters.SVGExporterContext; import com.jpexs.decompiler.flash.tags.DefineButtonSoundTag; import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.decompiler.flash.timeline.DepthState; @@ -57,6 +58,11 @@ public abstract class ButtonTag extends CharacterTag implements DrawableTag, Tim SWF.frameToImage(getTimeline(), frame, time, stateUnderCursor, mouseButton, image, transformation, colorTransform); } + @Override + public String toSVG(SVGExporterContext exporterContext) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + public DefineButtonSoundTag getSounds() { for (Tag t : swf.tags) { if (t instanceof DefineButtonSoundTag) { diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/base/DrawableTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/base/DrawableTag.java index f1255ccac..b465c7138 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/DrawableTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/DrawableTag.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.tags.base; 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.timeline.DepthState; import com.jpexs.decompiler.flash.types.ColorTransform; import com.jpexs.helpers.SerializableImage; @@ -31,6 +32,8 @@ 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); + public Point getImagePos(int frame); public int getNumFrames(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/base/FontTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/base/FontTag.java index 7c9bf95cd..80b59e7ab 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/FontTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/FontTag.java @@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.configuration.Configuration; 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.helpers.FontHelper; import com.jpexs.decompiler.flash.tags.DefineFontNameTag; import com.jpexs.decompiler.flash.tags.DefineText2Tag; @@ -258,6 +259,11 @@ public abstract class FontTag extends CharacterTag implements AloneTag, Drawable SHAPERECORD.shapeListToImage(swf, getGlyphShapeTable(), image, frame, Color.black, colorTransform); } + @Override + public String toSVG(SVGExporterContext exporterContext) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + @Override public Point getImagePos(int frame) { return new Point(0, 0); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/base/MorphShapeTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/base/MorphShapeTag.java index 6264b5510..5055d15b2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/MorphShapeTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/MorphShapeTag.java @@ -16,6 +16,7 @@ */ 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; @@ -40,7 +41,7 @@ public interface MorphShapeTag { public SHAPE getEndEdges(); - public abstract String toSVG(); + public String toSVG(SVGExporterContext exporterContext); public int getShapeNum(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/base/ShapeTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/base/ShapeTag.java index ca29f241c..2d0181859 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/ShapeTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/ShapeTag.java @@ -37,8 +37,6 @@ public abstract class ShapeTag extends CharacterTag implements BoundedTag, Drawa public abstract SHAPEWITHSTYLE getShapes(); - public abstract String toSVG(); - public abstract int getShapeNum(); @Override