de.enough.polish.processing
Interface ProcessingInterface

All Known Implementing Classes:
ProcessingContext

public interface ProcessingInterface

This interface defines all the methods required to write a standalone Mobile Processing implementation which can be integrated with J2ME Polish. The methods defined within include the Mobile Processing methods as defined by the specs, extension methods specific to J2ME Polish and a set of system methods to be used for integrating J2ME Polish and the Mobile Processing implementation.

Author:
Ovidiu Iliescu

Field Summary
static int CENTER
           
static int CENTER_RADIUS
           
static int CORNER
           
static int CORNERS
           
static int DOWN
           
static int FACE_MONOSPACE
           
static int FACE_PROPORTIONAL
           
static int FACE_SYSTEM
           
static int FIRE
           
static int GAME_A
           
static int GAME_B
           
static int GAME_C
           
static int GAME_D
           
static int HSB
           
static int LEFT
           
static int LINE_LOOP
           
static int LINE_STRIP
           
static int LINES
           
static int POINTS
           
static int POLYGON
           
static Vector processingContextObjects
          A vector that keeps track of all objects that implement ProcessingInterface.
static int QUAD_STRIP
           
static int QUADS
           
static int RGB
           
static int RIGHT
           
static int SEND
           
static int SIZE_LARGE
           
static int SIZE_MEDIUM
           
static int SIZE_SMALL
           
static int SOFTKEY1
           
static int SOFTKEY2
           
static int STYLE_BOLD
           
static int STYLE_ITALIC
           
static int STYLE_PLAIN
           
static int STYLE_UNDERLINED
           
static int TRIANGLE_STRIP
           
static int TRIANGLES
           
static int UP
           
 
Method Summary
 int abs(int value)
          Calculates the absolute value (magnitude) of a number.
 boolean[] append(boolean[] array, boolean element)
          Expands an array by one element and adds data to the new position.
 byte[] append(byte[] array, byte element)
          Expands an array by one element and adds data to the new position.
 char[] append(char[] array, char element)
          Expands an array by one element and adds data to the new position.
 double[] append(double[] array, double element)
          Expands an array by one element and adds data to the new position.
 float[] append(float[] array, float element)
          Expands an array by one element and adds data to the new position.
 int[] append(int[] array, int element)
          Expands an array by one element and adds data to the new position.
 String[] append(String[] array, String element)
          Expands an array by one element and adds data to the new position.
 boolean areKeypressesCaptured()
          Checks if keypress events should be captured and handled solely by the Mobile Processing implementation, or if they should also be bubbled up to the parent container and above.
 boolean arePointerEventsCaptured()
          Checks if pointer events should be captured and handled solely by the Mobile Processing implementation, or if they should also be bubbled up to the parent container and above.
 boolean areSoftkeysCaptured()
          Checks if softkey presses should be captured and handled solely by the Mobile Processing implementation, or if they should also be bubbled up to the parent container and above.
 double atan(double value1)
          Returns the arc tangent of a value.
 int atan(int value1)
          Returns the arc tangent of a value.
 int atan2(int x, int y)
          Calculates the angle (in radians) from a specified point to the coordinate origin as measured from the positive x-axis.
 double atan2d(int x, int y)
          Calculates the angle (in radians) from a specified point to the coordinate origin as measured from the positive x-axis.
 void background(color color)
          Sets the color to use as a background color.
 void background(int gray)
          Sets the shade of gray to be used as a background color.
 void background(int value1, int value2, int value3)
          Sets the color to use as a background color.
 void background(PImage img)
          Sets the image to be used as a background.
 void beginShape(int mode)
          Using the beginShape() and endShape() functions allow creating more complex forms.
 void bezier(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
          Draws a Bezier curve on the screen.
 void bezierVertex(int x1, int y1, int x2, int y2, int x3, int y3)
          Specifies vertex coordinates for Bezier curves.
 void captureKeyPresses()
          Signals that keypress events should be captured (such events should not be bubbled to the parent container and above anymore).
 void capturePointerEvents()
          Signals that pointer events should be captured (such events should not be bubbled to the parent container and above anymore).
 void captureSoftkeys()
          Signals that softkey presses should be captured (such events should not be bubbled to the parent container and above anymore).
 int ceil(int value1)
          Calculates the closest int fixed point value that is greater than or equal to the fixed point value of the parameter.
 boolean checkForRefresh()
          Checks if a refresh is needed since the last time the function was called.
 color color(int gray)
          Creates colors for storing in variables of the color datatype.
 color color(int gray, int alpha)
          Creates colors for storing in variables of the color datatype.
 color color(int value1, int value2, int value3, int alpha)
          Creates colors for storing in variables of the color datatype.
 void colorMode(int mode)
          Changes the way Processing interprets color data (by using either the RGB or the HSB color spaces).
 void colorMode(int mode, int range)
          Changes the way Processing interprets color data (by using either the RGB or the HSB color spaces).
 void colorMode(int mode, int range1, int range2, int range3)
          Changes the way Processing interprets color data (by using either the RGB or the HSB color spaces).
 boolean[] concat(boolean[] array1, boolean[] array2)
          Concatenates two arrays.
 byte[] concat(byte[] array1, byte[] array2)
          Concatenates two arrays.
 char[] concat(char[] array1, char[] array2)
          Concatenates two arrays.
 int[] concat(int[] array1, int[] array2)
          Concatenates two arrays.
 String[] concat(String[] array1, String[] array2)
          Concatenates two arrays.
 int constrain(int value, int min, int max)
          Constrains a value to not exceed a maximum and minimum value.
 boolean[] contract(boolean[] array, int newSize)
          Decreases the size of an array
 byte[] contract(byte[] array, int newSize)
          Decreases the size of an array
 char[] contract(char[] array, int newSize)
          Decreases the size of an array
 int[] contract(int[] array, int newSize)
          Decreases the size of an array
 String[] contract(String[] array, int newSize)
          Decreases the size of an array
 int cos(int rad)
          Calculates the cosine of an angle.
 double cosd(double rad)
          Calculates the cosine of an angle.
 int currentMemory()
          Returns an estimate of the current amount of free memory in the system, in bytes.
 void curve(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
          Draws a curved line on the screen.
 void curveVertex(int x, int y)
          Specifies vertex coordinates for curves.
 int day()
          The day() function returns the current day as a value from 1 - 31.
 void destroy()
          Event handler that is called once when the sketch is about to be ended.
 void disableFastDrawing()
          Disable fast drawing.
 int dist_fp(int x1, int y1, int x2, int y2)
          Calculates the distance between two points, with coordinates specified as fixed-point numbers.
 int dist(int x1, int y1, int x2, int y2)
          Calculates the distance between two points, with coordinates specified as integer numbers.
 int div(int dividend, int divisor)
          Divides the value of the second fixed point parameter by the value of the first fixed point parameter.
 void dontRepaintBackground()
          Stops repainting the background between frames.
 void draw()
          Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called.
 void ellipse(int x, int y, int width, int height)
          Draws an ellipse (oval) in the display window.
 void ellipseMode(int mode)
          The origin of the ellipse is modified by the ellipseMode() function.
 void enableFastDrawing()
          Enables fast drawing.
 void endShape()
          The endShape() function is the companion to beginShape() and may only be called after the later.
 void executeInitializationSequence()
          Starts the initialization sequence ( calls setup() and other initialization-related tasks )
 void executeRefresh(boolean alsoUpdateLastFrameTime)
          Executes a forced refresh by calling draw().
 void exit()
          Call this function to stop running your sketch.
 boolean[] expand(boolean[] array)
          Doubles the size of an array.
 boolean[] expand(boolean[] array, int newSize)
          Increases the size of an array to the specified size
 byte[] expand(byte[] array)
          Doubles the size of an array.
 byte[] expand(byte[] array, int newSize)
          Increases the size of an array to the specified size
 char[] expand(char[] array)
          Doubles the size of an array.
 char[] expand(char[] array, int newSize)
          Increases the size of an array to the specified size
 int[] expand(int[] array)
          Doubles the size of an array.
 int[] expand(int[] array, int newSize)
          Increases the size of an array to the specified size
 String[] expand(String[] array)
          Doubles the size of an array.
 String[] expand(String[] array, int newSize)
          Increases the size of an array to the specified size
 void fill(color color)
          Sets the color used to fill shapes.
 void fill(int gray)
          Sets the shade of gray to be used to fill shapes.
 void fill(int value1, int value2, int value3)
          Sets the color used to fill shapes.
 int floor(int value1)
          Calculates the closest int fixed point value that is less than or equal to the fixed point value of the parameter.
 void focus()
          Event handler for the "has focus" event.
 int fptoi(int value1)
          Returns the largest integer less than or equal to the specified fixed point value.
 void framerate(int framerate)
          Specifies the number of frames to be displayed every second.
 Image getBuffer()
          Returns the image buffer of the Mobile Processing implementation
 long getIntervalBetweenFrames()
          Returns the time (in milliseconds) between two consecutive frames.
 long getLastFrameTime()
          Returns the system time at which the last frame was drawn
 String getSoftkeyLabel()
          Returns the label of the softkey set via softkey(), if any, or null for none.
 int getTransparentColor()
          Returns the current transparent color (pixels of this color will be replaced with transparent ones when calling getTransparentRgbImage()).
 RgbImage getTransparentRgbImage()
          Returns the image buffer as an RgbImage, with transparency applied to it.
 int hour()
          The hour() function returns the current hour as a value from 0 - 23.
 void image(PImage img, int x, int y)
          Draws images to the screen.
 void image(PImage img, int sx, int sy, int swidth, int sheight, int dx, int dy)
          Diplays images to the screen.
 void imageMode(int mode)
          The mode to use when displaying images
 boolean isDrawingTransparent()
          Checks if transparent drawing is active or not
 boolean isLooping()
          Checks if the Processing draw() routine is called in a loop or not.
 int itofp(int value1)
          Returns the fixed point representation of the specified integer value.
 String join(int[] anyArray, String separator)
          Combines an array of elements into one String.
 String join(int[] intArray, String separator, int digits)
          Combines an array of elements into one String and pads each number with zeroes until it has the specified number of digits.
 String join(String[] anyArray, String separator)
          Combines an array of elements into one String.
 void keyPressed()
          Event handler for when a regular key is pressed.
 void keyReleased()
          Event handler for when a regular key is released.
 int length(boolean[] array)
          Returns the length, or size, of an array.
 int length(byte[] array)
          Returns the length, or size, of an array.
 int length(char[] array)
          Returns the length, or size, of an array.
 int length(int[] array)
          Returns the length, or size, of an array.
 int length(Object[] array)
          Returns the length, or size, of an array.
 void line(int x1, int y1, int x2, int y2)
          Draws a line (a direct path between two points) to the screen.
 byte[] loadBytes(String filename)
          Reads the contents of a file and places it in a byte array.
 PFont loadFont()
          Loads the default font as a PFont object.
 PFont loadFont(int face, int style, int size)
          Load the system font which best corresponds to the specified parameters
 PFont loadFont(String fontname)
          Loads a J2ME Polish bitmap font into a variable of type PFont.
 PFont loadFont(String fontname, color fgColor)
          Loads a J2ME Polish bitmap font into a variable of type PFont.
 PFont loadFont(String fontname, color fgColor, color bgColor)
          Loads a J2ME Polish bitmap font into a variable of type PFont.
 PImage loadImage(byte[] data)
          Loads an image into a variable of type PImage.
 PImage loadImage(String filename)
          Loads an image into a variable of type PImage.
 String[] loadStrings(String filename)
          Reads the contents of a file and creates a String array of its individual lines.
 void loop()
          Causes Processing to continuously execute the code within draw().
 void lostFocus()
          Event handler for the "lost focus" event.
 int max(int value1, int value2)
          Returns the maximum of two numbers
 int millis()
          Returns the number of milliseconds (thousandths of a second) since starting an applet.
 int min(int value1, int value2)
          Returns the minimum of two numbers
 int minute()
          The minute() function returns the current minute as a value from 0 - 59.
 int month()
          The month() function returns the current month as a value from 1 - 12.
 int mul(int value1, int value2)
          Multiplies two fixed point values and returns a fixed point value.
 void multitap()
          The multitap function will turn on multitap text input.
 void multitapClear()
          The multitapClear function will clear the multitap input buffer.
 void multitapDeleteChar()
          The multitapDeleteChar function will delete one character from the multitap buffer at the current index.
 String nf(int intValue, int digits)
          Utility function for formatting numbers into strings (with padding).
 String nfp(int intValue, int digits)
          Utility function for formatting numbers into strings.
 void noFill()
          Disables filling geometry.
 void noLoop()
          Stops Processing from continuously executing the code within draw().
 void noMultitap()
          The noMultitap function will turn off multitap text input.
 void noStroke()
          Disables drawing the stroke (outline).
 void opaqueDrawing()
          Deactivates transparent drawing.
 InputStream openStream(String fileName)
          Simplified method to open a Java InputStream.
 void point(int x, int y)
          Draws a point on the screen
 void pointerDragged()
          Event handler for when the pointer is dragged across the screen.
 void pointerPressed()
          Event handler for when the pointer is pressed.
 void pointerReleased()
          Event handler for when the pointer has been released (after a press).
 void popMatrix()
          Pops the current transformation matrix off the matrix stack.
 int pow(int base, int exponent)
          Raises a number to a given power.
 void print(boolean data)
          Outputs the given data to the console.
 void print(byte data)
          Outputs the given data to the console.
 void print(char data)
          Outputs the given data to the console.
 void print(int data)
          Outputs the given data to the console.
 void print(Object data)
          Outputs the given data to the console.
 void print(String data)
          Outputs the given data to the console.
 void println(boolean data)
          Outputs the given data to the console, creating a new line of text.
 void println(byte data)
          Outputs the given data to the console, creating a new line of text.
 void println(char data)
          Outputs the given data to the console, creating a new line of text.
 void println(int data)
          Outputs the given data to the console, creating a new line of text.
 void println(Object data)
          Outputs the given data to the console, creating a new line of text.
 void println(String data)
          Outputs the given data to the console, creating a new line of text.
 void pushMatrix()
          Pushes the current transformation matrix onto the matrix stack.
 void quad(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
          A quad is a quadrilateral, a four sided polygon.
 int radians(int angle)
          Converts a degree fixed point value measurement to its corresponding fixed point value in radians.
 double random(double value)
          Generates a random number between 0 and the specified maximum number, excluding the specified number.
 int random(int value)
          Generates a random number between 0 and the specified maximum number, excluding the specified number.
 int random(int value1, int value2)
          Generates a random number in the specified interval.
 void rect(int x, int y, int width, int height)
          Draws a rectangle to the screen.
 void rectMode(int mode)
          Modifies the location from which rectangles draw.
 void redraw()
          Executes the code within draw() one time.
 void releaseKeyPresses()
          Releases keypress events (resumes bubbling of such events to the parent container and above).
 void releasePointerEvents()
          Releases pointer events (resumes bubbling of such events to the parent container and above).
 void releaseSoftkeys()
          Releases softkey events (resumes bubbling of such events to the parent container and above).
 void repaintBackground()
          Starts/resumes repainting the background between frames.
 int reportedMemory()
          Returns the reported total amount of memory available.
 void resetMatrix()
          Replaces the current matrix with the identity matrix.
 void resume()
          Event handler that is called once when the application has resumed.
 boolean[] reverse(boolean[] array)
          Reverses an array
 byte[] reverse(byte[] array)
          Reverses an array
 char[] reverse(char[] array)
          Reverses an array
 int[] reverse(int[] array)
          Reverses an array
 String[] reverse(String[] array)
          Reverses an array
 int round(int value1)
          Calculates the integer fixed point value closest to the fixed point value parameter.
 void saveBytes(String filename, byte[] data)
          Opposite of loadBytes(), will write an entire array of bytes to a file.
 void saveStrings(String filename, String[] strings)
          Writes an array of strings to a file, one line per string.
 int second()
          The second() function returns the current second as a value from 0 - 59.
 void setKeyAndKeyCode(char key, int keyCode)
          Sets the key and keyCode variables (which correspond to the last active key) to the given values.
 void setParent(ProcessingContextContainerInterface parent)
          Sets the parent container of the Mobile Processing implementation
 void setPointerCoordinates(int x, int y)
          Sets the pointer coordinates to the given values.
 void setTransparentColor(color color)
          Sets the transparent color to be used with getTransparentRgbImage().
 void setTransparentColor(int gray)
          Sets the transparent color to be used with getTransparentRgbImage().
 void setTransparentColor(int value1, int value2, int value3)
          Sets the transparent color to be used with getTransparentRgbImage().
 void setup()
          Called once when the program is started and every time the size of the sketch changes (eg: when the phone is switched from portrait to landscape).
 boolean[] shorten(boolean[] array)
          Decreases an array by one element and returns the shortened array.
 byte[] shorten(byte[] array)
          Decreases an array by one element and returns the shortened array.
 char[] shorten(char[] array)
          Decreases an array by one element and returns the shortened array.
 int[] shorten(int[] array)
          Decreases an array by one element and returns the shortened array.
 String[] shorten(String[] array)
          Decreases an array by one element and returns the shortened array.
 void signalApplicationResume()
          Signals to the Mobile Processing implementation that the application has been resumed.
 void signalApplicationSuspend()
          Signals to the Mobile Processing implementation that the application is about to be suspended.
 void signalDestroy()
          Signals to the Mobile Processing implementation that it is about to be destroyed.
 void signalHasFocus()
          Signals to the Mobile Processing implementation that it has focus.
 void signalInitialization()
          Signals to the Mobile Processing implementation that it must initialize itself.
 void signalKeyPressed(int keyCode)
          Signals to the Mobile Processing implementation that a key has been pressed
 void signalKeyReleased(int keyCode)
          Signals to the Mobile Processing implementation that a key has been released
 void signalLostFocus()
          Signals to the Mobile Processing implementation that it lost focus
 void signalPointerDragged(int x, int y)
          Signals a pointer dragged event to the Mobile Processing implementation.
 void signalPointerPressed(int x, int y)
          Signals a pointer pressed event to the Mobile Processing implementation.
 void signalPointerReleased(int x, int y)
          Signals a pointer released event to the Mobile Processing implementation.
 void signalSizeChange(int width, int height)
          Signals a size change to the Mobile Processing implementation
 void signalSoftkeyPressed(String label)
          Signals to the Mobile Processing implementation that a softkey has been pressed.
 int sin(int rad)
          Calculates the sine of an angle.
 double sind(double rad)
          Calculates the sine of an angle.
 void softkey(String label)
          The softkey() function sets up a custom labelled softkey.
 void softkeyPressed(String label)
          Event handler for sofkey presses.
 boolean[] splice(boolean[] array, boolean[] array2, int index)
          Inserts an array into antoher array.
 boolean[] splice(boolean[] array, boolean value, int index)
          Insert a value into an existing array
 byte[] splice(byte[] array, byte[] array2, int index)
          Inserts an array into antoher array.
 byte[] splice(byte[] array, byte value, int index)
          Insert a value into an existing array
 char[] splice(char[] array, char[] array2, int index)
          Inserts an array into antoher array.
 char[] splice(char[] array, char value, int index)
          Insert a value into an existing array
 int[] splice(int[] array, int[] array2, int index)
          Inserts an array into antoher array.
 int[] splice(int[] array, int value, int index)
          Insert a value into an existing array
 String[] splice(String[] array, String[] array2, int index)
          Inserts an array into antoher array.
 String[] splice(String[] array, String value, int index)
          Insert a value into an existing array
 String[] split(String str, char delim)
          Splits a given string into an array of strings, according to the specified delimiter
 String[] split(String str, String delim)
          Splits a given string into an array of strings, according to the specified delimiter
 int sq(int number)
          Squares a number (multiplies a number by itself).
 int sqrt(int value_fp)
          Calculates the square root of a fixed point value and returns a fixed point value.
 String str(boolean val)
          Returns a string representation of its parameter.
 String[] str(boolean[] val)
          Returns a string representation of its parameter.
 String str(byte val)
          Returns a string representation of its parameter.
 String[] str(byte[] val)
          Returns a string representation of its parameter.
 String str(char val)
          Returns a string representation of its parameter.
 String[] str(char[] val)
          Returns a string representation of its parameter.
 String str(int val)
          Returns a string representation of its parameter.
 String[] str(int[] val)
          Returns a string representation of its parameter.
 void stroke(color color)
          Sets the color used to draw lines and borders around shapes.
 void stroke(int gray)
          Sets a shade of gray to be used used to draw lines and borders around shapes.
 void stroke(int param1, int param2, int param3)
          Sets the color used to draw lines and borders around shapes.
 void strokeWeight(int width)
          Sets the width of the stroke used for lines, points, and the border around shapes.
 boolean[] subset(boolean[] array, int offset)
          Extracts a sub-array of elements from an existing array.
 boolean[] subset(boolean[] array, int offset, int length)
          Extracts a sub-array of elements from an existing array.
 byte[] subset(byte[] array, int offset)
          Extracts a sub-array of elements from an existing array.
 byte[] subset(byte[] array, int offset, int length)
          Extracts a sub-array of elements from an existing array.
 char[] subset(char[] array, int offset)
          Extracts a sub-array of elements from an existing array.
 char[] subset(char[] array, int offset, int length)
          Extracts a sub-array of elements from an existing array.
 int[] subset(int[] array, int offset)
          Extracts a sub-array of elements from an existing array.
 int[] subset(int[] array, int offset, int length)
          Extracts a sub-array of elements from an existing array.
 String[] subset(String[] array, int offset)
          Extracts a sub-array of elements from an existing array.
 String[] subset(String[] array, int offset, int length)
          Extracts a sub-array of elements from an existing array.
 void suspend()
          Event handler that is called once when the application is about to be suspended.
 void text(String text, int x, int y)
          Draws text to the screen.
 void text(String text, int x, int y, int width, int height)
          Draws text to the screen.
 void textAlign(int mode)
          Sets the current alignment for drawing text.
 void textFont(PFont font)
          Sets the current font.
 String textInput()
          The textInput function will open a new screen in which the user can input text using the native text input methods of the mobile phone (i.e.
 String textInput(String title, String text, int max)
          The textInput function will open a new screen in which the user can input text using the native text input methods of the mobile phone (i.e.
 int textWidth(String data)
          Calculates and returns the width of any character or text string.
 String[] textWrap(String data, int width)
          This function takes text in a String object and returns an array of String objects containing the text split into lines that will fit in the specified width when rendered with the current font.
 String[] textWrap(String data, int width, int height)
          This function takes text in a String object and returns an array of String objects containing the text split into lines that will fit in the box specified by the given width and height when rendered with the current font.
 void translate(int x, int y)
          Specifies an amount to displace objects within the display window.
 void transparentDrawing()
          Activates transparent drawing.
 void triangle(int x1, int y1, int x2, int y2, int x3, int y3)
          A triangle is a plane created by connecting three points.
 void triggerRepaint()
          Triggers a repaint of the Mobile Processing context and/or of its parent container.
 String trim(String str)
          Removes whitespace characters from the beginning and end of a String.
 void vertex(int x, int y)
          All shapes are constructed by connecting a series of vertices.
 int year()
          The year() function returns the current year as an integer (2003, 2004, 2005, etc).
 

Field Detail

processingContextObjects

static final Vector processingContextObjects
A vector that keeps track of all objects that implement ProcessingInterface.


RGB

static final int RGB
See Also:
Constant Field Values

HSB

static final int HSB
See Also:
Constant Field Values

POINTS

static final int POINTS
See Also:
Constant Field Values

LINES

static final int LINES
See Also:
Constant Field Values

LINE_STRIP

static final int LINE_STRIP
See Also:
Constant Field Values

LINE_LOOP

static final int LINE_LOOP
See Also:
Constant Field Values

TRIANGLES

static final int TRIANGLES
See Also:
Constant Field Values

TRIANGLE_STRIP

static final int TRIANGLE_STRIP
See Also:
Constant Field Values

QUADS

static final int QUADS
See Also:
Constant Field Values

QUAD_STRIP

static final int QUAD_STRIP
See Also:
Constant Field Values

POLYGON

static final int POLYGON
See Also:
Constant Field Values

CENTER

static final int CENTER
See Also:
Constant Field Values

CENTER_RADIUS

static final int CENTER_RADIUS
See Also:
Constant Field Values

CORNER

static final int CORNER
See Also:
Constant Field Values

CORNERS

static final int CORNERS
See Also:
Constant Field Values

UP

static final int UP
See Also:
Constant Field Values

DOWN

static final int DOWN
See Also:
Constant Field Values

LEFT

static final int LEFT
See Also:
Constant Field Values

RIGHT

static final int RIGHT
See Also:
Constant Field Values

FIRE

static final int FIRE
See Also:
Constant Field Values

GAME_A

static final int GAME_A
See Also:
Constant Field Values

GAME_B

static final int GAME_B
See Also:
Constant Field Values

GAME_C

static final int GAME_C
See Also:
Constant Field Values

GAME_D

static final int GAME_D
See Also:
Constant Field Values

SOFTKEY1

static final int SOFTKEY1
See Also:
Constant Field Values

SOFTKEY2

static final int SOFTKEY2
See Also:
Constant Field Values

SEND

static final int SEND
See Also:
Constant Field Values

FACE_SYSTEM

static final int FACE_SYSTEM
See Also:
Constant Field Values

FACE_MONOSPACE

static final int FACE_MONOSPACE
See Also:
Constant Field Values

FACE_PROPORTIONAL

static final int FACE_PROPORTIONAL
See Also:
Constant Field Values

STYLE_PLAIN

static final int STYLE_PLAIN
See Also:
Constant Field Values

STYLE_BOLD

static final int STYLE_BOLD
See Also:
Constant Field Values

STYLE_ITALIC

static final int STYLE_ITALIC
See Also:
Constant Field Values

STYLE_UNDERLINED

static final int STYLE_UNDERLINED
See Also:
Constant Field Values

SIZE_SMALL

static final int SIZE_SMALL
See Also:
Constant Field Values

SIZE_MEDIUM

static final int SIZE_MEDIUM
See Also:
Constant Field Values

SIZE_LARGE

static final int SIZE_LARGE
See Also:
Constant Field Values
Method Detail

signalSizeChange

void signalSizeChange(int width,
                      int height)
Signals a size change to the Mobile Processing implementation

Parameters:
width - the new width
height - the new height

signalPointerDragged

void signalPointerDragged(int x,
                          int y)
Signals a pointer dragged event to the Mobile Processing implementation.

Parameters:
x - the x-coordinate of the poiner
y - the y-coordinate of the pointer

signalPointerReleased

void signalPointerReleased(int x,
                           int y)
Signals a pointer released event to the Mobile Processing implementation.

Parameters:
x - the x-coordinate of the pointer
y - the y-coordinate of the pointer

signalPointerPressed

void signalPointerPressed(int x,
                          int y)
Signals a pointer pressed event to the Mobile Processing implementation.

Parameters:
x - the x-coordinate of the pointer
y - the y-coordinate of the pointer

signalSoftkeyPressed

void signalSoftkeyPressed(String label)
Signals to the Mobile Processing implementation that a softkey has been pressed.

Parameters:
label - the label of the softkey

signalKeyPressed

void signalKeyPressed(int keyCode)
Signals to the Mobile Processing implementation that a key has been pressed

Parameters:
keyCode - the keycode of the key, as reported by the JVM

signalKeyReleased

void signalKeyReleased(int keyCode)
Signals to the Mobile Processing implementation that a key has been released

Parameters:
keyCode - the keycode of the key, as reported by the JVM

signalApplicationSuspend

void signalApplicationSuspend()
Signals to the Mobile Processing implementation that the application is about to be suspended.


signalApplicationResume

void signalApplicationResume()
Signals to the Mobile Processing implementation that the application has been resumed.


signalDestroy

void signalDestroy()
Signals to the Mobile Processing implementation that it is about to be destroyed.


signalInitialization

void signalInitialization()
Signals to the Mobile Processing implementation that it must initialize itself.


signalHasFocus

void signalHasFocus()
Signals to the Mobile Processing implementation that it has focus.


signalLostFocus

void signalLostFocus()
Signals to the Mobile Processing implementation that it lost focus


getBuffer

Image getBuffer()
Returns the image buffer of the Mobile Processing implementation

Returns:
image buffer

getSoftkeyLabel

String getSoftkeyLabel()
Returns the label of the softkey set via softkey(), if any, or null for none.

Returns:
the softkey label, or null for none.

getLastFrameTime

long getLastFrameTime()
Returns the system time at which the last frame was drawn

Returns:
the last frame time, or -1 if no frames have been drawn yet.

getIntervalBetweenFrames

long getIntervalBetweenFrames()
Returns the time (in milliseconds) between two consecutive frames.

Returns:
the interval between frames, in milliseconds

checkForRefresh

boolean checkForRefresh()
Checks if a refresh is needed since the last time the function was called.

Returns:
true if a refresh should be executed, false otherwise

isLooping

boolean isLooping()
Checks if the Processing draw() routine is called in a loop or not.

Returns:
true if draw() is called in a loop, false otherwise.

setParent

void setParent(ProcessingContextContainerInterface parent)
Sets the parent container of the Mobile Processing implementation

Parameters:
parent - the parent container

setPointerCoordinates

void setPointerCoordinates(int x,
                           int y)
Sets the pointer coordinates to the given values.

Parameters:
x - the x-coordinate of the pointer
y - the y-coordinate of the pointer

setKeyAndKeyCode

void setKeyAndKeyCode(char key,
                      int keyCode)
Sets the key and keyCode variables (which correspond to the last active key) to the given values.

Parameters:
key - the key's corresponding character
keyCode - the keycode of key

executeRefresh

void executeRefresh(boolean alsoUpdateLastFrameTime)
Executes a forced refresh by calling draw().

Parameters:
alsoUpdateLastFrameTime - should the last frame time be updated also?

triggerRepaint

void triggerRepaint()
Triggers a repaint of the Mobile Processing context and/or of its parent container.


areKeypressesCaptured

boolean areKeypressesCaptured()
Checks if keypress events should be captured and handled solely by the Mobile Processing implementation, or if they should also be bubbled up to the parent container and above.

Returns:
true if keypress events should be captured, false otherwise

areSoftkeysCaptured

boolean areSoftkeysCaptured()
Checks if softkey presses should be captured and handled solely by the Mobile Processing implementation, or if they should also be bubbled up to the parent container and above.

Returns:
true if softkey presses should be captured, false otherwise

arePointerEventsCaptured

boolean arePointerEventsCaptured()
Checks if pointer events should be captured and handled solely by the Mobile Processing implementation, or if they should also be bubbled up to the parent container and above.

Returns:
true if pointer events should be captured, false otherwise

isDrawingTransparent

boolean isDrawingTransparent()
Checks if transparent drawing is active or not

Returns:
true if transparent drawing is active, false otherwise

getTransparentRgbImage

RgbImage getTransparentRgbImage()
Returns the image buffer as an RgbImage, with transparency applied to it.

Returns:
the image buffer as an RgbImage

getTransparentColor

int getTransparentColor()
Returns the current transparent color (pixels of this color will be replaced with transparent ones when calling getTransparentRgbImage()).

Returns:
the transparent color
See Also:
getTransparentRgbImage()

executeInitializationSequence

void executeInitializationSequence()
Starts the initialization sequence ( calls setup() and other initialization-related tasks )


focus

void focus()
Event handler for the "has focus" event.


lostFocus

void lostFocus()
Event handler for the "lost focus" event.


captureKeyPresses

void captureKeyPresses()
Signals that keypress events should be captured (such events should not be bubbled to the parent container and above anymore).


releaseKeyPresses

void releaseKeyPresses()
Releases keypress events (resumes bubbling of such events to the parent container and above).


captureSoftkeys

void captureSoftkeys()
Signals that softkey presses should be captured (such events should not be bubbled to the parent container and above anymore).


releaseSoftkeys

void releaseSoftkeys()
Releases softkey events (resumes bubbling of such events to the parent container and above).


capturePointerEvents

void capturePointerEvents()
Signals that pointer events should be captured (such events should not be bubbled to the parent container and above anymore).


releasePointerEvents

void releasePointerEvents()
Releases pointer events (resumes bubbling of such events to the parent container and above).


repaintBackground

void repaintBackground()
Starts/resumes repainting the background between frames.


dontRepaintBackground

void dontRepaintBackground()
Stops repainting the background between frames.


transparentDrawing

void transparentDrawing()
Activates transparent drawing.


opaqueDrawing

void opaqueDrawing()
Deactivates transparent drawing.


setTransparentColor

void setTransparentColor(color color)
Sets the transparent color to be used with getTransparentRgbImage().

Parameters:
color - the transparent color to use
See Also:
getTransparentRgbImage()

setTransparentColor

void setTransparentColor(int gray)
Sets the transparent color to be used with getTransparentRgbImage().

Parameters:
gray - the level of gray to use as a transparent color
See Also:
getTransparentRgbImage()

setTransparentColor

void setTransparentColor(int value1,
                         int value2,
                         int value3)
Sets the transparent color to be used with getTransparentRgbImage().

Parameters:
value1 - red or hue values relative to the current color range
value2 - green or saturation values relative to the current color range
value3 - blue or brightness values relative to the current color range

enableFastDrawing

void enableFastDrawing()
Enables fast drawing.


disableFastDrawing

void disableFastDrawing()
Disable fast drawing.


currentMemory

int currentMemory()
Returns an estimate of the current amount of free memory in the system, in bytes.

Returns:
free memory

reportedMemory

int reportedMemory()
Returns the reported total amount of memory available. This may change if the operating system is dynamically adjusting the amount of memory available.


framerate

void framerate(int framerate)
Specifies the number of frames to be displayed every second. If the processor is not fast enough to maintain the specified rate (for whatever reason), it will not be acheived. For example, the function call framerate(30) will attempt to refresh 30 times a second. It is recommended to set the framerate within setup().

Parameters:
framerate -

draw

void draw()
Called directly after setup() and continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called. draw() is called automatically and should never be called explicitly. It should always be controlled with noLoop(), redraw() and loop(). After noLoop() stops the code in draw() from executing, redraw() causes the code inside draw() to execute once and loop() will causes the code inside draw() to execute continuously again. The number of times draw() executes in each second may be controlled with the framerate() function. There can only be one draw() function for each sketch and draw() must exist if you want the code to run continuously. You can call redraw() from within an event handler to execute a redraw even if noLoop() is active.


redraw

void redraw()
Executes the code within draw() one time. This functions allows the program to update the display window only when necessary, for example when an event registered by keyPressed() occurs. In structuring a program, it only makes sense to call redraw() within events such as keyPressed(). Calling it within draw() has no effect because draw() is continuously called anyway.


loop

void loop()
Causes Processing to continuously execute the code within draw(). If noLoop() is called, the code in draw() stops executing.


noLoop

void noLoop()
Stops Processing from continuously executing the code within draw(). If loop() is called, the code in draw() is executed continuously


destroy

void destroy()
Event handler that is called once when the sketch is about to be ended. Save your data and do cleanup work within this event handler.


suspend

void suspend()
Event handler that is called once when the application is about to be suspended.


resume

void resume()
Event handler that is called once when the application has resumed.


setup

void setup()
Called once when the program is started and every time the size of the sketch changes (eg: when the phone is switched from portrait to landscape). Used to define initial enviroment properties background color, loading images, etc. before the draw() begins executing. Variables declared within setup() are not accessible within other functions, including draw(). There can only be one setup() function for each sketch.


exit

void exit()
Call this function to stop running your sketch. The destroy() callback will be called before the sketch exits.


colorMode

void colorMode(int mode)
Changes the way Processing interprets color data (by using either the RGB or the HSB color spaces).

Parameters:
mode - Either RGB or HSB, corresponding to Red/Green/Blue and Hue/Saturation/Brightness

colorMode

void colorMode(int mode,
               int range)
Changes the way Processing interprets color data (by using either the RGB or the HSB color spaces). Also allows you to specify a range for all three color channels at once

Parameters:
mode - Either RGB or HSB, corresponding to Red/Green/Blue and Hue/Saturation/Brightness
range - range for all color elements

colorMode

void colorMode(int mode,
               int range1,
               int range2,
               int range3)
Changes the way Processing interprets color data (by using either the RGB or the HSB color spaces). Also allows you to specify a range for all three color channels individually

Parameters:
mode - Either RGB or HSB, corresponding to Red/Green/Blue and Hue/Saturation/Brightness
range1 - range for the red or hue depending on the current color mode
range2 - range for the green or saturation depending on the current color mode
range3 - range for the blue or brightness depending on the current color mode

color

color color(int gray)
Creates colors for storing in variables of the color datatype. The resulting color is a shade of gray.

Parameters:
gray - shade of gray, between 0 and 255
Returns:
the resulting color

color

color color(int gray,
            int alpha)
Creates colors for storing in variables of the color datatype. The resulting color is a shade of gray.

Parameters:
gray - shade of gray, between 0 and 255
alpha - alpha level (NOTE: on current MIDP 2.1 devices and below this is ignored)
Returns:
the resulting color

color

color color(int value1,
            int value2,
            int value3,
            int alpha)
Creates colors for storing in variables of the color datatype. The parameters are interpreted as RGB or HSB values depending on the current colorMode().

Parameters:
value1 - red or hue values relative to the current color range
value2 - green or saturation values relative to the current color range
value3 - blue or brightness values relative to the current color range
alpha - alpha level (NOTE: on current MIDP 2.1 devices and below this is ignored)
Returns:
the resulting color

stroke

void stroke(color color)
Sets the color used to draw lines and borders around shapes.

Parameters:
color - the color to use

stroke

void stroke(int gray)
Sets a shade of gray to be used used to draw lines and borders around shapes.

Parameters:
gray - the shade of gray to use, between 0 and 255

stroke

void stroke(int param1,
            int param2,
            int param3)
Sets the color used to draw lines and borders around shapes. This color is either specified in terms of the RGB or HSB color depending on the current colorMode().

Parameters:
param1 - red or hue values relative to the current color range
param2 - green or saturation values relative to the current color range
param3 - blue or brightness values relative to the current color range

strokeWeight

void strokeWeight(int width)
Sets the width of the stroke used for lines, points, and the border around shapes. All widths are set in units of pixels.

Parameters:
width - the stroke width

noStroke

void noStroke()
Disables drawing the stroke (outline). If both noStroke() and noFill() are called, nothing will be drawn to the screen.


fill

void fill(int gray)
Sets the shade of gray to be used to fill shapes.

Parameters:
gray - the shade of gray to use, between 0 and 255

fill

void fill(color color)
Sets the color used to fill shapes.

Parameters:
color - the fill color for shapes

fill

void fill(int value1,
          int value2,
          int value3)
Sets the color used to fill shapes. This color is either specified in terms of the RGB or HSB color depending on the current colorMode().

Parameters:
value1 - red or hue values relative to the current color range
value2 - green or saturation values relative to the current color range
value3 - blue or brightness values relative to the current color range

noFill

void noFill()
Disables filling geometry. If both noStroke() and noFill() are called, nothing will be drawn to the screen.


background

void background(int gray)
Sets the shade of gray to be used as a background color.

Parameters:
gray - the shade of gray to use, between 0 and 255

background

void background(color color)
Sets the color to use as a background color.

Parameters:
color - color the color to use as a background color

background

void background(int value1,
                int value2,
                int value3)
Sets the color to use as a background color. This color is either specified in terms of the RGB or HSB color depending on the current colorMode().

Parameters:
value1 - red or hue values relative to the current color range
value2 - green or saturation values relative to the current color range
value3 - blue or brightness values relative to the current color range

background

void background(PImage img)
Sets the image to be used as a background. The image will be centered.

Parameters:
img - the image to use.

line

void line(int x1,
          int y1,
          int x2,
          int y2)
Draws a line (a direct path between two points) to the screen. The version of line() with four parameters draws the line in 2D. To color a line, use the stroke() function. A line cannot be filled, therefore the fill() method will not affect the color of a line. 2D lines are drawn with a width of one pixel by default, but this can be changed with the strokeWeight() function.

Parameters:
x1 - x-coordinate of the first point
y1 - y-coordinate of the first point
x2 - x-coordinate of the second point
y2 - y-coordinate of the second point

bezier

void bezier(int x1,
            int y1,
            int x2,
            int y2,
            int x3,
            int y3,
            int x4,
            int y4)
Draws a Bezier curve on the screen. These curves are defined by a series of anchor and control points. The first two parameters specify the first anchor point and the last two parameters specify the other anchor point. The middle parameters specify the control points which define the shape of the curve.

Parameters:
x1 - x-coordinate of the first anchor point
y1 - y-coordinate of the first anchor point
x2 - x-coordinate of the first control point
y2 - y-coordinate of the first control point
x3 - x-coordinate of the second control point
y3 - y-coordinate of the second control point
x4 - x-coordinate of the second anchor point
y4 - y-coordinate of the second anchor point

point

void point(int x,
           int y)
Draws a point on the screen

Parameters:
x - the x coordinate of the point
y - the y coordinate of the point

triangle

void triangle(int x1,
              int y1,
              int x2,
              int y2,
              int x3,
              int y3)
A triangle is a plane created by connecting three points. The first two arguments specify the first point, the middle two arguments specify the second point, and the last two arguments specify the third point.

Parameters:
x1 - x-coordinate of the first point
y1 - y-coordinate of the first point
x2 - x-coordinate of the second point
y2 - y-coordinate of the second point
x3 - x-coordinate of the third point
y3 - y-coordinate of the third point

quad

void quad(int x1,
          int y1,
          int x2,
          int y2,
          int x3,
          int y3,
          int x4,
          int y4)
A quad is a quadrilateral, a four sided polygon. It is similar to a rectangle, but the angles between its edges are not constrained to ninety degrees.

Parameters:
x1 - x-coordinate of the first corner
y1 - y-coordinate of the first corner
x2 - x-coordinate of the second corner
y2 - y-coordinate of the second corner
x3 - x-coordinate of the third corner
y3 - y-coordinate of the third corner
x4 - x-coordinate of the fourth corner
y4 - y-coordinate of the fourth corner

rect

void rect(int x,
          int y,
          int width,
          int height)
Draws a rectangle to the screen. A rectangle is a four-sided shape with every angle at ninety degrees. The first two parameters set the location, the third sets the width, and the fourth sets the height. The origin is changed with the rectMode() function.

Parameters:
x - x-coordinate of the rectangle
y - y-coordinate of the rectangle
width - width of the rectangle
height - height of the rectangle
See Also:
rectMode(int)

rectMode

void rectMode(int mode)
Modifies the location from which rectangles draw. The default mode is rectMode(CORNER), which specifies the location to be the upper left corner of the shape and uses the third and fourth parameters of rect() to specify the width and height. The syntax rectMode(CORNERS) uses the first and second parameters of rect() to set the location of one corner and uses the third and fourth parameters to set the opposite corner. The syntax rectMode(CENTER) draws the image from its center point and uses the third and forth parameters to rect() to specify the image's width and height.

Parameters:
mode - Either CORNER, CORNERS, CENTER

ellipse

void ellipse(int x,
             int y,
             int width,
             int height)
Draws an ellipse (oval) in the display window. An ellipse with an equal width and height is a circle. The first two parameters set the location, the third sets the width, and the fourth sets the height. The origin may be changed with the ellipseMode() function.

Parameters:
x - x-coordinate of the ellipse
y - y-coordinate of the ellipse
width - width of the ellipse
height - height of the ellipse
See Also:
ellipseMode(int)

curve

void curve(int x1,
           int y1,
           int x2,
           int y2,
           int x3,
           int y3,
           int x4,
           int y4)
Draws a curved line on the screen. The first and second parameters specify the first anchor point and the last two parameters specify the second anchor. The middle parameters specify the points for defining the shape of the curve. Longer curves can be created by putting a series of curve() functions together. The curve() function is an implementation of Catmull-Rom splines.

Parameters:
x1 - x-coordinate of the first anchor point
y1 - y-coordinate of the first anchor point
x2 - x-coordinate of the first control point
y2 - y-coordinate of the first control point
x3 - x-coordinate of the second control point
y3 - y-coordinate of the second control point
x4 - x-coordinate of the second anchor point
y4 - y-coordinate of the second anchor point

ellipseMode

void ellipseMode(int mode)
The origin of the ellipse is modified by the ellipseMode() function. The default configuration is ellipseMode(CENTER), which specifies the location of the ellipse as the center of the shape. The CENTER_RADIUS mode is the same, but the width and height parameters to ellipse() specify the radius of the ellipse, rather than the diameter. The CORNER mode draws the shape from the upper-left corner of its bounding box. The CORNERS mode uses the four parameters to ellipse() to set two opposing corners of the ellipse's bounding box.

Parameters:
mode - Either CENTER, CENTER_RADIUS, CORNER, CORNERS.

beginShape

void beginShape(int mode)
Using the beginShape() and endShape() functions allow creating more complex forms. beginShape() begins recording vertices for a shape and endShape() stops recording. The value of the MODE parameter tells it which types of shapes to create from the provided vertices. The parameters available for beginShape() are LINES, LINE_STRIP, LINE_LOOP, TRIANGLES, TRIANGLE_STRIP, QUADS, QUAD_STRIP, and POLYGON. If there is no MODE specified, POLYGON is used. After calling the beginShape() function, a series of vertex() commands must follow. To stop drawing the shape, call endShape().Each shape will be outlined with the current stroke color and filled with the fill color. Transformations such as translate(), rotate(), and scale() do not work within beginShape().

Parameters:
mode - Either LINES, LINE_STRIP, LINE_LOOP, TRIANGLES, TRIANGLE_STRIP, QUADS, QUAD_STRIP, POLYGON
See Also:
endShape()

curveVertex

void curveVertex(int x,
                 int y)
Specifies vertex coordinates for curves. This function may only be called between beginShape() and endShape() and can only be used with the drawing types POLYGON, LINE_LOOP, and LINE_STRIP. The curveVertex() function is an implementation of Catmull-Rom splines

Parameters:
x - the x coordinate of the next vertex
y - the y coordinate of the next vertex

bezierVertex

void bezierVertex(int x1,
                  int y1,
                  int x2,
                  int y2,
                  int x3,
                  int y3)
Specifies vertex coordinates for Bezier curves. Each call to bezierVertex() defines the position of two control points and one anchor point of a Bezier curve, adding a new segment to a line or shape. The first time bezierVertex() is used within a beginShape() call, it must be prefaced with a call to vertex() to set the first anchor point. This function must be used between beginShape() and endShape() can only be used with the drawing types POLYGON, LINE_LOOP, and LINE_STRIP.

Parameters:
x1 - x-coordinate of the first control point
y1 - y-coordinate of the first control point
x2 - x-coordinate of the second control point
y2 - y-coordinate of the second control point
x3 - x-coordinate of the anchor point
y3 - y-coordinate of the anchor point
See Also:
vertex(int, int)

vertex

void vertex(int x,
            int y)
All shapes are constructed by connecting a series of vertices. vertex() is used to specify the vertex coordinates for points, lines, triangles, quads, and polygons and is used exclusively within the beginShape() and endShape() function.

Parameters:
x - the x coordinate of the next vertex
y - the y coordinate of the next vertex

endShape

void endShape()
The endShape() function is the companion to beginShape() and may only be called after the later. When endshape() is called, all of image data defined since the previous call to beginShape() is written into the image buffer.

See Also:
;

loadImage

PImage loadImage(String filename)
Loads an image into a variable of type PImage. Only .png images may be loaded. To load correctly, images must be located in the data directory of the current sketch. In most cases, load all images in setup() to preload them when the program starts. Loading images in draw() can dramatically reduce the speed of a program.

Parameters:
filename - the name of the image file to load
Returns:
the resulting PImage

loadImage

PImage loadImage(byte[] data)
Loads an image into a variable of type PImage. Only .png images may be loaded. To load correctly, images must be located in the data directory of the current sketch. In most cases, load all images in setup() to preload them when the program starts. Loading images in draw() can dramatically reduce the speed of a program.

Parameters:
data - array of bytes of image data in .png format
Returns:
the resulting PImage

image

void image(PImage img,
           int x,
           int y)
Draws images to the screen.

Parameters:
img - the image to use
x - the x-coordinate of where to draw the image
y - the y coordinate of where to draw the image

image

void image(PImage img,
           int sx,
           int sy,
           int swidth,
           int sheight,
           int dx,
           int dy)
Diplays images to the screen. To display only a sub-area of the image, specify the upper-left corner and dimensions of the sub-area. The imageMode() function changes the way the parameters work. For example, a call to imageMode(CORNERS) will change the width and height parameters to define the x and y values of the opposite corner of the image.

Parameters:
img - img the image to display
sx - x-coordinate of the sub-area in the image
sy - y-coordinate of the sub-area in the image
swidth - width of the sub-area in the image
sheight - height of the sub-area in the image
dx - destination x-coordinate of the image
dy - destination y-coordinate of the image
See Also:
imageMode(int)

imageMode

void imageMode(int mode)
The mode to use when displaying images

Parameters:
mode - the image mode
See Also:
image(de.enough.polish.processing.PImage, int, int, int, int, int, int)

softkey

void softkey(String label)
The softkey() function sets up a custom labelled softkey.

Parameters:
label - the custom label on the softkey

softkeyPressed

void softkeyPressed(String label)
Event handler for sofkey presses. The softkeyPressed() function is called when the user presses a custom labelled softkey. A softkey is labelled using the softkey() function. The custom label is passed to the function as a parameter.

Parameters:
label - the label on the softkey

keyPressed

void keyPressed()
Event handler for when a regular key is pressed. The keyPressed() function is called once every time a key is pressed. As a general rule, nothing should be draw within the keyPressed() block.


keyReleased

void keyReleased()
Event handler for when a regular key is released. The keyReleased() function is called once every time a key is released. As a general rule, nothing should be draw within the keyReleased() block.


multitap

void multitap()
The multitap function will turn on multitap text input. When enabled, each key press will be interpreted according to the multitap input method and stored in an array of characters called multitapBuffer. The multitap input method interprets each key press based on the letters associated with the key as seen on a typical phone key pad. For example, the 2 key is associated with the letters 'a', 'b', and 'c'. If the user presses the 2 key once, it is interpreted as the first letter associated with the key, which is 'a'. If the user presses the 2 key three times quickly, this will be interpreted as the letter 'c', which is the third letter associated with the key. A fourth press will be interpreted as the number 2, and subsequent presses will cycle through the same characters. The multitapBuffer array contains the characters interpreted by the multitap input method. This array will automatically grow in size depending upon the number of characters entered. The variable multitapBufferLength represents the actual number of characters stored in the array. The multitapBufferIndex variable represents the location of the editing "cursor" in the buffer. If the user presses the left or right directional keys, this cursor will be moved in the buffer.

See Also:
noMultitap()

noMultitap

void noMultitap()
The noMultitap function will turn off multitap text input.

See Also:
multitap()

multitapClear

void multitapClear()
The multitapClear function will clear the multitap input buffer. Any characters that have been buffered from interpreting key presses will be lost.

See Also:
multitap()

multitapDeleteChar

void multitapDeleteChar()
The multitapDeleteChar function will delete one character from the multitap buffer at the current index.

See Also:
multitap()

textInput

String textInput()
The textInput function will open a new screen in which the user can input text using the native text input methods of the mobile phone (i.e. T9). Execution of the sketch will be paused until the text input screen is dismissed by the user. The text will be returned as a string.

Returns:
the user-entered text

textInput

String textInput(String title,
                 String text,
                 int max)
The textInput function will open a new screen in which the user can input text using the native text input methods of the mobile phone (i.e. T9). Execution of the sketch will be paused until the text input screen is dismissed by the user. The text will be returned as a string.

Parameters:
title - title of the text input form
text - default text of the form
max - maximum length of the user entered text
Returns:
the user-entered text

pointerDragged

void pointerDragged()
Event handler for when the pointer is dragged across the screen. The pointerDragged() function is called as the stylus or other pointing device is dragged across the touchscreen. As a general rule, nothing should be drawn within the pointerDragged() block.


pointerPressed

void pointerPressed()
Event handler for when the pointer is pressed. The pointerPressed() function is called once every time the stylus or other pointing device has been pressed onto the touchscreen. As a general rule, nothing should be drawn within the pointerPressed() block.


pointerReleased

void pointerReleased()
Event handler for when the pointer has been released (after a press). The pointerReleased() function is called as the stylus or other pointing device is picked up off the touchscreen. As a general rule, nothing should be drawn within the pointerReleased() block.


millis

int millis()
Returns the number of milliseconds (thousandths of a second) since starting an applet. This information is often used for timing animation sequences.

Returns:
elapsed time (in milliseconds)

second

int second()
The second() function returns the current second as a value from 0 - 59.

Returns:
current second

minute

int minute()
The minute() function returns the current minute as a value from 0 - 59.

Returns:
current minute

hour

int hour()
The hour() function returns the current hour as a value from 0 - 23.

Returns:
current hour

day

int day()
The day() function returns the current day as a value from 1 - 31.

Returns:
current day

month

int month()
The month() function returns the current month as a value from 1 - 12.

Returns:
current month

year

int year()
The year() function returns the current year as an integer (2003, 2004, 2005, etc).

Returns:
current year

print

void print(boolean data)
Outputs the given data to the console. Useful for debugging.

Parameters:
data - the data to output

print

void print(byte data)
Outputs the given data to the console. Useful for debugging.

Parameters:
data - the data to output

print

void print(char data)
Outputs the given data to the console. Useful for debugging.

Parameters:
data - the data to output

print

void print(int data)
Outputs the given data to the console. Useful for debugging.

Parameters:
data - the data to output

print

void print(Object data)
Outputs the given data to the console. Useful for debugging.

Parameters:
data - the data to output

print

void print(String data)
Outputs the given data to the console. Useful for debugging.

Parameters:
data - the data to output

println

void println(boolean data)
Outputs the given data to the console, creating a new line of text. Useful for debugging.

Parameters:
data - the data to output

println

void println(byte data)
Outputs the given data to the console, creating a new line of text. Useful for debugging.

Parameters:
data - the data to output

println

void println(char data)
Outputs the given data to the console, creating a new line of text. Useful for debugging.

Parameters:
data - the data to output

println

void println(int data)
Outputs the given data to the console, creating a new line of text. Useful for debugging.

Parameters:
data - the data to output

println

void println(Object data)
Outputs the given data to the console, creating a new line of text. Useful for debugging.

Parameters:
data - the data to output

println

void println(String data)
Outputs the given data to the console, creating a new line of text. Useful for debugging.

Parameters:
data - the data to output

length

int length(boolean[] array)
Returns the length, or size, of an array.

Parameters:
array - the array in question
Returns:
array length

length

int length(byte[] array)
Returns the length, or size, of an array.

Parameters:
array - the array in question
Returns:
array length

length

int length(char[] array)
Returns the length, or size, of an array.

Parameters:
array - the array in question
Returns:
array length

length

int length(int[] array)
Returns the length, or size, of an array.

Parameters:
array - the array in question
Returns:
array length

length

int length(Object[] array)
Returns the length, or size, of an array.

Parameters:
array - the array in question
Returns:
array length

join

String join(String[] anyArray,
            String separator)
Combines an array of elements into one String.

Parameters:
anyArray - the source array
separator - the separator string
Returns:
the resulting string

join

String join(int[] anyArray,
            String separator)
Combines an array of elements into one String.

Parameters:
anyArray - the source array
separator - the separator string
Returns:
the resulting string

join

String join(int[] intArray,
            String separator,
            int digits)
Combines an array of elements into one String and pads each number with zeroes until it has the specified number of digits.

Parameters:
intArray - the source array
separator - the separator string
digits - desired number of digits for each number
Returns:
the resulting string

nf

String nf(int intValue,
          int digits)
Utility function for formatting numbers into strings (with padding). The value for the digits parameter should always be a positive integer.

Parameters:
intValue - the number to format
digits - the number of digits
Returns:
the resulting string
See Also:
nfp(int, int)

nfp

String nfp(int intValue,
           int digits)
Utility function for formatting numbers into strings. Similar to nf() but puts a "+" in front of positive numbers and a "-" in front of negative numbers. The value for the digits parameter should always be a positive integer.

Parameters:
intValue - the number to format
digits - the number of digits
Returns:
the resulting string
See Also:
nf(int, int)

split

String[] split(String str,
               char delim)
Splits a given string into an array of strings, according to the specified delimiter

Parameters:
str - the source string
delim - delimiter
Returns:
resulting array

split

String[] split(String str,
               String delim)
Splits a given string into an array of strings, according to the specified delimiter

Parameters:
str - the source string
delim - delimiter
Returns:
resulting array

trim

String trim(String str)
Removes whitespace characters from the beginning and end of a String. In addition to standard whitespace characters such as space, carriage return, and tab, this function also removes the Unicode "nbsp" character.

Parameters:
str - original string
Returns:
trimmed string

append

String[] append(String[] array,
                String element)
Expands an array by one element and adds data to the new position. The datatype of the element parameter must be the same as the datatype of the array.

Parameters:
array - the original array
element - element to append
Returns:
resulting array

append

boolean[] append(boolean[] array,
                 boolean element)
Expands an array by one element and adds data to the new position. The datatype of the element parameter must be the same as the datatype of the array.

Parameters:
array - the original array
element - element to append
Returns:
resulting array

append

float[] append(float[] array,
               float element)
Expands an array by one element and adds data to the new position. The datatype of the element parameter must be the same as the datatype of the array.

Parameters:
array - the original array
element - element to append
Returns:
resulting array

append

double[] append(double[] array,
                double element)
Expands an array by one element and adds data to the new position. The datatype of the element parameter must be the same as the datatype of the array.

Parameters:
array - the original array
element - element to append
Returns:
resulting array

append

byte[] append(byte[] array,
              byte element)
Expands an array by one element and adds data to the new position. The datatype of the element parameter must be the same as the datatype of the array.

Parameters:
array - the original array
element - element to append
Returns:
resulting array

append

char[] append(char[] array,
              char element)
Expands an array by one element and adds data to the new position. The datatype of the element parameter must be the same as the datatype of the array.

Parameters:
array - the original array
element - element to append
Returns:
resulting array

append

int[] append(int[] array,
             int element)
Expands an array by one element and adds data to the new position. The datatype of the element parameter must be the same as the datatype of the array.

Parameters:
array - the original array
element - element to append
Returns:
resulting array

concat

String[] concat(String[] array1,
                String[] array2)
Concatenates two arrays. For example, concatenating the array { 1, 2, 3 } and the array { 4, 5, 6 } yields { 1, 2, 3, 4, 5, 6 }. Both parameters must be arrays of the same datatype.

Parameters:
array1 - the first array
array2 - the second array
Returns:
the resulting array

concat

boolean[] concat(boolean[] array1,
                 boolean[] array2)
Concatenates two arrays. For example, concatenating the array { 1, 2, 3 } and the array { 4, 5, 6 } yields { 1, 2, 3, 4, 5, 6 }. Both parameters must be arrays of the same datatype.

Parameters:
array1 - the first array
array2 - the second array
Returns:
the resulting array

concat

byte[] concat(byte[] array1,
              byte[] array2)
Concatenates two arrays. For example, concatenating the array { 1, 2, 3 } and the array { 4, 5, 6 } yields { 1, 2, 3, 4, 5, 6 }. Both parameters must be arrays of the same datatype.

Parameters:
array1 - the first array
array2 - the second array
Returns:
the resulting array

concat

char[] concat(char[] array1,
              char[] array2)
Concatenates two arrays. For example, concatenating the array { 1, 2, 3 } and the array { 4, 5, 6 } yields { 1, 2, 3, 4, 5, 6 }. Both parameters must be arrays of the same datatype.

Parameters:
array1 - the first array
array2 - the second array
Returns:
the resulting array

concat

int[] concat(int[] array1,
             int[] array2)
Concatenates two arrays. For example, concatenating the array { 1, 2, 3 } and the array { 4, 5, 6 } yields { 1, 2, 3, 4, 5, 6 }. Both parameters must be arrays of the same datatype.

Parameters:
array1 - the first array
array2 - the second array
Returns:
the resulting array

contract

boolean[] contract(boolean[] array,
                   int newSize)
Decreases the size of an array

Parameters:
array - the array in question
newSize - new size
Returns:
resulting array

contract

byte[] contract(byte[] array,
                int newSize)
Decreases the size of an array

Parameters:
array - the array in question
newSize - new size
Returns:
resulting array

contract

char[] contract(char[] array,
                int newSize)
Decreases the size of an array

Parameters:
array - the array in question
newSize - new size
Returns:
resulting array

contract

int[] contract(int[] array,
               int newSize)
Decreases the size of an array

Parameters:
array - the array in question
newSize - new size
Returns:
resulting array

contract

String[] contract(String[] array,
                  int newSize)
Decreases the size of an array

Parameters:
array - the array in question
newSize - new size
Returns:
resulting array

expand

boolean[] expand(boolean[] array)
Doubles the size of an array.

Parameters:
array - the array in question

expand

boolean[] expand(boolean[] array,
                 int newSize)
Increases the size of an array to the specified size

Parameters:
array - the array in question
newSize - new size
Returns:
resulting array

expand

byte[] expand(byte[] array)
Doubles the size of an array.

Parameters:
array - the array in question

expand

byte[] expand(byte[] array,
              int newSize)
Increases the size of an array to the specified size

Parameters:
array - the array in question
newSize - new size
Returns:
resulting array

expand

char[] expand(char[] array)
Doubles the size of an array.

Parameters:
array - the array in question

expand

char[] expand(char[] array,
              int newSize)
Increases the size of an array to the specified size

Parameters:
array - the array in question
newSize - new size
Returns:
resulting array

expand

int[] expand(int[] array)
Doubles the size of an array.

Parameters:
array - the array in question

expand

int[] expand(int[] array,
             int newSize)
Increases the size of an array to the specified size

Parameters:
array - the array in question
newSize - new size
Returns:
resulting array

expand

String[] expand(String[] array)
Doubles the size of an array.

Parameters:
array - the array in question

expand

String[] expand(String[] array,
                int newSize)
Increases the size of an array to the specified size

Parameters:
array - the array in question
newSize - new size
Returns:
resulting array

reverse

boolean[] reverse(boolean[] array)
Reverses an array

Parameters:
array - the array in question
Returns:
resulting array

reverse

byte[] reverse(byte[] array)
Reverses an array

Parameters:
array - the array in question
Returns:
resulting array

reverse

char[] reverse(char[] array)
Reverses an array

Parameters:
array - the array in question
Returns:
resulting array

reverse

int[] reverse(int[] array)
Reverses an array

Parameters:
array - the array in question
Returns:
resulting array

reverse

String[] reverse(String[] array)
Reverses an array

Parameters:
array - the array in question
Returns:
resulting array

shorten

boolean[] shorten(boolean[] array)
Decreases an array by one element and returns the shortened array.

Parameters:
array - the array in question
Returns:
resulting array

shorten

byte[] shorten(byte[] array)
Decreases an array by one element and returns the shortened array.

Parameters:
array - the array in question
Returns:
resulting array

shorten

char[] shorten(char[] array)
Decreases an array by one element and returns the shortened array.

Parameters:
array - the array in question
Returns:
resulting array

shorten

int[] shorten(int[] array)
Decreases an array by one element and returns the shortened array.

Parameters:
array - the array in question
Returns:
resulting array

shorten

String[] shorten(String[] array)
Decreases an array by one element and returns the shortened array.

Parameters:
array - the array in question
Returns:
resulting array

subset

boolean[] subset(boolean[] array,
                 int offset)
Extracts a sub-array of elements from an existing array.

Parameters:
array - the array in question
offset - position to begin at
Returns:
the sub-array

subset

boolean[] subset(boolean[] array,
                 int offset,
                 int length)
Extracts a sub-array of elements from an existing array.

Parameters:
array - the array in question
offset - position to begin at
length - length of the sub-array
Returns:
the sub-array

subset

byte[] subset(byte[] array,
              int offset)
Extracts a sub-array of elements from an existing array.

Parameters:
array - the array in question
offset - position to begin at
Returns:
the sub-array

subset

byte[] subset(byte[] array,
              int offset,
              int length)
Extracts a sub-array of elements from an existing array.

Parameters:
array - the array in question
offset - position to begin at
length - length of the sub-array
Returns:
the sub-array

subset

char[] subset(char[] array,
              int offset)
Extracts a sub-array of elements from an existing array.

Parameters:
array - the array in question
offset - position to begin at
Returns:
the sub-array

subset

char[] subset(char[] array,
              int offset,
              int length)
Extracts a sub-array of elements from an existing array.

Parameters:
array - the array in question
offset - position to begin at
length - length of the sub-array
Returns:
the sub-array

subset

int[] subset(int[] array,
             int offset)
Extracts a sub-array of elements from an existing array.

Parameters:
array - the array in question
offset - position to begin at
Returns:
the sub-array

subset

int[] subset(int[] array,
             int offset,
             int length)
Extracts a sub-array of elements from an existing array.

Parameters:
array - the array in question
offset - position to begin at
length - length of the sub-array
Returns:
the sub-array

subset

String[] subset(String[] array,
                int offset)
Extracts a sub-array of elements from an existing array.

Parameters:
array - the array in question
offset - position to begin at
Returns:
the sub-array

subset

String[] subset(String[] array,
                int offset,
                int length)
Extracts a sub-array of elements from an existing array.

Parameters:
array - the array in question
offset - position to begin at
length - length of the sub-array
Returns:
the sub-array

splice

boolean[] splice(boolean[] array,
                 boolean value,
                 int index)
Insert a value into an existing array

Parameters:
array - the array in question
value - the value to insert
index - the index at which to insert
Returns:
resulting array

splice

boolean[] splice(boolean[] array,
                 boolean[] array2,
                 int index)
Inserts an array into antoher array.

Parameters:
array - source array
array2 - array to insert
index - index at which to insert
Returns:
resulting array

splice

byte[] splice(byte[] array,
              byte value,
              int index)
Insert a value into an existing array

Parameters:
array - the array in question
value - the value to insert
index - the index at which to insert
Returns:
resulting array

splice

byte[] splice(byte[] array,
              byte[] array2,
              int index)
Inserts an array into antoher array.

Parameters:
array - source array
array2 - array to insert
index - index at which to insert
Returns:
resulting array

splice

char[] splice(char[] array,
              char value,
              int index)
Insert a value into an existing array

Parameters:
array - the array in question
value - the value to insert
index - the index at which to insert
Returns:
resulting array

splice

char[] splice(char[] array,
              char[] array2,
              int index)
Inserts an array into antoher array.

Parameters:
array - source array
array2 - array to insert
index - index at which to insert
Returns:
resulting array

splice

int[] splice(int[] array,
             int value,
             int index)
Insert a value into an existing array

Parameters:
array - the array in question
value - the value to insert
index - the index at which to insert
Returns:
resulting array

splice

int[] splice(int[] array,
             int[] array2,
             int index)
Inserts an array into antoher array.

Parameters:
array - source array
array2 - array to insert
index - index at which to insert
Returns:
resulting array

splice

String[] splice(String[] array,
                String value,
                int index)
Insert a value into an existing array

Parameters:
array - the array in question
value - the value to insert
index - the index at which to insert
Returns:
resulting array

splice

String[] splice(String[] array,
                String[] array2,
                int index)
Inserts an array into antoher array.

Parameters:
array - source array
array2 - array to insert
index - index at which to insert
Returns:
resulting array

str

String str(boolean val)
Returns a string representation of its parameter.

Parameters:
val - the value to represent as a string
Returns:
string representation

str

String str(byte val)
Returns a string representation of its parameter.

Parameters:
val - the value to represent as a string
Returns:
string representation

str

String str(char val)
Returns a string representation of its parameter.

Parameters:
val - the value to represent as a string
Returns:
string representation

str

String str(int val)
Returns a string representation of its parameter.

Parameters:
val - the value to represent as a string
Returns:
string representation

str

String[] str(boolean[] val)
Returns a string representation of its parameter.

Parameters:
val - the value to represent as a string
Returns:
string representation

str

String[] str(byte[] val)
Returns a string representation of its parameter.

Parameters:
val - the value to represent as a string
Returns:
string representation

str

String[] str(char[] val)
Returns a string representation of its parameter.

Parameters:
val - the value to represent as a string
Returns:
string representation

str

String[] str(int[] val)
Returns a string representation of its parameter.

Parameters:
val - the value to represent as a string
Returns:
string representation

pushMatrix

void pushMatrix()
Pushes the current transformation matrix onto the matrix stack. Understanding pushMatrix() and popMatrix() requires understanding the concept of a matrix stack. The pushMatrix() function saves the current coordinate system to the stack and popMatrix() restores the prior coordinate system. pushMatrix() and popMatrix() are used in conjuction with the other transformation methods and may be embedded to control the scope of the transformations.


popMatrix

void popMatrix()
Pops the current transformation matrix off the matrix stack. Understanding pushing and popping requires understanding the concept of a matrix stack. The pushMatrix() function saves the current coordinate system to the stack and popMatrix() restores the prior coordinate system. pushMatrix() and popMatrix() are used in conjuction with the other transformation methods and may be embedded to control the scope of the transformations.


resetMatrix

void resetMatrix()
Replaces the current matrix with the identity matrix.


translate

void translate(int x,
               int y)
Specifies an amount to displace objects within the display window. The x parameter specifies left/right translation and the y parameter specifies up/down translation. Transformations apply to everything that happens after and subsequent calls to the function accumulates the effect. For example, calling translate(50, 0) and then translate(20, 0) is the same as translate(70, 0). If translate() is called within draw(), the transformation is reset when the loop begins again. Further control over applying the transformation is acheived with pushMatrix() and popMatrix().

Parameters:
x - horizontal translation amount
y - vertical translation amount

abs

int abs(int value)
Calculates the absolute value (magnitude) of a number. The absolute value of a number is always positive.

Parameters:
value - the number to process
Returns:
absolute value of the number

max

int max(int value1,
        int value2)
Returns the maximum of two numbers

Parameters:
value1 - first number
value2 - second number
Returns:
maximum number

min

int min(int value1,
        int value2)
Returns the minimum of two numbers

Parameters:
value1 - first number
value2 - second number
Returns:
minimum number

sq

int sq(int number)
Squares a number (multiplies a number by itself).

Parameters:
number - the number to process
Returns:
the square of the number

pow

int pow(int base,
        int exponent)
Raises a number to a given power.

Parameters:
base - base
exponent - exponent
Returns:
result

constrain

int constrain(int value,
              int min,
              int max)
Constrains a value to not exceed a maximum and minimum value.

Parameters:
value - the value in question
min - minimum value
max - maximum value
Returns:
either value, min or max (depending on the input numbers)

random

int random(int value)
Generates a random number between 0 and the specified maximum number, excluding the specified number.

Parameters:
value - maximum number
Returns:
random number between 0 and the maximum number specified

random

double random(double value)
Generates a random number between 0 and the specified maximum number, excluding the specified number.

Parameters:
value - maximum number
Returns:
random number between 0 and the maximum number specified

random

int random(int value1,
           int value2)
Generates a random number in the specified interval.

Parameters:
value1 - the minimum number to generate (left end of the interval)
value2 - the maximum number to generate (right end of the interval)
Returns:
random number between value1 and value2

mul

int mul(int value1,
        int value2)
Multiplies two fixed point values and returns a fixed point value.

Parameters:
value1 - the first number
value2 - the second number

div

int div(int dividend,
        int divisor)
Divides the value of the second fixed point parameter by the value of the first fixed point parameter.

Parameters:
dividend - dividend
divisor - divisior

itofp

int itofp(int value1)
Returns the fixed point representation of the specified integer value.

Parameters:
value1 - the integer in question
Returns:
fixed-point representation of the integer value

fptoi

int fptoi(int value1)
Returns the largest integer less than or equal to the specified fixed point value. Use this function to convert a fixed point value into a normal integer for use in other functions, such as drawing functions.

Parameters:
value1 - the fixed point value in question

sqrt

int sqrt(int value_fp)
Calculates the square root of a fixed point value and returns a fixed point value. The square root of a number is always positive, even though there may be a valid negative root. The square root s of number a is such that s*s = a. It is the opposite of squaring.

Parameters:
value_fp - fixed-point value
Returns:
square root of said fixed point value

dist

int dist(int x1,
         int y1,
         int x2,
         int y2)
Calculates the distance between two points, with coordinates specified as integer numbers.

Parameters:
x1 - the x-coordinate of the first point
y1 - the y-coordinate of the first point
x2 - the x-coordinate of the second point
y2 - the y-coordinate of the second point
Returns:
distance between the points, as a fixed-point number

dist_fp

int dist_fp(int x1,
            int y1,
            int x2,
            int y2)
Calculates the distance between two points, with coordinates specified as fixed-point numbers.

Parameters:
x1 - the x-coordinate of the first point
y1 - the y-coordinate of the first point
x2 - the x-coordinate of the second point
y2 - the y-coordinate of the second point
Returns:
distance between the points, as a fixed-point number

floor

int floor(int value1)
Calculates the closest int fixed point value that is less than or equal to the fixed point value of the parameter.

Parameters:
value1 - the fixed point value in question

ceil

int ceil(int value1)
Calculates the closest int fixed point value that is greater than or equal to the fixed point value of the parameter. For example, ceil(9.03) returns the value 10.0.

Parameters:
value1 - the fixed point value in question

round

int round(int value1)
Calculates the integer fixed point value closest to the fixed point value parameter. For example, round(9.2) returns the value 9.0.

Parameters:
value1 - the fixed point value in question

radians

int radians(int angle)
Converts a degree fixed point value measurement to its corresponding fixed point value in radians. Radians and degrees are two ways of measuring the same thing. There are 360 degrees in a circle and 2*PI radians in a circle. For example, 90 degrees = PI/2 = 1.5707964. All trigonometric methods in Processing require their parameters to be specified in radian fixed point values.

Parameters:
angle - the angle in question
Returns:
angle in radians, as a fixed-point number

sin

int sin(int rad)
Calculates the sine of an angle. This function expects the values of the angle parameter to be provided in radian fixed point values (values from 0 to 6.28). Values are returned as fixed point values in the range -1 to 1.

Parameters:
rad - angle in radians (fixed-point number)
Returns:
sine value (fixed-point number)

sind

double sind(double rad)
Calculates the sine of an angle. This function expects the values of the angle parameter to be provided in radians.

Parameters:
rad - angle in radians
Returns:
sine value

cos

int cos(int rad)
Calculates the cosine of an angle. This function expects the values of the angle parameter to be provided in radian fixed point values (values from 0 to PI*2). Values are returned as fixed point values in the range -1 to 1.

Parameters:
rad - angle in radians (fixed-point number)
Returns:
cosine (fixed-point number)

cosd

double cosd(double rad)
Calculates the cosine of an angle. This function expects the values of the angle parameter to be provided in radians.

Parameters:
rad - angle in radians
Returns:
cosine

atan

int atan(int value1)
Returns the arc tangent of a value. This function expects the values as fixed point values in the range of -Infinity to Infinity (exclusive) and values are returned as fixed point values in the range -PI/2 to PI/2 .

Parameters:
value1 - fixed-point value to calculate the arctangent of
Returns:
fixed-point value

atan2

int atan2(int x,
          int y)
Calculates the angle (in radians) from a specified point to the coordinate origin as measured from the positive x-axis. Values are returned as an int fixed point value in the range from PI to -PI. The atan2() function is most often used for orienting geometry to the position of the cursor. Note: The y-coordinate of the point is the first parameter and the x-coordinate is the second due the the structure of calculating the tangent.

Parameters:
x - the x-coordinate of the point
y - the y-coordinate of the point
Returns:
angle in radians (fixed-point value)

atan

double atan(double value1)
Returns the arc tangent of a value. This function expects the values as fixed point values in the range of -Infinity to Infinity (exclusive) and values are returned as fixed point values in the range -PI/2 to PI/2 .

Parameters:
value1 - value to calculate the arctangent of
Returns:
arctangent

atan2d

double atan2d(int x,
              int y)
Calculates the angle (in radians) from a specified point to the coordinate origin as measured from the positive x-axis. Values are returned as an int fixed point value in the range from PI to -PI. The atan2() function is most often used for orienting geometry to the position of the cursor. Note: The y-coordinate of the point is the first parameter and the x-coordinate is the second due the the structure of calculating the tangent.

Parameters:
x - the x-coordinate of the point
y - the y-coordinate of the point
Returns:
angle in radians

loadBytes

byte[] loadBytes(String filename)
Reads the contents of a file and places it in a byte array.

Parameters:
filename - the filename to load data from
Returns:
byte array

loadStrings

String[] loadStrings(String filename)
Reads the contents of a file and creates a String array of its individual lines.

Parameters:
filename - the filename to load data from

saveBytes

void saveBytes(String filename,
               byte[] data)
Opposite of loadBytes(), will write an entire array of bytes to a file. This file is saved to the persistent storage memory of the mobile phone. Filenames must be 32 characters or less.

Parameters:
filename - the filename to write data to
data - the data to write

saveStrings

void saveStrings(String filename,
                 String[] strings)
Writes an array of strings to a file, one line per string. This file is saved to the persistent storage memory of the mobile phone. Filenames must be 32 characters or less.

Parameters:
filename - the filename to write data to
strings - the strings to write

openStream

InputStream openStream(String fileName)
Simplified method to open a Java InputStream. This function is useful if you want to easily open files from the data folder or from a URL, but want an InputStream object so that you can use other Java methods to take more control of how the stream is read.

Parameters:
fileName - file name
Returns:
corresponding InputStream object

loadFont

PFont loadFont(String fontname,
               color fgColor,
               color bgColor)
Loads a J2ME Polish bitmap font into a variable of type PFont.

Parameters:
fontname - the J2ME polish font name
fgColor - color of the font
bgColor - background color
Returns:
the corresponding PFont object

loadFont

PFont loadFont(String fontname,
               color fgColor)
Loads a J2ME Polish bitmap font into a variable of type PFont.

Parameters:
fontname - the J2ME polish font name
fgColor - color of the font
Returns:
the corresponding PFont object

loadFont

PFont loadFont(String fontname)
Loads a J2ME Polish bitmap font into a variable of type PFont.

Parameters:
fontname - the J2ME polish font name
Returns:
the corresponding PFont object

loadFont

PFont loadFont()
Loads the default font as a PFont object.


loadFont

PFont loadFont(int face,
               int style,
               int size)
Load the system font which best corresponds to the specified parameters

Parameters:
face - the font face
style - the font style
size - the font size
Returns:
the font as a PFont object

textFont

void textFont(PFont font)
Sets the current font. The font must be loaded with loadFont() before it can be used. This font will be used in all subsequent calls to the text() function.

Parameters:
font - the font to use

textWrap

String[] textWrap(String data,
                  int width)
This function takes text in a String object and returns an array of String objects containing the text split into lines that will fit in the specified width when rendered with the current font.

Parameters:
data - string to wrap
width - the maximum line width
Returns:
resulting array of Strings

textWrap

String[] textWrap(String data,
                  int width,
                  int height)
This function takes text in a String object and returns an array of String objects containing the text split into lines that will fit in the box specified by the given width and height when rendered with the current font. The array will only contain lines that will fit in the box- any text that would not fit is ignored.

Parameters:
data - string to wrap
width - the maximum line width
height - the maximum box height
Returns:
resulting array of String

textWidth

int textWidth(String data)
Calculates and returns the width of any character or text string.

Parameters:
data - the string in question
Returns:
width

textAlign

void textAlign(int mode)
Sets the current alignment for drawing text. The parameters LEFT, CENTER, and RIGHT set the display characteristics of the letters in relation to the values for the x and y parameters of the text() function.

Parameters:
mode - Either LEFT, CENTER, or RIGHT

text

void text(String text,
          int x,
          int y)
Draws text to the screen. Displays the information specified in the stringdata parameter on the screen in the position specified by the x and y parameters. A font must be set with the textFont() function before text() may be called. The text displays in relation to the textAlign() function, which gives the option to draw to the left, right, and center of the coordinates. If the font was loaded from the mobile phone (not J2ME Polish font), you can change the color of the text with the fill() function. To change the color of a bitmap font, you must reload it with the color specified in loadFont().

Parameters:
text - the text to draw
x - on-sceen x-coordinate of the text
y - on-sceen y-coordinate of the text

text

void text(String text,
          int x,
          int y,
          int width,
          int height)
Draws text to the screen. Displays the information specified in the stringdata parameter on the screen in the position specified by the x and y parameters. A font must be set with the textFont() function before text() may be called. The text displays in relation to the textAlign() function, which gives the option to draw to the left, right, and center of the coordinates. If the font was loaded from the mobile phone (not J2ME Polish font), you can change the color of the text with the fill() function. To change the color of a bitmap font, you must reload it with the color specified in loadFont(). The width and height parameters define a rectangular area to display within. Text will automatically be wrapped and clipped to fit within the area.

Parameters:
text - the text to draw
x - on-sceen x-coordinate of the text
y - on-sceen y-coordinate of the text
width - the width of the area
height - the height of the area