The software#

Apk for Android 2.1+#

Source code#

Spec for draw#

Handle rotation of screen#

Zoom in an out (with button, with multi touch)#

Save and load image.#

Change color#

Display summary image to provide context#

Have a tool bar to avoid the menu button on Android 2.2 tablet:#


  • draw curves (regular, blur, emboss, custom brush, erase)
  • draw lines
  • selection (draw, rectangle etc.)
  • copy paste
  • move selection around
  • draw text (form+keyboard, recognition)
  • zoom
  • pan

Input methods#

  • touch (simple, like mouse)
  • touch (multi)
  • buttons/menus
  • keyboard

Handling of layers #

(draw in layer, hide layer, move layer etc.)

Design for draw#

Buffered drawing#

The original draws on the screen (in the view) and on a hidden bitmap that represents the final product. The hidden bitmap is what gets saved to a file. Currently the same filter and path can be used for both images as they are basically identical.

To allow the user to zoom in and out, the two images need to be decorrelated:

  • the hidden bitmap can be drawn on as usual.
  • the view needs adjustments of scale and translation for the path drawing as well as the copy of the hidden bitmap.
The original design from the Google demo was drawing straight to the view as it went. Then once the user was done drawing a stroke, the hidden bitmap was drawn upon and copied to the view. The original design seems quite convenient for handling gesture recognition as it means that the reference image (i.e. the hidden bitmap) is not modified as soon as drawing starts but later (end of stroke) which leaves plenty of time to detect a gesture (e.g. zoom) and cancel the drawing. The MyView instance needs to maintain the zoom level. A float value that represents the number of display pixels used to represent one pixel of hidden bitmap. Implementation one: update hidden bitmap every time there is a change (i.e. on every touch move event) copy modified part of hidden bitmap to view with appropriate scale factor. Implementation two: create backup of hidden bitmap on touch down event. update hidden bitmap every time there is a change and implementation three: draw on visible view as events happen and write to hidden bitmap at the end. This last solution is not WYSYWYG and might look strange when the changes are committed and the view is refreshed from that. Implemented: In onDraw:
  • Have a hidden canvas and a scratch one.
  • Copy hidden canvas to scratch with adequate clipping rect
  • Draw path on scratch
  • Copy updated part of scratch to view

See also Android dev journal

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-4) was last changed on 13-Jul-2011 22:02 by pgaillard  
Welcome (anonymous guest) Wiki Prefs
JSPWiki v2.8.5-svn-6