From d124e33a9bcef8a87613b3cdf0350e71a7469428 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 21 Jul 2024 13:42:26 +0200 Subject: [PATCH] Fixed #2257 Shape SVG Importer - Linear gradient matrix --- CHANGELOG.md | 2 ++ .../jpexs/decompiler/flash/importers/svg/SvgImporter.java | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00f390067..f939bf754 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ All notable changes to this project will be documented in this file. - [#2224] Exporting Embed assets - handling DefineBits(+JPEGTables) - convert to DefineBitsJPEG2 - [PR191] Saving class name during AS3 P-code class trait editation - [#2231] AS3 coercion to String as convert +- [#2257] Shape SVG Importer - Linear gradient matrix ### Changed - [#2185] MochiCrypt no longer offered for auto decrypt, user needs to choose variant from "Use unpacker" menu @@ -3414,6 +3415,7 @@ Major version of SWF to XML export changed to 2. [#2222]: https://www.free-decompiler.com/flash/issues/2222 [#2224]: https://www.free-decompiler.com/flash/issues/2224 [#2231]: https://www.free-decompiler.com/flash/issues/2231 +[#2257]: https://www.free-decompiler.com/flash/issues/2257 [#2206]: https://www.free-decompiler.com/flash/issues/2206 [#2100]: https://www.free-decompiler.com/flash/issues/2100 [#2123]: https://www.free-decompiler.com/flash/issues/2123 diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/svg/SvgImporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/svg/SvgImporter.java index d5d440f64..ca4b9a3ce 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/svg/SvgImporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/svg/SvgImporter.java @@ -1719,7 +1719,7 @@ public class SvgImporter { if (fill instanceof SvgGradient) { SvgGradient gfill = (SvgGradient) fill; Matrix gradientMatrix = Matrix.parseSvgMatrix(gfill.gradientTransform, SWF.unitDivisor, 1); - gradientMatrix = transform.concatenate(Matrix.getScaleInstance(1 / SWF.unitDivisor)).concatenate(gradientMatrix); + gradientMatrix = transform.concatenate(Matrix.getScaleInstance(1 / SWF.unitDivisor)).concatenate(gradientMatrix); fillStyle.gradientMatrix = gradientMatrix.toMATRIX(); if (fill instanceof SvgLinearGradient) { SvgLinearGradient lgfill = (SvgLinearGradient) fill; @@ -1760,7 +1760,7 @@ public class SvgImporter { .concatenate(zeroStartMatrix) .concatenate(scaleMatrix); } else { - Matrix gmatrix = new Matrix(fillStyle.gradientMatrix); + x1 *= SWF.unitDivisor; y1 *= SWF.unitDivisor; x2 *= SWF.unitDivisor; @@ -1786,14 +1786,13 @@ public class SvgImporter { double scale = lenCD / lenAB; tMatrix = tMatrix + .concatenate(gradientMatrix) .concatenate(Matrix.getTranslateInstance(c.x, c.y)) .concatenate(Matrix.getRotateInstance(rotation * 180 / Math.PI)) .concatenate(Matrix.getScaleInstance(scale)) .concatenate(Matrix.getTranslateInstance(-a.x, -a.y)) ; } - - tMatrix = tMatrix.concatenate(gmatrix); } fillStyle.gradientMatrix = tMatrix.toMATRIX(); } else if (fill instanceof SvgRadialGradient) {