public class Tablet extends Object
void penLevelEventMethod(Tablet tablet) {
println(tablet.getPressure());
}
Modifier and Type | Field and Description |
---|---|
static int |
CURSOR
Constant to identify the mouse.
|
static int |
ERASER
Constant to identify the erasing tip of the pen.
|
static int |
STYLUS
Constant to identify the drawing tip of the pen.
|
static int |
UNDEFINED
Constant to identify an unknown pen kind.
|
static String |
VERSION |
Constructor and Description |
---|
Tablet(PApplet parent)
The class constructor that takes the parent Processing applet as parameter
to initialize the pen manager.
|
Modifier and Type | Method and Description |
---|---|
float |
getAltitude()
Returns the current altitude of the pen.
|
float |
getAzimuth()
Returns the current x azimuth of the pen.
|
void |
getAzimuthXAndAltitude(float[] azimuthXAndAltitude)
Calculates the current x azimuth and altitude values and return them in the
azimuthXAndAltitude array.
|
int |
getPenKind()
Returns the current pen kind: CURSOR is the mouse, STYLUS is the drawing
tip of the pen and ERASER is the eraser tip of the pen.
|
float |
getPenX()
Returns the current X position of the pen.
|
float |
getPenY()
Returns the current Y position of the pen.
|
float |
getPressure()
Returns the current pressure.
|
float |
getRotation()
Returns pen rotation.
|
float |
getSavedAltitude()
Returns the saved altitude of the pen.
|
float |
getSavedAzimuth()
Returns the saved x azimuth of the pen.
|
void |
getSavedAzimuthXAndAltitude(float[] azimuthXAndAltitude)
Calculates the x azimuth and altitude values using the saved tablet state
and return them in the azimuthXAndAltitude array.
|
float |
getSavedPenX()
Returns the saved X position of the pen.
|
float |
getSavedPenY()
Returns the saved Y position of the pen.
|
float |
getSavedPressure()
Returns the saved pressure.
|
float |
getSavedRotation()
Returns the saved rotation.
|
float |
getSavedSidePressure()
Returns the saved side pressure.
|
float |
getSavedTiltX()
Returns the saved X tilt of the pen.
|
float |
getSavedTiltY()
Returns the saved Y tilt of the pen.
|
float |
getSidePressure()
Barrel button or wheel.
|
float |
getTiltX()
Returns the current X tilt of the pen.
|
float |
getTiltY()
Returns the current Y tilt of the pen.
|
boolean |
isCenterDown()
Returns true if there is the center button is currently pressed.
|
boolean |
isDown()
Returns true if there is any button being currently pressed.
|
boolean |
isLeftDown()
Returns true if there is the left button is currently pressed.
|
boolean |
isMovement()
Returns true if a level event has occurred, meaning that a change in
pressure, position or tilt has been detected.
|
boolean |
isRightDown()
Returns true if there is the right button is currently pressed.
|
void |
penButtonEvent(PButtonEvent ev)
Invokes penButtonEventMethod in the Processing applet (if exists) when a
button event occurs.
|
void |
penKindEvent(PKindEvent ev)
Invokes penKindEventMethod in the Processing applet (if exists) when a kind
event occurs.
|
void |
penLevelEvent(PLevelEvent ev)
Invokes penLevelEventMethod in the Processing applet (if exists) when a
level event occurs.
|
void |
penScrollEvent(PScrollEvent ev)
Invokes penScrollEventMethod in the Processing applet (if exists) when a
scroll event occurs.
|
void |
penTock(long availableMillis) |
void |
saveState()
Saves the current state of the pen.
|
public static final String VERSION
public static final int UNDEFINED
public static final int CURSOR
public static final int STYLUS
public static final int ERASER
public Tablet(PApplet parent)
parent
- PAppletpublic float getPressure()
public float getPenX()
public float getPenY()
public float getTiltX()
public float getTiltY()
public float getSidePressure()
public float getRotation()
public float getAzimuth()
public float getAltitude()
public void getAzimuthXAndAltitude(float[] azimuthXAndAltitude)
azimuthXAndAltitude
- float[]public boolean isMovement()
public int getPenKind()
public boolean isDown()
public boolean isCenterDown()
public boolean isLeftDown()
public boolean isRightDown()
public void saveState()
public float getSavedPressure()
public float getSavedPenX()
public float getSavedPenY()
public float getSavedTiltX()
public float getSavedSidePressure()
public float getSavedRotation()
public float getSavedTiltY()
public float getSavedAzimuth()
public float getSavedAltitude()
public void getSavedAzimuthXAndAltitude(float[] azimuthXAndAltitude)
azimuthXAndAltitude
- float[]public void penButtonEvent(PButtonEvent ev)
ev
- PButtonEventpublic void penKindEvent(PKindEvent ev)
ev
- PKindEventpublic void penLevelEvent(PLevelEvent ev)
ev
- PLevelEventpublic void penScrollEvent(PScrollEvent ev)
ev
- PScrollEventpublic void penTock(long availableMillis)
Processing library Tablet by Andres Colubri. (c) 2008-13