Jump to content

Apparent GIF transparency bug: confirm or deny


Recommended Posts

I have been having quite the time getting transparency working. I'm trying to create a weather radar application with notification. To start I'm trying to emulate what the National Weather Service (NWS) has here:

http://radar.weather.gov/ridge/radar.php?r...111&loop=no

To do this I'm using GuiCreate() for each layer, using WS_EX_LAYERED and WS_EX_MDICHILD. The problem comes when I try to load the GIF downloaded from the NWS site (Sterling VA Radar GIF), I have no transparency through to the bottom map (Sterling VA Topo Map GIF). If I instead try to load another file such as merlin.gif (from the system32 directory) transparency works properly.

When I open the radar GIF file (LWS_N0R_0.gif) in an editor, the background is indeed white (0xFFFFFF) as is the top-left corner pixel. When I run my script I don't see the bottom layer, but rather the gray background of the main GUI. After a couple hours of investigating, it appears that there are some very odd bugs. The only way to make the GIF appear correctly was to do one of the following in an image editor (the transparent color is 0xFFFFFF, index 7:

1) Change the 0xFFFFFF index from 7 to some other number.

2) Change the two other indices that point to 0xFFFFFF to point to some other color.

3) Change the index 7 color from 0xFFFFFF to some other number "far away" from 0xFFFFFF, like a pink color.

This seems very bizarre, so I would appreciate it if someone could check on this. This has driven me nuts for about a day now. Below is code that demonstrates this, and includes downloading the images.

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$topoFile=@TempDir&"\LWX_Topo_Short.jpg"
$radarFile=@TempDir&"\LWX_N0R_0.gif"
InetGet("http://radar.weather.gov/ridge/RadarImg/N0R/LWX_N0R_0.gif",$radarFile,1)
InetGet("http://radar.weather.gov/ridge/Overlays/Topo/Short/LWX_Topo_Short.jpg",$topoFile,1)

$main = GUICreate("GUI", 600, 550)
$topoPic=GUICtrlCreatePic($topoFile,0, 0, 600, 550)

$radar=GUICreate("",600, 550, 0, 0, $WS_POPUP, BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD), $main)
$radarPic = GUICtrlCreatePic($radarFile, 0, 0, 0, 0) ; transparency does not work
;$radarPic = GUICtrlCreatePic(@SystemDir&"\oobe\images\merlin.gif", 0, 0, 0, 0) ; transparency works

GUISetState(@SW_SHOW,$radar)
GUISetState(@SW_SHOW,$main)

do
    $msg = GUIGetMsg()
until $msg = $GUI_EVENT_CLOSE
Exit

Edit: I have tried this both in 3.2.10.0 and 3.2.11.5

Edited by joshtp
Link to comment
Share on other sites

Probably not a bug, just some rather subtle aspect of controlling the transparency effect.

I'm not able to look at your example right now, but take a look at the recent topic "Seeking LED-like radio button" on this forum. It may give you some ideas of what to change or try.

Link to comment
Share on other sites

Probably not a bug, just some rather subtle aspect of controlling the transparency effect.

If it does turn out to be a subtle aspect, and we find out the exact reason, it might be helpful for the help file to be updated.

I'm not able to look at your example right now, but take a look at the recent topic "Seeking LED-like radio button" on this forum. It may give you some ideas of what to change or try.

I don't think it helps with my particular problem, but it is useful to learn that the transparency is determined by the top-left pixel of the LAST image added, and that all controls in that GUI are affected by it. Thank you for the suggestion.

One thing I'd like to know is why AutoIt requires the use of a GIF file, if it doesn't even use the GIF89a standard of defining transparency, but instead imposes an additional and unnecessary requirement of defining the top-left pixel to be the transparent value. In my mind it makes sense to use one or the other, but not both at the same time.

Link to comment
Share on other sites

For me it works

Here's the link to the screenshot : http://img76.imageshack.us/my.php?image=29698908wl0.jpg

BTW,I'm using AutoIt 3.2.10.0 with Beta 3.2.11.5

Thanks LIMITER. Well, I just tried running it on my laptop, and it works fine! I've verified that it fails to run on my desktop computer with both 3.2.11.5 and the new 3.2.11.7.

Any idea why it would work on one computer but not another? Both computers are Windows XP SP2.

Any enlightenment would be greatly appreciated!

Link to comment
Share on other sites

Hi Joshtp,

Have you tried to do update on the software for the current release? Sometimes it will help out.

Thanks Henry, but yes, I have tried 3.2.10.0, 3.2.11.5, and 3.2.11.7, and all of them have the same problem.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...