andybiochem Posted August 2, 2008 Share Posted August 2, 2008 (edited) Hi!I studied stereograms (also known as Magic Eye pictures) back in GCSE art at high school. I always thought it'd be cool to write a program to render them - the theory is pretty straight forward - but because computers were pants back then (1995 - 1996), and I couldn't program at all, it was a non-starter.So tryin to teach myself multi-dimensional array use (I've been putting it off waaay too long), I've put together a script to create my own stereograms!!!Have fun!!!expandcollapse popup#include <GUIConstants.au3> Opt("GUIOnEventMode", 1) Opt("PixelCoordMode",2) ;************************************************************************************** ;GUI ;************************************************************************************** $GUI = GUICreate("", 819, 578, 195, 135) GUISetOnEvent($GUI_EVENT_CLOSE,"close") ;************************************************************************************** ; User ;************************************************************************************** ;----- Graphic control ----- $Image = "image.bmp" ; should be 800x500 black + white only. $Picture = GUICtrlCreatePic($Image,9,9,800,500) $Graphic = GUICtrlCreateGraphic(8, 8, 802, 502) GUICtrlSetBkColor(-1,0xFFFFFF) GUICtrlSetColor(-1,0x000000) ;----- buttons/input ----- GUICtrlCreateButton("GO", 190,544,170,25) GUICtrlSetOnEvent(-1,"_Create_Stereogram") GUICtrlSetFont(-1,15) GUICtrlCreateButton("Load Picture",8,544,170,25) GUICtrlSetOnEvent(-1,"Load_Pic") GUICtrlCreateLabel("Depth of field = ",8,523) $TotalDepthInput = GUICtrlCreateInput(20,90,520,30,20) $TypeCheckBox = GUICtrlCreateCheckbox("Use converge method",200,520,200,20) ;----- progress----- $Progress = GUICtrlCreateProgress(410,544,390,25) GUISetState(@SW_SHOW) ;###################################################################################### ; LOOP ;###################################################################################### While 1 Sleep(100) WEnd ;###################################################################################### ; END LOOP ;###################################################################################### Func Load_Pic() ;************************************************************************************** ; Load new picture ;************************************************************************************** ;----- renew graphic ----- GUICtrlDelete($graphic) $Graphic = GUICtrlCreateGraphic(8, 8, 802, 502) ;----- renew pic ----- $Image = FileOpenDialog("",".","Images (*.bmp;*.jpeg;*.jpg;*.gif)") If @error = 1 Then Return GUICtrlDelete($Picture) $Picture = GUICtrlCreatePic($Image,9,9,800,500) EndFunc Func _Create_Stereogram() ;************************************************************************************** ; Create Stereogram Map ;************************************************************************************** GUICtrlSetData($Progress,10) ;----- define noise block ----- Dim $aNoisePattern[801][501] For $x = 1 to 100 For $y = 1 to 500 $Col = 0xFFFFFF If Random(0,1,1) = 1 Then $Col = 0x000000 $aNoisePattern[$x][$y] = $Col Next Next For $Copy = 1 to 7 For $x = 1 to 100 For $y = 1 to 500 $aNoisePattern[$x + ($Copy * 100)][$y] = $aNoisePattern[$x][$y] Next Next Next GUICtrlSetData($Progress,20) ;----- Make profile ----- ; This creates a profile used to off-set the NoisePattern Dim $aProfilePattern[801][501] For $x = 1 to 800 For $y = 1 to 500 $aProfilePattern[$x][$y] = PixelGetColor($x + 9,$y + 9,$GUI) Next Next GUICtrlSetData($Progress,30) ;----- edit noise pattern ----- ; Decide on depth for each pixel (scale 1 to $TotalDepth) $TotalDepth = GUICtrlRead($TotalDepthInput) For $x = 1 to 800 For $y = 1 To 500 $cCol = BitAND($aProfilePattern[$x][$y],255) $aProfilePattern[$x][$y] = (($TotalDepth/255) * $cCol) if GUICtrlRead($TypeCheckBox) = 1 Then $aProfilePattern[$x][$y] = $TotalDepth - $aProfilePattern[$x][$y] Next Next ;----- Apply depth as off-set ----- $CriticalWidth = 100 For $x = $TotalDepth to 800 For $y = 1 to 500 $Offset = ($x - $aProfilePattern[$x][$y]) Do $aNoisePattern[$Offset][$y] = $aNoisePattern[$x][$y] $Offset += $CriticalWidth Until $Offset >= 800 Next Next GUICtrlSetData($Progress,40) ;----- draw edited noise blocks ----- For $x = 1 to 800 For $y = 1 to 500 GUICtrlSetGraphic($Graphic,$GUI_GR_COLOR,$aNoisePattern[$x][$y]) GUICtrlSetGraphic($graphic,$GUI_GR_PIXEL,$x,$y) Next GUICtrlSetData($Progress,40 + (($x/800) * 60)) Next GUICtrlSetData($Progress,100) ;----- Show stereogram ----- GUICtrlDelete($Picture) EndFunc Func close() ;************************************************************************************** ; Bye bye!! ;************************************************************************************** Exit EndFuncIt only supports black + white images at the mo (must be in scriptdir), but I might add support for proper 3d grey-scale images soon.Feedback / criticism welcome!!!Attached is an example image to get you started. - "AutoIT Rocks" - Donut[EDIT]- Added support for 3d "Depth Map" images.- Added loading new pics without re-start- Added option to use cross-eyed "converge" mode, rather than "diverge"- Added option to change depth of field (try values up to 100 ish)Note - you can find depth map images on google. Go to google images and search for "Depth Map":http://images.google.co.uk/images?hl=en&am...mages&gbv=2IMPORTANT::: After pressing the "GO!" button, do not open any windows over the GUI!!! The script uses PixelGetColor to interogate your depth map. Edited October 21, 2008 by andybiochem - Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar! Link to comment Share on other sites More sharing options...
gseller Posted August 2, 2008 Share Posted August 2, 2008 Groovy! How far away are ya suposed to stand from them? The script works like your images but I can't see it in the stereogram.. LOL Good work! Link to comment Share on other sites More sharing options...
BigDod Posted August 2, 2008 Share Posted August 2, 2008 Groovy! How far away are ya suposed to stand from them? The script works like your images but I can't see it in the stereogram.. LOL Good work!I can see it with my head approx 600mm from screen with a lot of staring. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
martin Posted August 2, 2008 Share Posted August 2, 2008 That's great. The text is a little ragged with the depth set at 5. At 2 there' no problem, at 8 it is really messed up and there appear to be 3 levels. I hope you get the grey scale version working, or even a colour version. It would make a good birthday card which was a bit different. BTW, any tips for how I can get my eyes uncrossed? 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...
AdmiralAlkex Posted August 2, 2008 Share Posted August 2, 2008 I have never been able to se anything, I am like that fat guy in Mallrats .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
andybiochem Posted August 2, 2008 Author Share Posted August 2, 2008 The text is a little ragged with the depth set at 5. At 2 there' no problem, at 8 it is really messed up and there appear to be 3 levels.The text looks ragged because I'm using individual randomized black/white pixes as the 'medium', thus you still tend to get groups of similar pixels where there shouldn't be. These will show up as elevations even though none was intended.That probably didn't make much sense. If you're seeing more than 1 level on the AutoIT Rocks!!! image then you've crossed your eyes too far!!! ha ha! - relax out a bit.Thanks for the comments!! - Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar! Link to comment Share on other sites More sharing options...
Szhlopp Posted August 2, 2008 Share Posted August 2, 2008 (edited) If you're seeing more than 1 level on the AutoIT Rocks!!! image then you've crossed your eyes too far!!! ha ha! - relax out a bit. Thanks for the comments!! Lol that was frustrating when I first tried to see them. I was looking to close and had my eyes to messed up Nice script! It takes a hella time to complete but I had no idea it could be done in autoIt! This gives me an Idea for a script. Have you ever seen the text version of these? You line two blocks of code up in a message and encode them. To make this work, go so far cross-eyed that you create a third block out of the left and the right blocks of text. Then slowly focus in on that third (center) block of text. After the center block is in focus, Words will appear to be coming out of the screen! This may take a few tries, so don't give up if you don't get it immediately!! Edited August 2, 2008 by Szhlopp RegEx/RegExRep Tester!Nerd Olympics - Community App!Login UDFMemory UDF - "Game.exe+753EC" - CE pointer to AU3Password Manager W/ SourceDataFiler - Include files in your au3!--- Was I helpful? Click the little green '+' Link to comment Share on other sites More sharing options...
andybiochem Posted August 5, 2008 Author Share Posted August 5, 2008 (edited) Here's a quick and easy method to help you see the 3d image if you're having trouble with it.Generate a stereogram using the script above. Make sure you tick the 'Use converge method' before clicking 'Go'.1) Get a 30cm ruler and a little piece of Blu-Tack (also called Fun-Tack, or Sticky-Tack). 2) make a small point with the blu-tack and stick it to the surface of the ruler at the 11cm* mark:3) Hold the ruler up to your screen, as close as you can get it (careful not ot scratch your monitor!!!), the 0cm end towards the screen.4) Move your head so that your nose is touching the other end of the ruler:5) Look down the ruler at the tip of the blu-tack. Keep your focus on the tip of the blu-tack - don't look at the screen.6) The 3d image should 'fall' into place in the background of your focus.*11cm works for me. You might find that you need to adjust this distance slightly. Try between 9 and 13 cmp.s. that's my decorating ruler - that's why it's so filthy!!! Edited August 5, 2008 by andybiochem - Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar! Link to comment Share on other sites More sharing options...
monoceres Posted October 19, 2008 Share Posted October 19, 2008 This is terrific. Really nice I finally was able to see it, it only took me 2 months You should take a look at the GDI+ functions so you can speed it up a little, I'm going insane having to wait for it and not beiong able to do anything else. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
enaiman Posted October 20, 2008 Share Posted October 20, 2008 Niiice Without your explanations I couldn't see them at all. It looks awesome. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
james3mg Posted October 20, 2008 Share Posted October 20, 2008 (edited) Very cool...but Vista seems to break it, both with Desktop Composition disabled and otherwise it leaves a big white stripe down the final image.XP works great though! Edit: how difficult would it be to provide a background to have your script "shift" the pixels of, rather than your seeded "static" looking random pixels?For instance: providing the collage picture and the shark depth map gradient pictures to result in the following:http://upload.wikimedia.org/wikipedia/comm...m_Tut_Shark.png?I know you'd have to have a monitor large enough to display BOTH pictures, if you were to continue using your current methods (with the PixelGetColor() functions)...just a thought Edited October 20, 2008 by james3mg "There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110 Link to comment Share on other sites More sharing options...
wraithdu Posted October 20, 2008 Share Posted October 20, 2008 (edited) These things are so cool. I wanna try it, but it's sooooo slooooow on my Vista laptop. It takes roughly ~13 seconds per column to PixelGetColor, which is ~3 hours to complete !! Edited October 20, 2008 by wraithdu Link to comment Share on other sites More sharing options...
james3mg Posted October 21, 2008 Share Posted October 21, 2008 These things are so cool. I wanna try it, but it's sooooo slooooow on my Vista laptop. It takes roughly ~13 seconds per column to PixelGetColor, which is ~3 hours to complete !! compile the script, right-click and choose properties, then under the compatability tab, choose to disable desktop composition Let me know if you get it working right on vista... "There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110 Link to comment Share on other sites More sharing options...
quake101 Posted October 21, 2008 Share Posted October 21, 2008 Found a small typo on line 60. This: $Image = FileOpenDialog("",".","Images (*.bpm;*.jpeg;*.jpg;*.gif)") Should be: $Image = FileOpenDialog("",".","Images (*.bmp;*.jpeg;*.jpg;*.gif)") Great script tho! I would like to see more of this. Link to comment Share on other sites More sharing options...
wraithdu Posted October 21, 2008 Share Posted October 21, 2008 @james3mg Good tip. It goes much faster now, but I get the same white stripe you speak of. Link to comment Share on other sites More sharing options...
james3mg Posted October 21, 2008 Share Posted October 21, 2008 BTW, I remembered this morning that you can also add the following lines to the top of the script so you don't have to compile it to disable desktop composition. I don't know what this does in XP...it might throw an error. $dll = Dllopen("dwmapi.dll") Dllcall($dll,"int","DwmEnableComposition","dword","DWM_EC_DISABLECOMPOSITION") "There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110 Link to comment Share on other sites More sharing options...
andybiochem Posted October 21, 2008 Author Share Posted October 21, 2008 XP works great though! Edit: how difficult would it be to provide a background to have your script "shift" the pixels of, rather than your seeded "static" looking random pixels?Would be fairly easy theoretically...there's no difference in how the effect works. Unfortunately I've got a LOT on at the mo work-wise, so will look at it sometime soon.Vista seems to break it, both with Desktop Composition disabled and otherwise crying.gif it leaves a big white stripe down the final image.tut. blummin vista. Don't know what the solution to this is sorry. running XPThese things are so cool. I wanna try it, but it's sooooo slooooow on my Vista laptop. It takes roughly ~13 seconds per column to PixelGetColor, which is ~3 hours to completeGosh, that is slow!! My comp takes 25 secs per render.Perhaps someone could look at improving the algo, I'm sure there must be a better way....You should take a look at the GDI+ functions so you can speed it up a little....like this.Found a small typo on line 60.This:$Image = FileOpenDialog("",".","Images (*.bpm;*.jpeg;*.jpg;*.gif)")heh! my bad. will fix. - Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar! Link to comment Share on other sites More sharing options...
james3mg Posted October 21, 2008 Share Posted October 21, 2008 (edited) Note: please consider this post all but deleted, since I made another script entirely based on wraithdu's GDI 'port' of andybiochem's original scriptUsing your post as inspiration and wikipedia for the method, I developed this one that applies the depth mask to a background of your specification (note that the image you specify needs to repeat itself several times over in each direction, at least):{script deleted}Unfortunately, it doesn't work as well as yours...I seem to be getting odd "phantoms" and areas that dent into the "background" even though the background was solid black in the depth map. So, it's a start, and if you want to use any of it, feel free, but I can't seem to get it working any better. I'm happy I came close though Thanks for turning me on to this!P.S. My script leaves the white stripe in the final render too...so there's something goofy between AutoIt's Graphic functions and Vista. Edited October 22, 2008 by james3mg "There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110 Link to comment Share on other sites More sharing options...
wraithdu Posted October 22, 2008 Share Posted October 22, 2008 (edited) UPDATE 2:Now uses direct calls to GDI to get pixel color, so it's not necessary to disable composition in Vista anymore, since getting the DC (previous performance hit) is only done once.UPDATE:Here's a version of the original script that works on Vista. This one redraws properly so the image doesn't disappear, and it doesn't seem to care what you do with or over the window once it's done with the PixelGetColor phase. Once the source pic disappears, you can minimize or move other windows over the GUI.expandcollapse popup#include <GUIConstants.au3> #include <GdiPlus.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Opt("PixelCoordMode", 2) ;~ $hDLL = DllOpen("dwmapi.dll") ;~ DllCall($hDLL,"int","DwmEnableComposition","uint",0) Global $graphic, $pWhite, $pBlack, $fdraw = False, $graphic1, $hBMP _GDIPlus_Startup() ;************************************************************************************** ;GUI ;************************************************************************************** $GUI = GUICreate("", 819, 578, 195, 135) GUISetOnEvent($GUI_EVENT_CLOSE,"close") ;************************************************************************************** ; User ;************************************************************************************** ;----- Graphic control ----- $Image = "image.bmp" ; should be 800x500 black + white only. $Picture = GUICtrlCreatePic($Image,9,9,800,500) $graphic = GUICtrlCreateGraphic(8, 8, 802, 502) GUICtrlSetBkColor(-1,0xFFFFFF) GUICtrlSetColor(-1,0x000000) ;----- buttons/input ----- GUICtrlCreateButton("GO", 190,544,170,25) GUICtrlSetOnEvent(-1,"_Create_Stereogram") GUICtrlSetFont(-1,15) GUICtrlCreateButton("Load Picture",8,544,170,25) GUICtrlSetOnEvent(-1,"Load_Pic") GUICtrlCreateLabel("Depth of field = ",8,523) $TotalDepthInput = GUICtrlCreateInput(20,90,520,30,20) $TypeCheckBox = GUICtrlCreateCheckbox("Use converge method",200,520,200,20) ;----- progress----- $Progress = GUICtrlCreateProgress(410,544,390,25) GUIRegisterMsg($WM_PAINT, "MY_WM_PAINT") GUIRegisterMsg($WM_ERASEBKGND, "MY_WM_PAINT") GUISetState(@SW_SHOW) ;###################################################################################### ; LOOP ;###################################################################################### While 1 Sleep(100) WEnd ;###################################################################################### ; END LOOP ;###################################################################################### Func Load_Pic() ;************************************************************************************** ; Load new picture ;************************************************************************************** $fdraw = False _GDIPlus_GraphicsDispose($graphic1) _GDIPlus_BitmapDispose($hBMP) ;----- renew pic ----- $Image = FileOpenDialog("",".","Images (*.bmp;*.jpeg;*.jpg;*.gif)") If @error = 1 Then Return GUICtrlDelete($Picture) $Picture = GUICtrlCreatePic($Image,9,9,800,500) GUICtrlSetBkColor($graphic,0xFFFFFF) GUICtrlSetColor($graphic,0x000000) EndFunc Func _Create_Stereogram() ;************************************************************************************** ; Create Stereogram Map ;************************************************************************************** GUICtrlSetData($Progress,10) ;----- define noise block ----- Dim $aNoisePattern[801][501] For $x = 1 to 100 For $y = 1 to 500 $Col = 0xFFFFFF If Random(0,1,1) = 1 Then $Col = 0x000000 $aNoisePattern[$x][$y] = $Col Next Next For $Copy = 1 to 7 For $x = 1 to 100 For $y = 1 to 500 $aNoisePattern[$x + ($Copy * 100)][$y] = $aNoisePattern[$x][$y] Next Next Next GUICtrlSetData($Progress,20) ;----- Make profile ----- ; This creates a profile used to off-set the NoisePattern ConsoleWrite("Getting pixel colors..." & @CRLF) $hGDI = DllOpen("gdi32.dll") $hDC = _WinAPI_GetDC($GUI) If @error Then ConsoleWrite("Error getting DC" & @CRLF) Dim $aProfilePattern[801][501] For $x = 1 to 800 For $y = 1 to 500 $ret = DllCall($hGDI, "int", "GetPixel", "hwnd", $hDC, "int", $x + 9, "int", $y + 9) ;~ $aProfilePattern[$x][$y] = PixelGetColor($x + 9,$y + 9,$GUI) $aProfilePattern[$x][$y] = BGRtoRGB($ret[0]) Next Next _WinAPI_ReleaseDC($GUI, $hDC) DllClose($hGDI) ConsoleWrite("Finished getting pixel data." & @CRLF) GUICtrlSetData($Progress,30) ;----- edit noise pattern ----- ; Decide on depth for each pixel (scale 1 to $TotalDepth) $TotalDepth = GUICtrlRead($TotalDepthInput) For $x = 1 to 800 For $y = 1 To 500 $cCol = BitAND($aProfilePattern[$x][$y],255) $aProfilePattern[$x][$y] = (($TotalDepth/255) * $cCol) if GUICtrlRead($TypeCheckBox) = 1 Then $aProfilePattern[$x][$y] = $TotalDepth - $aProfilePattern[$x][$y] Next Next ;----- Apply depth as off-set ----- $CriticalWidth = 100 For $x = $TotalDepth to 800 For $y = 1 to 500 $Offset = ($x - $aProfilePattern[$x][$y]) Do $aNoisePattern[$Offset][$y] = $aNoisePattern[$x][$y] $Offset += $CriticalWidth Until $Offset >= 800 Next Next GUICtrlSetData($Progress,40) ;----- draw edited noise blocks ----- GUICtrlDelete($Picture) $graphic1 = _GDIPlus_GraphicsCreateFromHWND($GUI) $hBMP = _GDIPlus_BitmapCreateFromGraphics(800, 500, $graphic1) $graphic2 = _GDIPlus_ImageGetGraphicsContext($hBMP) For $x = 1 to 800 For $y = 1 to 500 If $aNoisePattern[$x][$y] == 0 Then $pBlack = _GDIPlus_PenCreate() _GDIPlus_GraphicsDrawRect($graphic2, $x, $y, 1, 1, $pBlack) _GDIPlus_PenDispose($pBlack) Else $pWhite = _GDIPlus_PenCreate(0xFFFFFFFF) _GDIPlus_GraphicsDrawRect($graphic2, $x, $y, 1, 1, $pWhite) _GDIPlus_PenDispose($pWhite) EndIf Next GUICtrlSetData($Progress,40 + (($x/800) * 60)) Next _GDIPlus_GraphicsDispose($graphic2) $fdraw = True ;~ _GDIPlus_ImageSaveToFile($hBMP, @DesktopDir & "\stereo1.jpg") _GDIPlus_GraphicsDrawImageRect($graphic1, $hBMP, 0, 0, 800, 500) GUICtrlSetData($Progress,100) EndFunc Func MY_WM_PAINT($hwnd, $msg, $wparam, $lparam) If $fdraw Then _GDIPlus_GraphicsDrawImageRect($graphic1, $hBMP, 0, 0, 800, 500) Return $GUI_RUNDEFMSG EndFunc Func BGRtoRGB($iColor) Return Int(BitOR(BitShift(BitAND($iColor, 0xFF), -16), BitAND($iColor, 0xFF00), BitShift(BitAND($iColor, 0xFF0000), 16))) EndFunc Func close() ;************************************************************************************** ; Bye bye!! ;************************************************************************************** ;~ DllClose($hDLL) _GDIPlus_GraphicsDispose($graphic1) _GDIPlus_BitmapDispose($hBMP) _GDIPlus_Shutdown() Exit EndFunc Edited October 22, 2008 by wraithdu Link to comment Share on other sites More sharing options...
BillLuvsU Posted October 22, 2008 Share Posted October 22, 2008 (edited) Definatly one of the funnest scripts I've seen coming out of these forums. I love these things Edit: I admit I don't know alot about the technical theory of these, but would it be possible to do this with transparencie? For example make a cursor a stereogram? Cause i just had an idea for the most awesome desktop ever. Edited October 22, 2008 by BillLuvsU [center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw 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