diff --git a/CHANGELOG.md b/CHANGELOG.md index 064bba6d7..7162ad1cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ All notable changes to this project will be documented in this file. - AS3 - AIR float support - incorrect writing float values to output stream - AS3 - AIR float support - ABC Explorer incorrectly calculating float usages (For clean action, etc.) - [#2446] Nightly version asked for update to previous stable +- [#2447] SVG import - gradients can inherit (href) from other gradient types (radial vs linear) ## [22.0.2] - 2025-01-17 ### Added @@ -3744,6 +3745,7 @@ Major version of SWF to XML export changed to 2. [#2444]: https://www.free-decompiler.com/flash/issues/2444 [#2415]: https://www.free-decompiler.com/flash/issues/2415 [#2446]: https://www.free-decompiler.com/flash/issues/2446 +[#2447]: https://www.free-decompiler.com/flash/issues/2447 [#2375]: https://www.free-decompiler.com/flash/issues/2375 [#2374]: https://www.free-decompiler.com/flash/issues/2374 [#2389]: https://www.free-decompiler.com/flash/issues/2389 diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/svg/SvgStyle.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/svg/SvgStyle.java index 896429f04..577d02d2e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/svg/SvgStyle.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/svg/SvgStyle.java @@ -397,35 +397,39 @@ class SvgStyle { importer.showWarning("fillNotSupported", "Parent gradient not found."); return new SvgColor(random.nextInt(256), random.nextInt(256), random.nextInt(256)); } - - if ("linearGradient".equals(el.getTagName()) && parent_el.getTagName().equals(el.getTagName())) { - SvgLinearGradient parentFill = (SvgLinearGradient) parseGradient(idMap, parent_el); + SvgGradient parentFill = null; + if (parent_el.getTagName().equals("linearGradient")) { + parentFill = (SvgLinearGradient) parseGradient(idMap, parent_el); + } + if (parent_el.getTagName().equals("radialGradient")) { + parentFill = (SvgRadialGradient) parseGradient(idMap, parent_el); + } + + if (parentFill != null) { gradientUnits = parentFill.gradientUnits; gradientTransform = parentFill.gradientTransform; spreadMethod = parentFill.spreadMethod; - - x1 = parentFill.x1; - y1 = parentFill.y1; - x2 = parentFill.x2; - y2 = parentFill.y2; interpolation = parentFill.interpolation; stops = parentFill.stops; - } - if ("radialGradient".equals(el.getTagName()) && parent_el.getTagName().equals(el.getTagName())) { - SvgRadialGradient parentFill = (SvgRadialGradient) parseGradient(idMap, parent_el); - gradientUnits = parentFill.gradientUnits; - gradientTransform = parentFill.gradientTransform; - spreadMethod = parentFill.spreadMethod; - - cx = parentFill.cx; - cy = parentFill.cy; - fx = parentFill.fx; - fy = parentFill.fy; - r = parentFill.r; - interpolation = parentFill.interpolation; - stops = parentFill.stops; - } - + + if (el.getTagName().equals(parent_el.getTagName())) { + if ("linearGradient".equals(el.getTagName())) { + SvgLinearGradient linearParentFill = (SvgLinearGradient) parentFill; + x1 = linearParentFill.x1; + y1 = linearParentFill.y1; + x2 = linearParentFill.x2; + y2 = linearParentFill.y2; + } + if ("radialGradient".equals(el.getTagName())) { + SvgRadialGradient radialParentFill = (SvgRadialGradient) parentFill; + cx = radialParentFill.cx; + cy = radialParentFill.cy; + fx = radialParentFill.fx; + fy = radialParentFill.fy; + r = radialParentFill.r; + } + } + } } else { importer.showWarning("fillNotSupported", "Parent gradient invalid."); return new SvgColor(random.nextInt(256), random.nextInt(256), random.nextInt(256));