MSDN Magazine - October 2008 - (Page 145) Gus ClAss GoinG Places Ink-Enabled Apps For Tablet PC From a highlevel perspective, the pro cess for ink capture and analysis on the Tablet PC is straightforward. In man aged code, where object creation and ac cess is consistent and simple, it is easy to develop managed applications for Tablet PC. And it won’t be much more difficult for seasoned Windows developers to de velop such apps in unmanaged code. To the uninitiated developer, however, cre ating unmanaged Tablet PC applications can be rather daunting. Figure 1 Ink Data Components Taking input from a pen and transform ing it into meaningful data is a common and potentially InkOverlay arduous task for pencomputing developers in general. Captures In the case of Tablet PC, this process is simplified be cause we designed the pencomputing system with an Ink abstracted architecture to ease your design overhead. Strokes This column gives a quick introduction to the Tab let PC ink architecture and shows how to capture and Stroke recognize ink for Tablet PC applications. I will include example code that illustrates how to use the Tablet PC Packets SDK to recognize handwriting as text and create a sim ple penbased illustration input. the strokes are captured by OS hooks and can then be rendered or recognized. Microsoft has implemented interfaces, classes, and managed objects for repre senting, rendering, and recognizing each of the aforementioned data types. These objects were originally distributed to de velopers in the Tablet PC SDK in Win dows XP, and they are now a part of the Windows Vista SDK. Ink recognition—the process of trans forming pen input into text—is built into the Tablet PC SDK and is accomplished by capturing ink and passing this ink to an object that can recognize the ink. Ink is captured by using Ink Collector or a derived object such as InkOverlay. After InkCollector or InkOverlay has captured packets, which are formed into strokes, the strokes can be retrieved. By passing the strokes to a recognizer and calling a meth od to analyze the captured strokes, the ink data can be translated to recognized content. Figure 2 illustrates the inkrecognition process. More information on ink analysis can be found in the Tablet PC SDK (available at msdn.microsoft.com/library/ ms812486). Another excellent resource for Tablet PC de InkAnalyzer velopment is the Mobile PC Developer Center (msdn.miAnalyzes In the Tablet PC world, input from the pen to the PC crosoft.com/mobilepc). Recognized Text is called “ink.” Ink is a useful form of input data, as it can be easily transformed to other types of data (numbers, InkEdit and InkPicture text, and characters) or can be left as ink if the input is Figure 2 The InkThe simplest way to access the powerful function best left in that form. Scribbled notes with intermixed Recognition ality of the Tablet PC SDK in an unmanaged context diagrams are one such example where it makes sense Process is to use the InkEdit and InkPicture ActiveX controls. to save input as ink. These controls simplify the various procedures that are typically Ink is made up of packets that contain all sorts of nifty infor performed with the Tablet PC objects. For example, the InkEdit mation such as the x position, y position, and state of the pen. Ink control will automatically perform the InkRecognition procedure also includes stroke collections that share attributes such as width, for you in an optimal manner. This will get you going with Tablet color, and transparency values. Figure 1 illustrates the highlevel PC development faster than if you were to create such a control design of pen input (ink) data for Tablet PCs. on your own. Reading stroke data is just like reading any other input stream; Each of the controls has applications where it makes more sense to use one rather than the other, and the differences between them are shown in Figure 3. The InkEdit control enables handwriting Send your questions and comments to goplaces@microsoft.com. recognition, but operates more like the RichEdit control. InkEdit October 2008 145 Tablet PC Writing and Recognition http://msdn.microsoft.com/library/ms812486 http://msdn.microsoft.com/library/ms812486 http://msdn.microsoft.com/mobilepc http://msdn.microsoft.com/mobilepc
For optimal viewing of this digital publication, please enable JavaScript and then refresh the page. If you would like to try to load the digital publication without using Flash Player detection, please click here.