From 9a90572312ab6d69616a582e2f0ac30c60a04529 Mon Sep 17 00:00:00 2001 From: Honfika Date: Sun, 20 Apr 2014 10:11:15 +0200 Subject: [PATCH] frame SVG export: opacity fixed --- .../avm2/model/operations/AsTypeAVM2Item.java | 1 - .../avm2/model/operations/IsTypeAVM2Item.java | 1 - .../flash/tags/DefineMorphShape2Tag.java | 6 +++--- .../flash/tags/DefineMorphShapeTag.java | 6 +++--- .../decompiler/flash/tags/DefineShape2Tag.java | 14 -------------- .../decompiler/flash/tags/DefineShape3Tag.java | 18 ------------------ .../decompiler/flash/tags/DefineShape4Tag.java | 14 -------------- .../decompiler/flash/tags/DefineShapeTag.java | 14 -------------- .../decompiler/flash/tags/base/ShapeTag.java | 13 +++++++++++++ .../decompiler/flash/tags/base/TextTag.java | 4 ++-- 10 files changed, 21 insertions(+), 70 deletions(-) diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AsTypeAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AsTypeAVM2Item.java index 5fb55acb8..2271d38e0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AsTypeAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/AsTypeAVM2Item.java @@ -18,7 +18,6 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.decompiler.flash.abc.avm2.instructions.types.AsTypeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.types.AsTypeLateIns; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/IsTypeAVM2Item.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/IsTypeAVM2Item.java index 92d802dfa..1b6df655e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/IsTypeAVM2Item.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/model/operations/IsTypeAVM2Item.java @@ -18,7 +18,6 @@ package com.jpexs.decompiler.flash.abc.avm2.model.operations; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.decompiler.flash.abc.avm2.instructions.types.IsTypeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.types.IsTypeLateIns; import com.jpexs.decompiler.graph.CompilationException; import com.jpexs.decompiler.graph.GraphSourceItem; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java index 832d35ab8..0b89689bd 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShape2Tag.java @@ -331,15 +331,15 @@ public class DefineMorphShape2Tag extends CharacterTag implements MorphShapeTag @Override public String toSVG(SVGExporterContext exporterContext, int ratio, ColorTransform colorTransform, int level) { ExportRectangle rect = new ExportRectangle(getRect()); - SVGExporter svgExporter = new SVGExporter(rect, new ColorTransform()); + SVGExporter svgExporter = new SVGExporter(rect, colorTransform); if (ratio == -2) { SHAPEWITHSTYLE beginShapes = getShapeAtRatio(0); SHAPEWITHSTYLE endShapes = getShapeAtRatio(65535); - SVGMorphShapeExporter exporter = new SVGMorphShapeExporter(swf, beginShapes, endShapes, svgExporter, null, new ColorTransform() /*FIXME?*/); + SVGMorphShapeExporter exporter = new SVGMorphShapeExporter(swf, beginShapes, endShapes, svgExporter, null, colorTransform); exporter.export(); } else { SHAPEWITHSTYLE shapes = getShapeAtRatio(ratio); - SVGShapeExporter exporter = new SVGShapeExporter(swf, shapes, svgExporter, null, new ColorTransform() /*FIXME?*/); + SVGShapeExporter exporter = new SVGShapeExporter(swf, shapes, svgExporter, null, colorTransform); exporter.export(); } return svgExporter.getSVG(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShapeTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShapeTag.java index eb9b75225..32f495702 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShapeTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineMorphShapeTag.java @@ -314,15 +314,15 @@ public class DefineMorphShapeTag extends CharacterTag implements MorphShapeTag { @Override public String toSVG(SVGExporterContext exporterContext, int ratio, ColorTransform colorTransform, int level) { ExportRectangle rect = new ExportRectangle(getRect()); - SVGExporter svgExporter = new SVGExporter(rect, new ColorTransform()); + SVGExporter svgExporter = new SVGExporter(rect, colorTransform); if (ratio == -2) { SHAPEWITHSTYLE beginShapes = getShapeAtRatio(0); SHAPEWITHSTYLE endShapes = getShapeAtRatio(65535); - SVGMorphShapeExporter exporter = new SVGMorphShapeExporter(swf, beginShapes, endShapes, svgExporter, null, new ColorTransform() /*FIXME?*/); + SVGMorphShapeExporter exporter = new SVGMorphShapeExporter(swf, beginShapes, endShapes, svgExporter, null, colorTransform); exporter.export(); } else { SHAPEWITHSTYLE shapes = getShapeAtRatio(ratio); - SVGShapeExporter exporter = new SVGShapeExporter(swf, shapes, svgExporter, null, new ColorTransform() /*FIXME?*/); + SVGShapeExporter exporter = new SVGShapeExporter(swf, shapes, svgExporter, null, colorTransform); exporter.export(); } return svgExporter.getSVG(); diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape2Tag.java index 18ab5a7da..aa3f5ec0f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape2Tag.java @@ -18,13 +18,8 @@ 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.SVGExporter; -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; import com.jpexs.decompiler.flash.types.RECT; import com.jpexs.decompiler.flash.types.SHAPEWITHSTYLE; import com.jpexs.decompiler.flash.types.annotations.SWFType; @@ -55,15 +50,6 @@ public class DefineShape2Tag extends ShapeTag { return shapes.getNeededCharacters(); } - @Override - public String toSVG(SVGExporterContext exporterContext, int ratio, ColorTransform colorTransform, int level) { - ExportRectangle rect = new ExportRectangle(getRect()); - SVGExporter svgExporter = new SVGExporter(rect, new ColorTransform()); - SVGShapeExporter exporter = new SVGShapeExporter(swf, getShapes(), svgExporter, null, new ColorTransform() /*FIXME?*/); - exporter.export(); - return svgExporter.getSVG(); - } - @Override public int getCharacterId() { return shapeId; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape3Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape3Tag.java index 68ce4873a..06741fa8c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape3Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape3Tag.java @@ -18,13 +18,8 @@ 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.SVGExporter; -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; import com.jpexs.decompiler.flash.types.RECT; import com.jpexs.decompiler.flash.types.SHAPEWITHSTYLE; import com.jpexs.decompiler.flash.types.annotations.SWFType; @@ -60,19 +55,6 @@ public class DefineShape3Tag extends ShapeTag { return shapeBounds; } - @Override - public String toSVG(SVGExporterContext exporterContext, int ratio, ColorTransform colorTransform, int level) { - ExportRectangle rect = new ExportRectangle(getRect()); - SVGExporter svgExporter = new SVGExporter(rect, new ColorTransform()); - SVGShapeExporter exporter = new SVGShapeExporter(swf, getShapes(), svgExporter, null, new ColorTransform() /*FIXME?*/); - exporter.export(); - 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 int getCharacterId() { return shapeId; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape4Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape4Tag.java index 3f3d5209a..c0d5a4544 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape4Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShape4Tag.java @@ -18,13 +18,8 @@ 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.SVGExporter; -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; import com.jpexs.decompiler.flash.types.RECT; import com.jpexs.decompiler.flash.types.SHAPEWITHSTYLE; import com.jpexs.decompiler.flash.types.annotations.Reserved; @@ -63,15 +58,6 @@ public class DefineShape4Tag extends ShapeTag { return shapes.getNeededCharacters(); } - @Override - public String toSVG(SVGExporterContext exporterContext, int ratio, ColorTransform colorTransform, int level) { - ExportRectangle rect = new ExportRectangle(getRect()); - SVGExporter svgExporter = new SVGExporter(rect, new ColorTransform()); - SVGShapeExporter exporter = new SVGShapeExporter(swf, getShapes(), svgExporter, null, new ColorTransform() /*FIXME?*/); - exporter.export(); - return svgExporter.getSVG(); - } - @Override public int getCharacterId() { return shapeId; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShapeTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShapeTag.java index 20a0c5285..927c4c3c2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineShapeTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineShapeTag.java @@ -19,13 +19,8 @@ package com.jpexs.decompiler.flash.tags; 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.SVGExporter; -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; import com.jpexs.decompiler.flash.types.RECT; import com.jpexs.decompiler.flash.types.SHAPEWITHSTYLE; import com.jpexs.decompiler.flash.types.annotations.SWFType; @@ -93,15 +88,6 @@ public class DefineShapeTag extends ShapeTag { return shapeId; } - @Override - public String toSVG(SVGExporterContext exporterContext, int ratio, ColorTransform colorTransform, int level) { - ExportRectangle rect = new ExportRectangle(getRect()); - SVGExporter svgExporter = new SVGExporter(rect, new ColorTransform()); - SVGShapeExporter exporter = new SVGShapeExporter(swf, getShapes(), svgExporter, null, new ColorTransform() /*FIXME?*/); - exporter.export(); - return svgExporter.getSVG(); - } - @Override public int getNumFrames() { return 1; 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 2d0181859..68d750af0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/ShapeTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/ShapeTag.java @@ -18,7 +18,11 @@ package com.jpexs.decompiler.flash.tags.base; import com.jpexs.decompiler.flash.SWF; 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.SVGExporter; +import com.jpexs.decompiler.flash.exporters.SVGExporterContext; +import com.jpexs.decompiler.flash.exporters.shape.SVGShapeExporter; import com.jpexs.decompiler.flash.timeline.DepthState; import com.jpexs.decompiler.flash.types.ColorTransform; import com.jpexs.decompiler.flash.types.SHAPEWITHSTYLE; @@ -48,4 +52,13 @@ public abstract class ShapeTag extends CharacterTag implements BoundedTag, Drawa public void toImage(int frame, int time, int ratio, DepthState stateUnderCursor, int mouseButton, SerializableImage image, Matrix transformation, ColorTransform colorTransform) { BitmapExporter.export(swf, getShapes(), null, image, transformation, colorTransform); } + + @Override + public String toSVG(SVGExporterContext exporterContext, int ratio, ColorTransform colorTransform, int level) { + ExportRectangle rect = new ExportRectangle(getRect()); + SVGExporter svgExporter = new SVGExporter(rect, colorTransform); + SVGShapeExporter exporter = new SVGShapeExporter(swf, getShapes(), svgExporter, null, colorTransform); + exporter.export(); + return svgExporter.getSVG(); + } } 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 d5f59278f..4313122ee 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/TextTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/TextTag.java @@ -312,7 +312,7 @@ public abstract class TextTag extends CharacterTag implements BoundedTag, Drawab int x = 0; int y = 0; List glyphs = new ArrayList<>(); - SVGExporter svgExporter = new SVGExporter(null, new ColorTransform()); + SVGExporter svgExporter = new SVGExporter(null, colorTransform); for (TEXTRECORD rec : textRecords) { if (rec.styleFlagsHasColor) { if (numText == 2) { @@ -341,7 +341,7 @@ public abstract class TextTag extends CharacterTag implements BoundedTag, Drawab // shapeNum: 1 SHAPE shape = glyphs.get(entry.glyphIndex); svgExporter.createNewGroup(mat); - SVGShapeExporter exporter = new SVGShapeExporter(swf, shape, svgExporter, textColor, new ColorTransform() /*FIXME?*/); + SVGShapeExporter exporter = new SVGShapeExporter(swf, shape, svgExporter, textColor, colorTransform); exporter.export(); x += entry.glyphAdvance; }