|
Chapter 4: Tablet PC Platform SDK: Tablet Input continued
Capturing Input from the PenBefore we cover how to write applications that receive pen input from the tablet digitizer, let's take a look at the software that enables us to harness the power of the pen.
The Tablet PC's tablet input subsystem refers to the logical pieces of software that transfer and transform the data generated from a tablet digitizer into the input an application can make use of. Exactly what kind of input is it that an application can make use of? Chapter 2 gives us a good idea of the experience we want to provide for a Tablet PC user, so let's see whether we can come up with some requirements here that might help us better understand the functions of the input subsystem.
Requirement #1Mouse EmulationAs you know by now, all tablet-unaware Microsoft Windows XP-compatible applications are fully supported under Windows XP Tablet PC Editionthe pen behaves like a mouse in these cases. It also happens that mouse input is valuable to tablet-aware applicationsstandard Windows behaviors, controls, and the like are already driven by the mouse, so it's convenient to be able to leverage this functionality for the pen. And of course, it's likely that a physical mouse device will be used to drive the application because many Tablet PCs will have integrated mouse hardware such as a touch pad or mini-trackball.
Because most applications rely heavily on mouse input, our first requirement of the input subsystem is that it be able to map pen input to mouse inputa process we'll refer to as mouse emulation. Both left-mouse and right-mouse buttons should be supported for compatibility.
Requirement #2Digital InkTablet-enabled applications often accept user input in the form of digital ink, which can be added to a document or recognized into a command. Capturing ink from the pen is one of the most important aspects of realizing an electronic paper paradigm. As such, digital ink must mirror physical ink as closely as possible to provide the most natural and unobtrusive end-user experience. From a user's perspective, ink should "just work" on a Tablet PC and be practically indistinguishable in behavior from physical ink. We can therefore impose the following sub-requirements on a system that's used to capture digital ink:
In the initial version of the Tablet PC Platform, normal pressure is the only property besides X and Y position that the rendering of ink can reflect. However, future versions of the Tablet PC Platform will likely take more properties into account. It is entirely possible for you to custom draw ink if you wish to have more properties taken into account, as we'll learn in Chapter 5. In the majority of cases, we think x, y, and pressure yield incredible results.
Requirement #3Pen-Based ActionsPen-specific actions like press-and-hold, using the top-of-pen eraser, and pressing pen buttons can become powerful means to streamline the user model of a tablet-aware application. In addition, employing pen input for means other than digital ink is useful because pen-specific properties can enhance existing user interface behaviors. For example, pen rotation could be used to rotate a selection while it's being dragged, or pen pressure could be used to determine how large an erasing area should be used for an eraser tool. Distinguishing between the user tapping the pen and the user dragging it is therefore important functionality.
Although the tablet hardware's device driver can easily report top-of-pen use (called pen inversion) and pen button presses, detecting press-and-hold and associated actions such as tap and drag is a nontrivial algorithm that arguably falls outside the driver's scope; this algorithm is best centralized so that any tablet device can use it.
Summing Up the RequirementsWe have now specified that the input system must be able to transform raw pen movement into mouse input (supporting left-mouse and right-mouse button emulation), provide realistic digital ink, and detect higher-level pen-based actions (press-and-hold, pen inversion, pen button presses, and tap versus drag). The Tablet PC Platform's tablet input subsystem (which we'll start referring to as "the TIS" for brevity) provides all this and more.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||