diff --git a/CHANGELOG.md b/CHANGELOG.md index ceeba2ad1..cd2ad8b0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file. ### Added - AS3 - Remove trait which is outside class +### Fixed +- Flash viewer - bitmap line style + ## [14.2.1] - 2021-03-13 ### Added - Placeobject display and edit - raw editor on right side diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/BitmapExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/BitmapExporter.java index 7726cf561..3a8c0f3ae 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/BitmapExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/BitmapExporter.java @@ -517,6 +517,27 @@ public class BitmapExporter extends ShapeExporterBase { } } + @Override + public void lineBitmapStyle(int bitmapId, Matrix matrix, boolean repeat, boolean smooth, ColorTransform colorTransform) { + ImageTag imageTag = swf.getImage(bitmapId); + if (imageTag != null) { + SerializableImage img = imageTag.getImageCached(); + if (img != null) { + if (colorTransform != null) { + img = colorTransform.apply(img); + } + + linePaint = new TexturePaint(img.getBufferedImage(), new java.awt.Rectangle(img.getWidth(), img.getHeight())); + lineTransform = matrix.toTransform(); + return; + } + } + + // fill with red in case any error + linePaint = Color.RED; + lineTransform = matrix.toTransform(); + } + @Override public void moveTo(double x, double y) { path.moveTo(x, y); @@ -673,7 +694,7 @@ public class BitmapExporter extends ShapeExporterBase { graphics.setPaint(linePaint); if (inverse != null) { - ExportRectangle rect = inverse.transform(new ExportRectangle(path.getBounds2D())); + ExportRectangle rect = inverse.transform(new ExportRectangle(strokedShape.getBounds2D())); double minX = rect.xMin; double minY = rect.yMin; graphics.fill(new Rectangle((int) minX, (int) minY, (int) (rect.xMax - minX), (int) (rect.yMax - minY))); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/CanvasShapeExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/CanvasShapeExporter.java index d5b6a7e99..f1f346b31 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/CanvasShapeExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/CanvasShapeExporter.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.exporters.shape; import com.jpexs.decompiler.flash.SWF; @@ -371,6 +372,11 @@ public class CanvasShapeExporter extends ShapeExporterBase { strokeData.insert(0, preStrokeData); } + @Override + public void lineBitmapStyle(int bitmapId, Matrix matrix, boolean repeat, boolean smooth, ColorTransform colorTransform) { + //TODO + } + @Override public void moveTo(double x, double y) { currentDrawCommand = DRAW_COMMAND_M; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/IShapeExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/IShapeExporter.java index 2a403c3a1..4bb9376a3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/IShapeExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/IShapeExporter.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.exporters.shape; import com.jpexs.decompiler.flash.exporters.commonshape.Matrix; @@ -50,6 +51,8 @@ public interface IShapeExporter { public void lineGradientStyle(int type, GRADRECORD[] gradientRecords, Matrix matrix, int spreadMethod, int interpolationMethod, float focalPointRatio); + public void lineBitmapStyle(int bitmapId, Matrix matrix, boolean repeat, boolean smooth, ColorTransform colorTransform); + public void moveTo(double x, double y); public void lineTo(double x, double y); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/PathExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/PathExporter.java index 63465426e..a1b161b65 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/PathExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/PathExporter.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.exporters.shape; import com.jpexs.decompiler.flash.SWF; @@ -121,6 +122,11 @@ public class PathExporter extends ShapeExporterBase { } + @Override + public void lineBitmapStyle(int bitmapId, Matrix matrix, boolean repeat, boolean smooth, ColorTransform colorTransform) { + + } + @Override public void moveTo(double x, double y) { path.moveTo(x, y); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/SVGShapeExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/SVGShapeExporter.java index f0bb77e3a..e0a6aa4ad 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/SVGShapeExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/SVGShapeExporter.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.exporters.shape; import com.jpexs.decompiler.flash.SWF; @@ -202,6 +203,11 @@ public class SVGShapeExporter extends DefaultSVGShapeExporter { exporter.addToDefs(gradient); } + @Override + public void lineBitmapStyle(int bitmapId, Matrix matrix, boolean repeat, boolean smooth, ColorTransform colorTransform) { + //TODO + } + @Override protected void finalizePath() { if (path != null && pathData != null && pathData.length() > 0) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/ShapeExporterBase.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/ShapeExporterBase.java index 8c11e3f9a..412096fb1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/ShapeExporterBase.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/ShapeExporterBase.java @@ -400,6 +400,16 @@ public abstract class ShapeExporterBase implements IShapeExporter { (fillStyle.gradient instanceof FOCALGRADIENT) ? ((FOCALGRADIENT) fillStyle.gradient).focalPoint : 0 ); break; + case FILLSTYLE.CLIPPED_BITMAP: + case FILLSTYLE.REPEATING_BITMAP: + case FILLSTYLE.NON_SMOOTHED_CLIPPED_BITMAP: + case FILLSTYLE.NON_SMOOTHED_REPEATING_BITMAP: + lineBitmapStyle(fillStyle.bitmapId, + fillStyle.bitmapMatrix, + (fillStyle.fillStyleType == FILLSTYLE.REPEATING_BITMAP || fillStyle.fillStyleType == FILLSTYLE.NON_SMOOTHED_REPEATING_BITMAP), + (fillStyle.fillStyleType == FILLSTYLE.REPEATING_BITMAP || fillStyle.fillStyleType == FILLSTYLE.CLIPPED_BITMAP), + colorTransform); + break; } } } else {