From 24200bce6d09616d1258117d0a6d4aa5a122aed1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Mon, 21 Oct 2024 17:54:53 +0200 Subject: [PATCH] Fixed: FLA export - DefineEditText default text color alpha --- CHANGELOG.md | 1 + .../jpexs/decompiler/flash/xfl/XFLConverter.java | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f213f0f3..6da35dafb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ All notable changes to this project will be documented in this file. - [#2341] FLA export - linkage and imported fonts did not work correctly - [#2345] items smaller than 20 twips were not drawn - caused PDF problems - now ceil is used - [#2341] FLA export - DefineEditText - use its default text color on HTML enabled inputs +- FLA export - DefineEditText default text color alpha ## [21.1.1] - 2024-10-13 ### Added diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java index 24136e732..b73d4d6d3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java @@ -5479,6 +5479,8 @@ public class XFLConverter { private String fontFace = ""; private String color = ""; + + private int colorAlpha = 255; private boolean autoKern = false; @@ -5514,6 +5516,7 @@ public class XFLConverter { private Stack fontSizeStack = new Stack<>(); private Stack fontFaceStack = new Stack<>(); private Stack fontColorStack = new Stack<>(); + private Stack fontColorAlphaStack = new Stack<>(); private Stack fontKerningStack = new Stack<>(); private final Map characterImportLinkageURL; private final Reference lastImportedId; @@ -5587,6 +5590,7 @@ public class XFLConverter { } if (det.hasTextColor) { color = det.textColor.toHexRGB(); + colorAlpha = det.textColor.alpha; } this.chatacterTags = characterTags; @@ -5666,6 +5670,7 @@ public class XFLConverter { String c = attributes.getValue("color"); if (c != null) { color = c; + colorAlpha = 255; } String f = attributes.getValue("face"); if (f != null) { @@ -5697,6 +5702,7 @@ public class XFLConverter { } } fontColorStack.push(color); + fontColorAlphaStack.push(colorAlpha); fontFaceStack.push(fontFace); fontSizeStack.push(size); fontLetterSpacingStack.push(letterSpacing); @@ -5726,14 +5732,17 @@ public class XFLConverter { } if (qName.equals("font")) { fontColorStack.pop(); + fontColorAlphaStack.pop(); fontFaceStack.pop(); fontKerningStack.pop(); fontLetterSpacingStack.pop(); fontSizeStack.pop(); color = null; + colorAlpha = 255; if (!fontColorStack.isEmpty()) { color = fontColorStack.peek(); - } + colorAlpha = fontColorAlphaStack.peek(); + } fontFace = null; if (!fontFaceStack.isEmpty()) { fontFace = fontFaceStack.peek(); @@ -5788,6 +5797,9 @@ public class XFLConverter { } if (color != null && !color.isEmpty()) { result.writeAttribute("fillColor", color); + if (colorAlpha != 255) { + result.writeAttribute("alpha", colorAlpha / 255.0); + } } if (url != null) { result.writeAttribute("url", url);