mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-29 03:05:47 +00:00
Fixed: #2572 SVG import - incorrect stroke width when transform contains rotation/shear
This commit is contained in:
@@ -28,13 +28,13 @@ import java.awt.geom.Rectangle2D;
|
||||
*/
|
||||
public final class Matrix implements Cloneable {
|
||||
|
||||
public double scaleX = 1;
|
||||
public double scaleX = 1; //a
|
||||
|
||||
public double scaleY = 1;
|
||||
public double scaleY = 1; //d
|
||||
|
||||
public double rotateSkew0;
|
||||
public double rotateSkew0; //b
|
||||
|
||||
public double rotateSkew1;
|
||||
public double rotateSkew1; //c
|
||||
|
||||
public double translateX;
|
||||
|
||||
|
||||
@@ -107,9 +107,7 @@ public class SVGShapeExporter extends DefaultSVGShapeExporter {
|
||||
this.exporter = exporter;
|
||||
this.displayZoom = displayZoom;
|
||||
|
||||
com.jpexs.decompiler.flash.exporters.commonshape.Point p00 = strokeTransformation.transform(0, 0);
|
||||
com.jpexs.decompiler.flash.exporters.commonshape.Point p11 = strokeTransformation.transform(1, 1);
|
||||
thicknessScale = p00.distanceTo(p11) / Math.sqrt(2);
|
||||
thicknessScale = Math.sqrt(Math.abs(strokeTransformation.scaleX * strokeTransformation.scaleY - strokeTransformation.rotateSkew0 * strokeTransformation.rotateSkew1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2028,7 +2028,8 @@ public class SvgImporter {
|
||||
|
||||
ILINESTYLE lineStyle = shapeNum <= 3 ? new LINESTYLE() : new LINESTYLE2();
|
||||
lineStyle.setColor(getRGB(shapeNum, lineColor));
|
||||
double scale = Math.max(transform.scaleX, transform.scaleY);
|
||||
double scale = Math.sqrt(Math.abs(transform.scaleX * transform.scaleY - transform.rotateSkew0 * transform.rotateSkew1));
|
||||
|
||||
lineStyle.setWidth((int) Math.round(style.getStrokeWidth() * scale * SWF.unitDivisor));
|
||||
SvgLineCap lineCap = style.getStrokeLineCap();
|
||||
SvgLineJoin lineJoin = style.getStrokeLineJoin();
|
||||
|
||||
Reference in New Issue
Block a user