techPowerUp! Forums

Go Back   techPowerUp! Forums > Software > General Software

Reply
 
Thread Tools
Old Oct 23, 2011, 04:46 AM   #1
a111087
2000 Posts
 
a111087's Avatar
 
Join Date: Apr 2007
Location: US
Posts: 2,521 (1.11/day)
Thanks: 240
Thanked 190 Times in 157 Posts

System Specs

My CopyMe program for Facebook Graffiti app

Hey,
If you are not familiar with Graffiti app on Facebook - it is a small app that allows you to draw pictures for your friends on Facebook. Pictures are posted to their wall and they can then view how you drew them, step by step.

I know it might sound silly, but I liked it. Me and one of my friends liked using it to draw all kinds of things, whenever one of us had birthday, or any other occasion. It sure was fun using it. It felt like it was better than a present you buy at the store because you put your time into it and you just know that the other person will appreciate it. (I know it silly, but keep reading. )

So, I did a lot of drawings and each one was taking more time than before. They were also more complicated and more beautiful, but I was spending up to 4 hours on one drawing. I though, I would try something new and write a program that would draw pictures for me.

Here is how it works:
  1. You find a picture on the web
  2. Convert it to only black and white pixels (current limitation of the program)
  3. Tell the program to start drawing. (Program will look at the image and draw it in the app pixel by pixel. It might take 2-3 hours to finish. You will not be able to use your computer during that time because mouse pointer will be used to draw and click in the app.)
  4. When draft is ready, it is up to you to add colors or some other interesting things.

So, what do you think?
PM me if you want to receive a copy of the program and try it out.



Code:
Gui, Add, GroupBox, x12 y10 w170 h50 , Current Mouse Pos
Gui, Add, Text, x22 y30 w50 h20 , vMouseX
Gui, Add, Text, x72 y30 w50 h20 , vMouseY
Gui, Add, Text, x122 y30 w50 h20 , vMouseColor

Gui, Add, GroupBox, x12 y70 w170 h70 , Input Mouse Coord
Gui, Add, GroupBox, x12 y170 w180 h90 , Load Mouse Pos
Gui, Add, Text, x22 y90 w50 h20 , From
Gui, Add, Text, x22 y110 w50 h20 , To
Gui, Add, Edit, x72 y90 w60 h20 , vInputBegX
Gui, Add, Edit, x132 y90 w50 h20 , vInputBegY
Gui, Add, Edit, x72 y110 w60 h20 , vInputEndX
Gui, Add, Edit, x132 y110 w50 h20 , vInputEndY
Gui, Add, Text, x22 y190 w50 h20 , From
Gui, Add, Text, x22 y210 w50 h20 , To
Gui, Add, Edit, x72 y190 w60 h20 , vInputBegX
Gui, Add, Edit, x132 y190 w50 h20 , vInputBegY
Gui, Add, Edit, x72 y210 w60 h20 , vInputEndX
Gui, Add, Edit, x132 y210 w50 h20 , vInputEndY
Gui, Add, Button, x22 y140 w50 h20 , Start
Gui, Add, Button, x82 y140 w50 h20 , Copy


Gui, Show, x524 y513 h267 w206, CopyMe
Return


StartScan:
CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
MouseGetPos, xpos, ypos 
GuiControl,, Static1, %xpos%
GuiControl,, Static2, %ypos%
PixelGetColor, color, xpos-1 , ypos-1
GuiControl,, Static3, %color%
;Gui, Color, %color%
return

ButtonStart:
SetTimer, StartScan, 550
return

#z::
GuiControl,, Edit1, %xpos%
GuiControl,, Edit2, %ypos%
return

#x::
GuiControl,, Edit3, %xpos%
GuiControl,, Edit4, %ypos%
return

#c::
GuiControl,, Edit5, %xpos%
GuiControl,, Edit6, %ypos%
return

#v::
GuiControl,, Edit7, %xpos%
GuiControl,, Edit8, %ypos%
return


ButtonCopy:
SetTimer, StartScan, Off
ControlGetText, inpx, Edit1
ControlGetText, inpy, Edit2
ControlGetText, inpxx, Edit3
ControlGetText, inpyy, Edit4

ControlGetText, loadx, Edit5
ControlGetText, loady, Edit6
ControlGetText, loadxx, Edit7
ControlGetText, loadyy, Edit8

count1 := inpxx-inpx
count2 := inpyy-inpy

y = 1

Loop, %count2%
{
x = 1 
 Loop, %count1%
  {
	CoordMode, Mouse, Screen
	CoordMode, Pixel, Screen

    PixelGetColor, color, inpx + x , inpy + y
	GuiControl,, Static3, %color%    
	if (color = color2)
	    {
		MouseClick, left, loadx + x, loady + y,,0
	    }
    x:= x+1
  }
y:= y+1
}
return

#f::
CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
PixelGetColor, color2, xpos-1 , ypos-1
return

GuiClose:
ExitApp
Quote:
Instructions:
Ok, it's not very user friendly so far, so I will have to explain a bit.
1. When you find an image that you want to draw, covert it to only pure black and white pixels (can be done in photoshop)
2. Run program and arrange 3 windows on your display: one for facebook, one that displays edited image, and one with a program.
3. In the program click "Start". It will start tracking mouse pointer and will tell you the color of the pixel next to the mouse.
4. If you want a program to draw black pixels, then set up Graffiti app appropriately (smallest size brush, color black, opacity to max)
5. find pure black pixels in your picture or anywhere on the screen with your mouse (remember, program tells you the code for the color next to the mouse pointer) and press Windows + F (this will set a color for which program will look in the picture)
6. It is time to let program know location of the picture and graffiti app on the screen.
Locate, with your mouse pointer top left corner of the image you are going to copy and press Windows + Z
7. Locate, with your mouse pointer lower right corner of the image you are going to copy and press Windows + X
8. Locate, with your mouse pointer top left corner of the Graffiti drawing surface and press Windows + C
(there is also Windows + V to select lower right corner of graffiti app, but it is useless so far...)
9. Click copy and enjoy
__________________

Last edited by a111087; Oct 23, 2011 at 05:15 PM.
a111087 is offline  
Reply With Quote
Old Oct 23, 2011, 05:34 AM   #2
micropage7
3500 Posts
 
micropage7's Avatar
 
Join Date: Mar 2010
Location: Jakarta, Indonesia
Posts: 3,717 (3.15/day)
Thanks: 193
Thanked 853 Times in 559 Posts

System Specs

looks nice
__________________
:: New Cases, Tips And All About Your Cases Visit CaseGear ::

Don't Ever Ask About Love And Honesty That You Don't Ever Have
micropage7 is offline  
Reply With Quote
The Following User Says Thank You to micropage7 For This Useful Post:
Old Oct 23, 2011, 05:36 AM   #3
mlee49
Eligible for custom title
 
mlee49's Avatar
 
Join Date: Dec 2007
Location: KU
Posts: 6,935 (3.47/day)
Thanks: 1,603
Thanked 2,064 Times in 1,610 Posts
Send a message via Skype™ to mlee49

System Specs

Your computer might take 2-3 hours to finish, and you might not be able to use it during that time.

Try me... This could be a new benchmark
__________________
mlee49 is online now  
Reply With Quote
Old Oct 23, 2011, 05:37 AM   #4
FordGT90Concept
"I go fast!1!11!1!"
 
FordGT90Concept's Avatar
 
Join Date: Oct 2008
Location: IA, USA
Posts: 10,654 (6.23/day)
Thanks: 1,788
Thanked 2,633 Times in 1,987 Posts

System Specs

I think you should not use the mouse and you could really cut down on the time if it were multithreaded. XD

What language is it coded in? If you're using .NET, create a Bitmap and use the various tools to "paint" on it. You can easily target a single cell in the image and change the color.

Except for the "add color" part, I don't see what your program does. It looks like it changed black to gray.
__________________
Golden Rule of Programming: Never assume.

try { SteamDownload(); }
catch (Steamception ex) { RageQuit(); }
FordGT90Concept is offline  
Crunching for Team TPU
Reply With Quote
Old Oct 23, 2011, 06:27 AM   #5
a111087
2000 Posts
 
a111087's Avatar
 
Join Date: Apr 2007
Location: US
Posts: 2,521 (1.11/day)
Thanks: 240
Thanked 190 Times in 157 Posts

System Specs

Quote:
Originally Posted by mlee49 View Post
Your computer might take 2-3 hours to finish, and you might not be able to use it during that time.

Try me... This could be a new benchmark
lol, i wish it was doing this faster, but it really doesn't depend on processor speed. it is just a limitation of the script language i used.

Quote:
Originally Posted by FordGT90Concept View Post
I think you should not use the mouse and you could really cut down on the time if it were multithreaded. XD

What language is it coded in? If you're using .NET, create a Bitmap and use the various tools to "paint" on it. You can easily target a single cell in the image and change the color.

Except for the "add color" part, I don't see what your program does. It looks like it changed black to gray.
I wrote this in autohotkey script language (it is very easy and can compile programs into EXE's). It is something I never even heard about until I started doing this whole thing. I first tried C++, but since I'm not an expert at it and googling for info didn't yield too much, I decided to try autohotkey and see how it works.

Heart of the program is a really small nested loop and while there are no explicit delays written into the code, autohotkey decides that you could use some delay in your program.

The reason why draft looks grey, instead of pure black is because Graffiti app can't draw single pure black pixel from just one click of a mouse (which is what my program does, it reads placement of black or white pixels, then clicks in an app to draw that image, pixel by pixel)
__________________
a111087 is offline  
Reply With Quote
The Following 2 Users Say Thank You to a111087 For This Useful Post:
Old Oct 23, 2011, 07:24 AM   #6
de.das.dude
3500 Posts
 
de.das.dude's Avatar
 
Join Date: Jun 2010
Location: Wild Wild East
Posts: 4,859 (4.41/day)
Thanks: 2,447
Thanked 1,421 Times in 978 Posts
Send a message via Skype™ to de.das.dude

System Specs

can i haz it?
__________________
de.das.dude is offline  
Reply With Quote
Old Oct 23, 2011, 07:45 AM   #7
FordGT90Concept
"I go fast!1!11!1!"
 
FordGT90Concept's Avatar
 
Join Date: Oct 2008
Location: IA, USA
Posts: 10,654 (6.23/day)
Thanks: 1,788
Thanked 2,633 Times in 1,987 Posts

System Specs

Quote:
Originally Posted by a111087 View Post
I wrote this in autohotkey script language (it is very easy and can compile programs into EXE's).


Quote:
Originally Posted by a111087 View Post
Heart of the program is a really small nested loop and while there are no explicit delays written into the code, autohotkey decides that you could use some delay in your program.
That's so it doesn't overflow the user32 stack. You know how you hold down three keys on, for example, the keypad of a keyboard, it beeps at you? That's effectively the same thing it is trying to avoid. By creating a virtual image in the RAM and painting on it, you avoid that bottleneck.


Quote:
Originally Posted by a111087 View Post
The reason why draft looks grey, instead of pure black is because Graffiti app can't draw single pure black pixel from just one click of a mouse (which is what my program does, it reads placement of black or white pixels, then clicks in an app to draw that image, pixel by pixel)
So all this autohotkey script is doing is copying from an image into a program (browser)? There's no way to upload an image?
__________________
Golden Rule of Programming: Never assume.

try { SteamDownload(); }
catch (Steamception ex) { RageQuit(); }
FordGT90Concept is offline  
Crunching for Team TPU
Reply With Quote
Old Oct 23, 2011, 07:58 AM   #8
a111087
2000 Posts
 
a111087's Avatar
 
Join Date: Apr 2007
Location: US
Posts: 2,521 (1.11/day)
Thanks: 240
Thanked 190 Times in 157 Posts

System Specs

Quote:
Originally Posted by FordGT90Concept View Post
So all this autohotkey script is doing is copying from an image into a program (browser)? There's no way to upload an image?
Yes, to put it simply, it just copies/steal an image to your browser. That's why I called it CopyMe.

There is of course a way to upload an image straight to a wall, but not to a graffiti app.
__________________
a111087 is offline  
Reply With Quote
The Following User Says Thank You to a111087 For This Useful Post:
Old Oct 23, 2011, 08:03 AM   #9
a111087
2000 Posts
 
a111087's Avatar
 
Join Date: Apr 2007
Location: US
Posts: 2,521 (1.11/day)
Thanks: 240
Thanked 190 Times in 157 Posts

System Specs

just added full code to the first post
and here is a link for download (click free at the bottom):
http://www.megashare.com/3666639
__________________
a111087 is offline  
Reply With Quote
Old Oct 23, 2011, 08:06 AM   #10
a111087
2000 Posts
 
a111087's Avatar
 
Join Date: Apr 2007
Location: US
Posts: 2,521 (1.11/day)
Thanks: 240
Thanked 190 Times in 157 Posts

System Specs

Quote:
Originally Posted by FordGT90Concept View Post
That's so it doesn't overflow the user32 stack. You know how you hold down three keys on, for example, the keypad of a keyboard, it beeps at you? That's effectively the same thing it is trying to avoid. By creating a virtual image in the RAM and painting on it, you avoid that bottleneck.
But how do you put that virtual image into graffiti app or anywhere else?
__________________
a111087 is offline  
Reply With Quote
Old Oct 23, 2011, 08:24 AM   #11
FordGT90Concept
"I go fast!1!11!1!"
 
FordGT90Concept's Avatar
 
Join Date: Oct 2008
Location: IA, USA
Posts: 10,654 (6.23/day)
Thanks: 1,788
Thanked 2,633 Times in 1,987 Posts

System Specs

Good question and I think the answer would be very complex (memory hacking). Is it not the point of a Graffitti app to paint, not copy?

Bypassing autohotkey would provide a rather large performance boost though because you could adjust the delay yourself (if it is even necessary).
__________________
Golden Rule of Programming: Never assume.

try { SteamDownload(); }
catch (Steamception ex) { RageQuit(); }
FordGT90Concept is offline  
Crunching for Team TPU
Reply With Quote
Old Oct 23, 2011, 08:29 AM   #12
a111087
2000 Posts
 
a111087's Avatar
 
Join Date: Apr 2007
Location: US
Posts: 2,521 (1.11/day)
Thanks: 240
Thanked 190 Times in 157 Posts

System Specs

Quote:
Originally Posted by FordGT90Concept View Post
Is it not the point of a Graffitti app to paint, not copy?
Haha, it sure is the point, but CopyMe doesn't do everything for you. It simply helps you get started on the image, then you add color and whatever else you have in mind. Just like in the picture that I posted.
So, it is cheating, but just a little bit.
__________________
a111087 is offline  
Reply With Quote
Old Oct 23, 2011, 05:16 PM   #13
a111087
2000 Posts
 
a111087's Avatar
 
Join Date: Apr 2007
Location: US
Posts: 2,521 (1.11/day)
Thanks: 240
Thanked 190 Times in 157 Posts

System Specs

lol, I just corrected a mistake in the instructions.
You need to use Windows key, not Control key.
__________________
a111087 is offline  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Facebook App Developer any one? smartali89 Programming & Webmastering 0 May 23, 2011 08:36 AM
Graffiti Style Wallpaper - illustrating various hardware logos 20mmrain General Hardware 153 Oct 23, 2010 02:35 PM
Looking for an Multi Core LCD app for my G15?? Live OR Die General Software 5 Jul 5, 2010 09:18 PM
looking for a program to turn volume levels up and down per program acousticlemur General Software 0 Oct 3, 2008 06:50 PM
Facebook Founder Sued For Concept Theft HellasVagabond News 2 Jul 24, 2007 02:58 AM


All times are GMT. The time now is 11:55 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
no new posts