|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcodeanticode.protablet.Tablet
public class Tablet
This class extends the PenListener class of the JPen library by adding getter methods
to retrieve the pen values (position, pressure, tilt, pressed buttons, etc.). It also
defines event methods that are called inside the Processing sketch when tablet events
such as pressure or position changes occur. These methods are penButtonEventMethod,
penKindEventMethod, penLevelEventMethod and penScrollEventMethod, and always pass as
parameter the Tablet object generating the event:
void penLevelEventMethod(Tablet tablet) {
println(tablet.getPressure());
}
However, these methods don't need to be implemented.
For more details about the JPen library, check the
JPen website.
Field Summary | |
---|---|
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. |
Constructor Summary | |
---|---|
Tablet(processing.core.PApplet parent)
The class constructor that takes the parent Processing applet as parameter to initialize the pen manager. |
Method Summary | |
---|---|
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 |
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 |
getSavedTiltX()
Returns the saved X tilt of the pen. |
float |
getSavedTiltY()
Returns the saved Y tilt of the pen. |
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. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int UNDEFINED
public static final int CURSOR
public static final int STYLUS
public static final int ERASER
Constructor Detail |
---|
public Tablet(processing.core.PApplet parent)
parent
- PAppletMethod Detail |
---|
public float getPressure()
public float getPenX()
public float getPenY()
public float getTiltX()
public float getTiltY()
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 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)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |