Achilles Posted May 15, 2007 Share Posted May 15, 2007 I'm planning on making a game that quizes the user on the capitals and positions of South American countries (eventually all the world once I get to summer...). However, In order to ask a question the computer will randomly highlight one of the countries by making the whole country a specific unique color. Instead of making about 15 different images where each different image has a different color highlighted I was wondering if there was a way to "fill" (like paint does) a certain country. I have a short example: GuiCreate('Map of South America', 516, 761) GuiCtrlCreatePic(@ScriptDir & '\South America Map.gif', 5, 5, 506, 751) ;Image is attached GUISetState() Do Sleep(50) Until GuiGetMsg() = -3 t0nZ 1 My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
martin Posted May 15, 2007 Share Posted May 15, 2007 I'm planning on making a game that quizes the user on the capitals and positions of South American countries (eventually all the world once I get to summer...). However, In order to ask a question the computer will randomly highlight one of the countries by making the whole country a specific unique color. Instead of making about 15 different images where each different image has a different color highlighted I was wondering if there was a way to "fill" (like paint does) a certain country. I have a short example: GuiCreate('Map of South America', 516, 761) GuiCtrlCreatePic(@ScriptDir & '\South America Map.gif', 5, 5, 506, 751) ;Image is attached GUISetState() Do Sleep(50) Until GuiGetMsg() = -3 I suggest you google for floodfill dll, or flood-fill dll. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
i542 Posted May 15, 2007 Share Posted May 15, 2007 I'm planning on making a game that quizes the user on the capitals and positions of South American countries (eventually all the world once I get to summer...). However, In order to ask a question the computer will randomly highlight one of the countries by making the whole country a specific unique color. Instead of making about 15 different images where each different image has a different color highlighted I was wondering if there was a way to "fill" (like paint does) a certain country. I have a short example: GuiCreate('Map of South America', 516, 761) GuiCtrlCreatePic(@ScriptDir & '\South America Map.gif', 5, 5, 506, 751) ;Image is attached GUISetState() Do Sleep(50) Until GuiGetMsg() = -3Wont that should be in Example Script forum? i542 I can do signature me. Link to comment Share on other sites More sharing options...
RazerM Posted May 15, 2007 Share Posted May 15, 2007 Wont that should be in Example Script forum?i542No, he is asking for help.@Piano_manI'm not aware of a way to do that in AutoIt unfortunately. My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. Link to comment Share on other sites More sharing options...
James Posted May 15, 2007 Share Posted May 15, 2007 Without the need for a special .dll and/or lots of scripting for points and paths. Its going to be very hard! Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Achilles Posted May 15, 2007 Author Share Posted May 15, 2007 (edited) I suggest you google for floodfill dll, or flood-fill dll.Do you have any examples of how to use this .dll?Edit: I mean with autoit, I found some people using this but I don't know how I would translate it to autoit language... Edited May 15, 2007 by Piano_Man My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Lakes Posted May 16, 2007 Share Posted May 16, 2007 Maybe an easier way would be to prefill the areas with different colours and then change/swap the colour of the high-lighted area? 2015 - Still no flying cars, instead blankets with sleeves. Link to comment Share on other sites More sharing options...
Achilles Posted May 16, 2007 Author Share Posted May 16, 2007 Maybe an easier way would be to prefill the areas with different colours and then change/swap the colour of the high-lighted area?I'm not sure what you mean... Would your idea include me having a bunch of different images? 'Cause if not, then I don't know how I would prefill the areas... My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
James Posted May 16, 2007 Share Posted May 16, 2007 Pixel Searching maybe? Its really hard to find away without images. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
martin Posted May 16, 2007 Share Posted May 16, 2007 Do you have any examples of how to use this .dll?Edit: I mean with autoit, I found some people using this but I don't know how I would translate it to autoit language... I only meant that you should search for floodfill and dll to find a dll which has a floodfill function. I found this API which I would think could be the best optionfloodfill APIbut I haven't got ime to play with it now. Maybe you will find something searching the forum, in particular I suggest you search for posts by Zedna about graphics and drawing because I think he is very good at this sort of thing. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
martin Posted May 18, 2007 Share Posted May 18, 2007 (edited) I couldn't get the Floodfill api to work so I've written a dll to do floodfill. I think it will do what Piano Man wants, and could be usefule to someone else. It has a single function Function Fill(ctrlHandle,xcoord,ycoord,brushcol,bordercol,ffilltype) The filltype has to be 1 at the moment untill I either fix or or find it works with 0. (Haven't tried it yet!) 1 means fill the area bordered by colour bodercol, starting at the point xcoord, ycoord, and using a brush colour of brushcol. Here is a sample program which uses the gif in Piano Man's OP Documentation is not my forte. To use the program have the dll in the @ScriptDir, change the colour value in the edit box (RGB) to what you want, and click in the area to be filled. #include <GUIConstants.au3> Const $FLOODFILLBORDER = 0, $FLOODFILLSURFACE = 1 Opt("mousecoordmode",2) $gg = GUICreate("floods",700,800,10,10) $pic1 = GUICtrlCreatePic("South_America_Map.GIF",0,0, 0,0) $ed = GUICtrlCreateEdit("ff0000",520,50,170,45) $ed2 = GUICtrlCreateEdit("",520,100,170,45) GUICtrlCreateLabel("Fill colour",520,25) Guisetstate() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit If $msg = $pic1 Then $fcol = Dec(GUICtrlRead($ed)) $mp = MouseGetPos() DllCall("floodfill02.dll","int","Fill","hwnd",GUICtrlGetHandle($pic1),"int",$mp[0],"int",$mp[1],"int",$fcol,"int",0,"int",1) EndIf $mp = MouseGetPos() GUICtrlSetData($ed2,$mp[0] & ', ' & $mp[1]) WEnd Any suggestions on how I can make the image refresh automatically? EDIT: Replaced line GuiSetState() which somehow I had deleted. Edited May 18, 2007 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Zedna Posted May 18, 2007 Share Posted May 18, 2007 (edited) I couldn't get the Floodfill api to work so I've written a dll to do floodfill. I think it will do what Piano Man wants, and could be usefule to someone else. Here is working sample for FloodFill without external DLL #include <GUIConstants.au3> Opt("mousecoordmode",2) $gui = GuiCreate('Map of South America', 516, 761) $pic1 = GuiCtrlCreatePic(@ScriptDir & '\South_America_Map.gif', 5, 5, 506, 751) ;Image is attached GUISetState() $pic_hWnd = ControlGetHandle($gui,"",$pic1) $pic_hdc = DLLCall("user32.dll","int","GetDC","hwnd",$pic_hWnd) $hBrush = DllCall("gdi32.dll", "long", "CreateSolidBrush", "int", 0xFF00FF) ; fill color $obj_orig = DLLCall("gdi32.dll","int","SelectObject","int",$pic_hdc[0],"int",$hBrush[0]) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $pic1 Then $mp = MouseGetPos() ;~ DllCall("floodfill02.dll","int","Fill","hwnd",GUICtrlGetHandle($pic1),"int",$mp[0],"int",$mp[1],"int",0xFF00FF,"int",0,"int",1) DllCall("gdi32.dll","int","FloodFill","int",$pic_hdc[0],"int",$mp[0],"int",$mp[1],"int",0x00) ; border color EndIf WEnd DLLCall("gdi32.dll","int","SelectObject","int",$pic_hdc[0],"int",$obj_orig[0]) DLLCall("gdi32.dll","int","DeleteObject","int",$hBrush[0]) ; http://msdn2.microsoft.com/en-us/library/ms532286.aspx Edited May 18, 2007 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
martin Posted May 18, 2007 Share Posted May 18, 2007 Here is working sample for FloodFill without external DLL Very good Zedna, that's much better. I couldn't work out how to do that. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Zedna Posted May 18, 2007 Share Posted May 18, 2007 Maybe you will find something searching the forum, in particular I suggest you search for posts by Zedna about graphics and drawing because I think he is very good at this sort of thing.HeHe Now I noticed my name in your post. Thanks for compliments martin. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Achilles Posted May 19, 2007 Author Share Posted May 19, 2007 HeHe Now I noticed my name in your post. Thanks for compliments martin.VERY VERY AWESOME! Thanks! My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
sshrum Posted November 30, 2007 Share Posted November 30, 2007 GUIGetMsg() is only returning mouseevent codes (-7, -8, -11 = mousedown, mouseup, mousemove). It's not returning the control ID. Sean Shrum :: http://www.shrum.net All my published AU3-based apps and utilities 'Make it idiot-proof, and someone will make a better idiot' Link to comment Share on other sites More sharing options...
cheatera Posted March 21, 2008 Share Posted March 21, 2008 @Zedna: rly big thx dude, i was looking for something like this, but gaved up with the project, now thx to it will be reborned Is There A Life BEFORE Death?im stupidSaved warn logs: cheateraSmOke_N Note Added 17 January 2009 - 02:54 PM Added to warn level Posting a way to hack the registry and force sending someones desktop via TCP. Jos Note Added 25 November 2008 - 02:52 PM Added to warn level for being an impolite rookie.once a year i go bad ... what will happen in 2010??[u]Its GOOD to be BAD ... (Warlock's Succubus - World of Warcraft)[/u] Link to comment Share on other sites More sharing options...
Zedna Posted March 21, 2008 Share Posted March 21, 2008 @Zedna: rly big thx dude, i was looking for something like this, but gaved up with the project, now thx to it will be reborned I'm pleased to help so many people Resources UDF ResourcesEx UDF AutoIt Forum Search 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