Re: About Ink drawing with wacom tablet
Re: About Ink drawing with wacom tablet
- Subject: Re: About Ink drawing with wacom tablet
- From: Raleigh Ledet <email@hidden>
- Date: Wed, 5 Nov 2008 09:23:26 -0800
Hi John,
As a former Wacom OS X Software Engineer, I believe I can be of some
assistance.
There are 2 routes you can go. Easy and Hard.
Easy:
Just grab any pertinent tablet info out of the mouseDragged event. You
can make sure that the mouse event has tablet data via [event subType]
== NSTabletPointEventSubtype. The mouse coordinates from a pen on a
tablet are not integral. That is, they are not aligned to pixels. This
provides for greater accuracy if needed. It's important to know at
this stage so you aren't confused by them. Simply gather all the mouse
locations from the mouseDragged events (converted to your view
coordinate space) and connect them via a NSBezierPath. Or you can do
some fancier drawing.
Pros: Very easy.
Cons: You are at the mercy of the tablet to screen mapping. However
the user maps their tablet to the screen, only the portion of the
tablet that maps to your view can ve used for a signature. (Note:
don't try to put up a shield window as the tablet may not be mapped to
the entire desktop.)
Hard:
You can talk directly to the Wacom Tablet driver to open a 'context'.
With this context, you can get the raw dimensions of the tablet and
tell the tablet to stop moving the cursor (temporarily). Then you want
to listen for -tabletPoint: events and can map the absoluteY and
absoluteY data to map the tablet how you see fit. Gather all of the
tabletPoints mapped to your liking and connect them NSBezierPath. Or
you can do some fancier drawing.
Pros: The whole tablet can be used for signature capture.
Cons: Harder. Email Wacom engineering for more support on this.
Quick Notes:
1. Once the tablet starts issuing mouse drags, it will continue to
issue drags at a fairly consistent interval until the mouseUp.
2. You can make sure the user is using a Pen on the tablet and not a
mouse via the TabletProximity event. However, you really want to
capture this event at the NSApp level and broadcast it out to all
concerned objects (NSNotification anyone) See my 10.4 sample code
(Cocoa Tiger Tablets) on Wacom's dev site.
3. Be sure to read "Next Generation Tablet Software Implementer's
Guide, MacOS X" from Wacom's dev site.
4. Wacom's dev site: http://www.wacomeng.com/devsupport/mac.html
Regards,
raleigh
Hi all,
I am working on to implement a signature feature in a cocoa
application. I
have an NSImageView, and the goal is for user to sign their names
using
wacom tablet and the signature would be drawn on the NSImageView. I
was
wondering if there is an API (from Ink, or wacom ...) that once user
is done
drawing on the tablet, I can call the API to get a NSImage, or
a NSBezierPath so I can draw directly onto the NSImageView ?
I saw there is post on cocoa-dev list,
http://www.cocoabuilder.com/archive/message/cocoa/2006/1/26/155365,
but I
haven't figured out how to do it in my cocoa application.
At this point, since I haven't figure out how to get the information
from
ink, I treated the pen as mouse and checking mouseDown event to draw
a NSBezierPath, which doesn't work well when the pen is outside the
NSImageView.
Thanks , I appreciate any help!
John
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden