|
-
Apr 21st, 2002, 04:12 AM
#1
Thread Starter
Frenzied Member
-
Apr 21st, 2002, 04:50 AM
#2
Not NoteMe
One way would be to store the previous and new value of each pixel as the user changes it. Then wien the user clickes undo, have it revert (but you would have to work out how to undo, i.e. don't have to undo each pixel individualy).
I havn't tried doing an undo feature but i woudl suggest something like this.
Create an array of a custom type like this
VB Code:
Private Type typUndoRedo
PixelX as Double
PixelY as Double
OldColour as Long '???
NewColour as Long '???
IsUndoRedoPoint as Boolean
End Type
Dim UndoRedo(Really Big Number, Or variable length) as typUndoRedo
I presume you have various functions for manipulating pixels, such as square, circle, line etc....
Do this sort of thing for each of these.
Code:
sub Box(param1,param2...)
'The first pixel change
currentnumber = currentnumber+1
UndoRedo(Currentnumber).isundoredopoint = True
UndoRedo(Currentnumber).pixelx = 5
UndoRedo(Currentnumber).pixely = 7
UndoRedo(Currentnumber).OldColour = ColourOfPixel(5,7)
UndoRedo(Currentnumber).NewColour = vbBlack
pset (5,7),vbBlack
'The rest of the code for changing all the pixels in the square
currentnumber = currentnumber+1
UndoRedo(Currentnumber).isundoredopoint = False
UndoRedo(Currentnumber).pixelx = X
UndoRedo(Currentnumber).pixely = Y
UndoRedo(Currentnumber).OldColour = ColourOfPixel(X,Y)
UndoRedo(Currentnumber).NewColour = vbBlack
pset (X,Y),vbBlack
'The Last Pixel Change
currentnumber = currentnumber+1
UndoRedo(Currentnumber).isundoredopoint = True
UndoRedo(Currentnumber).pixelx = 56
UndoRedo(Currentnumber).pixely = 32
UndoRedo(Currentnumber).OldColour = ColourOfPixel(56,32)
UndoRedo(Currentnumber).NewColour = vbBlack
pset (56,32),vbBlack
end sub
Now, for your undo function, you will start at currentnumber, and go back through the array, changing the pixels to oldcolour. UNTILL you get to the isundoredopoint = True
For the redo function you would do the same, but go forward.
NB: This is purely, me thinking about how it may work, as i havn't tried it before, or tested the above method it may not work. Its just an idea of how i would go about it. Hope it helpes.
If you want me to explain a certain aspect better, just ask.
Last edited by SLH; Apr 21st, 2002 at 04:54 AM.
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
-
Apr 21st, 2002, 05:33 AM
#3
Thread Starter
Frenzied Member
i think i get the idea but im not a good programmer so i would need some help to finish it...
one think that would be cool is to make a listbox with thumbnails of the changes so the user could click on any item in the list to restore a previous picture... 
i think phososhop has that feature but im not sure....
-
Apr 21st, 2002, 06:37 AM
#4
Not NoteMe
You start it, and i'll be happy to help.
Unless you did some clever coding, to manipulate those pictures, that would take up A LOT of memory, with a lot of undo levels.
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
-
Apr 21st, 2002, 07:15 AM
#5
Download the project attached in this thread to the last post by Nucleus.
http://www.vbforums.com/showthread.p...highlight=undo
-
Apr 21st, 2002, 07:53 AM
#6
Thread Starter
Frenzied Member
oh! thanks!
that code reminds me alot about that richtext undo/redo code that i couldt remake to picturebox code, but i can try...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|