Erasing Ink and Undo

The proper method of erasing ink with the Tablet PC SDK is to set the pen to delete or Eraser mode. There are two methods of erasing: stroke, which deletes whatever stroke you touch on (ink collection is a collection of strokes) or point by point. The point by point method works like an eraser. As you move the mouse around it affect the touched strokes by breaking them apart. So if you have a stroke that goes from point a to point b and erase in the middle, the original stroke is modified to end where the eraser started and a new stroke is created that begins at the end of the erasure and ends where the original stroke ended.

Since I have an UNDO method in my BLInk application, this is important to me. My method of undoing is to go to the top of the stack of strokes and remove them one at a time. Those get stored and can be used to “redo” as well. However, this method of erasing totally mucks up my stroke collection and without a lot more work, I can’t “undo” erasures.

The other way I can go about this is by sleight of hand. Rather than breaking up the strokes, my “eraser” can be an additional stroke that is the same color as the background. That way, I can undo and redo to my hearts content. The only consideration is the affect that this method will have on my resources and the size of my image when all is done.

There is probably a better way – or just the harder way of creating an additional store to capture all strokes and all erasures. ANd then undo and redo from that stack instead. I think I’m going to have to do a little more research on this one.

  Sign up for my newsletter so you don't miss my conference & Pluralsight course announcements!  

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.