Wednesday, December 17, 2003

"Strokes Collection"
Contains the collection of Stroke objects that represent a single ink stroke.

Strokes collections are references to ink data and are not the actual data itself.


Caution In managed code, to avoid a memory leak you must explicitly call the Dispose() method on any Strokes collection to which an event handler has been attached before the collection goes out of scope. "
from Microsoft Tablet PC SDK definition for Strokes Collecction

this abstraction represents a single ink stroke, it implements ICollection and IEnumerable , has 28 methods and 2 events(StrokesAdded and StrokesRemoved ) and 7 properties that take care of things like how many Stroke objects are stored in the collection. In addition to the standard collection methods that take care of adding ,removing, moving stroke objects there are methods to scale and rotate stroke objects (remember that from PacketProperties that stroke objects are really just a fancy polyline - you have all the information that is required to do all kinds of vector type transformations on strokes) It would have been easy for the designers of the API to keep it at the bitmap level but the it might not have been the same magical ink that we have today. Requires more data to be stored but gives real powerful ink.


PacketProperties of course are very exciting to think about but thats too much paper for folks that just recently (70 centruries ago) figured out how to abstract on a surface. So we will still talk abit about Strokes. That power is coming shortly.

A Stroke Object is contained by an instance of an Ink Object. Ink Objects define the scope of a Stroke Object. an Ink Object owns zero or more Stroke objects. Yes am going to capitalize all the class names i reference. Thats because the SDK did such a good job at OO that its literally possible to talk about this and it would sound like a normal english conversation, talk about Object abstraction.

liteally the ink is made up of strokes and the strokes are made up of packets described by PacketProperties.

its hard to talk about ink persistence without talking about ink itself. We have all heard how ink is a first class citizen in the the Tablet PC SDK object model.
Another way of looking at it is that the Ink class is the outermost entry point into the Ink Data API, and it is analogous to a document class , much like text or files are the basis of keyboard based computing.

User input occuring on InkCollector and InkOverlay create Stroke objects.
Stroke objects are the characters or basic building blocks of an ink document . Each Stroke objects represents a stroke of digital ink, the same way each handritten stroke represents some type of human intention, a doodle and scribble, a straight line, a letter, a number, a stroke of the pen. Each time you actually take a pen to paper , you are really create strokes of some type. Thats what is abstracted by Stroke objects. A stroke.
-Movement of the pen on a surface is essentially what is captured though more information is collected than the movement - its scary to imagine how powerful this strokes are compared to ordinary pen and paper strokes.
paper and pen interaction of course has a lot of expressiveness but once you have a computer underneath , you can the capability to store things like the time the stroke was done, a serial number for each stroke, even the angle the pen was making with the digitizer....thats why paper is at the end of its time, and of course there 's the whole "save a tree thing"

Stroke objects are are a collection of packets and each packet contains an x,y location and other packet properties. Next is the almighty PacketProperty Object.
Your stroke is represented as a collection of PacketProperties

No comments: