qwert Posted April 4, 2008 Author Share Posted April 4, 2008 If you want the transparency to be determined by the top left pixel then you need to add the $WS_EX_LAYERED attribute to your GUI creation as Saunders mentioned.That is what was confusing about the earlier examples. I added this and it didn't change anything: $gui = GUICreate('Custom Radio Test', 200, 200, -1, -1, -1, $WS_EX_LAYERED) Is there more required for the topleft=transparent technique? (GEOSoft, I located your LED library, but not G. Frost's UDFs. Where might I find an example of their use?) Link to comment Share on other sites More sharing options...
zorphnog Posted April 4, 2008 Share Posted April 4, 2008 The top-left pixel technique will make every pixel that is the same color as the top left pixel transparent. Therefore, anything you want to be transparent should be the same color as the top-left pixel. Link to comment Share on other sites More sharing options...
GEOSoft Posted April 4, 2008 Share Posted April 4, 2008 (GEOSoft, I located your LED library, but not G. Frost's UDFs. Where might I find an example of their use?)If you have the Beta then just open the help file and go to User Defined Functions >> GUIButton ManagementLook at _GUIButton_SetImage. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
qwert Posted April 4, 2008 Author Share Posted April 4, 2008 The top-left pixel technique will make every pixel that is the same color as the top left pixel transparent. Therefore, anything you want to be transparent should be the same color as the top-left pixel.BING ! ! ! . . . . . a GIANT LIGHT BULB JUST LIT UP ! ! ! ! !The pixel everyone is talking about is the top-left pixel of the entire GUI -- NOT of the individual graphics(s)! With $WS_EX_LAYERED set, that one pixel causes all like pixels in that window to be rendered as transparent.I feel better now. Everything makes sense. Thank you for sticking with this. Link to comment Share on other sites More sharing options...
therks Posted April 8, 2008 Share Posted April 8, 2008 In my example the transparency is not determined by the top left pixel. Its actually saved in the bitmap. If you want the transparency to be determined by the top left pixel then you need to add the $WS_EX_LAYERED attribute to your GUI creation as Saunders mentioned. Otherwise you need a decent editor because you're not going to be able to edit these properly with MSPaint. I use GIMP and would suggest it since its free and has tons of features. You need to be able to save the Alpha layer (or transparency layer) which you can do through GIMP or any other decent editor.I was not aware of this ability with bitmaps, my first thought was that you must be wrong, but when I checked your script and example files, they worked exactly as you described. Thank you for showing me this. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
therks Posted April 8, 2008 Share Posted April 8, 2008 BING ! ! ! . . . . . a GIANT LIGHT BULB JUST LIT UP ! ! ! ! !The pixel everyone is talking about is the top-left pixel of the entire GUI -- NOT of the individual graphics(s)! With $WS_EX_LAYERED set, that one pixel causes all like pixels in that window to be rendered as transparent.I feel better now. Everything makes sense. Thank you for sticking with this.Actually, if you look at my example, you'll see that I was talking about the top-left pixel of the graphic, as the top-left pixel in the GUI is solid. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
qwert Posted April 8, 2008 Author Share Posted April 8, 2008 Actually, if you look at my example, you'll see that I was talking about the top-left pixel of the graphic, as the top-left pixel in the GUI is solid.Yes, the light bulb has dimmed a bit. Further testing revealed that the transparent pixel gets changed when other graphics are added to the GUI. I haven't been able to determine what the "rule" is. That leaves me rearranging the order of creates in order to get the result I need.Thanks for your posts. Link to comment Share on other sites More sharing options...
zorphnog Posted April 8, 2008 Share Posted April 8, 2008 Ok. I'll try to clear this up a bit for you. If you use the $WS_EX_LAYERED property and you add an image, every pixel within the entire GUI that is the same color as the top-left pixel of the LAST image added will be transparent. Here's another example with two gifs. On.gif has a pink (0xFF00F0) background, and off.gif has a purple (0x8A20DC) background. The GUI background color alternates between black, pink and purple. You'll notice when you first run the script, the entire GUI becomes transparent when the background is pink (the same as the on.gif top-left pixel). Now if you reverse the order in which the pictures are created (i.e. create $rb_CustomRadio2 first and $rb_CustomRadio1 second) the GUI becomes transparent when the background is purple. Hopefully this clears up any confusion.expandcollapse popup#include <GUIConstants.au3> #include <WindowsConstants.au3> Global $gui, $rb_CustomRadio1[2], $rb_CustomRadio2[2], $nMsg, $iTimer, $iTimerDif, $i = 1 Global $aBGColors[3] = ["0x000000","0xff00f0", "0x8A20DC"] $gui = GUICreate('Custom Radio Test', 200, 200, -1, -1, -1, $WS_EX_LAYERED) GUISetBkColor($aBGColors[0]) $rb_CustomRadio1[0] = GUICtrlCreatePic(@ScriptDir & '\off.gif', 10, 10, 17, 17) $rb_CustomRadio1[1] = False $rb_CustomRadio2[0] = GUICtrlCreatePic(@ScriptDir & '\on.gif', 10, 27, 51, 51) $rb_CustomRadio2[1] = True GUISetState() $iTimer = TimerInit() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $rb_CustomRadio1[0] $rb_CustomRadio1[1] = Not $rb_CustomRadio1[1] If $rb_CustomRadio1[1] Then GUICtrlSetImage($rb_CustomRadio1[0], @ScriptDir & "\on.gif") Else GUICtrlSetImage($rb_CustomRadio1[0], @ScriptDir & "\off.gif") EndIf Case $rb_CustomRadio2[0] $rb_CustomRadio2[1] = Not $rb_CustomRadio2[1] If $rb_CustomRadio2[1] Then GUICtrlSetImage($rb_CustomRadio2[0], @ScriptDir & "\on.gif") Else GUICtrlSetImage($rb_CustomRadio2[0], @ScriptDir & "\off.gif") EndIf Case $GUI_EVENT_CLOSE Exit EndSwitch $iTimerDif = TimerDiff($iTimer) If $iTimerDif >= 2000 Then GUISetBkColor($aBGColors[$i]) If $i = 2 Then $i = 0 Else $i += 1 EndIf $iTimer = TimerInit() EndIf WEndImages: Link to comment Share on other sites More sharing options...
qwert Posted April 8, 2008 Author Share Posted April 8, 2008 every pixel within the entire GUI that is the same color as the top-left pixel of the LAST image added will be transparent.I figured that was the rule, but I couldn't find it documented anywhere. Thanks very much for clarifying this and for the excellent examples. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now