
So I spent this weekend buried in my laptop, redesigning my coloring app interface. Originally, I had a few tool buttons and selection menus on the right hand side of the screen. The canvas for drawing was positioned in the the center of the page and the coloring page selection area was on the far right. The new design compacts everything on the right hand side of the screen. That means no more menus that open up over the drawing screen. In addition to a new interface, I just couldn’t resist adding some new functionality. I started with undo and redo buttons, then I added clear and finally a spray paint tool which helped to even out the look of the new UI.
Rearranging the UI took a bit of time but it was relatively simple. First, I added color buttons for the featured colors the Worcester Art Museum wants displayed. Then I resized the size menu and shoved it over to the right. After that I recoded the coloring page scroll window to be horizontal, shrunk it to size, and sent it to the right. I rearranged all the buttons into the right side UI including new animated undo, redo, and clear buttons and that was that.
Undo and Redo were a piece of cake and I have to give full credit to http://www.codicode.com/art/undo_and_redo_to_the_html5_canvas.aspx author Chtiwi Malek. His methods for handling undo and redo for a drawing app specifically, worked so perfectly, I found it unnecessary to make any modifications other than those necessary to add it to my program. His solution was to take a snapshot of the screen after each mouse event and then store those images in an array. Then you can traverse the images in the array using undo and redo. I am having am issue on the iPad where you have to click the undo and redo buttons twice before they fire. This does not happen on the computer however and thus far I can find no reason for the problem. Clear will not only clear the page currently but it will also refresh the undo redo array so you cannot undo clear. I am debating whether or not it should refresh the array though because hitting clear on accident would not be so good. After that I decided to tackle spray paint.
Spray paint was actually very easy to implement. You set up two arrays one with width multiples <= 1 and the other with alpha values <= 1. The larger widths have the lighter alpha values and the small widths have the darker values. It creates the effect of a well faded tip. However, I found for larger tips you must increase the number of widths you are using or else the different alpha values in the tip will be distinguishable to the eye. The effect can create a sort of cool pattern but for a spray tool it was undesirable.
I almost forgot, I changed the color wheel to a smaller wheel with no shaded regions. the color wheel menu is activated by the color palette button. When activated it takes the place of the original paint colors. I created a slider bar similar to a volume bar for selecting the shade of the color. The slider works as far as animation goes but there is no logic for shading or lightening the current color yet. Work for this week I suppose.

Anyway that just about wraps it up for this week.
Till next time.
Jason

From the blog jasonhintlian » cs-wsu by jasonhintlian and used with permission of the author. All other rights reserved by the author.