ludocus Posted May 16, 2008 Posted May 16, 2008 Wtf.. Worst program ever, I don't even like to call it a program. It sucks bro
jaskerry Posted May 19, 2008 Posted May 19, 2008 Ok I took the program yesterday and modified it Yup it's crap !! But now it ROCKS !! 1. Draws smoother 2. More colors 3. Change brush size 4. Floodfill enabled 5. Record/Trace feature added with fast playback 6. InkWell feature added, for diminishing brush strokes 7. Color Picker replaced Spacebar Picker P.S. The Record/Trace feature is really fun when tracing web pages, and images P.S. Please give feedback if you like and I will add the ability to save recorded brush strokes and assign them to buttons or hotkeys P.S. Also any ideas welcome CODE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; #include <Misc.au3> #include <Array.au3> Opt("ColorMode",1) AutoItSetOption ( "sendcapslockmode",0 ) AutoItSetOption ("GUIOnEventMode",1) ;;;;; DRAWING FUNCTIONS and FILL FUNCTIONS Func draw_dot() Global $pen, $penflag $ox = $x $oy = $y $pos= MouseGetPos() $x= $pos[0] $y = $pos[1] mouseup("Left") $dc= DllCall ("user32.dll", "int", "GetDC", "hwnd", "") DllCall("gdi32.dll", "int", "SelectObject", "int", $dc[0], "int", $pen[0]) DllCall("GDI32.dll", "int", "MoveToEx", "hwnd", $dc[0], "int", $ox, "int", $oy, "int", 0) DllCall("GDI32.dll", "int", "LineTo", "hwnd", $dc[0], "int", $x, "int", $y) DllCall ("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $dc[0]) EndFunc Func fill() Global $color, $pen, $bgcolor get_bgcolor() $pos= MouseGetPos() $x= $pos[0] $y = $pos[1] $dc= DllCall ("user32.dll", "int", "GetDC", "hwnd", "") $brush=DllCall("GDI32.dll", "int", "CreateSolidBrush", "int", $color) DllCall("gdi32.dll", "int", "SelectObject", "int", $dc[0], "int", $brush[0]) DllCall("GDI32.dll", "int", "ExtFloodFill", "int", $dc[0], "int", $x, "int", $y,"int",$bgcolor,"int",1) DllCall ("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $dc[0]) EndFunc ;;;;;;;;; PENUP and PENDOWN is a TOGGLE Func pentoggle() Global $penflag, $x , $y, $playflag, $brushflag, $radius, $brushrad mouseup("Left") If $penflag = 1 Then $penflag = 0 if $radius=1 and $brushflag =1 Then $radius = $brushrad $pen = DllCall("gdi32.dll", "int", "CreatePen", "int", 0, "int", $radius, "int", $color) make_Brush() endif make_Brush() Return Else $penflag = 1 $pos= MouseGetPos() $x= $pos[0] $y = $pos[1] make_Brush() return Endif Endfunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func incSpeed() Global $speed $speed = $speed + .02 if $speed > 1 Then $speed = 1 $sx = 1 - $speed $dc= DllCall ("user32.dll", "int", "GetDC", "hwnd", "") $brush=DllCall("GDI32.dll", "int", "CreateSolidBrush","int", "0x000000") DllCall("gdi32.dll", "int", "SelectObject", "int", $dc[0], "int", $brush[0]) $rect = DllCall("GDI32.dll", "int", "Rectangle", "int", $dc[0], "int",@DesktopWidth/2-$sx*150-15,"int",0,"int",@DesktopWidth/2+$sx*150+15,"int",15) DllCall("gdi32.dll", "int", "DeleteObject", "int", $rect[0]) DllCall("gdi32.dll", "int", "DeleteObject", "int", $brush[0]) $brush=DllCall("GDI32.dll", "int", "CreateSolidBrush","int", "0xaa0000") DllCall("gdi32.dll", "int", "SelectObject", "int", $dc[0], "int", $brush[0]) $rect = DllCall("GDI32.dll", "int", "Rectangle", "int", $dc[0], "int",@DesktopWidth/2-$sx*150-5,"int",0,"int",@DesktopWidth/2+$sx*150+5,"int",15) DllCall("gdi32.dll", "int", "DeleteObject", "int", $rect[0]) DllCall("gdi32.dll", "int", "DeleteObject", "int", $brush[0]) DllCall ("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $dc[0]) Endfunc Func decSpeed() Global $speed $speed = $speed -.02 if $speed < .1 then $speed = .1 $sx = 1 - $speed $dc= DllCall ("user32.dll", "int", "GetDC", "hwnd", "") $brush=DllCall("GDI32.dll", "int", "CreateSolidBrush","int", "0xaa0000") DllCall("gdi32.dll", "int", "SelectObject", "int", $dc[0], "int", $brush[0]) $rect = DllCall("GDI32.dll", "int", "Rectangle", "int", $dc[0], "int",@DesktopWidth/2-$sx*150-5,"int",0,"int",@DesktopWidth/2+$sx*150+5,"int",15) DllCall("gdi32.dll", "int", "DeleteObject", "int", $rect[0]) DllCall("gdi32.dll", "int", "DeleteObject", "int", $brush[0]) DllCall ("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $dc[0]) Endfunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func changebrush() Global $brushflag, $radius, $brushrad, $color $radius = $radius - $speed if $radius < 1 Then $radius = 1 pentoggle() ; blockinput(0) endif $pen = DllCall("gdi32.dll", "int", "CreatePen", "int", 0, "int", $radius, "int", $color) if $radius <> 1 then make_Brush() Endfunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func animBrush() Global $brushflag, $radius, $brushrad, $desktop, $speed $sx = 1 - $speed if $brushflag = 0 then $brushflag = 1 $brushrad = $radius $dc= DllCall ("user32.dll", "int", "GetDC", "hwnd", "") $brush=DllCall("GDI32.dll", "int", "CreateSolidBrush","int", "0xaa0000") DllCall("gdi32.dll", "int", "SelectObject", "int", $dc[0], "int", $brush[0]) $rect = DllCall("GDI32.dll", "int", "Rectangle", "int", $dc[0], "int",@DesktopWidth/2-$sx*150,"int",0,"int",@DesktopWidth/2+$sx*150,"int",15) DllCall("gdi32.dll", "int", "DeleteObject", "int", $rect[0]) DllCall("gdi32.dll", "int", "DeleteObject", "int", $brush[0]) DllCall ("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $dc[0]) Else $brushflag = 0 $dc= DllCall ("user32.dll", "int", "GetDC", "hwnd", "") $brush=DllCall("GDI32.dll", "int", "CreateSolidBrush", "int", "0x000000") DllCall("gdi32.dll", "int", "SelectObject", "int", $dc[0], "int", $brush[0]) $rect = DllCall("GDI32.dll", "int", "Rectangle", "int", $dc[0], "int",@DesktopWidth/2-$sx*500,"int",0,"int",@DesktopWidth/2+$sx*500,"int",15) DllCall("gdi32.dll", "int", "DeleteObject", "int", $rect[0]) DllCall("gdi32.dll", "int", "DeleteObject", "int", $brush[0]) DllCall ("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $dc[0]) endif EndFunc ;;;;;;;;; PEN STROKE SIZE or WIDTH Func incRadius() Global $radius, $color, $pen, $brushflag, $brushrad $radius = $radius + 1 $pen = DllCall("gdi32.dll", "int", "CreatePen", "int", 2, "int", $radius, "int", $color) if $brushflag = 1 then $brushrad = $radius make_Brush() Endfunc Func decRadius() Global $radius, $color, $pen, $brushflag, $brushrad $radius = $radius - 1 if $radius < 1 then $radius = 1 $pen = DllCall("gdi32.dll", "int", "CreatePen", "int", 0, "int", $radius, "int", $color) if $brushflag = 1 then $brushrad = $radius make_Brush() Endfunc Func incColor() Global $radius, $color, $pen, $colorArray, $colori $colori = $colori + 1 if $colori > ubound($colorArray)-1 then $colori = 0 $color = $colorArray[$colori] $pen = DllCall("gdi32.dll", "int", "CreatePen", "int", 2, "int", $radius, "int", $color) make_Brush() Endfunc Func decColor() Global $radius, $color, $pen, $colorArray, $colori $colori = $colori - 1 if $colori < 0 Then $colori = ubound($colorArray)-1 $color = $colorArray[$colori] $pen = DllCall("gdi32.dll", "int", "CreatePen", "int", 2, "int", $radius, "int", $color) make_Brush() Endfunc ;;;;;;;;;;; RECORD MOUSE MOVEMENTS + TRIGGERS the FLAGS from KEYBOARD INPUT + SETUPS VARS Func start_record() Global $recordflag, $rx, $ry, $old_rx, $old_ry, $movX, $movY, $border, $penArray if $recordflag = 0 Then $pos= MouseGetPos() $rx= $pos[0] $ry = $pos[1] $old_rx = $rx $old_ry = $ry $recordflag = 1 $border = "0xff2222" Global $movX[1] Global $movY[1] Global $penArray[1] EndIf EndFunc Func stop_record() Global $recordflag, $border $recordflag = 0 $dc= DllCall ("user32.dll", "int", "GetDC", "hwnd", "") $brush=DllCall("GDI32.dll", "int", "CreateSolidBrush", "int", "0x000000") DllCall("gdi32.dll", "int", "SelectObject", "int", $dc[0], "int", $brush[0]) $rect = DllCall("GDI32.dll", "int", "RoundRect", "int", $dc[0], "int",@DesktopWidth/2-$radius-30,"int",45,"int",@DesktopWidth/2-$radius+10-30,"int",55,"int",6,"int",6) DllCall("gdi32.dll", "int", "DeleteObject", "int", $rect[0]) DllCall("gdi32.dll", "int", "DeleteObject", "int", $brush[0]) DllCall ("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $dc[0]) Endfunc Func record() Global $recordflag, $rx, $ry, $old_rx, $old_ry, $movX, $movY, $border, $radius, $penArray, $penflag $pos= MouseGetPos() $rx= $pos[0] $ry = $pos[1] $dx = $rx - $old_rx $dy = $ry - $old_ry If $border = "0x000000" Then $border = "0x2222ff" Else $border = "0x000000" Endif $dc= DllCall ("user32.dll", "int", "GetDC", "hwnd", "") $brush=DllCall("GDI32.dll", "int", "CreateSolidBrush", "int", $border) DllCall("gdi32.dll", "int", "SelectObject", "int", $dc[0], "int", $brush[0]) $rect = DllCall("GDI32.dll", "int", "RoundRect", "int", $dc[0], "int",@DesktopWidth/2-$radius-30,"int",45,"int",@DesktopWidth/2-$radius-20,"int",55,"int",6,"int",6) DllCall("gdi32.dll", "int", "DeleteObject", "int", $rect[0]) DllCall("gdi32.dll", "int", "DeleteObject", "int", $brush[0]) DllCall ("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $dc[0]) if $dx = 0 Then return _arrayadd($movX,$dx) _arrayadd($movY,$dy) _arrayadd($penArray,$penflag) Endfunc ;;;;;;;;;;;; PLAYBACK MOUSE MOVEMENTS Func start_play() Global $playflag, $playx, $playy, $playi, $recordflag, $playdone if $playflag = 0 then $playflag = 1 $pos= MouseGetPos() $playx = $pos[0] $playy = $pos[1] $playi = 0 $playdone = ubound($movY) stop_record() Endif EndFunc Func play() Global $playflag, $playx, $playy, $playi, $playflag, $playdone Global $penflag, $penArray, $capslock For $ii = $playi to $playdone-1 step 1 $penflag = 1 - $penArray[$ii] if $capslock = 1 then $penflag = 0 pentoggle() mousemove($movX[$ii]+$playx,$movY[$ii]+$playy,0) if $penflag=1 then draw_dot() if ($brushflag = 1 and $penflag = 1) Then changebrush() Next $playflag =0 $penflag = 1 pentoggle() Endfunc Func set_capslock() Global $capslock if $capslock = 0 Then $capslock = 1 Else $capslock = 0 Endif Endfunc ;;;;;;;;;;;;;;;;; GRAB PIXEL COLOR FROM MOUSE POSITION Func get_fgcolor() Global $color,$radius,$pen $pos = mousegetpos() $color = pixelgetcolor($pos[0],$pos[1]) $color = "0x"&hex($color,6) make_Brush() $pen = DllCall("gdi32.dll", "int", "CreatePen", "int", 0, "int", $radius, "int", $color) Endfunc Func get_bgcolor() Global $bgcolor,$radius,$pen $pos = mousegetpos() $bgcolor = pixelgetcolor($pos[0],$pos[1]) $bgcolor = "0x"&hex($bgcolor,6) Endfunc ;;;;;;;;;;;;;;;; TOP OF SCREEN TOOLS called BRUSH function Func make_Brush() Global $color, $radius, $brush1, $brush, $penflag, $bgcolor, $desktop local $posx =@DesktopWidth/2 - $radius/2, $posy = $radius/2 + 8 $dc= DllCall ("user32.dll", "int", "GetDC", "hwnd", "") $brush=DllCall("GDI32.dll", "int", "CreateSolidBrush", "int", "0x000000") DllCall("gdi32.dll", "int", "SelectObject", "int", $dc[0], "int", $brush[0]) $rect = DllCall("GDI32.dll", "int", "RoundRect", "int", $dc[0], "int",$posx-12,"int",50-$posy-8,"int",$posx+$radius+12,"int",50+$posy+8,"int",$radius,"int",$radius) DllCall("gdi32.dll", "int", "DeleteObject", "int", $rect[0]) DllCall("gdi32.dll", "int", "DeleteObject", "int", $brush[0]) If $penflag = 1 Then $brush=DllCall("GDI32.dll", "int", "CreateSolidBrush", "int", "0xffffff") DllCall("gdi32.dll", "int", "SelectObject", "int", $dc[0], "int", $brush[0]) $rect = DllCall("GDI32.dll", "int", "RoundRect", "int", $dc[0], "int",$posx-8,"int",50-$posy,"int",$posx+$radius+8,"int",50+$posy,"int",$radius,"int",$radius) DllCall("gdi32.dll", "int", "DeleteObject", "int", $rect[0]) DllCall("gdi32.dll", "int", "DeleteObject", "int", $brush[0]) Endif $brush=DllCall("GDI32.dll", "int", "CreateSolidBrush", "int", $color) DllCall("gdi32.dll", "int", "SelectObject", "int", $dc[0], "int", $brush[0]) $rect = DllCall("GDI32.dll", "int", "RoundRect", "int", $dc[0], "int",$posx-4,"int",50-$posy+4,"int",$posx+$radius+4,"int",50+$posy-4,"int",$radius,"int",$radius) DllCall("gdi32.dll", "int", "DeleteObject", "int", $rect[0]) DllCall("gdi32.dll", "int", "DeleteObject", "int", $brush[0]) DllCall ("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $dc[0]) Endfunc Func captureEsc() exit EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func help() $mess = " "&@crlf $mess = $mess & " Press *LeftClick* to lower/raise pen" & @CRLF $mess = $mess & " Press *A* and *S* to change colors" & @CRLF $mess = $mess & " Press *Z* and *X* to change pen size" & @CRLF $mess = $mess & @CRLF $mess = $mess & " Press *V* to turn on/off Ink Well " & @CRLF $mess = $mess & " Press *N* to decrease ink capacity" & @CRLF $mess = $mess & " Press *M* to increase ink capacity" & @CRLF $mess = $mess & " Press *D* to floodfill area with Ink" & @CRLF $mess = $mess & @CRLF $mess = $mess & " Press *Q* to Record paint strokes" & @CRLF $mess = $mess & " Press *W* to Stop Recording strokes" & @CRLF $mess = $mess & " Press *E* to Playback paint strokes" & @CRLF $mess = $mess & " try with capslock on,keeps pen down" & @CRLF $mess = $mess & @CRLF $mess = $mess & " **Space will colorpick from desktop" & @CRLF $mess = $mess & " **ESC will exit program" & @CRLF MsgBox(0, "KEYBOARD",$mess) Endfunc Global $colorArray = StringSplit("0xffffff,0x0000ff,0x000099,0x0066ff,0x0099cc,0x00ffff,0x00ff66,0x009900,0x006600,0x003300,0x990 066,0xcc3366,0x990033,0xcc6633,0xffcc99", ",") $colorArray[0] = "0x000000" Global $colori = 0 Global $movX[1] Global $movY[1] Global $penArray[1] $desktop = pixelgetcolor(@desktopwidth/2,30) $desktop = "0x"&hex($desktop,6) $speed = .2 $dll = DllOpen("user32.dll") $x= 0 $y = 0 $radius = 5 $penflag = 0 $brushflag = 0 $recordflag = 0 $playflag = 0 $count = 100 $capslock = 0 $color = "0xff4455" $pen = DllCall("gdi32.dll", "int", "CreatePen", "int", 2, "int", $radius, "int", $color) make_Brush() send("{CAPSLOCK off}") ;;;;;; ASSIGN ALL THE KEYBOARD KEYS to FUNCTIONS HotKeySet("{Esc}","captureEsc") HotKeySet("{space}" ,"get_fgcolor") HotKeySet("x" , "incRadius") HotKeySet("z" , "decRadius") HotKeySet("a" , "incColor") HotKeySet("s" , "decColor") HotKeySet("d" ,"fill") HotKeySet("g", "get_fgcolor") HotKeySet("v", "animBrush") HotKeySet("m", "decSpeed") HotKeySet("n", "incSpeed") HotKeySet("q" , "start_record") HotKeySet("w" , "stop_record") HotKeySet("e" , "start_play") HotKeySet("h" , "help") HotKeySet("{CAPSLOCK}", "set_capslock") ;;;;;;; INFINITE LOOP FOR PROGRAM TO RUN Do if _ispressed("01",$dll) Then ; $penflag = 0 pentoggle() endif if ($brushflag = 1 and $penflag = 1) Then changebrush() if ($penflag=1 and $playflag=0) Then draw_dot() if $recordflag = 1 Then record() if $playflag = 1 Then play() ;;;; A LITTLE BIT OF SLEEP saves the PROCESSOR !!! sleep(1) Until $count < 15 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
jaskerry Posted May 19, 2008 Posted May 19, 2008 A variable got hacked near the bottom....it Looks like this... Global $colorArray = StringSplit("0xffffff,0x0000ff,0x000099,0x0066ff,0x0099cc,0x00ffff,0x00ff66,0x009900,0x006600,0x003300,0x990 066,0xcc3366,0x990033,0xcc6633,0xffcc99", ",") It should be ONE line...!! But the window broke it into two....make sure you re-connect the pieces... it won't fit in this window as one line of code....
zackrspv Posted May 19, 2008 Posted May 19, 2008 (edited) Deleted post content, and added user: jaskerry to my ignore list. I do not take kindly to people telling me to run their script in PM Just because i'm looking at it in the post doesn't mean i'm going to run it; nor does it mean I want to hear about it in PM. And secondly: you're too sensitive, and anti-social...anyway i can basically do whatever I want...you can't stop me......and i don't need too shout it. Yeah, i somehow don't think so But, for those actually care; change the top part of his script too: #include<Array.au3> #include<Misc.au3> Local $x, $y, $color, $speed, $radius, $movY, $movx, $brushflag And you can avoid all the nasty warnings you get. Secondly, I removed [Opt("ColorMode",1)], as it errored out on me But yes, it's much nicer than the OP's code, i'll give him credit for that. But, personally, I'd rather see a GUI w/ all of the available options, or at least a gui that can pop up from the side/bottom/top of the screen with options for size, color, pen width, etc, instead of that large blob at the top center of the screen Edited May 19, 2008 by zackrspv -_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ†ƒë@®, wï†høµ††ïmë, @ñd wï†høµ†@ †ïmïdï†ÿ ƒø® !ïƒë. €×阮ñø†, bµ†ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ††hë ë§§ëñ§ë øƒ !ïƒë.
jaskerry Posted May 20, 2008 Posted May 20, 2008 Working on a toolbar, interface is difficult to use.....one use that may not be apparent is you can trace images on the internet then minimize iexplorer and redraw the image on your desktop with any color, brush size etc.... I thought the original code was for that purpose but when I discovered it was not, I re-wrote this piece so that it was simply smoother. I guess I can add an easy toolbar that shows/hides with an F1 key or something. I didn't add zackrspv to my ignore list. I like to hear his rants....
TnTProductions Posted May 20, 2008 Posted May 20, 2008 Fun script to play around with "FREEDOM is not FREE""Its a good thing war is so terrible, or we grow too fond of it" -Robert E. Lee[quote]Firestrom: global $warming = False[/quote]My scripts:Desktop Cleaner---->Total Downloads:167;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;111111;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;;;;;;;;;;;1;;;;;;1;;;;;;;;;;;;;;11;;;;;;"a wise man once said why use your skills when we have technology"
DexterMorgan Posted May 20, 2008 Posted May 20, 2008 Fun script to play around with Cool, had a lot of fun!! code
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