Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Trying to work on previews with a paint program.
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Reality Check




PostPosted: Sun Jun 11, 2006 9:53 am   Post subject: Trying to work on previews with a paint program.

You know in actual Paint or photoshop when you draw line or drawcircle, the shape is previewed so you can see the size. How would I go about doing that without cls and redrawing it everytime? The one in Turing reference works nicely where you draw a white line where it was the line previously was until you let go. However, if they try and draw a line on top of something, then a lot of their drawing will be erased. There is a 'takepic' command in turing that takes a picture of the specified coordinate and that would solve everything (I'd just draw the picture that was taken after they draw the line). However, that works very slowly, it actually lags when taking the picture and I'd rather not have that so I'm stuck here. I could just have the shape drawn after they let go but its just not the same without previews.
Sponsor
Sponsor
Sponsor
sponsor
upthescale




PostPosted: Sun Jun 11, 2006 11:01 am   Post subject: (No subject)

wut do u meen?
Reality Check




PostPosted: Sun Jun 11, 2006 11:10 am   Post subject: (No subject)

you know when you draw the circle and hold it shows you the size. The square moves as your mouse moves. I can't get this to work cleanly, If I update and cls then my the drawing goes away. I can't redraw whats in the canvas because I don't know what they drew, the only command I can think of is takepic and that is slow...
TheOneTrueGod




PostPosted: Sun Jun 11, 2006 12:53 pm   Post subject: (No subject)

Well, the way the actual paint works is it takes a picture of the background (In turing this translates into Pic.New), then draws your "preview" overtop of the background. You can have several layers of pictures so you can have an undo key as well.

Don't forget to Pic.Free
Reality Check




PostPosted: Sun Jun 11, 2006 1:31 pm   Post subject: (No subject)

I just did the Pic.New thing and its slow as hell. I click and drag to the position and it takes like 6 seconds to get drawn.
Clayton




PostPosted: Sun Jun 11, 2006 2:17 pm   Post subject: (No subject)

yes, but did you have a fps limiter in place? if not, you would be saving a picture every iteration of your loop (possibly every 10 ms or so depending on amount of lines in ur loop)
Reality Check




PostPosted: Sun Jun 11, 2006 3:14 pm   Post subject: (No subject)

nope, no fps limiter and I don't know what that is. What I did was take a pic of the background (only once) using Pic.New, and then when they click to draw, it draws the background over and over again after the line is drawn. So everytime the background is drawn, the line is then drawn again over it so yes, it does look like a preview as the old line is drawn over by the background and what you see is the new line being drawn but it is extremely slow. Would an FPS limiter fix this?
Cervantes




PostPosted: Sun Jun 11, 2006 3:31 pm   Post subject: (No subject)

I think that a better idea would be to record history in terms of what was done. Instead of saving an image at each step, you can represent each step as a single action. For example, "Draw.Line (200, 300, 100, 20, 2)" could represent an action. This line would be saved in a data file. You could use this syntax or make up your own, more efficient syntax.
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: