Thread
:
The Epic Android Thread
View Single Post
Capt'n Corrupt
2010-11-17 , 14:51
Posts: 3,524 | Thanked: 2,958 times | Joined on Oct 2007 @ Delta Quadrant
#
1174
Just some musings about Android development.
I've been very interested in having a pen app for Android and have been looking into the API to see if this sort of thing is feasible. My intuition says that it is, but it doesn't hurt to learn a bit more.
It seems that there's a class for touch events (duh) called Motion Event:
http://developer.android.com/referen...tionEvent.html
This class allows for absolute touch events and 'relative' touch events which are of interest.
What I'm gunning for is a way to differentiate capacitive-stylus input from other touch (ie. the pad of the hand) for comfortable paper-like writing -- rather than resistive-style hovering.
It stands to reason that the capacitive tip will have a very constrained 'pressure' based on the fixed size of the tip. For light touch, it will be close to 0, but even for heavy pressure it is likely to be far less than a full on touch with a fat finger or pad of hand. However, light touch may certainly mimic the stylus tip, which would be undesirable for unwanted input (eg. the moment the pad of the hand touches the screen).
Further, in the event that that there are multiple objects touching the screen, and you are expecting pen input, it should be easy to discern (again by pressure) which is the capacitive stylus and which is the pad of the hand to be ignored. As soon as this is detected, all other drawn strokes from input should be rolled back and only the pen tip should be allowed to draw. Additionally as soon as a touch point breaches the threshold, it should be flagged as non-pen and rolled back.
Further, with each new multi-touch event, the pen tip should be 'discovered' if and only if it has been previously lifted. If it has not been lifted, then all other touch events should be flagged as non-pen and simply be ignored.
As a further method of differentiation, priority can be given to the top and/or leftmost point touching the surface as being the pen-tip (top and/or rightmost if you're right handed) with a pressure below the pressure threshold. This may require some calibration upon first use -- ie. touching the pen to the screen and asking whether the user is left or right handed.
Using these variables, it should be easy to track the tip of the pen and exclude other unwanted input that may be touching the screen with a high degree of reliability. In this way, the Tab (or any android device with sufficiently high input fidelity) can reliably behave like an active digitizer for pen input (minus the tilt found on dedicated devices -- eg. Wacom).
Further, we can also include gesture support: pinch to zoom, single/double finger scrolling, as it is now easy to differentiate pen input from finger.
The next problem is to optimize the input stroke to be fast enough to provide low latency between input and drawn stroke. In order to do this, the drawing routine should be fast, extremely fast (eg. wu-lines or some built in primitive). This can perhaps be optimized by a very simple line-drawing routine for immediate on-screen feedback, and a de-prioritized (threaded?) stroke 'class' for fancy stroke effects (ie. calligraphic pen, dotted lines, variable thickness, neon glow, paintbrush, pencil-like stroke, etc).
Add in an unobtrusive UI to select pen type, colour, eraser, background medium, etc, create flexible PNG/JPEG/PDF import/export filters, and you have one heck of a useful application for pen input!
Quote & Reply
|
The Following User Says Thank You to Capt'n Corrupt For This Useful Post:
danramos
Capt'n Corrupt
View Public Profile
Send a private message to Capt'n Corrupt
Find all posts by Capt'n Corrupt