Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to implement undo functionality in opengl in android

I am developing an android app which distort the image.I am using opengl translate and scale function to distort the image.The image is distorting fine.Now I want to implement undo feature.But unable to implement the functionality.Any one can help how to implement undo functionality in opengl .Any suggestion or code will be helpful. Thanks in advance .

like image 802
Nikhil Chaurasiya Avatar asked Nov 04 '22 04:11

Nikhil Chaurasiya


1 Answers

I suspect that the command pattern is not enough for your situation. This is based on my assumption that is is not easy to reverse the image distortion even when you know what distortion was applied.

Instead, you will probably need to push the image onto the stack just before applying the distortion. Then, the undo implementation will replace the current image with the image on the stack. This will lead to potentially interesting issues resulting from the combination of redo and undo.

You can optimize this be storing command objects for changes that are easily reversable and storing images for changes that are not easily reversable.

like image 148
DwB Avatar answered Nov 14 '22 10:11

DwB