
Developing applications for Windows 8 has been so much fun now that we can use HTML5, CSS3, and JavaScript. I have been inspired to write some simple applications for the Windows 8 App Store. This has been a very fun experience and I find that the more that I try and push myself, the more I end up learning.
I recently just released a new application for drawing called, “DoodlePad“. This simple application allows you to draw on the canvas and change your brush color, size, and background of your canvas. It also allows you to save your drawing, create a new one, or open an existing image. One of the tricky parts that I ran into when developing this application was trying to provide a good user experience by allowing them to have a background color.
This wasn’t as easy as I had first imagined since the Canvas is transparent by default. At first I thought I could simply create a fill style and then fill the Canvas rectangle with whatever color a user chose. However this didn’t work out very well when I was testing because as soon as I would start drawing and then want to change the background, all of my art work up till then would be covered with the new background.
Here is what I came up with, I decided to use a wrapping DIV that I would set the “background-color” property using JavaScript whenever the user selected a different color. This turned out to work perfectly well due to the Canvas being transparent out of the box.
Now comes the problem, when I want to dump all the beautiful work that the user has done create a masterpiece, the canvas no longer has any information concerning the background.