cello.tablet
Class JTabletCursor

java.lang.Object
  extended by cello.tablet.JTabletCursor

public class JTabletCursor
extends java.lang.Object

Object representation of a physical cursor on the tablet.

For each input of a stylus, mouse, airbrush, etc. on the tablet, a separate JTabletCursor object is created. The same stylus could have multiple JTabletCursor objects associated. They should have the same physicalId, assuming the tablet supports this feature.

For example, the pen tip, and eraser will be separate JTabletCursor objects, but getPhysicalId() on both will return the same value.

  if (jtablet.hasCursor()) {
      JTabletCursor cursor = jtablet.getCursor();
      setPosition(cursor.getData(JTabletCursor.DATA_X), cursor.getData(JTabletCursor.DATA_Y));
  }
 

Since:
0.9.1
See Also:
JTablet, JTabletException

Field Summary
static int DATA_ARRAY_SIZE
          Data type ID for getting the maximum number of data types.
static int DATA_BUTTONS
          Data type ID for getting the bitmask of buttons for this cursor.
static int DATA_CURSOR
          Data type ID for getting the cursor id of this cursor.
static int DATA_ORIENTATION_ALTITUDE
          Data type ID for getting orientation altitude angle for this cursor (between 90 and 0 degrees, although physical range may be less).
static int DATA_ORIENTATION_AZIMUTH
          Data type ID for getting orientation azimuth for this cursor (full 360 degrees clockwise rotation about the z axis).
static int DATA_ORIENTATION_TWIST
          Data type ID for getting orientation twist angle for this cursor (clockwise rotation about the cursor's major access).
static int DATA_PRESSURE
          Data type ID for getting pressure value for this cursor.
static int DATA_ROTATION_PITCH
          Data type ID for getting orientation rotation pitch (currently unsupported).
static int DATA_ROTATION_ROLL
          Data type ID for getting orientation rotation roll (currently unsupported).
static int DATA_ROTATION_YAW
          Data type ID for getting orientation rotation yaw (currently unsupported).
static int DATA_TANGENT_PRESSURE
          Data type ID for getting the tangent pressure for this cursor (airbrush fingerwheel).
static int DATA_X
          Data type ID for getting x position for this cursor.
static int DATA_Y
          Data type ID for getting y position for this cursor.
static int DATA_Z
          Data type ID for getting z position for this cursor.
static int TYPE_4DMOUSE
          4-D Mouse specific cursor type.
static int TYPE_AIRBRUSH
          Airbrush specific cursor type.
static int TYPE_LENS_CURSOR
          2D Mouse specific cursor type.
static int TYPE_PEN_ERASER
          Pen eraser cursor type.
static int TYPE_PEN_TIP
          Pen tip cursor type.
static int TYPE_PUCK
          Puck cursor type.
static int TYPE_STYLUS
          Stylus specific cursor type.
static int TYPE_UNKNOWN
          Unknown Cursor Type.
 
Method Summary
 long getCursorTime()
          Retrieves the time of the last poll.
 int getCursorType()
          Retrieves the general type of this cursor.
 int getCursorTypeSpecific()
          Retrieves the specific type of this cursor.
 int getData(int type)
          Retrieves the raw integer data for the specified DATA_XXX type.
 float getDataFloat(int type)
          A helper function that returns a percentage based on minimum, maximum, and current value.
 int getDataMaximum(int type)
          Retrieves the tablet's maximum value for the specified data type.
 int getDataMinimum(int type)
          Retrieves the tablet's minimum value for the specified data type.
 java.lang.String getName()
          Retrieves the name generated by the tablet driver.
 int getPhysicalId()
          Retrieves the 32bit physicalId of this cursor from tablet driver.
 int getPressure()
          A helper function that returns the translated raw pressure.
 int getPressureExtent()
          A helper function that returns the maximum pressure.
 float getPressureFloat()
          A helper function that returns a percentage based pressure range.
 boolean isDataSupported(int type)
          Returns if a specified data type is supported by the cursor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATA_CURSOR

public static final int DATA_CURSOR
Data type ID for getting the cursor id of this cursor.

See Also:
Constant Field Values

DATA_BUTTONS

public static final int DATA_BUTTONS
Data type ID for getting the bitmask of buttons for this cursor.

See Also:
Constant Field Values

DATA_X

public static final int DATA_X
Data type ID for getting x position for this cursor.

See Also:
Constant Field Values

DATA_Y

public static final int DATA_Y
Data type ID for getting y position for this cursor.

See Also:
Constant Field Values

DATA_Z

public static final int DATA_Z
Data type ID for getting z position for this cursor.

See Also:
Constant Field Values

DATA_PRESSURE

public static final int DATA_PRESSURE
Data type ID for getting pressure value for this cursor.

See Also:
Constant Field Values

DATA_TANGENT_PRESSURE

public static final int DATA_TANGENT_PRESSURE
Data type ID for getting the tangent pressure for this cursor (airbrush fingerwheel).

See Also:
Constant Field Values

DATA_ORIENTATION_AZIMUTH

public static final int DATA_ORIENTATION_AZIMUTH
Data type ID for getting orientation azimuth for this cursor (full 360 degrees clockwise rotation about the z axis).

See Also:
Constant Field Values

DATA_ORIENTATION_ALTITUDE

public static final int DATA_ORIENTATION_ALTITUDE
Data type ID for getting orientation altitude angle for this cursor (between 90 and 0 degrees, although physical range may be less). Also, this number will be negative if the eraser is being used.

See Also:
Constant Field Values

DATA_ORIENTATION_TWIST

public static final int DATA_ORIENTATION_TWIST
Data type ID for getting orientation twist angle for this cursor (clockwise rotation about the cursor's major access).

See Also:
Constant Field Values

DATA_ROTATION_PITCH

public static final int DATA_ROTATION_PITCH
Data type ID for getting orientation rotation pitch (currently unsupported).

See Also:
Constant Field Values

DATA_ROTATION_ROLL

public static final int DATA_ROTATION_ROLL
Data type ID for getting orientation rotation roll (currently unsupported).

See Also:
Constant Field Values

DATA_ROTATION_YAW

public static final int DATA_ROTATION_YAW
Data type ID for getting orientation rotation yaw (currently unsupported).

See Also:
Constant Field Values

DATA_ARRAY_SIZE

public static final int DATA_ARRAY_SIZE
Data type ID for getting the maximum number of data types.

See Also:
Constant Field Values

TYPE_UNKNOWN

public static final int TYPE_UNKNOWN
Unknown Cursor Type.

See Also:
getCursorType(), getCursorTypeSpecific(), Constant Field Values

TYPE_PEN_TIP

public static final int TYPE_PEN_TIP
Pen tip cursor type. (A cursor's tip.)

See Also:
getCursorType(), Constant Field Values

TYPE_PEN_ERASER

public static final int TYPE_PEN_ERASER
Pen eraser cursor type. (A cursor's eraser.)

See Also:
getCursorType(), Constant Field Values

TYPE_PUCK

public static final int TYPE_PUCK
Puck cursor type. (A mouse, lens cursor, or similar.)

See Also:
getCursorType(), Constant Field Values

TYPE_STYLUS

public static final int TYPE_STYLUS
Stylus specific cursor type. (A regular stylus pen.)

See Also:
getCursorTypeSpecific(), Constant Field Values

TYPE_AIRBRUSH

public static final int TYPE_AIRBRUSH
Airbrush specific cursor type. (A airbrush stylus, supporting tangent pressure.)

See Also:
getCursorTypeSpecific(), Constant Field Values

TYPE_4DMOUSE

public static final int TYPE_4DMOUSE
4-D Mouse specific cursor type. (A mouse with extended buttons and the ability to retrieve rotation.)

See Also:
getCursorTypeSpecific(), Constant Field Values

TYPE_LENS_CURSOR

public static final int TYPE_LENS_CURSOR
2D Mouse specific cursor type. (A regular mouse.)

See Also:
getCursorTypeSpecific(), Constant Field Values
Method Detail

getName

public java.lang.String getName()
Retrieves the name generated by the tablet driver. This may be null.

Returns:
the name

getPhysicalId

public int getPhysicalId()
Retrieves the 32bit physicalId of this cursor from tablet driver. This may be 0.

Returns:
the id int

getCursorType

public int getCursorType()
Retrieves the general type of this cursor. Possible values are: TYPE_UNKNOWN, TYPE_PEN_TIP, TYPE_PEN_ERASER, TYPE_PUCK.

Returns:
the type

getCursorTypeSpecific

public int getCursorTypeSpecific()
Retrieves the specific type of this cursor. Possible values are: TYPE_UNKNOWN, TYPE_STYLUS, TYPE_AIRBRUSH, TYPE_4DMOUSE, TYPE_LENS_CURSOR.

Returns:
the type

getCursorTime

public long getCursorTime()
Retrieves the time of the last poll. This number isn't necessarily related to System.currentTimeMillis().

Returns:
the time in milliseconds
Since:
0.9.2

getData

public int getData(int type)
Retrieves the raw integer data for the specified DATA_XXX type. You will most likely want to use getDataMaximum and getDataMinimum to find out the range for these raw values.

Parameters:
type - A JTabletCursor.DATA_XXX... constant.
Returns:
the raw data
See Also:
getDataMaximum(int), getDataMinimum(int)

getDataMaximum

public int getDataMaximum(int type)
Retrieves the tablet's maximum value for the specified data type.

Parameters:
type - A JTabletCursor.DATA_XXX... constant.
Returns:
the maximum value

getDataMinimum

public int getDataMinimum(int type)
Retrieves the tablet's minimum value for the specified data type.

Parameters:
type - A JTabletCursor.DATA_XXX... constant.
Returns:
the minimum value

isDataSupported

public boolean isDataSupported(int type)
Returns if a specified data type is supported by the cursor. As of version 0.9.1, this information is not specific to the actual cursor, and a return value of true, does not guarantee that the cursor or tablet actually supports this value.

Parameters:
type - A JTabletCursor.DATA_XXX... constant.
Returns:
if specified data type is supported

getPressure

public final int getPressure()
A helper function that returns the translated raw pressure. This uses the following code:
   getData(DATA_PRESSURE)-getDataMinimum(DATA_PRESSURE)
 

Returns:
the pressure range starting at 0 and going to JTabletCursor.getPressureExtent()-1
See Also:
getPressureFloat(), getPressureExtent()

getPressureExtent

public final int getPressureExtent()
A helper function that returns the maximum pressure. This uses the following code:
   getDataMaximum(DATA_PRESSURE)-getDataMinimum(DATA_PRESSURE)
 

Returns:
the maximum pressure value
See Also:
getPressure()

getPressureFloat

public final float getPressureFloat()
A helper function that returns a percentage based pressure range. This uses the following code:
   ((float)getPressure())/getPressureExtent();
 

Returns:
the pressure range as a float [0,1]
See Also:
getPressure(), getPressureExtent()

getDataFloat

public final float getDataFloat(int type)
A helper function that returns a percentage based on minimum, maximum, and current value.

Parameters:
type - A JTabletCursor.DATA_XXX... constant.
Returns:
the value range as a float [0,1]