forever Posted February 15, 2005 Share Posted February 15, 2005 (edited) I tried to make a moving object (picture) in my dialog. But i noticed that the transparent areas (it's a .gif) are in the gui-grey color, ... how to solve this problem? I've got one picture (.jpg) as a background (filling whole gui) .. but how to draw objects with transparent areas on this one ? Could be very useful! especially for moving objects... thanks in advance //edit #include <GUIConstants.au3> ;Run("soma.exe") GUICreate("Basti back by Popular Demand", 800, 330, -1, -1, "", $WS_EX_LAYERED) $background = GUICtrlCreatePic ("images\demo-bg.jpg", 0, 0, 800, 300) $basti_stay = GUICtrlCreatePic ("images\l_st.gif", 770, 220, 14, 80) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend Is what i have now, l_st.gif got it's transparent areas filled with rgb 255,0,255 (pink). Now these areas are white, but i want demo-bg.jpg as the background for it, how to realize that? //EDIT2 My try (look up) didn't work.: with $ws_ex_layered it show me the things behind the window, i just want the picture as a background Here's what i have for now, perhaps anyone got a idea (i want the pink places of the figure beeing transparent) #include <GUIConstants.au3> ;ISPRESSED? Func _IsPressed($hexKey) Local $aR, $bO $hexKey = '0x' & $hexKey $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey) If Not @error And BitAND($aR[0], 0x8000) = 0x8000 Then $bO = 1 Else $bO = 0 EndIf Return $bO EndFunc ;ISPRESSED! ;Run("soma.exe") $bastario = GUICreate("Basti back by Popular Demand", 800, 300, -1, -1) GUISetBkColor (0xE0FFFF) $background = GUICtrlCreatePic ("images\demo-bg.jpg", 0, 0, 800, 300) $basti = GUICtrlCreatePic ("images\l_st.gif", 770, 220, 14, 80) $basti_Pos = ControlGetPos($bastario, "", $basti) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop ;Moving Left if _IsPressed("25") Then $basti_Pos[0] = $basti_Pos[0] -5 GUICtrlSetPos($basti, $basti_Pos[0], $basti_Pos[1]) EndIf Wend Images i used could be downloaded from here Background l_st.gif Edited May 20, 2006 by Jon Link to comment Share on other sites More sharing options...
jpm Posted February 15, 2005 Share Posted February 15, 2005 I tried to make a moving object (picture) in my dialog. But i noticed that the transparent areas (it's a .gif) are in the gui-grey color, ...how to solve this problem?I've got one picture (.jpg) as a background (filling whole gui) .. but how to draw objects with transparent areas on this one ?Could be very useful! especially for moving objects...thanks in advance//edit#include <GUIConstants.au3> ;Run("soma.exe") GUICreate("Basti back by Popular Demand", 800, 330, -1, -1, "", $WS_EX_LAYERED) $background = GUICtrlCreatePic ("images\demo-bg.jpg", 0, 0, 800, 300) $basti_stay = GUICtrlCreatePic ("images\l_st.gif", 770, 220, 14, 80) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WendIs what i have now, l_st.gif got it's transparent areas filled with rgb 255,0,255 (pink). Now these areas are white, but i want demo-bg.jpg as the background for it, how to realize that?//EDIT2My try (look up) didn't work.: with $ws_ex_layered it show me the things behind the window, i just want the picture as a background Here's what i have for now, perhaps anyone got a idea (i want the pink places of the figure beeing transparent)#include <GUIConstants.au3> ;ISPRESSED? Func _IsPressed($hexKey) Local $aR, $bO $hexKey = '0x' & $hexKey $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey) If Not @error And BitAND($aR[0], 0x8000) = 0x8000 Then $bO = 1 Else $bO = 0 EndIf Return $bO EndFunc ;ISPRESSED! ;Run("soma.exe") $bastario = GUICreate("Basti back by Popular Demand", 800, 300, -1, -1) GUISetBkColor (0xE0FFFF) $background = GUICtrlCreatePic ("images\demo-bg.jpg", 0, 0, 800, 300) $basti = GUICtrlCreatePic ("images\l_st.gif", 770, 220, 14, 80) $basti_Pos = ControlGetPos($bastario, "", $basti) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop ;Moving Left if _IsPressed("25") Then $basti_Pos[0] = $basti_Pos[0] -5 GUICtrlSetPos($basti, $basti_Pos[0], $basti_Pos[1]) EndIf WendImages i used could be downloaded from hereBackground l_st.gif <{POST_SNAPBACK}>as I design the transparency, the entire GUI will be transparent on the desktop background.So you need to synchronize in position 2 windows one being your background and the other having the transparent labelI don't know if there is a solution to make what you like in one window Link to comment Share on other sites More sharing options...
forever Posted February 16, 2005 Author Share Posted February 16, 2005 as I design the transparency, the entire GUI will be transparent on the desktop background.So you need to synchronize in position 2 windows one being your background and the other having the transparent labelI don't know if there is a solution to make what you like in one window <{POST_SNAPBACK}>That seems to be a very bad workaround but I'll give it a try (thanks)... any other idea's ? Link to comment Share on other sites More sharing options...
therks Posted February 16, 2005 Share Posted February 16, 2005 Wait.. that doesn't seem right. The icon and cursor transparency works perfectly fine. The only problem there is the limited sizes. I don't understand the need to make a whole window transparent..? My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
jpm Posted February 16, 2005 Share Posted February 16, 2005 Wait.. that doesn't seem right. The icon and cursor transparency works perfectly fine. The only problem there is the limited sizes. I don't understand the need to make a whole window transparent..?<{POST_SNAPBACK}>the need was express by you (your picture)it is possible now with the $WS_EX_LAYERED but for the whole window not a pic on pic in the same window.To be frank the GUI design support badly refresh on overlap controls. Sometime it works but not all the time. Link to comment Share on other sites More sharing options...
therks Posted February 16, 2005 Share Posted February 16, 2005 (edited) the need was express by you (your picture)it is possible now with the $WS_EX_LAYERED but for the whole window not a pic on pic in the same window.To be frank the GUI design support badly refresh on overlap controls. Sometime it works but not all the time. <{POST_SNAPBACK}>Wait, so how does this work exactly? I tried creating a window with the $WS_EX_LAYERED style, but it just seems to be completely invisible...Wait.. scratch that. If I put a picture control in it, it becomes visible, but doesn't appear to be any different from a regular window.Here's my test code:#include <GuiConstants.au3> GuiCreate('Window Title', 200, 100, -1, -1, -1, $WS_EX_LAYERED) GuiCtrlCreateButton('Button', 0, 0) GuiCtrlCreateButton('Button 2', 100, 0) GuiCtrlCreatePic('picture.bmp', 0, 50, 200, 50); <-- If you comment out this line, no GUI window appears at all GuiSetState() While 1 $i_Msg = GuiGetMsg() Select Case $i_Msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd*Edit: Nevermind! Sorry about that, I figured it out. Any pink (ff00ff) color is transparent. Nifty.I think what the OP is looking for is just better GIF transparency support. So that a GIF with transparent colours looks like a cursor or icon with transparent background. Is that possible? Edited February 16, 2005 by Saunders My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
jpm Posted February 16, 2005 Share Posted February 16, 2005 Wait, so how does this work exactly? I tried creating a window with the $WS_EX_LAYERED style, but it just seems to be completely invisible...Wait.. scratch that. If I put a picture control in it, it becomes visible, but doesn't appear to be any different from a regular window.Here's my test code:#include <GuiConstants.au3> GuiCreate('Window Title', 200, 100, -1, -1, -1, $WS_EX_LAYERED) GuiCtrlCreateButton('Button', 0, 0) GuiCtrlCreateButton('Button 2', 100, 0) GuiCtrlCreatePic('picture.bmp', 0, 50, 200, 50); <-- If you comment out this line, no GUI window appears at all GuiSetState() While 1 $i_Msg = GuiGetMsg() Select Case $i_Msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd*Edit: Nevermind! Sorry about that, I figured it out. Any pink (ff00ff) color is transparent. Nifty.I think what the OP is looking for is just better GIF transparency support. So that a GIF with transparent colours looks like a cursor or icon with transparent background. Is that possible?<{POST_SNAPBACK}>The current implemenation allow any transparent color the one in the leftupper pixel.I understand OP want more but I didn't find a better implementation. Link to comment Share on other sites More sharing options...
forever Posted February 16, 2005 Author Share Posted February 16, 2005 My problem is not better gif-transparency support, myproblem is just that i can't get the area fileld with FF00FF gets transparent! If i use ws_ex_layered the are is transparent, yea, but it doesn't shows the picture under it, it shows the thing behind the window! That's my problem, i want the background as a real background.. the background (thepic) should be shown on other transparent areas on pictures which are drawn over this one (over the background) could i explain it now? Link to comment Share on other sites More sharing options...
SlimShady Posted February 16, 2005 Share Posted February 16, 2005 My problem is not better gif-transparency support, myproblem is just that i can't get the area fileld with FF00FF gets transparent!If i use ws_ex_layered the are is transparent, yea, but it doesn't shows the picture under it, it shows the thing behind the window! That's my problem, i want the background as a real background.. the background (thepic) should be shown on other transparent areas on pictures which are drawn over this one (over the background)could i explain it now?<{POST_SNAPBACK}>That's what I want too for my Tetris script/game.I made parts of the pictures pink (0xff00ff), but the GUI is acting really strange.Sometimes I see the pink and sometimes I can look through the GUI.Should I explain in detail what happens with my original script? Link to comment Share on other sites More sharing options...
forever Posted February 16, 2005 Author Share Posted February 16, 2005 So we've got the same problem, but how could we solve it, is there absolutely no way then creating a second window and putting it behind the ws_ex_layered window?!?!? Anyone must have a idea, that cannot be .. if it is so i think it should be highly recommended that this feature gets implemented .. Link to comment Share on other sites More sharing options...
jpm Posted February 16, 2005 Share Posted February 16, 2005 That's what I want too for my Tetris script/game.I made parts of the pictures pink (0xff00ff), but the GUI is acting really strange.Sometimes I see the pink and sometimes I can look through the GUI.Should I explain in detail what happens with my original script?<{POST_SNAPBACK}>Obviously you can explain better post a repro script if you cannot define a small repro script just PM what is needed script+ imagesI will try to understand.Just few info if you use $WS_EX_LAYERED it is normal that a transparent gif will just dispaly the opaque part the transparent part will show the window which is behind.if you don't use $WS_EX_LAYERED the transparent color of your gif will be display as you defined it. It could be pink if it was the color you define as the transparency color during the gif creation. Remember AutoiT KNOW THE TRANSPARENCY COLOR by looking at the pixel at coord 0,0 of your gif image.I hope that explain what you are seing Link to comment Share on other sites More sharing options...
SlimShady Posted February 16, 2005 Share Posted February 16, 2005 Very interesting. I will look into this tomorrow. Link to comment Share on other sites More sharing options...
forever Posted February 17, 2005 Author Share Posted February 17, 2005 Thanks, but how do i set the transparency color from my gif with photoshop ? Does anyone know? Link to comment Share on other sites More sharing options...
jpm Posted February 17, 2005 Share Posted February 17, 2005 Thanks, but how do i set the transparency color from my gif with photoshop ?Does anyone know?<{POST_SNAPBACK}>I don't know for Photoshop but you have a freeware at www.irfanview.com very easy when you save in .gif format Link to comment Share on other sites More sharing options...
forever Posted February 18, 2005 Author Share Posted February 18, 2005 I don't know for Photoshop but you have a freeware at www.irfanview.com very easy when you save in .gif format<{POST_SNAPBACK}>I've IV too .. how to do it? Link to comment Share on other sites More sharing options...
jpm Posted February 18, 2005 Share Posted February 18, 2005 I've IV too .. how to do it? <{POST_SNAPBACK}>You save as a .gif and chooze to select yourself the transparent color.so the application your picture again and you click inside on the choosen color Link to comment Share on other sites More sharing options...
SlimShady Posted February 18, 2005 Share Posted February 18, 2005 Hot! Yesterday I was searching my _ss off for some freeware graphics editor. I'm glad you explained it, jpm. I'll install it right away. Link to comment Share on other sites More sharing options...
forever Posted February 18, 2005 Author Share Posted February 18, 2005 Mhhh, i've done it as you said and in the windows xp thumbnails it shows the pink areas transparent now, but in the au3 gui it shows them pink please help.. here some code from me : ~gui.au3 #include <GUIConstants.au3> #include <File.au3> #include "function.inc.au3" #include "images.au3" $bastario = GUICreate("Basti back by Popular Demand", 800, 300, -1, -1) $background = GUICtrlCreatePic ($img_DemoBg, 0, 0, 800, 300) $basti = GUICtrlCreatePic ($img_L_st, 770, 220, 15, 80) $basti_Pos = ControlGetPos($bastario, "", $basti) GUISetState(@SW_SHOW) ...(cut off)... ~images.au3 $Img_DemoBg = _TempFile() FileInstall ("images/demo-bg.jpg", $Img_Demobg) $Img_Blank = _TempFile() FileInstall ("images/blank.gif", $Img_Blank) $Img_L_wl = _TempFile() FileInstall ("images/l_wl.gif", $Img_L_wl) $Img_L_st = _TempFile() FileInstall ("images/l_st2.gif", $Img_L_st);;THIS FILE MUST SHOW UP TRANSPARENT (PINK AREAS) but it doenst do :( $Img_R_wl = _TempFile() FileInstall ("images/r_wl.gif", $Img_R_wl) $Img_R_st = _TempFile() FileInstall ("images/r_st.gif", $Img_R_st) Link to comment Share on other sites More sharing options...
jpm Posted February 18, 2005 Share Posted February 18, 2005 Mhhh, i've done it as you said and in the windows xp thumbnails it shows the pink areas transparent now, but in the au3 gui it shows them pink please help..here some code from me :~gui.au3#include <GUIConstants.au3> #include <File.au3> #include "function.inc.au3" #include "images.au3" $bastario = GUICreate("Basti back by Popular Demand", 800, 300, -1, -1) $background = GUICtrlCreatePic ($img_DemoBg, 0, 0, 800, 300) $basti = GUICtrlCreatePic ($img_L_st, 770, 220, 15, 80) $basti_Pos = ControlGetPos($bastario, "", $basti) GUISetState(@SW_SHOW) ...(cut off)...~images.au3$Img_DemoBg = _TempFile() FileInstall ("images/demo-bg.jpg", $Img_Demobg) $Img_Blank = _TempFile() FileInstall ("images/blank.gif", $Img_Blank) $Img_L_wl = _TempFile() FileInstall ("images/l_wl.gif", $Img_L_wl) $Img_L_st = _TempFile() FileInstall ("images/l_st2.gif", $Img_L_st);;THIS FILE MUST SHOW UP TRANSPARENT (PINK AREAS) but it doenst do :( $Img_R_wl = _TempFile() FileInstall ("images/r_wl.gif", $Img_R_wl) $Img_R_st = _TempFile() FileInstall ("images/r_st.gif", $Img_R_st)<{POST_SNAPBACK}>use the attached files I think you will understand Link to comment Share on other sites More sharing options...
SlimShady Posted February 18, 2005 Share Posted February 18, 2005 (edited) It works here! Y'know how happy I am?I'll explain what I did.- Install IrfanView from http://www.irfanview.com- Start the app- File, Batch Conversion- Select all BMP files from the previous time- drag them to the left listbox- Click "Use this directory as output"- "Work as: Batch Conversion"- "Output format: GIF"- Check "Use advanced options"- Click "Set advanced options"- check "Don't enlarge smaller files"- check "CHANGE COLOR DEPTH"- choose 256 colors (8 BPP)- Click on "Options"- check "Save interlaced"- check "Save transparent color"- choose "Choose transparant color during saving"- Press OK- Click Start- Choose white as the transparency color, for every file- Open my script in an editor- Replace .BMP to .GIF- SaveResult: The MyTetris objects don't overlap each other any more. Edited February 18, 2005 by SlimShady 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