Fixed: Flash viewer - bitmap line style

This commit is contained in:
Jindra Petřík
2021-03-24 20:36:42 +01:00
parent c7648f01fd
commit a1c7b26b9d
7 changed files with 60 additions and 5 deletions
@@ -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)));
@@ -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;
@@ -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);
@@ -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);
@@ -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) {
@@ -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 {