Create account / Log in
Bug 13307 - Background transparency in Text Labels not working
Background transparency in Text Labels not working
Status: RESOLVED FIXED
Product: VASSAL
Classification: Applications
Component: Editor
3.3.3-beta1
PC All
: unspecified minor
: 3.5.0
Assigned To: Jason Stewart
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2020-08-20 11:30 CEST by Jonathan Watts
Modified: 2020-09-09 22:10 CEST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Watts 2020-08-20 11:30:42 CEST
If you set the background of a Text Label to include any amount of transparency (i.e., alpha channel > 0), it immediately resets to fully opaque when you exit the color dialog.

Reported three times in the past few weeks: http://www.vassalengine.org/forum/viewtopic.php?f=6&t=12284#p63551
http://www.vassalengine.org/forum/viewtopic.php?f=3&t=12246#p63372
http://www.vassalengine.org/forum/viewtopic.php?f=3&t=12207&p=63059&hilit=alpha#p63059

Per those posts, this bug is present in 3.2.17, 3.3.1, and 3.3.3-beta1.
Comment 1 Jason Stewart 2020-08-20 23:36:04 CEST
Since I'm affected by this bug, I dug into it a little bit. I downloaded different versions of VASSAL from the archive to test when this functionality stopped working. It never worked. In all the versions I downloaded all the way back to 2.0 as soon as you hit 'Save' on the text label and reopen, the transparency info is lost.

I attempted to dig through the code to figure out which java class is responsible for reading the information from the color-picker and storing it in the game piece data structure but I'm not familiar enough with the code tree and I could find it.
Comment 2 Jason Stewart 2020-08-21 15:06:37 CEST
According to this message from Brent:

http://www.vassalengine.org/forum/viewtopic.php?f=5&t=12287&p=63565#p63562

He confirms it has never worked. He has given me the info to hook it up properly. I will give it a try.
Comment 3 Jason Stewart 2020-08-21 20:43:05 CEST
Here's a diff to ColorConfigurer.java that fixes the bug.

93,97c93,94
<     if (c == null) {
<       return null;
<     }
<     else if (c.getTransparency() == c.OPAQUE) {
<       return c.getRed() + ","
---
>     return c == null ? null :
>         c.getRed() + ","
100,106d96
<     }
<     else {
<       return c.getRed() + ","
<         + c.getGreen() + ","
<         + c.getBlue() + ","
<         + c.getAlpha();
<     }
120,130c110,112
<         if (st.countTokens() > 3) { // has alpha value
<           return new Color(Integer.parseInt(st.nextToken()),
<                            Integer.parseInt(st.nextToken()),
<                            Integer.parseInt(st.nextToken()),
<                            Integer.parseInt(st.nextToken()));
<         }
<         else { // no alpha
<           return new Color(Integer.parseInt(st.nextToken()),
<                            Integer.parseInt(st.nextToken()),
<                            Integer.parseInt(st.nextToken()));
<         }
---
>         return new Color(Integer.parseInt(st.nextToken()),
>                          Integer.parseInt(st.nextToken()),
>                          Integer.parseInt(st.nextToken()));