| Framework |
Carbon/Carbon.h |
| Declared in | Ink.h |
Ink is a technology that allows users to enter text by writing with a stylus on a graphics tablet without requiring any modifications to the application that receives the text. As text is written on a tablet, it is automatically recognized and entered as a stream of key-down events into a document or text field.
The Ink Services application programming interface provides a set of functions that enables you to customize Ink input for your application. Using the Ink Services API, you can:
Programmatically turn handwriting recognition on or off for your application
Access Ink data at multiple levels (as points and recognized text)
Support gestures that allow the user to manipulate text directly
Set up deferred recognition or use on-demand recognition
Access alternate text interpretations
Manage options for drawing Ink
Create and terminate an Ink phrase
Ink Services provides Ink input data (text interpretations, gestures, and so forth) through the Carbon Event Manager. Your application must set up one or more handlers to receive Ink-related events and to extract the relevant parameters from the events of interest to your application.
InkSetApplicationWritingMode
InkSetApplicationRecognitionMode
InkSetPhraseTerminationMode
InkSetDrawingMode
Adds a stroke to the current Ink phrase.
void InkAddStrokeToCurrentPhrase ( unsigned long iPointCount, InkPoint *iPointArray );
The number of elements in the iPointArray array.
A pointer to an array of InkPoint structures
that specify the path of the stylus, starting with the point that
defines the first stylus-down location and ending with the point
that defines the last stylus-down location.
This function operates on the Ink source from the application,
and not on that from direct user input. So there is no need to specify
the Ink source as kInkSourceApplication.
See “Ink Source Types” for more information on sources.
You do not need to call this function unless you have raw
data to process or you have turned off automatic recognition (by
calling the function InkSetApplicationWritingMode) and
have set up your application to handle Ink input events itself.
For example, you might need to handle Ink input if your application
needs to acquire pen data in a device-specific manner.
If your application handles Ink input events, it can still
take advantage of the recognition service provided by Ink Services.
To do so, your application should call the function InkAddStrokeToCurrentPhase to
add one stroke at a time to the current phrase. You then terminate
the phrase at the appropriate time by calling the function InkTerminateCurrentPhrase.
Note that calling InkAddStrokeToCurrentPhase adds
a stroke to the current phrase, but does not draw the stroke. See Using
Ink Services in Your Application for details on writing
code that uses the function InkAddStrokeToCurrentPhase to implement
deferred recognition.
Ink.h
Returns whether Ink Services has initiated and is currently maintaining an Ink phrase whose source is user input.
Boolean InkIsPhraseInProgress ( void );
Returns TRUE if
the user is currently engaged in Ink input; FALSE otherwise.
If your application manages its own phrase termination, you
should use this function to make sure there is a phrase that can
be terminated before you call the function InkTerminateCurrentPhrase.
Don’t call this function if the Ink data stream originates from your
application rather than directly from user input. The application
data stream is completely independent of the user data stream.
If your application builds its own Ink phrases by calling the
function InkAddStrokeToCurrentPhrase,
it should be able track whether such a phrase is in-progress
or not.
Ink.h
Specifies whether Ink input should be interpreted as text, gestures, both, or neither.
void InkSetApplicationRecognitionMode ( InkRecognitionType iRecognitionType );
The recognition mode you want Ink Services
to use. Pass kInkRecognitionGesture to
specify gesture recognition, kInkRecognitionText to
specify text recognition, kInkRecognitionNone to turn
off recognition, or kInkRecognitionDefault (which
is kInkRecognitionGesture | kInkRecognitionText)
to specify both gesture and text recognition. See “Recognition Modes” for
more information on the constants you can supply.
This function only affects recognition of Ink that originates
from the user. It does not affect recognition of Ink that originates
from your application, and is recognized using the function InkAddStrokeToCurrentPhrase.
Note that only text recognition (not gesture recognition) is performed
on an Ink data stream that originates from your application.
Ink.h
Controls where the user is allowed to write in the current application.
void InkSetApplicationWritingMode ( InkApplicationWritingModeType iWriteWhere );
An “Application Modes” constant that specifies the Ink writing mode
to use for your application. Pass kInkWriteAnywhereInApp if
you want your application to allow Ink input and recognition and
to receive Ink events when the user writing mode is set to kInkWriteInkAwareOnly.
When you call this function with the iWriteWhere parameter
set to kInkWriteAnywhereInApp, your
application can receive Ink events whose screen locations lie outside the
application windows. Pass kInkWriteNowhereInApp to
disable Ink input temporarily, such as when the user is using a
paint tool.
You can call the function InkSetApplicationWritingMode to
control when Ink input and recognition are allowed in your application.
Using this function, you can turn Ink Services on or off for your
application. Note that Ink input is available for your application
only when your application is frontmost and when the user has turned
on recognition in the Ink preferences pane.
If your application calls the function InkSetApplicationWritingMode with
the parameter kInkWriteNowhereInApp to
disable Ink Services management of pen events because you want to
accumulate Ink data yourself, be aware that you may need to manage
mouse event coalescing yourself. You can use the Carbon Event Manger
function SetMouseCoalescingEnabled for
this purpose. See Using Ink Services in Your Application for
a discussion of mouse coalescing.
Ink.hControls what is drawn when the user writes.
void InkSetDrawingMode ( InkDrawingModeType iDrawingMode );
A “Drawing Modes” constant that specifies the drawing mode to
use for your application. The default (kInkDrawInkAndWritingGuides)
is for Ink Services to draw both the Ink writing guides and the
Ink. Pass kInkDrawInkOnly if
you want Ink Services to draw only the Ink. Pass kInkDrawNothing to
turn off drawing of both the Ink writing guides and the Ink.
Normally Ink Services draws writing guides, similar in look
to the alternating solid and broken lines used on many paper writing
tablets. The Ink itself is drawn anti-aliased and grayscale. Your
application can call the function InkSetDrawingMode to
request that Ink Services not draw the writing guides or not draw
either Ink or the writing guides. If Ink drawing is disabled, your
application must receive the points (by installing a handler for kEventInkPoint events)
and draw the Ink.
You do not need to call the function InkSetDrawingMode to
inhibit drawing if you called the function InkSetApplicationWritingMode,
passing the value kInkWriteNowhereInApp.
Also, Ink Services will not draw any point for which a kEventInkPoint Carbon
event handler returns noErr.
Ink.h
Sets the conditions that define a phrase termination.
void InkSetPhraseTerminationMode ( InkSourceType iSource, InkTerminationType iAllowedTerminationTypes );
An “Ink Source Types” constant that specifies the source of
the Ink data stream. You can use one of these constants to get independent
control over termination of data originating with the user
versus data that is passed from your application to Ink Services.
To manage phrase termination for user input, pass the constant kInkSourceUser.
To manage phrase termination for application input (that is
recognized using the function InkAddStrokeToCurrentPhrase,
pass the constant kInkSourceApplication.
A constant that specifies the conditions which
define a phrase termination. To turn off automatic phrase termination,
pass kInkTerminationNone.
You can restore the default phrase termination behavior by passing
the constant kInkTerminationDefault.
See “Phrase Termination Modes” for more information on the constants
you can supply.
The default behavior is for Ink Services to terminate a phrase when one of the following events occur:
The user removes the stylus from the proximity of the tablet
A specified period of time elapses in which the stylus is not pressed to the tablet (The user can control the period of time in the Ink preferences pane.)
The user writes sufficiently far away from the previous Ink—either horizontally, or on a new line
You can use the function InkSetPhraseTerminationMode if
your application does not want the default behavior or wants complete
control over when Ink phrases are terminated. If you turn off automatic
phrase termination, you must make sure you manage phrase termination
appropriately for your application.
For example, if you want to force Ink drawn in a specific
input window to be treated as a single phrase until the user presses
a “finished-writing” button, you would call InkSetPhraseTerminationMode with
the parameter kInkTerminationNone to
turn off automatic phrase termination. Then you would need to install
a Carbon event handler for the event kEventInkPoint.
Your handler would examine the kEventInkPoint events,
notice when a pen-down event occurs on the “finished-writing”
button, and then terminate the phrase by calling the function InkTerminateCurrentPhrase.
See Using Ink Services in Your Application for
details on writing code to handle phrase termination.
Ink.h
Returns the number of points in the specified InkStrokeRef.
CFIndex InkStrokeGetPointCount ( InkStrokeRef iStrokeRef );
The InkStrokeRef to
get the point count from.
A CFIndex indicating
the number of points contained in the specified InkStrokeRef.
Given an InkStrokeRef,
this function returns the number of points that stroke contains.
Use this function to calculate the appropriate size of the buffer
passed to InkStrokeGetPoints.
Ink.h
Fills an array with the points belonging to the specified InkStrokeRef.
InkPoint * InkStrokeGetPoints ( InkStrokeRef iStrokeRef, InkPoint *oPointBuffer );
The InkStrokeRef to
get the points from.
The buffer into which the point data is to be copied.
A pointer to the copied
array of point data from the specified InkStrokeRef; this
value is the same as the oPointBuffer address
provided by the application.
Given an InkStrokeRef and
a point buffer, this function fills that buffer with the points belonging
to that stroke.
The size of the point buffer must be at least the size of InkStrokeGetPointCount(
iStrokeRef ) * sizeof( InkPoint ). For details,
see InkStrokeGetPointCount.
The pointer to the block of memory containing the ink points is
returned as the result.
Ink.hReturns the CFTypeID of
an InkStrokeRef object.
CFTypeID InkStrokeGetTypeID ( void );
The CFTypeID of
an InkStrokeRef object.
Given an InkStrokeRef,
this function returns its CFTypeID.
Ink.h
Terminates the current phrase.
void InkTerminateCurrentPhrase ( InkSourceType iSource );
An “Ink Source Types” constant that specifies the source of
the Ink data stream.To terminate a phrase that originates from
application input (that is recognized using the function InkAddStrokeToCurrentPhrase),
pass the constant kInkSourceApplication.
If
you are managing phrase termination that originates from direct
user input, you can pass the constant kInkSourceUser.
Note that this function is normally not used in this fashion, as
most applications can let Ink Services terminate such phrases automatically.
You do not need to call this function unless you have turned
off automatic phrase termination (by calling the function InkSetPhraseTerminationMode)
and have set up your application to manage phrase termination. When
you call the function InkTerminateCurrentPhrase,
any Ink drawn by Ink Services is erased. If your application handles
phrase termination, it can still take advantage of the recognition
service provided by Ink Services.
Ink.h
Returns the number of alternate text interpretations available for an Ink phrase.
CFIndex InkTextAlternatesCount ( InkTextRef iTextRef );
On input, a reference to the Ink text object
that specifies the Ink word whose alternate count you want to obtain.
You must obtain an Ink text object reference (InkTextRef)
through your application’s Ink event handler. Your handler must
take care of the Carbon event class kEventClassInk and
the event kind kEventInkText.
The event parameter kEventParamInkTextRef that you
obtain from this event kind is a reference to an Ink text object.
Returns the number of interpretations available for the specified Ink phrase.
You can obtain the string associated with a text interpretation
by calling the function InkTextCreateCFString.
If you want to display a list of the alternate text interpretations
to the user, call the function InkTextInsertAlternatesInMenu.
Ink.h
Returns the bounds of an Ink text object.
HIRect InkTextBounds ( InkTextRef iTextRef );
On input, a reference to the Ink text object
whose bounds you want to obtain. You must obtain an Ink text object
reference (InkTextRef)
through your application’s Ink event handler. Your handler must
take care of the Carbon event class kEventClassInk and
the event kind kEventInkText.
The event parameter kEventParameterInkTextRef that
you obtain from this event kind is a reference to an Ink text object.
An HIRect data
structure that defines the bounds of the specified Ink text object.
The bounds are initially global coordinates, and may extend beyond your application’s windows.
Ink.h
Copies an existing Ink text object.
InkTextRef InkTextCopy ( InkTextRef iTextRef );
On input, a reference to the Ink text object
you want to copy. You must obtain an Ink text object reference (InkTextRef)
through your application’s Ink event handler. Your handler must
take care of the Carbon event class kEventClassInk and
the event kind kEventInkText.
The event parameter kEventParameterInkTextRef that
you obtain from this event kind is a reference to an Ink text object.
A reference to the newly-created Ink text object.
You can use this function to implement copy-and-paste functions
in a deferred-recognition application, or in a text application
to retain Ink when text is copied and pasted. The retention count
of the new InkTextRef is
1.
Ink.h
Obtains the string associated with a text interpretation of an Ink phrase.
CFStringRef InkTextCreateCFString ( InkTextRef iTextRef, CFIndex iAlternateIndex );
On input, a reference to the Ink text object
that specifies the Ink word for which you want to create a string.
You must obtain an Ink text object reference (InkTextRef)
through your application’s Ink event handler. Your handler must
take care of the Carbon event class kEventClassInk and
the event kind kEventInkText.
The event parameter kEventParamInkTextRef that you
obtain from this event kind is a reference to an Ink text object.
The index that specfies the text interpretation
for which you want to obtain a CFString.
Text interpretations are stored in an array in ranked order, with the
most-likely interpretation at index zero.
A CFStringRef that
specifies an interpretation for the given Ink text phrase. Returns NULL if
the index you provide is invalid. Your application is responsible
for releasing the returned CFStringRef.
Ink.hCreates an Ink text object from a previously-flattened Ink text object.
InkTextRef InkTextCreateFromCFData ( CFDataRef iFlattenedInkText, CFIndex iIndex );
On input, a reference to a CFData data
structure that contains data from a previously-flattened Ink text
object.
The index at which to start reading the data.
Returns a reference to the newly-created Ink text object. The retention count of the newly-created Ink text object is 1.
You can unflatten an Ink text object that was previously flattened
using the function InkTextFlatten.
If you flattened more than one Ink text object to the CFMutableData data type,
then you must call the function InkTextCreateFromCFData for
each Ink text object you want to unflatten, specifying the index
that defines the start of the Ink text data you want to unflatten.
Ink.h
Rescales and draws Ink text into the specified bounds.
void InkTextDraw ( InkTextRef iTextRef, CGContextRef iContext, const CGRect *iBounds, InkTextDrawFlagsType iFlags );
On input, a reference to the Ink text object
whose text you want to rescale and draw. You must obtain an Ink
text object reference (InkTextRef) through
your application’s Ink event handler. Your handler must take care of
the Carbon event class kEventClassInk and
the event kind kEventInkText. The
event parameter kEventParameterInkTextRef that
you obtain from this event kind is a reference to an Ink text object.
The CGContext into
which you want to draw. Drawing is relative to the specified CGContextRef,
and subject to the usual window and clipping constraints. Pass NULL if
you want to draw to the canonical context of the current port.
On input, a CGRect data
structure that specifies the bounds into which you want the Ink
text object to be drawn.
A “Text Drawing Flags” constant that specifies drawing settings.
Pass kInkTextDrawDefault to
use the default system settings when drawing, kInkTextDrawIgnorePressure if
you do not want to use pressure sensitive gradients, and kInkTextDrawHonorContext t
o use the current Quartz context settings.
The function InkTextDraw is useful
to applications that implement deferred recognition or searchable
Ink. The original points and bounds of the Ink text object are scaled
and offset to fit the specified bounds, so subsequent calls to the
function InkTextBounds return the rescaled
bounds.
Ink.hFlattens an Ink text object for archiving.
CFIndex InkTextFlatten ( InkTextRef iTextRef, CFMutableDataRef ioDataRef, CFIndex iIndex );
On input, a reference to the Ink text object
you want to flatten. You must obtain an Ink text object reference
(InkTextRef) through
your application’s Ink event handler. Your handler must take care
of the Carbon event class kEventClassInk and
the event kind kEventInkText.
The event parameter kEventParameterInkTextRef that
you obtain from this event kind is a reference to an Ink text object.
On input, a reference to a CFMutableData data
type. On output, refers to the flattened data. Your application
is responsible for creating and releasing the CFMutableDataRef.
The index at which you want the data to be written.
Returns the number
of bytes added to the ioDataRef.
Returns 0 if the operation
is unsuccessful or iTextRef is NULL or
empty.
CFMutableData objects
are extensible, which means you can flatten more than one Ink text object
into a CFMutableData object.
You store data in a CFMutableData object
by specifying the index at which data is to be stored. The function InkTextFlatten accepts
the starting index as an input parameter, writes all the Ink text
object data to the specified CFMutableData object,
and returns the byte count for the amount of data that is actually stored.
To flatten an additional Ink text object into the same CFMutableData object,
you must supply a value for the iIndex parameter
that specifies the byte location at which to start writing the data
for the additional Ink text object. You can calculate this value
by summing the byte count returned by the previous call with the
value of the iIndex parameter
you provided in the previous call.
Ink.hReturns a reference to the specified stroke in an InkTextRef.
InkStrokeRef InkTextGetStroke ( InkTextRef iTextRef, CFIndex iStrokeIndex );
The InkTextRef to
get the stroke from.
The index of the stroke for which you want
to get an InkStrokeRef.
An InkStrokeRef for
the specified stroke of the specified InkTextRef.
Given an InkTextRef and
a stroke index (between 0 and InkTextGetStrokeCount(
iTextRef ) - 1), this function returns the InkStrokeRef corresponding
to the specified stroke index. For details, see InkTextGetStrokeCount.
The returned InkStrokeRef is
guaranteed to persist only for the life of the InkTextRef from which
it was obtained. If you want to use the InkStrokeRef after
the InkTextRef has been released,
you must call the function CFRetain and
pass the InkStrokeRef to
it.
When any Ink object reference is obtained from a Carbon event,
it is guaranteed to persist only for the life of the event handler.
If you want to use the object at some later time, you must call
the function CFRetain and
pass the object to it.
Ink.h
Returns the number of strokes in the specified InkTextRef.
CFIndex InkTextGetStrokeCount ( InkTextRef iTextRef );
The InkTextRef to
get the stroke count from.
The number of stokes in
the specified InkTextRef.
Given an InkTextRef,
this function returns the number of strokes the InkTextRef contains.
Ink.hReturns the CFTypeID of
an InkTextRef object.
CFTypeID InkTextGetTypeID ( void );
The CFTypeID of
an InkStrokeRef object.
Given an InkTextRef,
this function returns its CFTypeID.
Ink.hInserts a list of alternate text interpretations into a menu.
ItemCount InkTextInsertAlternatesInMenu ( InkTextRef iTextRef, MenuRef iMenuRef, MenuItemIndex iAfterItem );
On input, a reference to an Ink text object
that specifies the Ink word for which you want to provide a list
of alternate text interpretations. You must obtain an Ink text object
reference (InkTextRef)
through your application’s Ink event handler. Your handler must
take care of the Carbon event class kEventClassInk and
the event kind kEventInkText.
The event parameter kEventParamInkTextRef that
you obtain from this event kind is a reference to an Ink text object.
A reference to the menu into which you want
to insert the list of alternate text interpretations. Ink Services
attaches menu event handlers to this menu, so you should use this MenuRef directly,
rather than copy items from the menu reference to another menu.
A value that specifies the menu item after
which you want to insert the list of alternate text interpretations.
If the specified menu item is 0,
the text alternates are inserted at the head of the menu. If the
specified menu item is greater than or equal to the existing number
of menu items, the text alternates are appended to the end of the
menu. Remember that the first item in a menu item array is numbered 1,
not 0.
Returns the number
of menu items added to the menu. Returns 0 if
the operation is not successful.
The function InkTextInsertAlternatesInMenu allows
your application to insert a list of text interpretations for a
given Ink text phrase into an existing contextual menu. You should handle
a list of alternate text interpretations as a standard contextual
menu using the Menu Manager function ContextualMenuSelect.
When a user selects an item from the list of alternates, the
list of alternates maintained by Ink Services are reordered automatically.
This means that if you call the function InkTextCreateCFString with
the parameter iIndex set
to 0, you obtain the
newly selected item.
Thus the user’s choice persists in internal system data structures without requiring your application to call additional functions. However your application must update its own internal data structures appropriately.
You must rebuild the menu to reflect the user’s choice. After the user makes a choice and then reopens the menu, you must make sure the newly-selected item shows up as the first item in the menu. The items in the menu should mirror the list of alternates maintained by Ink Services.
Upon return from the function ContextualMenuSelect,
your application can determine if the user has made a selection
by checking the value of the parameter outUserSelectionType.
The value indicates the item that the user selected from the contextual
menu. If there is a selection, your application can examine the outMenuID and outMenuItem parameters
of the function ContextualMenuSelect,
and use these values to obtain the alternate text interpretation
by calling the Menu Manager function CopyMenuItemTextAsCFString.
Menu items for a set of alternates whose first letter is an alphabetical character always include an alternate whose first letter is the opposite lettercase. Menu items for a set of alternates whose first letter is a non-alphabetical character do not include a lettercase alternate.
When the menu items are reordered automatically, the text that was first in the list moves to the second or the third position, depending upon whether the first letter is alphabetical or non-alphabetical. For example, the following list of menu items:
crash, Crash, crush, crust, wrash
If the user chooses crush, the menu items are reordered as follows:
crush, Crush, crash, crust, wrash
Notice that the list of alternates is kept to a length of five. A lettercase alternate for crush is added to the menu while the uppercase alternate Crash is dropped.
For a non-alphabetic first character, however, such as a number, the original moves to the second position. So for the following menu:
1239, 1234, 1289, 1284
If the user chooses 1234, the menu becomes:
1234, 1239, 1289, 1284
If it is important for your application to maintain the original order of alternates, then it must use its own internal data structures to keep track of the original list.
See Using Ink Services in Your Application for
details on writing code that uses the function InkTextInsertAlternatesInMenu to
implement a correction model.
Ink.hReturns a value that specifies the key modifiers applied to an Ink phrase.
UInt32 InkTextKeyModifiers ( InkTextRef iTextRef );
On input, a reference to the Ink text object
whose key modifiers you want to obtain. You must obtain an Ink text
object reference (InkTextRef)
through your application’s Ink event handler. Your handler must
take care of the Carbon event class kEventClassInk and
the event kind kEventInkText.
The event parameter kEventParameterInkTextRef that
you obtain from this event kind is a reference to an Ink text object.
Returns a value that
indicates which modifier keys were down during input of the Ink
phrase. This value is in the same form as that used by the Carbon Event
Manager for the event parameter kEventParamKeyModifiers.
Ink Services assigns keyboard modifier keys to a stroke if those keys are held down for more than 50% of the stroke’s points. Ink Services assigns the modifier keys associated with a phrase’s first stroke to the entire phrase. Ink Services assigns the modifier keys associated with a phrase to all of the text interpretations that are derived from an Ink phrase.
Ink.h
Returns the Ink writing mode set by the user in the Ink preferences pane.
InkUserWritingModeType InkUserWritingMode ( void );
A value that specifies
the current user preferences settings for Ink: kInkWriteInInkAwareAppsOnly, kInkWriteAnywhere,
or kInkWriteNowhere.
In general, Ink services are not available if kInkWriteNowhere is
returned (indicating the user has turned Ink off entirely). See “User Writing Modes” for
more information on each of these constants.
User preferences for Ink are set by the user in the Ink pane of System Preferences. Your application can only read these values, not set them.
Ink.hDefines a data type for a reference to an opaque Ink text object.
typedef struct OpaqueInkTextRef * InkTextRef;
You must use the Core Foundation functions CFRetain and CFRelease to
manage the retention and release of Ink text objects. When an Ink
text reference is obtained from a Carbon event, it is guaranteed
to persist only for the life of the event handler. If your application
needs to use the Ink text object at some later time, you must call
the function CFRetain, passing the
object you want to retain as a parameter.
Ink.h
Defines a data type for a reference to an opaque Ink stroke object.
typedef struct OpaqueInkStrokeRef * InkStrokeRef;
You must use the Core Foundation functions CFRetain and CFRelease to
manage the retention and release of Ink stroke objects. When an
Ink stroke reference is obtained from a Carbon event, it is guaranteed
to persist only for the life of the event handler. If your application
needs to use the Ink stroke object at some later time, you must
call the function CFRetain, passing
the object you want to retain as a parameter.
Ink.h
Defines a data type that specifies the number of alternate text interpretations of an Ink phrase.
typedef unsigned long InkAlternateCount;
Values of type InkAlternateCount are
returned by the function InkTextAlternatesCount and
passed as a parameter to the function InkTextCreateCFString.
Ink.h
Contains data that describes an Ink point.
struct InkPoint {
HIPoint point;
TabletPointRec tabletPointData;
UInt32 keyModifiers;
};
typedef struct InkPoint InkPoint;
typedef InkPoint * InkPointPtr;
pointDefines a point in floating-point coordinates.
These values are generally in global coordinates, with full sub-pixel
accuracy. This coordinate is what you obtain for a mouse event from
the Carbon event parameter kEventParamMouseLocation,
which also contains a typeHIPoint value.
tabletPointDataA tablet point structure that contains pressure,
tilt, rotation, and coordinate (in tablet space) data for a pen.
The pressure value is a measure of how hard the pen is being pressed,
ranging from 0 to 65535. Some tablet manufacturers allow users to
adjust pen sensitivity. In these cases, the zero value always corresponds
to the threshold set by the user, and the pressure value is relative
to that threshold. See Carbon Event Manager Reference for information
on the TabletPointRec data
type.
keyModifiersA value that specifies the keyboard modifier key
that is pressed when the point is sampled. This value is in the
same form as that used by the Carbon Event Manager for the event
parameter kEventParamKeyModifiers.
An InkPoint data
structure contains an essentially complete set of per-point data.
Ink Services currently only requires the point's (x,y) coordinates
and pressure to perform recognition and to draw the ink, but future
recognition services may require other information from the TabletPointRec.
Ink.hSpecify the Ink writing mode set by the user in the Ink pane of System Preferences.
enum {
kInkWriteNowhere = 'nowh',
kInkWriteAnywhere = 'anyw',
kInkWriteInInkAwareAppsOnly = 'iapp'
};
typedef FourCharCode InkUserWritingModeType;
kInkWriteNowhereSpecifies the user has disabled Ink or that Ink Services are not available (for example, a tablet is not attached).
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkWriteAnywhereSpecifies the user has enabled Ink to allow writing anywhere on the screen. Ink Services flows ink points and recognition results to the frontmost application. This is the default situation when the user enables Ink.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkWriteInInkAwareAppsOnlySpecifies the user has enabled Ink only to
allow writing in an application that has enabled Ink Services by
calling the function InkSetApplicationWritingMode with
the kInkWriteAnywhereInApp parameter.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
These constants are returned by the function InkUserWritingMode.
Specify an Ink input mode to use for an application.
enum {
kInkWriteNowhereInApp = 'nowa',
kInkWriteAnywhereInApp = 'anya'
};
typedef FourCharCode InkApplicationModeType;
kInkWriteNowhereInAppSpecifies not to allow Ink input in your application.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkWriteAnywhereInAppSpecifies to allow Ink input anywhere onscreen for your application.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
You can supply these constants as parameters to the function InkSetApplicationWritingMode.
If the user has not enabled Ink or if there is not an Ink input device
available, then calling InkSetApplicationWritingMode with
the parameter kInkWriteAnywhereInApp has
no effect.
Specify what Ink Services should draw.
enum {
kInkDrawNothing = 0,
kInkDrawInkOnly = 1,
kInkDrawInkAndWritingGuides= 2
};
typedef unsigned long InkDrawingModeType;
kInkDrawNothingSpecifies not to draw Ink or the writing guides.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkDrawInkOnlySpecifies to draw Ink but not the writing guides.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkDrawInkAndWritingGuidesSpecifies to draw both the Ink and the writing guides. This is the default.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
You can pass these constants as parameters to the function InkSetDrawingMode.
Defines the conditions under which an Ink phrase should be terminated.
enum InkTerminationType{ kInkTerminationNone = 0, kInkTerminationTimeOut = 1, kInkTerminationOutOfProximity = 1 << 1, kInkTerminationRecognizerHorizontalBreak = 1 << 2, kInkTerminationRecognizerVerticalBreak = 1 << 3, kInkTerminationStroke = 1 << 4, kInkTerminationAll = (unsigned long) 0xFFFFFFFF, kInkTerminationDefault = 0x0F }; typedef unsigned long InkTerminationType;
kInkTerminationNoneSpecifies to inhibit automatic phrase termination by Ink Services.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkTerminationTimeOutSpecifies to terminate a phrase when all of the following are true:
The user stops writing and lifts the stylus
The user keeps the stylus within the proximity range of the tablet
The user does not resume writing within the period of time defined by the user in the Ink pane of System Preferences
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkTerminationOutOfProximitySpecifies to terminate a phrase when the user stops writing and lifts the stylus entirely out of the proximity range of the tablet. This is on by default. However, users can turn off proximity termination in the Ink pane of System Preferences if they find it interferes with their writing style.
If the
user turns off proximity termination, your application can’t turn
it on even if you call the function InkSetPhraseTerminationMode with the parameter kInkTerminationOutOfProximity.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkTerminationRecognizerHorizontalBreakSpecifies to terminate a phrase when the user leaves a large horizontal space between words (approximately two character widths or more).
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkTerminationRecognizerVerticalBreakSpecifies to terminate a phrase when the user finishes one line and begins writing on the next.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkTerminationStrokeCauses phrases to be terminated at the end of every stroke (whenever the pen is lifted from the tablet while writing). Only useful for single-stroke gesture input, not for text.
Available in Mac OS X v10.4 and later.
Declared in Ink.h
kInkTerminationAllSpecifies to restore automatic phrase termination
by Ink Services. In this case, Ink Services uses all of the termination
modes (except kInkTerminationNone)
described previously. Deprecated in Mac OS X v10.4. As of Mac OS
X v10.4, this value is overridden to behave like kInkTerminationDefault.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkTerminationDefaultRestores default phrase termination matching
the current user settings (kInkTerminationTimeOut | kInkTerminationOutOfProximity | kInkTerminationRecognizerHorizontalBreak | kInkTerminationRecognizerVerticalBreak).
See also kInkTerminationOutOfProximity.
Available in Mac OS X v10.4 and later.
Declared in Ink.h
An Ink phrase (represented as an InkTextRef in
your application) is typically a word in a Roman language. Ink Services
uses phrases to determine when to erase onscreen Ink and initiate
recognition. You can pass Ink phrase termination constants as arguments
to the function InkSetPhraseTerminationMode.
You can combine two or more constants to obtain precise control
over phrase termination.
Specify how to interpret Ink input for an application.
enum InkRecognitionType{ kInkRecognitionNone = 0, kInkRecognitionText = 1, kInkRecognitionGesture = 1 << 1, kInkRecognitionDefault = 3 }; typedef unsigned long InkRecognitionType;
kInkRecognitionNoneSpecifies to turn off Ink recognition.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkRecognitionTextSpecifies to allow interpretation of Ink input as text.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkRecognitionGestureSpecifies to allow interpretation of Ink input as gestures.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkRecognitionDefaultSpecifies the default setting, which is to interpret Ink input as text or gestures.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
The recognition type constants are used as arguments for the
function InkSetApplicationRecognitionMode.
You can use these constants to specify that Ink Services interprets
input as both text and gestures or as either type individually.
Define editing actions.
enum InkGestureKind { kInkGestureUndo = 'undo', kInkGestureCut = 'cut ', kInkGestureCopy = 'copy', kInkGesturePaste = 'past', kInkGestureClear = 'cler', kInkGestureSelectAll = 'sall', kInkGestureLeftSpace = 'lspc', kInkGestureRightSpace = 'rspc', kInkGestureTab = 'tab ', kInkGestureLeftReturn = 'lrtn', kInkGestureRightReturn = 'rrtn', kInkGestureDelete = 'del ', kInkGestureEscape = 'esc ', kInkGestureJoin = 'join' }; typedef FourCharCode InkGestureKind;
kInkGestureUndoSpecifies to undo the last action.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkGestureCutSpecifies to cut.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkGestureCopySpecifies to copy.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkGesturePasteSpecifies to paste.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkGestureClearSpecifies to clear.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkGestureSelectAllSpecifies to select all items in the area that has user focus.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkGestureLeftSpaceSpecifies to insert a single space character. The “left” distinction indicates that the gesture is drawn with the long, horizontal tail is on the left side.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkGestureRightSpaceSpecifies to insert a single space character. The “right” distinction indicates that the gesture is drawn with the long, horizontal tail is on the right side.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkGestureTabSpecifies to insert a tab character.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkGestureLeftReturnSpecifies to insert a return (new line) character. The “left” distinction indicates that the gesture is drawn with the small angle-bracket pointing to the left side.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkGestureRightReturnSpecifies to insert a return (new line) character. The “right” distinction indicates that the gesture is drawn with the small angle-bracket pointing to the right side.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkGestureDeleteSpecifies to delete. This corresponds to pressing the Delete key.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkGestureEscapeThis corresponds to pressing the Escape key.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkGestureJoinSpecifies to join two words into a single word,
eliding the space between them, and may be applied to editable objects
other than text. The gesture is similar in shape to the letter “v”.
The joined words are the ones closest to the top-most points of
the gesture. This is a tentative, always targeted, gesture, meaning
that the system treats the associated Ink tentatively as a gesture
until your application either confirms the Ink is indeed a gesture
or returns eventNotHandledErr,
informing the system the Ink is not a gesture.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
These constants are returned in the Carbon event parameter kEventParamInkGestureKind. The
Carbon event class for this parameter is kEventClassInk and
the event kind is kEventInkGesture.
The constants define the complete set of gestures recognized by
Ink Services. When a gesture event is received by your application,
your application should determine the gesture kind and then take
appropriate action. For more details, see Using Ink Services
in Your Application.
Specify the menu command IDs assigned to items inserted in the alternates menu.
enum {
kInkAlternateCommand = 'inka',
kInkSeparatorCommand = 'inks',
kInkDrawingCommand = 'inkd'
};
kInkAlternateCommandSpecifies the menu command ID assigned to menu
items inserted by the function InkTextInsertAlternatesInMenu. You can
use this constant to determine which menu items in a menu are supplied
by Ink Services.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkSeparatorCommandSpecifies the menu command ID assigned to the separator item between the alternates and the Ink drawing.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkDrawingCommandSpecifies the menu command ID assigned to the menu item containing the ink drawing.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
Specify settings to use when drawing Ink text.
enum unsigned long InkTextDrawFlagsType{
kInkTextDrawDefault = 0,
kInkTextDrawIgnorePressure = 1,
kInkTextDrawHonorContext = 1 << 1
};
kInkTextDrawDefaultSpecifies to use the default system settings when drawing. By default, Ink is drawn with pressure sensitive gradients, and the Quartz context settings are overridden for line color and width.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkTextDrawIgnorePressureSpecifies not to use pressure sensitive gradients when drawing.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkTextDrawHonorContextSpecifies to use the current Quartz context settings for line color and width.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
Specify sources for an Ink data stream.
enum unsigned long InkSourceType{
kInkSourceUser = 1,
kInkSourceApplication = 2
};
kInkSourceUserSpecifies the Ink source from direct user input.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
kInkSourceApplicationSpecifies the Ink source from the application.
Available in Mac OS X v10.3 and later.
Declared in Ink.h
You can use these constants to specify which data stream is
currently being controlled by calls to the functions InkTerminateCurrentPhrase and InkSetPhraseTerminationMode.
You can control phrase termination for both the user-input data
stream (kInkSourceUser)
and an application-input data stream (kInkSourceApplication)
independently.
Specify ink pen constants.
enum {
kInkPenTipButtonMask = NX_TABLET_BUTTON_PENTIPMASK + 0,
kInkPenLowerSideButtonMask = NX_TABLET_BUTTON_PENLOWERSIDEMASK
+ 0,
kInkPenUpperSideButtonMask = NX_TABLET_BUTTON_PENUPPERSIDEMASK
+ 0
};
kInkPenTipButtonMaskThe writing or eraser tip.
Available in Mac OS X v10.4 and later.
Declared in Ink.h
kInkPenLowerSideButtonMaskThe lower pen barrel button.
Available in Mac OS X v10.4 and later.
Declared in Ink.h
kInkPenUpperSideButtonMaskThe upper pen barrel button.
Available in Mac OS X v10.4 and later.
Declared in Ink.h
Pens used with modern graphics tablets often have multiple
barrel buttons that can be assigned special meaning by the tablet
driver or by an application. In addition, the writing or eraser
tip may be engaged at any given moment. By performing an AND operation
of these contsants with that of a buttons member
of a TabletPointRec in
Carbon or the value returned by the buttonMask message
sent to tablet events (or mouse events containing tablet data) in
Cocoa, you can determine which (if any) pen tip or barrel buttons
are currently being held down. These buttons and buttonMask data
are only available for tablet-point events (not tablet-proximity
events).
To ensure consistency between the values used by driver writers
and the values used by applications, these constants are defined
in terms of NX_ constants
from IOKit/hidsystem/IOLLEvent.h.
Specify ink tablet constants.
enum {
kInkTabletPointerUnknown = NX_TABLET_POINTER_UNKNOWN + 0,
kInkTabletPointerPen = NX_TABLET_POINTER_PEN + 0,
kInkTabletPointerCursor = NX_TABLET_POINTER_CURSOR + 0,
kInkTabletPointerEraser = NX_TABLET_POINTER_ERASER + 0
};
kInkTabletPointerUnknownThe type of tablet pointer is unknown; having an unknown type of tablet pointer should not happen.
Available in Mac OS X v10.4 and later.
Declared in Ink.h
kInkTabletPointerPenThe writing end of a stylus-like device.
Available in Mac OS X v10.4 and later.
Declared in Ink.h
kInkTabletPointerCursorAny puck-like device.
Available in Mac OS X v10.4 and later.
Declared in Ink.h
kInktabletPointerEraserThe eraser end of a stylus-like device.
Pens used with modern graphics tablets often have a writing
tip and an eraser tip. Some tablets also support pucks in addition
to, or instead of, stylus-like devices. By comparing these constants
to the contents of the pointerType element
of a TabletProximityRec in Carbon
or to the value returned by the pointerType message
to tablet events (or mouse events with tablet data in them) in Cocoa,
you can determine what kind of pointer device and which tip of a
stylus-like device is being used with a graphics tablet. These pointerType data
are only available in tablet-proximity events (not tablet-point
events).
To ensure consistency between the values used by driver writers
and the values used by applications, these constants are defined
in terms of NX_ constants
from IOKit/hidsystem/IOLLEvent.h.
There are no results codes specific to Ink Services. Rather
than returning OSStatus values, functions
return NULL or specific,
predetermined invalid responses when you pass invalid parameters
to them. Designing the API in this way allows you to chain function
calls and write code that is more compact.
Last updated: 2006-01-10