iamtheky Posted November 3, 2010 Share Posted November 3, 2010 I am working now to try and get it to use many shades of a single color, but my color palette hex value knowledge is lacking. the second example was more for my daughter as she totally loves colored blocks. Single Line expandcollapse popup#include <Array.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Top = 0 $Bottom = 81 $MAX = 50 $Blocks = $MAX $each = @DesktopWidth / $Blocks For $i = 1 to $Blocks $Rcolor = random (0x000000 , 0xFFFFFF) For $x = $each * ($i - 1) To $each * $i For $y = $Top To $Bottom _PixelSetColor ($x , $y , $Rcolor) Next Next If $i = $Blocks Then $i = 0 $Top = 0 $Bottom = 81 $Blocks = Random (3 , $MAX , 1) $each = @DesktopWidth / $Blocks Endif Next Func _PixelSetColor($XCoord, $YCoord, $Color) Local $dc = DllCall("user32.dll", "int", "GetDC", "hwnd", 0) If Not IsArray($dc) Then Return -1 DllCall("gdi32.dll", "long", "SetPixel", "long", $dc[0], "long", $XCoord, "long", $YCoord, "long", _ "0x" & StringRegExpReplace(hex($Color,6), "(..)(..)(..)", "\3\2\1")) ; Change to 0xBBGGRR hex colour format. DllCall("user32.dll", "int", "ReleaseDC", "hwnd", 0, "hwnd", $dc[0]) EndFunc ;==>_PixelSetColor Full Screen expandcollapse popup#include <Array.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Top = 0 $Bottom = 81 $MAX = 50 $Blocks = $MAX $each = @DesktopWidth / $Blocks For $i = 1 to $Blocks $Rcolor = random (0x000000 , 0xFFFFFF) For $x = $each * ($i - 1) To $each * $i For $y = $Top To $Bottom _PixelSetColor ($x , $y , $Rcolor) Next Next If $i = $Blocks Then $i = 0 $Top = $Top + 82 $Bottom = $Bottom + 82 $Blocks = Random (3 , $MAX , 1) $each = @DesktopWidth / $Blocks EndIf If $y > @DesktopHeight and $x > $each * $Blocks Then $i = 0 $Top = 0 $Bottom = 81 $Blocks = 50 $each = @DesktopWidth / $Blocks Endif Next Func _PixelSetColor($XCoord, $YCoord, $Color) Local $dc = DllCall("user32.dll", "int", "GetDC", "hwnd", 0) If Not IsArray($dc) Then Return -1 DllCall("gdi32.dll", "long", "SetPixel", "long", $dc[0], "long", $XCoord, "long", $YCoord, "long", _ "0x" & StringRegExpReplace(hex($Color,6), "(..)(..)(..)", "\3\2\1")) ; Change to 0xBBGGRR hex colour format. DllCall("user32.dll", "int", "ReleaseDC", "hwnd", 0, "hwnd", $dc[0]) EndFunc ;==>_PixelSetColor ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
JohnOne Posted November 3, 2010 Share Posted November 3, 2010 Thats a lovely story, but any chance you could explain your problem? It will help you get a quicker answer? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
taietel Posted November 3, 2010 Share Posted November 3, 2010 iamtheky, try to move "$Rcolor = random (0x000000 , 0xFFFFFF)" above "_PixelSetColor ($x , $y , $Rcolor)". This does not solve the problem with the shades (I'm thing at it...), but... see for yourself. M.I. Things you should know first...In the beginning there was only ONE! And zero... Progs: Create PDF(TXT2PDF,IMG2PDF) 3D Bar Graph DeskGadget Menu INI Photo Mosaic 3D Text Link to comment Share on other sites More sharing options...
iamtheky Posted November 3, 2010 Author Share Posted November 3, 2010 (edited) I am working now to try and get it to use many shades of a single colorI was hoping maybe someone had a way to specify a range of shades in the same color, in a hex manner.so the first sentence was my issue. That must make the 14 word second sentence the lovely story. /@Taitel -- thats why i added the 3rd For Loop - if there was a way to scrub the screen like that at a faster speed it would be a nice tv noise effect. Edited November 3, 2010 by iamtheky ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
taietel Posted November 4, 2010 Share Posted November 4, 2010 Maybe this gives you some ideas: expandcollapse popupGUICreate("Gradient...", 500, 400) GUISetState(@SW_SHOW) ; Example _Gradient(0xffff00, 0xff0000,480,10,10,10,0) Sleep(200) _Gradient(0x001100, 0xffff00,460,360,20,30,1) While 1 Sleep(10) Switch GUIGetMsg() Case -3 Exit EndSwitch WEnd ; #FUNCTION# ==================================================================================================== ; Name...........: _Gradient ; Description....: Create gradient between two colors ; Syntax.........: _Gradient($lColor1, $lColor2, $iW=100, $iH=20, $iX=0, $iY=0, $iDirection=0) ; Parameters.....: $lColor1 - First color to begin with ; $lColor2 - Second color ; $iW - width of the area, [Optional] ; $iH - height of the area, [Optional] ; $iX - position from left, [Optional] ; $iY - position from top, [Optional] ; $iY - direction to fill the gradient, [Optional] ; 0 - vertical fill ; 1 - horizontal fill ; ; Return values..: none ; ; Author.........: taietel ; Reference.....: http://www.tannerhelland.com/ ; =============================================================================================================== Func _Gradient($lColor1, $lColor2, $iW=100, $iH=20, $iX=0, $iY=0, $iDirection=0) Local $m, $Ri,$Rf,$Rs,$Gi,$Gf,$Gs,$Bi,$Bf,$Bs Switch $iDirection Case 0 $m = $iW Case 1 $m = $iH EndSwitch $Ri = Mod($lColor1,256) $Gi = BitAND($lColor1/256,255) $Bi = BitAND($lColor1/65536,255) $Rf = Mod($lColor2,256) $Gf = BitAND($lColor2/256,255) $Bf = BitAND($lColor2/65536,255) $Rs = Abs($Ri - $Rf)/$m $Gs = Abs($Gi - $Gf)/$m $Bs = Abs($Bi - $Bf)/$m If $Rf < $Ri Then $Rs = -$Rs If $Gf < $Gi Then $Gs = -$Gs If $Bf < $Bi Then $Bs = -$Bs For $i = 0 To $m $Rf = $Ri + $Rs * $i $Gf = $Gi + $Gs * $i $Bf = $Bi + $Bs * $i GUICtrlCreateLabel(" ", $iX+$i-$i*$iDirection, $iY + $i*$iDirection, 2+$iDirection*$iW, 2+(1-$iDirection)*$iH) GUICtrlSetBkColor(-1, "0x"&Hex($Bf,2) & Hex($Gf,2) & Hex($Rf,2)) Next EndFunc Things you should know first...In the beginning there was only ONE! And zero... Progs: Create PDF(TXT2PDF,IMG2PDF) 3D Bar Graph DeskGadget Menu INI Photo Mosaic 3D Text Link to comment Share on other sites More sharing options...
iamtheky Posted November 5, 2010 Author Share Posted November 5, 2010 (edited) That is very nice Taietel. Thanks. Edited November 5, 2010 by iamtheky ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) 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