1. Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

My CopyMe program for Facebook Graffiti app

Discussion in 'General Software' started by a111087, Oct 23, 2011.

  1. a111087

    a111087

    Joined:
    Apr 2, 2007
    Messages:
    2,743 (1.01/day)
    Thanks Received:
    194
    Location:
    US
    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. :laugh:)

    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.

    [​IMG]

    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
    Last edited: Oct 23, 2011
  2. micropage7

    micropage7

    Joined:
    Mar 26, 2010
    Messages:
    5,732 (3.54/day)
    Thanks Received:
    1,316
    Location:
    Jakarta, Indonesia
    looks nice
    a111087 says thanks.
  3. mlee49

    mlee49

    Joined:
    Dec 27, 2007
    Messages:
    8,477 (3.47/day)
    Thanks Received:
    2,103
    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
  4. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Joined:
    Oct 13, 2008
    Messages:
    13,464 (6.26/day)
    Thanks Received:
    3,423
    Location:
    IA, USA
    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. :confused:
    Crunching for Team TPU
  5. a111087

    a111087

    Joined:
    Apr 2, 2007
    Messages:
    2,743 (1.01/day)
    Thanks Received:
    194
    Location:
    US
    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.

    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. :laugh:

    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)
  6. de.das.dude

    de.das.dude Pro Indian Modder

    Joined:
    Jun 13, 2010
    Messages:
    7,587 (4.92/day)
    Thanks Received:
    1,982
    can i haz it?
  7. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Joined:
    Oct 13, 2008
    Messages:
    13,464 (6.26/day)
    Thanks Received:
    3,423
    Location:
    IA, USA
    :eek:

    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. ;)


    So all this autohotkey script is doing is copying from an image into a program (browser)? There's no way to upload an image?
    Crunching for Team TPU
  8. a111087

    a111087

    Joined:
    Apr 2, 2007
    Messages:
    2,743 (1.01/day)
    Thanks Received:
    194
    Location:
    US
    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.
    FordGT90Concept says thanks.
  9. a111087

    a111087

    Joined:
    Apr 2, 2007
    Messages:
    2,743 (1.01/day)
    Thanks Received:
    194
    Location:
    US
  10. a111087

    a111087

    Joined:
    Apr 2, 2007
    Messages:
    2,743 (1.01/day)
    Thanks Received:
    194
    Location:
    US
    But how do you put that virtual image into graffiti app or anywhere else?
  11. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Joined:
    Oct 13, 2008
    Messages:
    13,464 (6.26/day)
    Thanks Received:
    3,423
    Location:
    IA, USA
    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).
    Crunching for Team TPU
  12. a111087

    a111087

    Joined:
    Apr 2, 2007
    Messages:
    2,743 (1.01/day)
    Thanks Received:
    194
    Location:
    US
    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. :laugh:
  13. a111087

    a111087

    Joined:
    Apr 2, 2007
    Messages:
    2,743 (1.01/day)
    Thanks Received:
    194
    Location:
    US
    lol, I just corrected a mistake in the instructions.
    You need to use Windows key, not Control key.

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

Share This Page