Fixed ShapeImporter fillstyles shapenum

This commit is contained in:
Jindra Petřík
2022-12-08 22:00:04 +01:00
parent f3fc42c1ab
commit 2f95902341
3 changed files with 10 additions and 8 deletions

View File

@@ -59,7 +59,7 @@ public class ShapeImporter {
rect.Ymax = rect.Ymin + (int) (SWF.unitDivisor * dimension.getHeight());
}
SHAPEWITHSTYLE shapes = imageTag.getShape(rect, fill);
SHAPEWITHSTYLE shapes = imageTag.getShape(rect, fill, st.getShapeNum());
st.shapes = shapes;
return (Tag) st;
}

View File

@@ -145,17 +145,18 @@ public abstract class ImageTag extends DrawableTag {
return false;
}
private SHAPEWITHSTYLE getShape() {
private SHAPEWITHSTYLE getShape(int shapeNum) {
RECT rect = getRect();
return getShape(rect, false);
return getShape(rect, false, shapeNum);
}
public SHAPEWITHSTYLE getShape(RECT rect, boolean fill) {
public SHAPEWITHSTYLE getShape(RECT rect, boolean fill, int shapeNum) {
boolean translated = rect.Xmin != 0 || rect.Ymin != 0;
SHAPEWITHSTYLE shape = new SHAPEWITHSTYLE();
shape.fillStyles = new FILLSTYLEARRAY();
shape.fillStyles.fillStyles = new FILLSTYLE[1];
FILLSTYLE fillStyle = new FILLSTYLE();
fillStyle.inShape3 = shapeNum >= 3;
fillStyle.fillStyleType = Configuration.shapeImportUseNonSmoothedFill.get()
? FILLSTYLE.NON_SMOOTHED_REPEATING_BITMAP : FILLSTYLE.REPEATING_BITMAP;
fillStyle.bitmapId = getCharacterId();
@@ -229,23 +230,23 @@ public abstract class ImageTag extends DrawableTag {
@Override
public Shape getOutline(int frame, int time, int ratio, RenderContext renderContext, Matrix transformation, boolean stroked) {
return transformation.toTransform().createTransformedShape(getShape().getOutline(1, swf, stroked));
return transformation.toTransform().createTransformedShape(getShape(1).getOutline(1, swf, stroked));
}
@Override
public void toImage(int frame, int time, int ratio, RenderContext renderContext, SerializableImage image, SerializableImage fullImage, boolean isClip, Matrix transformation, Matrix strokeTransformation, Matrix absoluteTransformation, Matrix fullTransformation, ColorTransform colorTransform, double unzoom, boolean sameImage, ExportRectangle viewRect, boolean scaleStrokes, int drawMode, int blendMode) {
BitmapExporter.export(1, swf, getShape(), null, image, unzoom, transformation, strokeTransformation, colorTransform, true);
BitmapExporter.export(1, swf, getShape(1), null, image, unzoom, transformation, strokeTransformation, colorTransform, true);
}
@Override
public void toSVG(SVGExporter exporter, int ratio, ColorTransform colorTransform, int level) throws IOException {
SVGShapeExporter shapeExporter = new SVGShapeExporter(1, swf, getShape(), getCharacterId(), exporter, null, colorTransform, 1);
SVGShapeExporter shapeExporter = new SVGShapeExporter(1, swf, getShape(1), getCharacterId(), exporter, null, colorTransform, 1);
shapeExporter.export();
}
@Override
public void toHtmlCanvas(StringBuilder result, double unitDivisor) {
CanvasShapeExporter cse = new CanvasShapeExporter(1, null, unitDivisor, swf, getShape(), null, 0, 0);
CanvasShapeExporter cse = new CanvasShapeExporter(1, null, unitDivisor, swf, getShape(1), null, 0, 0);
cse.export();
result.append(cse.getShapeData());
}