mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 07:00:45 +00:00
svg animation fixes, prepare for frame export
This commit is contained in:
@@ -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<File> exportFrames(AbortRetryIgnoreHandler handler, String outdir, int containerId, List<Integer> frames, final FramesExportMode mode) throws IOException {
|
||||
List<File> ret = new ArrayList<>();
|
||||
final List<File> 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<BufferedImage> 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<Clip> clips = new ArrayList<>();
|
||||
List<Shape> 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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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<Element> 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;
|
||||
}
|
||||
}
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.exporters;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class SVGExporterContext {
|
||||
|
||||
}
|
||||
@@ -24,5 +24,6 @@ public enum FramesExportMode {
|
||||
|
||||
PNG,
|
||||
GIF,
|
||||
AVI
|
||||
AVI,
|
||||
SVG
|
||||
}
|
||||
|
||||
+3
-1
@@ -14,7 +14,9 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.exporters;
|
||||
package com.jpexs.decompiler.flash.exporters.morphshape;
|
||||
|
||||
import com.jpexs.decompiler.flash.exporters.PointInt;
|
||||
|
||||
/**
|
||||
*
|
||||
+4
-3
@@ -14,9 +14,10 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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
|
||||
+3
-1
@@ -14,7 +14,9 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.exporters;
|
||||
package com.jpexs.decompiler.flash.exporters.morphshape;
|
||||
|
||||
import com.jpexs.decompiler.flash.exporters.PointInt;
|
||||
|
||||
/**
|
||||
*
|
||||
+4
-3
@@ -14,8 +14,9 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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);
|
||||
|
||||
+5
-1
@@ -14,8 +14,10 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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,
|
||||
+37
-19
@@ -14,9 +14,11 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
+3
-1
@@ -14,7 +14,9 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.exporters;
|
||||
package com.jpexs.decompiler.flash.exporters.morphshape;
|
||||
|
||||
import com.jpexs.decompiler.flash.exporters.PointInt;
|
||||
|
||||
/**
|
||||
*
|
||||
+3
-1
@@ -14,7 +14,9 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.exporters;
|
||||
package com.jpexs.decompiler.flash.exporters.shape;
|
||||
|
||||
import com.jpexs.decompiler.flash.exporters.PointInt;
|
||||
|
||||
/**
|
||||
*
|
||||
+2
-1
@@ -14,9 +14,10 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
+3
-1
@@ -14,7 +14,9 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.exporters;
|
||||
package com.jpexs.decompiler.flash.exporters.shape;
|
||||
|
||||
import com.jpexs.decompiler.flash.exporters.PointInt;
|
||||
|
||||
/**
|
||||
*
|
||||
+2
-1
@@ -14,8 +14,9 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
+21
-6
@@ -14,9 +14,11 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
+3
-1
@@ -14,8 +14,10 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
+3
-1
@@ -14,7 +14,9 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.exporters;
|
||||
package com.jpexs.decompiler.flash.exporters.shape;
|
||||
|
||||
import com.jpexs.decompiler.flash.exporters.PointInt;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -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());
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ frames = Frames
|
||||
frames.png = PNG
|
||||
frames.gif = GIF
|
||||
frames.avi = AVI
|
||||
frames.svg = SVG
|
||||
|
||||
fonts = Fonts
|
||||
fonts.ttf = TTF
|
||||
fonts.ttf = TTF
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user