Re: [GSOC 13] Optimizing undo/redo in Paintroid; Setting up Paintroid in Eclipse

143 views
Skip to first unread message

Stefan Galler

unread,
Apr 14, 2013, 10:32:51 AM4/14/13
to catr...@googlegroups.com
Hi!

First, thanks for being interested in our project! I think you have got some great ideas how to improve the history of Paintroid. 

I have just tried to checkout Paintroid from scratch to reproduce your problem. The things I had to do was to set the Java version
for the library project to Java 1.6 and then used "Fix Project Properties" (right click on project -> Android Tools -> Fix Project Properties)
on all four projects. After that I was able to start the App as expected.
Maybe you also have to install API 8/10.

I hope this helps.

Best regards, 
Stefan G 





On Sunday, April 14, 2013 2:43:12 PM UTC+2, Ace Nassri wrote:
Hey everyone!

My name is Aessa Nassri (you can call me Ace if that's easier) and I am a Computer Science student at the University of Illinois. I am interested in working with Catroid (specifically Paintroid) as a GSOC 2013 project. 

I looked at the ideas list for GSOC 2013 and am interested in optimizing Paintroid's undo/redo functionality. In particular, I saw that it currently has to carry out every previous command each time something is undone/redone.

I haven't had any real experience with mobile technology, so feel free to correct any flawed assumptions in my suggestions.

As far as I can tell, Paintroid currently handles undo/redo commands by running every previous command and then returning the resulting image. One (extreme) solution is to remember each previous frame, which would be fast but take up way too much memory. The other extreme is what Paintroid currently does - keep only the active frame in memory and re-render anything else from scratch (which saves memory at the cost of speed).

What I am proposing is that Paintroid should precompute a certain number of previous frames and store them in case an undo/redo request is submitted by the user. For example, a simple implementation of my solution would store every 5th frame (up to a certain point) and perform only the commands that happened between the stored frame that is closest to the target frame and the target frame itself.

The main improvement to this solution that I can see is to find a good mathematical function for determining which frames should be stored. In particular, users will most likely do lots of short undo operations (5 undos or less) and relatively few long undo operations (15 undos or more). However, the long operations should not require that every single command be run to generate their results. (This is why storing only the first 20 frames is a bad idea - what if a large percent of undo requests are 21 undos or longer?) Part of the project would be to find a good function that specifies which frames should be saved so that a good balance between speed and memory is achieved.

Another aspect of this solution is the precomputation and/or saving of frames once the user has undone an action. This is necessary because as actions are done, it is easy to grab the current image and add it to a list of stored ones (i.e. as the user is moving 'forward'). However, when the user undoes a large number of actions (and moves 'backward'), the frame behind the one the user stops undoing at may have been forgotten to save memory and needs to be regenerated in case they want to make a small undo. (For example, a user at frame 40 undoes 20 actions, waits 5 seconds, and then undoes 1 action. Even though Paintroid may not have stored any frames before frame 20, it can use the 5 seconds to asynchronously compute them while the user isn't doing anything so that the user's 1 undo is reasonably fast.)

I know my explanation may be a bit long-winded and hard to understand, so feel free to ask questions or suggest improvements.

Also, I am having trouble getting Paintroid set up in Eclipse (I'm using 3.7.2 and Versions 15/17 of the Android SDK if that helps.) In particular, I am getting a lot of errors along the lines of "X cannot be resolved to (a) Y" e.g. "Menu cannot be resolved to a type." I have loaded 3 projects (ActionBarSherlock, Paintroid, PaintroidTest; PaintroidSourceTest wouldn't load) into Eclipse and put them in the same working set, so I think that Eclipse has access to the files being referenced. I am also running Ubuntu 12.04 LTS and have checked out the latest code from Paintroid's GitHub. Note that I haven't checked out anything but the Paintroid repository from Catrobat's GitHub page (which may be part of the problem). Any help with this is definitely appreciated! (I will look into it more on my own after an exam I have on Wednesday.)

Thanks,
Aessa "Ace" Nassri

Stefan Galler

unread,
Apr 19, 2013, 4:13:44 AM4/19/13
to catr...@googlegroups.com
Have you tried using the Clean function of Eclipse? (Project -> Clean)
maybe this helps.

Stefan

On Friday, April 19, 2013 7:15:31 AM UTC+2, Ace Nassri wrote:
Hey Stefan,

I am getting errors saying that "org.catroid.paintroid.R" can't be imported because Eclipse can't find it within any of the Paintroid source files. I tried to find out what it was pointing to by looking through the Paintroid code on GitHub and Eclipse, but my search came up empty. As far as I can tell, ActionBarSherlock and Android both have their own version of R - but org.catroid.paintroid contains no mention of any.

Ace

Stefan Galler

unread,
Apr 19, 2013, 7:32:43 AM4/19/13
to catr...@googlegroups.com
Ok, make sure Project -> Build Automatically is enabled.

The other reason why the R file is not generated could be that there are some errors in the xml files. 
Are there any?

- Stefan

On Friday, April 19, 2013 11:29:59 AM UTC+2, Ace Nassri wrote:
Just tried that for every project. No luck there.

Ace
Message has been deleted

Stefan Galler

unread,
Apr 20, 2013, 5:43:18 AM4/20/13
to catr...@googlegroups.com
Then make sure you have selected ActionBarSherlock as a library.
Paintroid -> Properties -> Android -> Library. Select the 'library' project as a Library for Paintroid.

On Saturday, April 20, 2013 9:44:46 AM UTC+2, Ace Nassri wrote:
The image is a bit blurry - the errors are of this general form:

"error: Error retrieving parent for item: No resource found that matches the given name '@style/Theme.Sherlock.[more error text]"

On Friday, April 19, 2013 3:07:29 PM UTC-5, Ace Nassri wrote:


Stefan,

Yep. There are definitely errors in the .xml files. (Specifically style.xml)

My guess is that ActionBarSherlock isn't fully or properly imported.

Thanks,
Ace

yogi

unread,
Apr 20, 2013, 11:45:41 AM4/20/13
to catr...@googlegroups.com
May be this will help.

1) Make a new Workspace.
2) Import the project.(Paintroid repository).
3) Please DO NOT check the "copy projects into workspace" check-box. It is difficult to set the project once you copied it to the workspace. 
4) Click Finish.
Reply all
Reply to author
Forward
0 new messages