diff --git a/trunk/src/com/jpexs/decompiler/flash/SWF.java b/trunk/src/com/jpexs/decompiler/flash/SWF.java index c450c0d2b..2177b74bb 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWF.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWF.java @@ -2671,8 +2671,7 @@ public final class SWF implements TreeItem, Timelined { // TODO: if (layer.filters != null) // TODO: if (layer.blendMode > 1) String assetPath = level == 0 ? exporterContext.assetsDir + File.separator + assetFileName : assetFileName; - Matrix mat = new Matrix(layer.matrix); - mat.translate(rect.xMin, rect.yMin); + Matrix mat = Matrix.getTranslateInstance(rect.xMin, rect.yMin).preConcatenate(new Matrix(layer.matrix)); exporter.addImage(mat, boundRect, assetPath); // TODO: if (layer.clipDepth > -1)... diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java index 19b376570..5082e4d47 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButton2Tag.java @@ -21,7 +21,6 @@ import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.abc.CopyOutputStream; import com.jpexs.decompiler.flash.configuration.Configuration; -import com.jpexs.decompiler.flash.exporters.Point; import com.jpexs.decompiler.flash.tags.base.BoundedTag; import com.jpexs.decompiler.flash.tags.base.ButtonTag; import com.jpexs.decompiler.flash.tags.base.CharacterTag; @@ -245,12 +244,6 @@ public class DefineButton2Tag extends ButtonTag implements Container { return trackAsMenu; } - @Override - public Point getImagePos(int frame) { - RECT r = getRect(); - return new Point(r.Xmin / SWF.unitDivisor, r.Ymin / SWF.unitDivisor); - } - @Override public int getNumFrames() { return 1; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java index 024b11102..be6c1e38d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineButtonTag.java @@ -24,7 +24,6 @@ import com.jpexs.decompiler.flash.abc.CopyOutputStream; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.ActionListReader; import com.jpexs.decompiler.flash.configuration.Configuration; -import com.jpexs.decompiler.flash.exporters.Point; import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.flash.tags.base.ASMSource; @@ -273,12 +272,6 @@ public class DefineButtonTag extends ButtonTag implements ASMSource { return false; } - @Override - public Point getImagePos(int frame) { - RECT r = getRect(); - return new Point(r.Xmin / SWF.unitDivisor, r.Ymin / SWF.unitDivisor); - } - @Override public int getNumFrames() { return 1; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java index 4155c7f38..b009167e5 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java @@ -20,7 +20,6 @@ import com.jpexs.decompiler.flash.SWF; 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; @@ -956,11 +955,6 @@ public class DefineEditTextTag extends TextTag { return font; } - @Override - public Point getImagePos(int frame) { - return new Point(bounds.Xmin / SWF.unitDivisor, bounds.Ymin / SWF.unitDivisor); - } - @Override public int getNumFrames() { return 1; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java index 0e93c7090..832d35ab8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java @@ -22,7 +22,6 @@ import com.jpexs.decompiler.flash.SWFOutputStream; 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.SVGExporter; import com.jpexs.decompiler.flash.exporters.SVGExporterContext; import com.jpexs.decompiler.flash.exporters.morphshape.SVGMorphShapeExporter; @@ -346,13 +345,6 @@ public class DefineMorphShape2Tag extends CharacterTag implements MorphShapeTag return svgExporter.getSVG(); } - @Override - public Point getImagePos(int frame) { - return new Point( - (startBounds.Xmin + (endBounds.Xmin - startBounds.Xmin) * frame / 65535) / SWF.unitDivisor, - (startBounds.Ymin + (endBounds.Ymin - startBounds.Ymin) * frame / 65535) / SWF.unitDivisor); - } - @Override public int getNumFrames() { return 65536; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShapeTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShapeTag.java index af42cec1f..eb9b75225 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShapeTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShapeTag.java @@ -22,7 +22,6 @@ import com.jpexs.decompiler.flash.SWFOutputStream; 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.SVGExporter; import com.jpexs.decompiler.flash.exporters.SVGExporterContext; import com.jpexs.decompiler.flash.exporters.morphshape.SVGMorphShapeExporter; @@ -329,13 +328,6 @@ public class DefineMorphShapeTag extends CharacterTag implements MorphShapeTag { return svgExporter.getSVG(); } - @Override - public Point getImagePos(int frame) { - return new Point( - (startBounds.Xmin + (endBounds.Xmin - startBounds.Xmin) * frame / 65535) / SWF.unitDivisor, - (startBounds.Ymin + (endBounds.Ymin - startBounds.Ymin) * frame / 65535) / SWF.unitDivisor); - } - @Override public int getNumFrames() { return 65536; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape2Tag.java index 71a31c66c..18ab5a7da 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape2Tag.java @@ -19,7 +19,6 @@ package com.jpexs.decompiler.flash.tags; 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.SVGExporter; import com.jpexs.decompiler.flash.exporters.SVGExporterContext; import com.jpexs.decompiler.flash.exporters.shape.SVGShapeExporter; @@ -41,11 +40,6 @@ public class DefineShape2Tag extends ShapeTag { public SHAPEWITHSTYLE shapes; public static final int ID = 22; - @Override - public Point getImagePos(int frame) { - return new Point(shapeBounds.Xmin / SWF.unitDivisor, shapeBounds.Ymin / SWF.unitDivisor); - } - @Override public int getShapeNum() { return 2; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape3Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape3Tag.java index 14988b90f..68ce4873a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape3Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape3Tag.java @@ -19,7 +19,6 @@ package com.jpexs.decompiler.flash.tags; 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.SVGExporter; import com.jpexs.decompiler.flash.exporters.SVGExporterContext; import com.jpexs.decompiler.flash.exporters.shape.SVGShapeExporter; @@ -41,11 +40,6 @@ public class DefineShape3Tag extends ShapeTag { public SHAPEWITHSTYLE shapes; public static final int ID = 32; - @Override - public Point getImagePos(int frame) { - return new Point(shapeBounds.Xmin / SWF.unitDivisor, shapeBounds.Ymin / SWF.unitDivisor); - } - @Override public int getShapeNum() { return 3; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape4Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape4Tag.java index c24568fe1..3f3d5209a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape4Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape4Tag.java @@ -19,7 +19,6 @@ package com.jpexs.decompiler.flash.tags; 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.SVGExporter; import com.jpexs.decompiler.flash.exporters.SVGExporterContext; import com.jpexs.decompiler.flash.exporters.shape.SVGShapeExporter; @@ -49,11 +48,6 @@ public class DefineShape4Tag extends ShapeTag { public SHAPEWITHSTYLE shapes; public static final int ID = 83; - @Override - public Point getImagePos(int frame) { - return new Point(shapeBounds.Xmin / SWF.unitDivisor, shapeBounds.Ymin / SWF.unitDivisor); - } - @Override public int getShapeNum() { return 4; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShapeTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShapeTag.java index 7aee6a5c9..20a0c5285 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShapeTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShapeTag.java @@ -20,7 +20,6 @@ import com.jpexs.decompiler.flash.SWF; 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.SVGExporter; import com.jpexs.decompiler.flash.exporters.SVGExporterContext; import com.jpexs.decompiler.flash.exporters.shape.SVGShapeExporter; @@ -103,15 +102,6 @@ public class DefineShapeTag extends ShapeTag { return svgExporter.getSVG(); } - /* @Override - public void toImage(int frame, int ratio, java.awt.Point mousePos, int mouseButton, SerializableImage image, Matrix transformation, ColorTransform colorTransform) { - BitmapExporter.exportTo(swf, getShapes(), null, image, transformation, colorTransform); - }*/ - @Override - public Point getImagePos(int frame) { - return new Point(shapeBounds.Xmin / SWF.unitDivisor, shapeBounds.Ymin / SWF.unitDivisor); - } - @Override public int getNumFrames() { return 1; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java index cc4bd3145..40fdaff5f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java @@ -22,7 +22,6 @@ import com.jpexs.decompiler.flash.SWFOutputStream; 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; @@ -291,12 +290,7 @@ public class DefineSpriteTag extends CharacterTag implements Container, Drawable @Override public String toSVG(SVGExporterContext exporterContext, int ratio, ColorTransform colorTransform, int level) throws IOException { - return SWF.frameToSvg(getTimeline(), 0, 0, null, 0, exporterContext, getRect(), new ColorTransform(), null, level + 1); - } - - @Override - public Point getImagePos(int frame) { - return new Point(0, 0); + return SWF.frameToSvg(getTimeline(), 0, 0, null, 0, exporterContext, getRect(), colorTransform, null, level + 1); } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java index be041da2a..eed6504df 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java @@ -20,7 +20,6 @@ import com.jpexs.decompiler.flash.SWF; 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; @@ -495,12 +494,7 @@ public class DefineText2Tag extends TextTag { @Override public String toSVG(SVGExporterContext exporterContext, int ratio, ColorTransform colorTransform, int level) { - return staticTextToSVG(swf, textRecords, 2, getTextMatrix(), colorTransform); - } - - @Override - public Point getImagePos(int frame) { - return new Point(textBounds.Xmin / 20, textBounds.Ymin / 20); + return staticTextToSVG(swf, textRecords, 2, getRect(), getTextMatrix(), colorTransform); } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java index 00bfeb4e5..44ae0c635 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java @@ -21,7 +21,6 @@ import com.jpexs.decompiler.flash.SWF; 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; @@ -511,12 +510,7 @@ public class DefineTextTag extends TextTag { @Override public String toSVG(SVGExporterContext exporterContext, int ratio, ColorTransform colorTransform, int level) { - return staticTextToSVG(swf, textRecords, 1, getTextMatrix(), colorTransform); - } - - @Override - public Point getImagePos(int frame) { - return new Point(textBounds.Xmin / SWF.unitDivisor, textBounds.Ymin / SWF.unitDivisor); + return staticTextToSVG(swf, textRecords, 1, getRect(), getTextMatrix(), colorTransform); } @Override 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 075efeb18..42e811305 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/ButtonTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/ButtonTag.java @@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.types.BUTTONRECORD; import com.jpexs.decompiler.flash.types.ColorTransform; import com.jpexs.helpers.SerializableImage; import java.awt.Shape; +import java.io.IOException; import java.util.List; /** @@ -59,9 +60,8 @@ public abstract class ButtonTag extends CharacterTag implements DrawableTag, Tim } @Override - public String toSVG(SVGExporterContext exporterContext, int ratio, ColorTransform colorTransform, int level) { - return ""; - //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + public String toSVG(SVGExporterContext exporterContext, int ratio, ColorTransform colorTransform, int level) throws IOException { + return SWF.frameToSvg(getTimeline(), 0, 0, null, 0, exporterContext, getRect(), colorTransform, null, level + 1); } public DefineButtonSoundTag getSounds() { 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 a095da15b..a18a06c13 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/DrawableTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/DrawableTag.java @@ -17,7 +17,6 @@ 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; @@ -35,8 +34,6 @@ public interface DrawableTag extends BoundedTag { public String toSVG(SVGExporterContext exporterContext, int ratio, ColorTransform colorTransform, int level) throws IOException; - public Point getImagePos(int frame); - public int getNumFrames(); public boolean isSingleFrame(); 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 55817aa99..9e4df895e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/FontTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/FontTag.java @@ -19,7 +19,6 @@ package com.jpexs.decompiler.flash.tags.base; 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; @@ -264,11 +263,6 @@ public abstract class FontTag extends CharacterTag implements AloneTag, Drawable return ""; } - @Override - public Point getImagePos(int frame) { - return new Point(0, 0); - } - @Override public int getNumFrames() { int frameCount = (getGlyphShapeTable().size() - 1) / SHAPERECORD.MAX_CHARACTERS_IN_FONT_PREVIEW + 1; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/base/TextTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/base/TextTag.java index 7ad0b77ff..d5f59278f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/TextTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/TextTag.java @@ -305,7 +305,7 @@ public abstract class TextTag extends CharacterTag implements BoundedTag, Drawab } } - public static String staticTextToSVG(SWF swf, List textRecords, int numText, MATRIX textMatrix, ColorTransform colorTransform) { + public static String staticTextToSVG(SWF swf, List textRecords, int numText, RECT bounds, MATRIX textMatrix, ColorTransform colorTransform) { Color textColor = new Color(0, 0, 0); FontTag font = null; int textHeight = 12; @@ -336,8 +336,7 @@ public abstract class TextTag extends CharacterTag implements BoundedTag, Drawab double rat = textHeight / 1024.0 / font.getDivider(); for (GLYPHENTRY entry : rec.glyphEntries) { - Matrix matTr = Matrix.getTranslateInstance(x, y); - Matrix mat = new Matrix(textMatrix).concatenate(matTr).concatenate(Matrix.getScaleInstance(rat)); + Matrix mat = (new Matrix(textMatrix).concatenate(Matrix.getTranslateInstance(x - bounds.Xmin, y - bounds.Ymin))).concatenate(Matrix.getScaleInstance(rat)); if (entry.glyphIndex != -1) { // shapeNum: 1 SHAPE shape = glyphs.get(entry.glyphIndex); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineCompactedFont.java b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineCompactedFont.java index 19f2feb12..a189c9187 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineCompactedFont.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/gfx/DefineCompactedFont.java @@ -19,7 +19,6 @@ package com.jpexs.decompiler.flash.tags.gfx; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.SWFOutputStream; -import com.jpexs.decompiler.flash.exporters.Point; import com.jpexs.decompiler.flash.tags.DefineFont2Tag; import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.decompiler.flash.tags.base.DrawableTag; @@ -108,11 +107,6 @@ public final class DefineCompactedFont extends FontTag implements DrawableTag { shapeCache = fonts.get(0).getGlyphShapes(); } - @Override - public Point getImagePos(int frame) { - return new Point(0, 0); - } - @Override public int getNumFrames() { return 1;