use red color when bitmap is not available for bitmapfill (probably some fallback in flash player for erroneous bitmap fills)

This commit is contained in:
honfika@gmail.com
2016-12-14 19:43:06 +01:00
parent a44221b363
commit b8f88aea79
5 changed files with 22 additions and 1 deletions

View File

@@ -870,6 +870,11 @@ public final class SWF implements SWFContainerItem, Timelined {
compress(new ByteArrayInputStream(uncompressedData), os, compression, lzmaProperties);
}
public void saveTo(OutputStream os, boolean gfx) throws IOException {
byte[] uncompressedData = saveToByteArray(gfx);
compress(new ByteArrayInputStream(uncompressedData), os, compression, lzmaProperties);
}
public byte[] getHeaderBytes() {
return getHeaderBytes(compression, gfx);
}
@@ -903,6 +908,10 @@ public final class SWF implements SWFContainerItem, Timelined {
}
private byte[] saveToByteArray() throws IOException {
return saveToByteArray(gfx);
}
private byte[] saveToByteArray(boolean gfx) throws IOException {
fixCharactersOrder(false);
byte[] data;

View File

@@ -318,8 +318,13 @@ public class BitmapExporter extends ShapeExporterBase {
fillPaint = new TexturePaint(img.getBufferedImage(), new java.awt.Rectangle(img.getWidth(), img.getHeight()));
fillTransform = matrix.toTransform();
return;
}
}
// fill with red in case any error
fillPaint = Color.RED;
fillTransform = matrix.toTransform();
}
@Override

View File

@@ -31,6 +31,7 @@ import com.jpexs.decompiler.flash.types.RGBA;
import com.jpexs.decompiler.flash.types.SHAPE;
import com.jpexs.helpers.Helper;
import com.jpexs.helpers.SerializableImage;
import java.awt.Color;
/**
*
@@ -272,8 +273,11 @@ public class CanvasShapeExporter extends ShapeExporterBase {
fillData.append("\tvar fimg = ctrans.applyToImage(imageObj").append(bitmapId).append(");\r\n");
fillData.append("\tvar pat=ctx.createPattern(fimg,\"repeat\");\r\n");
fillData.append("\tctx.fillStyle = pat;\r\n");
return;
}
}
fillData.append("\tctx.fillStyle=").append(color(Color.RED.getRGB())).append(";\r\n");
}
@Override

View File

@@ -133,8 +133,11 @@ public class SVGShapeExporter extends DefaultSVGShapeExporter {
imageElement.setAttribute("xlink:href", "data:image/" + format + ";base64," + base64ImgData);
pattern.appendChild(imageElement);
exporter.addToGroup(pattern);
return;
}
}
path.setAttribute("fill", "#ff0000");
}
@Override