|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container java.awt.Panel java.applet.Applet processing.core.PApplet
public class PApplet
Base class for all sketches that use processing.core.
Note that you should not use AWT or Swing components inside a Processing applet. The surface is made to automatically update itself, and will cause problems with redraw of components drawn above it. If you'd like to integrate other Java components, see below. As of release 0145, Processing uses active mode rendering in all cases. All animation tasks happen on the "Processing Animation Thread". The setup() and draw() methods are handled by that thread, and events (like mouse movement and key presses, which are fired by the event dispatch thread or EDT) are queued to be (safely) handled at the end of draw(). For code that needs to run on the EDT, use SwingUtilities.invokeLater(). When doing so, be careful to synchronize between that code (since invokeLater() will make your code run from the EDT) and the Processing animation thread. Use of a callback function or the registerXxx() methods in PApplet can help ensure that your code doesn't do something naughty. As of release 0136 of Processing, we have discontinued support for versions of Java prior to 1.5. We don't have enough people to support it, and for a project of our size, we should be focusing on the future, rather than working around legacy Java code. In addition, Java 1.5 gives us access to better timing facilities which will improve the steadiness of animation. This class extends Applet instead of JApplet because 1) historically, we supported Java 1.1, which does not include Swing (without an additional, sizable, download), and 2) Swing is a bloated piece of crap. A Processing applet is a heavyweight AWT component, and can be used the same as any other AWT component, with or without Swing. Similarly, Processing runs in a Frame and not a JFrame. However, there's nothing to prevent you from embedding a PApplet into a JFrame, it's just that the base version uses a regular AWT frame because there's simply no need for swing in that context. If people want to use Swing, they can embed themselves as they wish. It is possible to use PApplet, along with core.jar in other projects. In addition to enabling you to use Java 1.5+ features with your sketch, this also allows you to embed a Processing drawing area into another Java application. This means you can use standard GUI controls with a Processing sketch. Because AWT and Swing GUI components cannot be used on top of a PApplet, you can instead embed the PApplet inside another GUI the way you would any other Component. It is also possible to resize the Processing window by including frame.setResizable(true) inside your setup() method. Note that the Java method frame.setSize() will not work unless you first set the frame to be resizable. Because the default animation thread will run at 60 frames per second, an embedded PApplet can make the parent sluggish. You can use frameRate() to make it update less often, or you can use noLoop() and loop() to disable and then re-enable looping. If you want to only update the sketch intermittently, use noLoop() inside setup(), and redraw() whenever the screen needs to be updated once (or loop() to re-enable the animation thread). The following example embeds a sketch and also uses the noLoop() and redraw() methods. You need not use noLoop() and redraw() when embedding if you want your application to animate continuously.public class ExampleFrame extends Frame { public ExampleFrame() { super("Embedded PApplet"); setLayout(new BorderLayout()); PApplet embed = new Embedded(); add(embed, BorderLayout.CENTER); // important to call this whenever embedding a PApplet. // It ensures that the animation thread is started and // that other internal variables are properly set. embed.init(); } } public class Embedded extends PApplet { public void setup() { // original setup code here ... size(400, 400); // prevent thread from starving everything else noLoop(); } public void draw() { // drawing code goes here } public void mousePressed() { // do something based on mouse movement // update the screen (run draw once) redraw(); } }
I was asked about Processing with multiple displays, and for lack of a better place to document it, things will go here.
You can address both screens by making a window the width of both, and the height of the maximum of both screens. In this case, do not use present mode, because that's exclusive to one screen. Basically it'll give you a PApplet that spans both screens. If using one half to control and the other half for graphics, you'd just have to put the 'live' stuff on one half of the canvas, the control stuff on the other. This works better in windows because on the mac we can't get rid of the menu bar unless it's running in present mode.
For more control, you need to write straight java code that uses p5. You can create two windows, that are shown on two separate screens, that have their own PApplet. this is just one of the tradeoffs of one of the things that we don't support in p5 from within the environment itself (we must draw the line somewhere), because of how messy it would get to start talking about multiple screens. It's also not that tough to do by hand w/ some Java code.
Nested Class Summary | |
---|---|
class |
PApplet.RegisteredMethods
This returns the last width and height specified by the user via the size() command. |
static class |
PApplet.RendererChangeException
Exception thrown when size() is called the first time. |
Field Summary | |
---|---|
java.lang.String[] |
args
Command line options passed in from main(). |
static java.lang.String |
ARGS_BGCOLOR
|
static java.lang.String |
ARGS_DISPLAY
|
static java.lang.String |
ARGS_EDITOR_LOCATION
Position of the upper-lefthand corner of the editor window that launched this applet. |
static java.lang.String |
ARGS_EXCLUSIVE
|
static java.lang.String |
ARGS_EXTERNAL
Location for where to position the applet window on screen. |
static java.lang.String |
ARGS_HIDE_STOP
|
static java.lang.String |
ARGS_LOCATION
|
static java.lang.String |
ARGS_PRESENT
|
static java.lang.String |
ARGS_SKETCH_FOLDER
Allows the user or PdeEditor to set a specific sketch folder path. |
static java.lang.String |
ARGS_STOP_COLOR
|
static int |
DEFAULT_HEIGHT
|
static int |
DEFAULT_WIDTH
Default width and height for applet when not specified |
boolean |
defaultSize
true if no size() command has been executed. |
static java.lang.String |
EXTERNAL_MOVE
When run externally to a PDE Editor, this is sent by the applet whenever the window is moved. |
static java.lang.String |
EXTERNAL_STOP
When run externally to a PdeEditor, this is sent by the applet when it quits. |
boolean |
finished
true if this applet has had it. |
boolean |
firstMouse
Used to set pmouseX/Y to mouseX/Y the first time mouseX/Y are used, otherwise pmouseX/Y are always zero, causing a nasty jump. |
boolean |
focused
Gets set to true/false as the applet gains/loses focus. |
java.awt.Frame |
frame
The frame containing this applet (if any) |
int |
frameCount
How many frames have been displayed since the applet started. |
float |
frameRate
The current value of frames per second. |
PGraphics |
g
The PGraphics renderer associated with this PApplet |
int |
height
height of this applet's associated PGraphics |
static byte[] |
ICON_IMAGE
GIF image of the Processing logo. |
static float |
javaVersion
Version of Java that's in use, whether 1.1 or 1.3 or whatever, stored as a float. |
static java.lang.String |
javaVersionName
Full name of the Java version (i.e. |
char |
key
Last key pressed. |
int |
keyCode
When "key" is set to CODED, this will contain a Java key code. |
java.awt.event.KeyEvent |
keyEvent
the last KeyEvent object passed into a mouse function. |
boolean |
keyPressed
true if the mouse is currently pressed. |
static int |
MENU_SHORTCUT
Modifier flags for the shortcut key used to trigger menus. |
static int |
MIN_WINDOW_HEIGHT
|
static int |
MIN_WINDOW_WIDTH
Minimum dimensions for the window holding an applet. |
int |
mouseButton
Last mouse button pressed, one of LEFT, CENTER, or RIGHT. |
java.awt.event.MouseEvent |
mouseEvent
|
boolean |
mousePressed
|
int |
mouseX
current x position of the mouse |
int |
mouseY
current y position of the mouse |
boolean |
online
true if the applet is online. |
int[] |
pixels
Pixel buffer from this applet's PGraphics. |
static int |
platform
Current platform in use, one of the PConstants WINDOWS, MACOSX, MACOS9, LINUX or OTHER. |
int |
pmouseX
Previous x/y position of the mouse. |
int |
pmouseY
Previous x/y position of the mouse. |
PGraphics |
recorder
A leech graphics object that is echoing all events. |
int |
requestImageMax
By trial and error, four image loading threads seem to work best when loading images from online. |
java.awt.Dimension |
screen
The screen size when the applet was started. |
java.io.File |
selectedFile
|
java.lang.String |
sketchPath
Path to sketch folder |
int |
width
width of this applet's associated PGraphics |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
PApplet()
|
Method Summary | |
---|---|
static float |
abs(float n)
|
static int |
abs(int n)
|
static float |
acos(float value)
|
void |
addListeners()
|
float |
alpha(int what)
|
void |
ambient(float gray)
|
void |
ambient(float x,
float y,
float z)
|
void |
ambient(int rgb)
|
void |
ambientLight(float red,
float green,
float blue)
|
void |
ambientLight(float red,
float green,
float blue,
float x,
float y,
float z)
|
static byte[] |
append(byte[] b,
byte value)
|
static char[] |
append(char[] b,
char value)
|
static float[] |
append(float[] b,
float value)
|
static int[] |
append(int[] b,
int value)
|
static java.lang.Object |
append(java.lang.Object b,
java.lang.Object value)
|
static java.lang.String[] |
append(java.lang.String[] b,
java.lang.String value)
|
void |
applyMatrix(float n00,
float n01,
float n02,
float n10,
float n11,
float n12)
|
void |
applyMatrix(float n00,
float n01,
float n02,
float n03,
float n10,
float n11,
float n12,
float n13,
float n20,
float n21,
float n22,
float n23,
float n30,
float n31,
float n32,
float n33)
|
void |
applyMatrix(PMatrix source)
|
void |
applyMatrix(PMatrix2D source)
|
void |
applyMatrix(PMatrix3D source)
|
void |
arc(float a,
float b,
float c,
float d,
float start,
float stop)
|
static void |
arraycopy(java.lang.Object src,
int srcPosition,
java.lang.Object dst,
int dstPosition,
int length)
Deprecated. Use arrayCopy() instead. |
static void |
arrayCopy(java.lang.Object src,
int srcPosition,
java.lang.Object dst,
int dstPosition,
int length)
Calls System.arraycopy(), included here so that we can avoid people needing to learn about the System object before they can just copy an array. |
static void |
arraycopy(java.lang.Object src,
java.lang.Object dst)
Deprecated. Use arrayCopy() instead. |
static void |
arrayCopy(java.lang.Object src,
java.lang.Object dst)
Shortcut to copy the entire contents of the source into the destination array. |
static void |
arraycopy(java.lang.Object src,
java.lang.Object dst,
int length)
Deprecated. Use arrayCopy() instead. |
static void |
arrayCopy(java.lang.Object src,
java.lang.Object dst,
int length)
Convenience method for arraycopy(). |
static float |
asin(float value)
|
static float |
atan(float value)
|
static float |
atan2(float a,
float b)
|
void |
background(float gray)
|
void |
background(float gray,
float alpha)
|
void |
background(float x,
float y,
float z)
|
void |
background(float x,
float y,
float z,
float a)
|
void |
background(int rgb)
|
void |
background(int rgb,
float alpha)
|
void |
background(PImage image)
|
void |
beginCamera()
|
void |
beginRaw(PGraphics rawGraphics)
Begin recording raw shape data to the specified renderer. |
PGraphics |
beginRaw(java.lang.String renderer,
java.lang.String filename)
Begin recording raw shape data to a renderer of the specified type, using the width and height of the main drawing surface. |
void |
beginRecord(PGraphics recorder)
Begin recording (echoing) commands to the specified PGraphics object. |
PGraphics |
beginRecord(java.lang.String renderer,
java.lang.String filename)
Begin recording to a new renderer of the specified type, using the width and height of the main drawing surface. |
void |
beginShape()
|
void |
beginShape(int kind)
|
void |
bezier(float x1,
float y1,
float x2,
float y2,
float x3,
float y3,
float x4,
float y4)
|
void |
bezier(float x1,
float y1,
float z1,
float x2,
float y2,
float z2,
float x3,
float y3,
float z3,
float x4,
float y4,
float z4)
|
void |
bezierDetail(int detail)
|
float |
bezierPoint(float a,
float b,
float c,
float d,
float t)
|
float |
bezierTangent(float a,
float b,
float c,
float d,
float t)
|
void |
bezierVertex(float x2,
float y2,
float x3,
float y3,
float x4,
float y4)
|
void |
bezierVertex(float x2,
float y2,
float z2,
float x3,
float y3,
float z3,
float x4,
float y4,
float z4)
|
static java.lang.String |
binary(byte what)
Returns a String that contains the binary value of a byte. |
static java.lang.String |
binary(char what)
Returns a String that contains the binary value of a char. |
static java.lang.String |
binary(int what)
Returns a String that contains the binary value of an int. |
static java.lang.String |
binary(int what,
int digits)
Returns a String that contains the binary value of an int. |
void |
blend(int sx,
int sy,
int sw,
int sh,
int dx,
int dy,
int dw,
int dh,
int mode)
|
void |
blend(PImage src,
int sx,
int sy,
int sw,
int sh,
int dx,
int dy,
int dw,
int dh,
int mode)
|
static int |
blendColor(int c1,
int c2,
int mode)
|
float |
blue(int what)
|
void |
box(float size)
|
void |
box(float w,
float h,
float d)
|
void |
breakShape()
|
float |
brightness(int what)
|
void |
camera()
|
void |
camera(float eyeX,
float eyeY,
float eyeZ,
float centerX,
float centerY,
float centerZ,
float upX,
float upY,
float upZ)
|
static int |
ceil(float what)
|
int |
color(float fgray)
|
int |
color(float fgray,
float falpha)
|
int |
color(float x,
float y,
float z)
|
int |
color(float x,
float y,
float z,
float a)
|
int |
color(int gray)
|
int |
color(int gray,
int alpha)
As of 0116 this also takes color(#FF8800, alpha) |
int |
color(int x,
int y,
int z)
|
int |
color(int x,
int y,
int z,
int a)
|
void |
colorMode(int mode)
|
void |
colorMode(int mode,
float max)
|
void |
colorMode(int mode,
float maxX,
float maxY,
float maxZ)
|
void |
colorMode(int mode,
float maxX,
float maxY,
float maxZ,
float maxA)
|
static boolean[] |
concat(boolean[] a,
boolean[] b)
|
static byte[] |
concat(byte[] a,
byte[] b)
|
static char[] |
concat(char[] a,
char[] b)
|
static float[] |
concat(float[] a,
float[] b)
|
static int[] |
concat(int[] a,
int[] b)
|
static java.lang.Object |
concat(java.lang.Object a,
java.lang.Object b)
|
static java.lang.String[] |
concat(java.lang.String[] a,
java.lang.String[] b)
|
static float |
constrain(float amt,
float low,
float high)
|
static int |
constrain(int amt,
int low,
int high)
|
void |
copy(int sx,
int sy,
int sw,
int sh,
int dx,
int dy,
int dw,
int dh)
|
void |
copy(PImage src,
int sx,
int sy,
int sw,
int sh,
int dx,
int dy,
int dw,
int dh)
|
static float |
cos(float angle)
|
PFont |
createFont(java.lang.String name,
float size)
|
PFont |
createFont(java.lang.String name,
float size,
boolean smooth)
|
PFont |
createFont(java.lang.String name,
float size,
boolean smooth,
char[] charset)
Create a .vlw font on the fly from either a font name that's installed on the system, or from a .ttf or .otf that's inside the data folder of this sketch. |
PGraphics |
createGraphics(int iwidth,
int iheight,
java.lang.String irenderer)
Create an offscreen PGraphics object for drawing. |
PGraphics |
createGraphics(int iwidth,
int iheight,
java.lang.String irenderer,
java.lang.String ipath)
Create an offscreen graphics surface for drawing, in this case for a renderer that writes to a file (such as PDF or DXF). |
PImage |
createImage(int wide,
int high,
int format)
Preferred method of creating new PImage objects, ensures that a reference to the parent PApplet is included, which makes save() work without needing an absolute path. |
static java.io.InputStream |
createInput(java.io.File file)
|
java.io.InputStream |
createInput(java.lang.String filename)
Simplified method to open a Java InputStream. |
java.io.InputStream |
createInputRaw(java.lang.String filename)
Call openStream() without automatic gzip decompression. |
static java.io.OutputStream |
createOutput(java.io.File file)
|
java.io.OutputStream |
createOutput(java.lang.String filename)
Similar to createInput() (formerly openStream), this creates a Java OutputStream for a given filename or path. |
static void |
createPath(java.io.File file)
|
static void |
createPath(java.lang.String path)
Takes a path and creates any in-between folders if they don't already exist. |
static java.io.BufferedReader |
createReader(java.io.File file)
I want to read lines from a file. |
static java.io.BufferedReader |
createReader(java.io.InputStream input)
I want to read lines from a stream. |
java.io.BufferedReader |
createReader(java.lang.String filename)
I want to read lines from a file. |
static java.io.PrintWriter |
createWriter(java.io.File file)
I want to print lines to a file. |
static java.io.PrintWriter |
createWriter(java.io.OutputStream output)
I want to print lines to a file. |
java.io.PrintWriter |
createWriter(java.lang.String filename)
I want to print lines to a file. |
void |
cursor()
Show the cursor after noCursor() was called. |
void |
cursor(int cursorType)
Set the cursor type |
void |
cursor(PImage image)
Replace the cursor with the specified PImage. |
void |
cursor(PImage image,
int hotspotX,
int hotspotY)
Set a custom cursor to an image with a specific hotspot. |
void |
curve(float x1,
float y1,
float x2,
float y2,
float x3,
float y3,
float x4,
float y4)
|
void |
curve(float x1,
float y1,
float z1,
float x2,
float y2,
float z2,
float x3,
float y3,
float z3,
float x4,
float y4,
float z4)
|
void |
curveDetail(int detail)
|
float |
curvePoint(float a,
float b,
float c,
float d,
float t)
|
float |
curveTangent(float a,
float b,
float c,
float d,
float t)
|
void |
curveTightness(float tightness)
|
void |
curveVertex(float x,
float y)
|
void |
curveVertex(float x,
float y,
float z)
|
java.io.File |
dataFile(java.lang.String where)
Return a full path to an item in the data folder as a File object. |
java.lang.String |
dataPath(java.lang.String where)
Return a full path to an item in the data folder. |
static int |
day()
Get the current day of the month (1 through 31). |
static float |
degrees(float radians)
|
void |
delay(int napTime)
The delay() function causes the program to halt for a specified time. |
void |
destroy()
Called by the browser or applet viewer to inform this applet that it is being reclaimed and that it should destroy any resources that it has allocated. |
void |
die(java.lang.String what)
Function for an applet/application to kill itself and display an error. |
void |
die(java.lang.String what,
java.lang.Exception e)
Same as above but with an exception. |
void |
directionalLight(float red,
float green,
float blue,
float nx,
float ny,
float nz)
|
boolean |
displayable()
|
static float |
dist(float x1,
float y1,
float x2,
float y2)
|
static float |
dist(float x1,
float y1,
float z1,
float x2,
float y2,
float z2)
|
void |
draw()
|
void |
edge(boolean edge)
|
void |
ellipse(float a,
float b,
float c,
float d)
|
void |
ellipseMode(int mode)
|
void |
emissive(float gray)
|
void |
emissive(float x,
float y,
float z)
|
void |
emissive(int rgb)
|
void |
endCamera()
|
void |
endRaw()
Stop recording raw shape data to the specified renderer. |
void |
endRecord()
|
void |
endShape()
|
void |
endShape(int mode)
|
static java.lang.Process |
exec(java.lang.String[] argv)
|
void |
exit()
Call to safely exit the sketch when finished. |
static float |
exp(float a)
|
static boolean[] |
expand(boolean[] list)
|
static boolean[] |
expand(boolean[] list,
int newSize)
|
static byte[] |
expand(byte[] list)
|
static byte[] |
expand(byte[] list,
int newSize)
|
static char[] |
expand(char[] list)
|
static char[] |
expand(char[] list,
int newSize)
|
static float[] |
expand(float[] list)
|
static float[] |
expand(float[] list,
int newSize)
|
static int[] |
expand(int[] list)
|
static int[] |
expand(int[] list,
int newSize)
|
static java.lang.Object |
expand(java.lang.Object array)
|
static java.lang.Object |
expand(java.lang.Object list,
int newSize)
|
static java.lang.String[] |
expand(java.lang.String[] list)
|
static java.lang.String[] |
expand(java.lang.String[] list,
int newSize)
|
void |
fill(float gray)
|
void |
fill(float gray,
float alpha)
|
void |
fill(float x,
float y,
float z)
|
void |
fill(float x,
float y,
float z,
float a)
|
void |
fill(int rgb)
|
void |
fill(int rgb,
float alpha)
|
void |
filter(int kind)
|
void |
filter(int kind,
float param)
|
static int |
floor(float what)
|
void |
flush()
|
void |
focusGained()
|
void |
focusGained(java.awt.event.FocusEvent e)
|
void |
focusLost()
|
void |
focusLost(java.awt.event.FocusEvent e)
|
void |
frameRate(float newRateTarget)
Set a target frameRate. |
void |
frustum(float left,
float right,
float bottom,
float top,
float near,
float far)
|
PImage |
get()
|
int |
get(int x,
int y)
|
PImage |
get(int x,
int y,
int w,
int h)
|
java.lang.Object |
getCache(java.lang.Object parent)
|
PMatrix |
getMatrix()
|
PMatrix2D |
getMatrix(PMatrix2D target)
|
PMatrix3D |
getMatrix(PMatrix3D target)
|
int |
getSketchHeight()
|
java.lang.String |
getSketchRenderer()
|
int |
getSketchWidth()
|
float |
green(int what)
|
void |
handleDraw()
|
static java.lang.String |
hex(byte what)
|
static java.lang.String |
hex(char what)
|
static java.lang.String |
hex(int what)
|
static java.lang.String |
hex(int what,
int digits)
|
void |
hint(int which)
|
static int |
hour()
Hour position of the current time in international format (0-23). |
float |
hue(int what)
|
void |
image(PImage image,
float x,
float y)
|
void |
image(PImage image,
float x,
float y,
float c,
float d)
|
void |
image(PImage image,
float a,
float b,
float c,
float d,
int u1,
int v1,
int u2,
int v2)
|
void |
imageMode(int mode)
|
void |
init()
|
static java.lang.String |
join(java.lang.String[] str,
char separator)
Join an array of Strings together as a single String, separated by the whatever's passed in for the separator. |
static java.lang.String |
join(java.lang.String[] str,
java.lang.String separator)
Join an array of Strings together as a single String, separated by the whatever's passed in for the separator. |
void |
keyPressed()
Called each time a single key on the keyboard is pressed. |
void |
keyPressed(java.awt.event.KeyEvent e)
Overriding keyXxxxx(KeyEvent e) functions will cause the 'key', 'keyCode', and 'keyEvent' variables to no longer work; key events will no longer be queued until the end of draw(); and the keyPressed(), keyReleased() and keyTyped() methods will no longer be called. |
void |
keyReleased()
See keyPressed(). |
void |
keyReleased(java.awt.event.KeyEvent e)
|
void |
keyTyped()
Only called for "regular" keys like letters, see keyPressed() for full documentation. |
void |
keyTyped(java.awt.event.KeyEvent e)
|
static float |
lerp(float start,
float stop,
float amt)
|
int |
lerpColor(int c1,
int c2,
float amt)
|
static int |
lerpColor(int c1,
int c2,
float amt,
int mode)
|
void |
lightFalloff(float constant,
float linear,
float quadratic)
|
void |
lights()
|
void |
lightSpecular(float x,
float y,
float z)
|
void |
line(float x1,
float y1,
float x2,
float y2)
|
void |
line(float x1,
float y1,
float z1,
float x2,
float y2,
float z2)
|
void |
link(java.lang.String here)
|
void |
link(java.lang.String url,
java.lang.String frameTitle)
Link to an external page without all the muss. |
static byte[] |
loadBytes(java.io.File file)
|
static byte[] |
loadBytes(java.io.InputStream input)
|
byte[] |
loadBytes(java.lang.String filename)
|
PFont |
loadFont(java.lang.String filename)
|
PImage |
loadImage(java.lang.String filename)
Load an image from the data folder or a local directory. |
PImage |
loadImage(java.lang.String filename,
java.lang.String extension)
Identical to loadImage, but allows you to specify the type of image by its extension. |
void |
loadPixels()
Override the g.pixels[] function to set the pixels[] array that's part of the PApplet object. |
PShape |
loadShape(java.lang.String filename)
Load a geometry from a file as a PShape. |
static java.lang.String[] |
loadStrings(java.io.File file)
|
static java.lang.String[] |
loadStrings(java.io.InputStream input)
|
java.lang.String[] |
loadStrings(java.lang.String filename)
Load data from a file and shove it into a String array. |
static float |
log(float a)
|
void |
loop()
|
static float |
mag(float a,
float b)
|
static float |
mag(float a,
float b,
float c)
|
static void |
main(java.lang.String[] args)
main() method for running this class from the command line. |
static float |
map(float value,
float istart,
float istop,
float ostart,
float ostop)
Convenience function to map a variable from one coordinate space to another. |
void |
mask(int[] alpha)
|
void |
mask(PImage alpha)
|
static java.lang.String[] |
match(java.lang.String what,
java.lang.String regexp)
Match a string with a regular expression, and returns the match as an array. |
static java.lang.String[][] |
matchAll(java.lang.String what,
java.lang.String regexp)
Identical to match(), except that it returns an array of all matches in the specified String, rather than just the first. |
static float |
max(float[] list)
Find the maximum value in an array. |
static float |
max(float a,
float b)
|
static float |
max(float a,
float b,
float c)
|
static int |
max(int[] list)
Find the maximum value in an array. |
static int |
max(int a,
int b)
|
static int |
max(int a,
int b,
int c)
|
int |
millis()
Get the number of milliseconds since the applet started. |
static float |
min(float[] list)
Find the minimum value in an array. |
static float |
min(float a,
float b)
|
static float |
min(float a,
float b,
float c)
|
static int |
min(int[] list)
Find the minimum value in an array. |
static int |
min(int a,
int b)
|
static int |
min(int a,
int b,
int c)
|
static int |
minute()
Minutes position of the current time. |
float |
modelX(float x,
float y,
float z)
|
float |
modelY(float x,
float y,
float z)
|
float |
modelZ(float x,
float y,
float z)
|
static int |
month()
Get the current month in range 1 through 12. |
void |
mouseClicked()
When the mouse is clicked, mousePressed() will be called, then mouseReleased(), then mouseClicked(). |
void |
mouseClicked(java.awt.event.MouseEvent e)
|
void |
mouseDragged()
Mouse button is pressed and the mouse has been dragged. |
void |
mouseDragged(java.awt.event.MouseEvent e)
|
void |
mouseEntered(java.awt.event.MouseEvent e)
|
void |
mouseExited(java.awt.event.MouseEvent e)
|
void |
mouseMoved()
Mouse button is not pressed but the mouse has changed locations. |
void |
mouseMoved(java.awt.event.MouseEvent e)
|
void |
mousePressed()
Mouse has been pressed, and should be considered "down" until mouseReleased() is called. |
void |
mousePressed(java.awt.event.MouseEvent e)
If you override this or any function that takes a "MouseEvent e" without calling its super.mouseXxxx() then mouseX, mouseY, mousePressed, and mouseEvent will no longer be set. |
void |
mouseReleased()
Mouse button has been released. |
void |
mouseReleased(java.awt.event.MouseEvent e)
|
static java.lang.String[] |
nf(float[] num,
int left,
int right)
|
static java.lang.String |
nf(float num,
int left,
int right)
|
static java.lang.String[] |
nf(int[] num,
int digits)
|
static java.lang.String |
nf(int num,
int digits)
|
static java.lang.String[] |
nfc(float[] num,
int right)
|
static java.lang.String |
nfc(float num,
int right)
|
static java.lang.String |
nfc(int num)
|
static java.lang.String[] |
nfc(int[] num)
|
static java.lang.String[] |
nfp(float[] num,
int left,
int right)
|
static java.lang.String |
nfp(float num,
int left,
int right)
|
static java.lang.String[] |
nfp(int[] num,
int digits)
|
static java.lang.String |
nfp(int num,
int digits)
number format positive (or plus) Formats a number, always placing a - or + sign in the front when it's negative or positive. |
static java.lang.String[] |
nfs(float[] num,
int left,
int right)
Number formatter that takes into account whether the number has a sign (positive, negative, etc) in front of it. |
static java.lang.String |
nfs(float num,
int left,
int right)
|
static java.lang.String[] |
nfs(int[] num,
int digits)
|
static java.lang.String |
nfs(int num,
int digits)
number format signed (or space) Formats a number but leaves a blank space in the front when it's positive so that it can be properly aligned with numbers that have a negative sign in front of them. |
void |
noCursor()
Hide the cursor by creating a transparent image and using it as a custom cursor. |
void |
noFill()
|
float |
noise(float x)
Computes the Perlin noise function value at point x. |
float |
noise(float x,
float y)
Computes the Perlin noise function value at the point x, y. |
float |
noise(float x,
float y,
float z)
Computes the Perlin noise function value at x, y, z. |
void |
noiseDetail(int lod)
|
void |
noiseDetail(int lod,
float falloff)
|
void |
noiseSeed(long what)
|
void |
noLights()
|
void |
noLoop()
|
static float |
norm(float value,
float start,
float stop)
Normalize a value to exist between 0 and 1 (inclusive). |
void |
normal(float nx,
float ny,
float nz)
|
void |
noSmooth()
|
void |
noStroke()
|
void |
noTint()
|
static void |
open(java.lang.String filename)
Attempt to open a file using the platform's shell. |
static java.lang.Process |
open(java.lang.String[] argv)
Launch a process using a platforms shell. |
java.io.InputStream |
openStream(java.lang.String filename)
Deprecated. As of release 0136, use createInput() instead. |
void |
ortho()
|
void |
ortho(float left,
float right,
float bottom,
float top,
float near,
float far)
|
void |
paint(java.awt.Graphics screen)
|
java.lang.String |
param(java.lang.String what)
Get a param from the web page, or (eventually) from a properties file. |
static boolean[] |
parseBoolean(byte[] what)
Convert a byte array to a boolean array. |
static boolean |
parseBoolean(int what)
Convert an integer to a boolean. |
static boolean[] |
parseBoolean(int[] what)
Convert an int array to a boolean array. |
static boolean |
parseBoolean(java.lang.String what)
Convert the string "true" or "false" to a boolean. |
static boolean[] |
parseBoolean(java.lang.String[] what)
|
static byte |
parseByte(boolean what)
|
static byte[] |
parseByte(boolean[] what)
|
static float[] |
parseByte(byte[] what)
|
static byte |
parseByte(char what)
|
static byte[] |
parseByte(char[] what)
|
static byte |
parseByte(float what)
|
static byte[] |
parseByte(float[] what)
|
static byte |
parseByte(int what)
|
static byte[] |
parseByte(int[] what)
|
static char |
parseChar(byte what)
|
static char[] |
parseChar(byte[] what)
|
static char |
parseChar(int what)
|
static char[] |
parseChar(int[] what)
|
static float |
parseFloat(int what)
Convert an int to a float value. |
static float[] |
parseFloat(int[] what)
|
static float |
parseFloat(java.lang.String what)
|
static float[] |
parseFloat(java.lang.String[] what)
|
static float[] |
parseFloat(java.lang.String[] what,
float missing)
|
static float |
parseFloat(java.lang.String what,
float otherwise)
|
static int |
parseInt(boolean what)
|
static int[] |
parseInt(boolean[] what)
|
static int |
parseInt(byte what)
Note that parseInt() will un-sign a signed byte value. |
static int[] |
parseInt(byte[] what)
|
static int |
parseInt(char what)
Note that parseInt('5') is unlike String in the sense that it won't return 5, but the ascii value. |
static int[] |
parseInt(char[] what)
|
static int |
parseInt(float what)
Same as floor(), or an (int) cast. |
static int[] |
parseInt(float[] what)
|
static int |
parseInt(java.lang.String what)
Parse a String into an int value. |
static int[] |
parseInt(java.lang.String[] what)
Make an array of int elements from an array of String objects. |
static int[] |
parseInt(java.lang.String[] what,
int missing)
Make an array of int elements from an array of String objects. |
static int |
parseInt(java.lang.String what,
int otherwise)
Parse a String to an int, and provide an alternate value that should be used when the number is invalid. |
void |
perspective()
|
void |
perspective(float fovy,
float aspect,
float zNear,
float zFar)
|
void |
point(float x,
float y)
|
void |
point(float x,
float y,
float z)
|
void |
pointLight(float red,
float green,
float blue,
float x,
float y,
float z)
|
void |
popMatrix()
|
void |
popStyle()
|
static float |
pow(float a,
float b)
|
static void |
print(boolean what)
|
static void |
print(byte what)
|
static void |
print(char what)
|
static void |
print(float what)
|
static void |
print(int what)
|
static void |
print(java.lang.Object what)
|
static void |
print(java.lang.String what)
|
void |
printCamera()
|
static void |
println()
|
static void |
println(boolean what)
|
static void |
println(byte what)
|
static void |
println(char what)
|
static void |
println(float what)
|
static void |
println(int what)
|
static void |
println(java.lang.Object what)
|
static void |
println(java.lang.String what)
|
void |
printMatrix()
|
void |
printProjection()
|
void |
pushMatrix()
|
void |
pushStyle()
|
void |
quad(float x1,
float y1,
float x2,
float y2,
float x3,
float y3,
float x4,
float y4)
|
static float |
radians(float degrees)
|
float |
random(float howbig)
Return a random number in the range [0, howbig). |
float |
random(float howsmall,
float howbig)
Return a random number in the range [howsmall, howbig). |
void |
randomSeed(long what)
|
void |
rect(float a,
float b,
float c,
float d)
|
void |
rectMode(int mode)
|
float |
red(int what)
|
void |
redraw()
|
void |
registerDispose(java.lang.Object o)
|
void |
registerDraw(java.lang.Object o)
|
void |
registerKeyEvent(java.lang.Object o)
|
void |
registerMouseEvent(java.lang.Object o)
|
void |
registerPost(java.lang.Object o)
|
void |
registerPre(java.lang.Object o)
|
void |
registerSize(java.lang.Object o)
|
void |
removeCache(java.lang.Object parent)
|
PImage |
requestImage(java.lang.String filename)
|
PImage |
requestImage(java.lang.String filename,
java.lang.String extension)
|
void |
resetMatrix()
|
static boolean[] |
reverse(boolean[] list)
|
static byte[] |
reverse(byte[] list)
|
static char[] |
reverse(char[] list)
|
static float[] |
reverse(float[] list)
|
static int[] |
reverse(int[] list)
|
static java.lang.Object |
reverse(java.lang.Object list)
|
static java.lang.String[] |
reverse(java.lang.String[] list)
|
void |
rotate(float angle)
|
void |
rotate(float angle,
float vx,
float vy,
float vz)
|
void |
rotateX(float angle)
|
void |
rotateY(float angle)
|
void |
rotateZ(float angle)
|
static int |
round(float what)
|
void |
run()
Main method for the primary animation thread. |
float |
saturation(int what)
|
void |
save(java.lang.String filename)
Intercepts any relative paths to make them absolute (relative to the sketch folder) before passing to save() in PImage. |
static void |
saveBytes(java.io.File file,
byte[] buffer)
Saves bytes to a specific File location specified by the user. |
static void |
saveBytes(java.io.OutputStream output,
byte[] buffer)
Spews a buffer of bytes to an OutputStream. |
void |
saveBytes(java.lang.String filename,
byte[] buffer)
Saves bytes to a file to inside the sketch folder. |
java.io.File |
saveFile(java.lang.String where)
Identical to savePath(), but returns a File object. |
void |
saveFrame()
Grab an image of what's currently in the drawing area and save it as a .tif or .tga file. |
void |
saveFrame(java.lang.String what)
Save the current frame as a .tif or .tga image. |
java.lang.String |
savePath(java.lang.String where)
Returns a path inside the applet folder to save to. |
static void |
saveStream(java.io.File targetFile,
java.io.InputStream sourceStream)
|
void |
saveStream(java.io.File targetFile,
java.lang.String sourceLocation)
Identical to the other saveStream(), but writes to a File object, for greater control over the file location. |
void |
saveStream(java.lang.String targetFilename,
java.lang.String sourceLocation)
Save the contents of a stream to a file in the sketch folder. |
static void |
saveStrings(java.io.File file,
java.lang.String[] strings)
|
static void |
saveStrings(java.io.OutputStream output,
java.lang.String[] strings)
|
void |
saveStrings(java.lang.String filename,
java.lang.String[] strings)
|
void |
scale(float s)
|
void |
scale(float sx,
float sy)
|
void |
scale(float x,
float y,
float z)
|
float |
screenX(float x,
float y)
|
float |
screenX(float x,
float y,
float z)
|
float |
screenY(float x,
float y)
|
float |
screenY(float x,
float y,
float z)
|
float |
screenZ(float x,
float y,
float z)
|
static int |
second()
Seconds position of the current time. |
java.lang.String |
selectFolder()
Open a platform-specific folder chooser dialog. |
java.lang.String |
selectFolder(java.lang.String prompt)
Open a platform-specific folder chooser dialog. |
java.lang.String |
selectInput()
Open a platform-specific file chooser dialog to select a file for input. |
java.lang.String |
selectInput(java.lang.String prompt)
Open a platform-specific file chooser dialog to select a file for input. |
java.lang.String |
selectOutput()
Open a platform-specific file save dialog to select a file for output. |
java.lang.String |
selectOutput(java.lang.String prompt)
Open a platform-specific file save dialog to select a file for output. |
void |
set(int x,
int y,
int c)
|
void |
set(int x,
int y,
PImage src)
|
void |
setCache(java.lang.Object parent,
java.lang.Object storage)
|
void |
setMatrix(PMatrix source)
|
void |
setMatrix(PMatrix2D source)
|
void |
setMatrix(PMatrix3D source)
|
void |
setup()
|
void |
setupExternalMessages()
Set this sketch to communicate its state back to the PDE. |
void |
setupFrameResizeListener()
Set up a listener that will fire proper component resize events in cases where frame.setResizable(true) is called. |
void |
shape(PShape shape)
|
void |
shape(PShape shape,
float x,
float y)
|
void |
shape(PShape shape,
float x,
float y,
float c,
float d)
|
void |
shapeMode(int mode)
|
void |
shininess(float shine)
|
static boolean[] |
shorten(boolean[] list)
|
static byte[] |
shorten(byte[] list)
|
static char[] |
shorten(char[] list)
|
static float[] |
shorten(float[] list)
|
static int[] |
shorten(int[] list)
|
static java.lang.Object |
shorten(java.lang.Object list)
|
static java.lang.String[] |
shorten(java.lang.String[] list)
|
static float |
sin(float angle)
|
void |
size(int iwidth,
int iheight)
Starts up and creates a two-dimensional drawing surface, or resizes the current drawing surface. |
void |
size(int iwidth,
int iheight,
java.lang.String irenderer)
|
void |
size(int iwidth,
int iheight,
java.lang.String irenderer,
java.lang.String ipath)
Creates a new PGraphics object and sets it to the specified size. |
java.io.File |
sketchFile(java.lang.String where)
|
java.lang.String |
sketchPath(java.lang.String where)
Prepend the sketch folder path to the filename (or path) that is passed in. |
void |
smooth()
|
static byte[] |
sort(byte[] what)
|
static byte[] |
sort(byte[] what,
int count)
|
static char[] |
sort(char[] what)
|
static char[] |
sort(char[] what,
int count)
|
static float[] |
sort(float[] what)
|
static float[] |
sort(float[] what,
int count)
|
static int[] |
sort(int[] what)
|
static int[] |
sort(int[] what,
int count)
|
static java.lang.String[] |
sort(java.lang.String[] what)
|
static java.lang.String[] |
sort(java.lang.String[] what,
int count)
|
void |
specular(float gray)
|
void |
specular(float x,
float y,
float z)
|
void |
specular(int rgb)
|
void |
sphere(float r)
|
void |
sphereDetail(int res)
|
void |
sphereDetail(int ures,
int vres)
|
static boolean[] |
splice(boolean[] list,
boolean[] v,
int index)
|
static boolean[] |
splice(boolean[] list,
boolean v,
int index)
|
static byte[] |
splice(byte[] list,
byte[] v,
int index)
|
static byte[] |
splice(byte[] list,
byte v,
int index)
|
static char[] |
splice(char[] list,
char[] v,
int index)
|
static char[] |
splice(char[] list,
char v,
int index)
|
static float[] |
splice(float[] list,
float[] v,
int index)
|
static float[] |
splice(float[] list,
float v,
int index)
|
static int[] |
splice(int[] list,
int[] v,
int index)
|
static int[] |
splice(int[] list,
int v,
int index)
|
static java.lang.Object |
splice(java.lang.Object list,
java.lang.Object v,
int index)
|
static java.lang.String[] |
splice(java.lang.String[] list,
java.lang.String[] v,
int index)
|
static java.lang.String[] |
splice(java.lang.String[] list,
java.lang.String v,
int index)
|
static java.lang.String[] |
split(java.lang.String what,
char delim)
Split a string into pieces along a specific character. |
static java.lang.String[] |
split(java.lang.String what,
java.lang.String delim)
Split a String on a specific delimiter. |
static java.lang.String[] |
splitTokens(java.lang.String what)
Split the provided String at wherever whitespace occurs. |
static java.lang.String[] |
splitTokens(java.lang.String what,
java.lang.String delim)
Splits a string into pieces, using any of the chars in the String 'delim' as separator characters. |
void |
spotLight(float red,
float green,
float blue,
float x,
float y,
float z,
float nx,
float ny,
float nz,
float angle,
float concentration)
|
static float |
sq(float a)
|
static float |
sqrt(float a)
|
void |
start()
Called by the browser or applet viewer to inform this applet that it should start its execution. |
void |
status(java.lang.String what)
Show status in the status bar of a web browser, or in the System.out console. |
void |
stop()
Called by the browser or applet viewer to inform this applet that it should stop its execution. |
static java.lang.String |
str(boolean x)
|
static java.lang.String[] |
str(boolean[] x)
|
static java.lang.String |
str(byte x)
|
static java.lang.String[] |
str(byte[] x)
|
static java.lang.String |
str(char x)
|
static java.lang.String[] |
str(char[] x)
|
static java.lang.String |
str(float x)
|
static java.lang.String[] |
str(float[] x)
|
static java.lang.String |
str(int x)
|
static java.lang.String[] |
str(int[] x)
|
void |
stroke(float gray)
|
void |
stroke(float gray,
float alpha)
|
void |
stroke(float x,
float y,
float z)
|
void |
stroke(float x,
float y,
float z,
float a)
|
void |
stroke(int rgb)
|
void |
stroke(int rgb,
float alpha)
|
void |
strokeCap(int cap)
|
void |
strokeJoin(int join)
|
void |
strokeWeight(float weight)
|
void |
style(PStyle s)
|
static boolean[] |
subset(boolean[] list,
int start)
|
static boolean[] |
subset(boolean[] list,
int start,
int count)
|
static byte[] |
subset(byte[] list,
int start)
|
static byte[] |
subset(byte[] list,
int start,
int count)
|
static char[] |
subset(char[] list,
int start)
|
static char[] |
subset(char[] list,
int start,
int count)
|
static float[] |
subset(float[] list,
int start)
|
static float[] |
subset(float[] list,
int start,
int count)
|
static int[] |
subset(int[] list,
int start)
|
static int[] |
subset(int[] list,
int start,
int count)
|
static java.lang.Object |
subset(java.lang.Object list,
int start)
|
static java.lang.Object |
subset(java.lang.Object list,
int start,
int count)
|
static java.lang.String[] |
subset(java.lang.String[] list,
int start)
|
static java.lang.String[] |
subset(java.lang.String[] list,
int start,
int count)
|
static float |
tan(float angle)
|
void |
text(char c)
|
void |
text(char[] chars,
int start,
int stop,
float x,
float y)
|
void |
text(char[] chars,
int start,
int stop,
float x,
float y,
float z)
|
void |
text(char c,
float x,
float y)
|
void |
text(char c,
float x,
float y,
float z)
|
void |
text(float num,
float x,
float y)
|
void |
text(float num,
float x,
float y,
float z)
|
void |
text(int num,
float x,
float y)
|
void |
text(int num,
float x,
float y,
float z)
|
void |
text(java.lang.String str)
|
void |
text(java.lang.String str,
float x,
float y)
|
void |
text(java.lang.String str,
float x,
float y,
float z)
|
void |
text(java.lang.String str,
float x1,
float y1,
float x2,
float y2)
|
void |
text(java.lang.String s,
float x1,
float y1,
float x2,
float y2,
float z)
|
void |
textAlign(int align)
|
void |
textAlign(int alignX,
int alignY)
|
float |
textAscent()
|
float |
textDescent()
|
void |
textFont(PFont which)
|
void |
textFont(PFont which,
float size)
|
void |
textLeading(float leading)
|
void |
textMode(int mode)
|
void |
textSize(float size)
|
void |
texture(PImage image)
|
void |
textureMode(int mode)
|
float |
textWidth(char c)
|
float |
textWidth(java.lang.String str)
|
void |
tint(float gray)
|
void |
tint(float gray,
float alpha)
|
void |
tint(float x,
float y,
float z)
|
void |
tint(float x,
float y,
float z,
float a)
|
void |
tint(int rgb)
|
void |
tint(int rgb,
float alpha)
|
void |
translate(float tx,
float ty)
|
void |
translate(float tx,
float ty,
float tz)
|
void |
triangle(float x1,
float y1,
float x2,
float y2,
float x3,
float y3)
|
static java.lang.String |
trim(java.lang.String str)
Remove whitespace characters from the beginning and ending of a String. |
static java.lang.String[] |
trim(java.lang.String[] array)
Trim the whitespace from a String array. |
static int |
unbinary(java.lang.String what)
Unpack a binary String into an int. |
static int |
unhex(java.lang.String what)
|
void |
unregisterDispose(java.lang.Object o)
|
void |
unregisterDraw(java.lang.Object o)
|
void |
unregisterKeyEvent(java.lang.Object o)
|
void |
unregisterMouseEvent(java.lang.Object o)
|
void |
unregisterPost(java.lang.Object o)
|
void |
unregisterPre(java.lang.Object o)
|
void |
unregisterSize(java.lang.Object o)
|
void |
update(java.awt.Graphics screen)
|
void |
updatePixels()
|
void |
updatePixels(int x1,
int y1,
int x2,
int y2)
|
void |
vertex(float[] v)
|
void |
vertex(float x,
float y)
|
void |
vertex(float x,
float y,
float z)
|
void |
vertex(float x,
float y,
float u,
float v)
|
void |
vertex(float x,
float y,
float z,
float u,
float v)
|
static int |
year()
Get the current year. |
Methods inherited from class java.applet.Applet |
---|
getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus |
Methods inherited from class java.awt.Panel |
---|
addNotify |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, validate |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String javaVersionName
public static final float javaVersion
Note that because this is stored as a float, the values may not be exactly 1.3 or 1.4. Instead, make sure you're comparing against 1.3f or 1.4f, which will have the same amount of error (i.e. 1.40000001). This could just be a double, but since Processing only uses floats, it's safer for this to be a float because there's no good way to specify a double with the preproc.
public static int platform
public static final int MENU_SHORTCUT
public PGraphics g
public java.awt.Frame frame
public java.awt.Dimension screen
Access this via screen.width and screen.height. To make an applet run at full screen, use size(screen.width, screen.height).
If you have multiple displays, this will be the size of the main display. Running full screen across multiple displays isn't particularly supported, and requires more monkeying with the values. This probably can't/won't be fixed until/unless I get a dual head system.
Note that this won't update if you change the resolution of your screen once the the applet is running.
This variable is not static, because future releases need to be better at handling multiple displays.
public PGraphics recorder
public java.lang.String[] args
This does not include the arguments passed in to PApplet itself.
public java.lang.String sketchPath
public static final int DEFAULT_WIDTH
public static final int DEFAULT_HEIGHT
public static final int MIN_WINDOW_WIDTH
public static final int MIN_WINDOW_HEIGHT
public boolean defaultSize
public int[] pixels
When used with OpenGL or Java2D, this value will be null until loadPixels() has been called.
public int width
public int height
public int mouseX
public int mouseY
public int pmouseX
public int pmouseY
public boolean firstMouse
Just using (frameCount == 0) won't work since mouseXxxxx() may not be called until a couple frames into things.
public int mouseButton
If running on Mac OS, a ctrl-click will be interpreted as the righthand mouse button (unlike Java, which reports it as the left mouse).
public boolean mousePressed
public java.awt.event.MouseEvent mouseEvent
public char key
If it's a coded key, i.e. UP/DOWN/CTRL/SHIFT/ALT, this will be set to CODED (0xffff or 65535).
public int keyCode
For the arrow keys, keyCode will be one of UP, DOWN, LEFT and RIGHT. Also available are ALT, CONTROL and SHIFT. A full set of constants can be obtained from java.awt.event.KeyEvent, from the VK_XXXX variables.
public boolean keyPressed
public java.awt.event.KeyEvent keyEvent
public boolean focused
public boolean online
This can be used to test how the applet should behave since online situations are different (no file writing, etc).
public float frameRate
The initial value will be 10 fps, and will be updated with each frame thereafter. The value is not instantaneous (since that wouldn't be very useful since it would jump around so much), but is instead averaged (integrated) over several frames. As such, this value won't be valid until after 5-10 frames.
public int frameCount
This value is read-only do not attempt to set it, otherwise bad things will happen.
Inside setup(), frameCount is 0. For the first iteration of draw(), frameCount will equal 1.
public boolean finished
public static final java.lang.String ARGS_EDITOR_LOCATION
public static final java.lang.String ARGS_EXTERNAL
This is used by the editor to when saving the previous applet location, or could be used by other classes to launch at a specific position on-screen.
public static final java.lang.String ARGS_LOCATION
public static final java.lang.String ARGS_DISPLAY
public static final java.lang.String ARGS_BGCOLOR
public static final java.lang.String ARGS_PRESENT
public static final java.lang.String ARGS_EXCLUSIVE
public static final java.lang.String ARGS_STOP_COLOR
public static final java.lang.String ARGS_HIDE_STOP
public static final java.lang.String ARGS_SKETCH_FOLDER
Used by PdeEditor to pass in the location where saveFrame() and all that stuff should write things.
public static final java.lang.String EXTERNAL_STOP
public static final java.lang.String EXTERNAL_MOVE
This is used so that the editor can re-open the sketch window in the same position as the user last left it.
public int requestImageMax
public java.io.File selectedFile
public static final byte[] ICON_IMAGE
Constructor Detail |
---|
public PApplet()
Method Detail |
---|
public void init()
init
in class java.applet.Applet
public int getSketchWidth()
public int getSketchHeight()
public java.lang.String getSketchRenderer()
public void start()
start
in class java.applet.Applet
public void stop()
stop
in class java.applet.Applet
public void destroy()
destroy
in class java.applet.Applet
public void registerSize(java.lang.Object o)
public void registerPre(java.lang.Object o)
public void registerDraw(java.lang.Object o)
public void registerPost(java.lang.Object o)
public void registerMouseEvent(java.lang.Object o)
public void registerKeyEvent(java.lang.Object o)
public void registerDispose(java.lang.Object o)
public void unregisterSize(java.lang.Object o)
public void unregisterPre(java.lang.Object o)
public void unregisterDraw(java.lang.Object o)
public void unregisterPost(java.lang.Object o)
public void unregisterMouseEvent(java.lang.Object o)
public void unregisterKeyEvent(java.lang.Object o)
public void unregisterDispose(java.lang.Object o)
public void setup()
public void draw()
public void size(int iwidth, int iheight)
This should be the first thing called inside of setup().
If using Java 1.3 or later, this will default to using PGraphics2, the Java2D-based renderer. If using Java 1.1, or if PGraphics2 is not available, then PGraphics will be used. To set your own renderer, use the other version of the size() method that takes a renderer as its last parameter.
If called once a renderer has already been set, this will use the previous renderer and simply resize it.
public void size(int iwidth, int iheight, java.lang.String irenderer)
public void size(int iwidth, int iheight, java.lang.String irenderer, java.lang.String ipath)
public PGraphics createGraphics(int iwidth, int iheight, java.lang.String irenderer)
PGraphics big; void setup() { big = createGraphics(3000, 3000, P3D); big.beginDraw(); big.background(128); big.line(20, 1800, 1800, 900); // etc.. big.endDraw(); // make sure the file is written to the sketch folder big.save("big.tif"); }
public PGraphics createGraphics(int iwidth, int iheight, java.lang.String irenderer, java.lang.String ipath)
ipath
- can be an absolute or relative pathpublic PImage createImage(int wide, int high, int format)
public void update(java.awt.Graphics screen)
update
in class java.awt.Container
public void paint(java.awt.Graphics screen)
paint
in class java.awt.Container
public void run()
run
in interface java.lang.Runnable
public void handleDraw()
public void redraw()
public void loop()
public void noLoop()
public void addListeners()
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
public void mousePressed()
public void mouseReleased()
public void mouseClicked()
public void mouseDragged()
public void mouseMoved()
public void keyPressed(java.awt.event.KeyEvent e)
keyPressed
in interface java.awt.event.KeyListener
public void keyReleased(java.awt.event.KeyEvent e)
keyReleased
in interface java.awt.event.KeyListener
public void keyTyped(java.awt.event.KeyEvent e)
keyTyped
in interface java.awt.event.KeyListener
public void keyPressed()
Examples for key handling: (Tested on Windows XP, please notify if different on other platforms, I have a feeling Mac OS and Linux may do otherwise)
1. Pressing 'a' on the keyboard: keyPressed with key == 'a' and keyCode == 'A' keyTyped with key == 'a' and keyCode == 0 keyReleased with key == 'a' and keyCode == 'A' 2. Pressing 'A' on the keyboard: keyPressed with key == 'A' and keyCode == 'A' keyTyped with key == 'A' and keyCode == 0 keyReleased with key == 'A' and keyCode == 'A' 3. Pressing 'shift', then 'a' on the keyboard (caps lock is off): keyPressed with key == CODED and keyCode == SHIFT keyPressed with key == 'A' and keyCode == 'A' keyTyped with key == 'A' and keyCode == 0 keyReleased with key == 'A' and keyCode == 'A' keyReleased with key == CODED and keyCode == SHIFT 4. Holding down the 'a' key. The following will happen several times, depending on your machine's "key repeat rate" settings: keyPressed with key == 'a' and keyCode == 'A' keyTyped with key == 'a' and keyCode == 0 When you finally let go, you'll get: keyReleased with key == 'a' and keyCode == 'A' 5. Pressing and releasing the 'shift' key keyPressed with key == CODED and keyCode == SHIFT keyReleased with key == CODED and keyCode == SHIFT (note there is no keyTyped) 6. Pressing the tab key in an applet with Java 1.4 will normally do nothing, but PApplet dynamically shuts this behavior off if Java 1.4 is in use (tested 1.4.2_05 Windows). Java 1.1 (Microsoft VM) passes the TAB key through normally. Not tested on other platforms or for 1.3.
public void keyReleased()
public void keyTyped()
public void focusGained()
public void focusGained(java.awt.event.FocusEvent e)
focusGained
in interface java.awt.event.FocusListener
public void focusLost()
public void focusLost(java.awt.event.FocusEvent e)
focusLost
in interface java.awt.event.FocusListener
public int millis()
This is a function, rather than a variable, because it may change multiple times per frame.
public static int second()
public static int minute()
public static int hour()
To convert this value to American time:
int yankeeHour = (hour() % 12); if (yankeeHour == 0) yankeeHour = 12;
public static int day()
If you're looking for the day of the week (M-F or whatever) or day of the year (1..365) then use java's Calendar.get()
public static int month()
public static int year()
public void delay(int napTime)
public void frameRate(float newRateTarget)
public java.lang.String param(java.lang.String what)
public void status(java.lang.String what)
public void link(java.lang.String here)
public void link(java.lang.String url, java.lang.String frameTitle)
When run with an applet, uses the browser to open the url, for applications, attempts to launch a browser with the url.
Works on Mac OS X and Windows. For Linux, use:
open(new String[] { "firefox", url });or whatever you want as your browser, since Linux doesn't yet have a standard method for launching URLs.
public static void open(java.lang.String filename)
public static java.lang.Process open(java.lang.String[] argv)
public static java.lang.Process exec(java.lang.String[] argv)
public void die(java.lang.String what)
public void die(java.lang.String what, java.lang.Exception e)
public void exit()
public void save(java.lang.String filename)
public void saveFrame()
Best used just before endDraw() at the end of your draw(). This can only create .tif or .tga images, so if neither extension is specified it defaults to writing a tiff and adds a .tif suffix.
public void saveFrame(java.lang.String what)
The String passed in can contain a series of # signs that will be replaced with the screengrab number.
i.e. saveFrame("blah-####.tif"); // saves a numbered tiff image, replacing the // #### signs with zeros and the frame number
public void cursor(int cursorType)
public void cursor(PImage image)
public void cursor(PImage image, int hotspotX, int hotspotY)
Based on code contributed by Amit Pitaru, plus additional code to handle Java versions via reflection by Jonathan Feinberg. Reflection removed for release 0128 and later.
public void cursor()
public void noCursor()
public static void print(byte what)
public static void print(boolean what)
public static void print(char what)
public static void print(int what)
public static void print(float what)
public static void print(java.lang.String what)
public static void print(java.lang.Object what)
public static void println()
public static void println(byte what)
public static void println(boolean what)
public static void println(char what)
public static void println(int what)
public static void println(float what)
public static void println(java.lang.String what)
public static void println(java.lang.Object what)
public static final float abs(float n)
public static final int abs(int n)
public static final float sq(float a)
public static final float sqrt(float a)
public static final float log(float a)
public static final float exp(float a)
public static final float pow(float a, float b)
public static final int max(int a, int b)
public static final float max(float a, float b)
public static final int max(int a, int b, int c)
public static final float max(float a, float b, float c)
public static final int max(int[] list)
list
- the source array
public static final float max(float[] list)
list
- the source array
public static final int min(int a, int b)
public static final float min(float a, float b)
public static final int min(int a, int b, int c)
public static final float min(float a, float b, float c)
public static final int min(int[] list)
list
- the source array
public static final float min(float[] list)
list
- the source array
public static final int constrain(int amt, int low, int high)
public static final float constrain(float amt, float low, float high)
public static final float sin(float angle)
public static final float cos(float angle)
public static final float tan(float angle)
public static final float asin(float value)
public static final float acos(float value)
public static final float atan(float value)
public static final float atan2(float a, float b)
public static final float degrees(float radians)
public static final float radians(float degrees)
public static final int ceil(float what)
public static final int floor(float what)
public static final int round(float what)
public static final float mag(float a, float b)
public static final float mag(float a, float b, float c)
public static final float dist(float x1, float y1, float x2, float y2)
public static final float dist(float x1, float y1, float z1, float x2, float y2, float z2)
public static final float lerp(float start, float stop, float amt)
public static final float norm(float value, float start, float stop)
public static final float map(float value, float istart, float istop, float ostart, float ostop)
public final float random(float howbig)
The number returned will range from zero up to (but not including) 'howbig'.
public final float random(float howsmall, float howbig)
The number returned will range from 'howsmall' up to (but not including 'howbig'.
If howsmall is >= howbig, howsmall will be returned, meaning that random(5, 5) will return 5 (useful) and random(7, 4) will return 7 (not useful.. better idea?)
public final void randomSeed(long what)
public float noise(float x)
public float noise(float x, float y)
public float noise(float x, float y, float z)
public void noiseDetail(int lod)
public void noiseDetail(int lod, float falloff)
public void noiseSeed(long what)
public PImage loadImage(java.lang.String filename)
Generally, loadImage() should only be used during setup, because re-loading images inside draw() is likely to cause a significant delay while memory is allocated and the thread blocks while waiting for the image to load because loading is not asynchronous.
To load several images asynchronously, see more information in the FAQ about writing your own threaded image loading method.
As of 0096, returns null if no image of that name is found, rather than an error.
Release 0115 also provides support for reading TIFF and RLE-encoded Targa (.tga) files written by Processing via save() and saveFrame(). Other TIFF and Targa files will probably not load, use a different format (gif, jpg and png are safest bets) when creating images with another application to use with Processing.
Also in release 0115, more image formats (BMP and others) can be read when using Java 1.4 and later. Because many people still use Java 1.1 and 1.3, these formats are not recommended for work that will be posted on the web. To get a list of possible image formats for use with Java 1.4 and later, use the following: println(javax.imageio.ImageIO.getReaderFormatNames())
Images are loaded via a byte array that is passed to Toolkit.createImage(). Unfortunately, we cannot use Applet.getImage() because it takes a URL argument, which would be a pain in the a-- to make work consistently for online and local sketches. Sometimes this causes problems, resulting in issues like Bug 279 and Bug 305. In release 0115, everything was instead run through javax.imageio, but that turned out to be very slow, see Bug 392. As a result, starting with 0116, the following happens:
public PImage loadImage(java.lang.String filename, java.lang.String extension)
public PImage requestImage(java.lang.String filename)
public PImage requestImage(java.lang.String filename, java.lang.String extension)
public PShape loadShape(java.lang.String filename)
public PFont loadFont(java.lang.String filename)
public PFont createFont(java.lang.String name, float size)
public PFont createFont(java.lang.String name, float size, boolean smooth)
public PFont createFont(java.lang.String name, float size, boolean smooth, char[] charset)
public java.lang.String selectInput()
public java.lang.String selectInput(java.lang.String prompt)
prompt
- Mesage to show the user when prompting for a file.
public java.lang.String selectOutput()
public java.lang.String selectOutput(java.lang.String prompt)
prompt
- Mesage to show the user when prompting for a file.
public java.lang.String selectFolder()
public java.lang.String selectFolder(java.lang.String prompt)
prompt
- Mesage to show the user when prompting for a file.
public java.io.BufferedReader createReader(java.lang.String filename)
public static java.io.BufferedReader createReader(java.io.File file)
public static java.io.BufferedReader createReader(java.io.InputStream input)
public java.io.PrintWriter createWriter(java.lang.String filename)
public static java.io.PrintWriter createWriter(java.io.File file)
public static java.io.PrintWriter createWriter(java.io.OutputStream output)
public java.io.InputStream openStream(java.lang.String filename)
public java.io.InputStream createInput(java.lang.String filename)
This method is useful if you want to use the facilities provided by PApplet to easily open things 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.
If the requested item doesn't exist, null is returned. (Prior to 0096, die() would be called, killing the applet)
For 0096+, the "data" folder is exported intact with subfolders, and openStream() properly handles subdirectories from the data folder
If not online, this will also check to see if the user is asking for a file whose name isn't properly capitalized. This helps prevent issues when a sketch is exported to the web, where case sensitivity matters, as opposed to Windows and the Mac OS default where case sensitivity is preserved but ignored.
It is strongly recommended that libraries use this method to open data files, so that the loading sequence is handled in the same way as functions like loadBytes(), loadImage(), etc.
The filename passed in can be:
public java.io.InputStream createInputRaw(java.lang.String filename)
public static java.io.InputStream createInput(java.io.File file)
public byte[] loadBytes(java.lang.String filename)
public static byte[] loadBytes(java.io.InputStream input)
public static byte[] loadBytes(java.io.File file)
public static java.lang.String[] loadStrings(java.io.File file)
public java.lang.String[] loadStrings(java.lang.String filename)
Exceptions are handled internally, when an error, occurs, an exception is printed to the console and 'null' is returned, but the program continues running. This is a tradeoff between 1) showing the user that there was a problem but 2) not requiring that all i/o code is contained in try/catch blocks, for the sake of new users (or people who are just trying to get things done in a "scripting" fashion. If you want to handle exceptions, use Java methods for I/O.
public static java.lang.String[] loadStrings(java.io.InputStream input)
public java.io.OutputStream createOutput(java.lang.String filename)
public static java.io.OutputStream createOutput(java.io.File file)
public void saveStream(java.lang.String targetFilename, java.lang.String sourceLocation)
public void saveStream(java.io.File targetFile, java.lang.String sourceLocation)
public static void saveStream(java.io.File targetFile, java.io.InputStream sourceStream)
public void saveBytes(java.lang.String filename, byte[] buffer)
public static void saveBytes(java.io.File file, byte[] buffer)
public static void saveBytes(java.io.OutputStream output, byte[] buffer)
public void saveStrings(java.lang.String filename, java.lang.String[] strings)
public static void saveStrings(java.io.File file, java.lang.String[] strings)
public static void saveStrings(java.io.OutputStream output, java.lang.String[] strings)
public java.lang.String sketchPath(java.lang.String where)
public java.io.File sketchFile(java.lang.String where)
public java.lang.String savePath(java.lang.String where)
public java.io.File saveFile(java.lang.String where)
public java.lang.String dataPath(java.lang.String where)
In this method, the data path is defined not as the applet's actual data path, but a folder titled "data" in the sketch's working directory. When running inside the PDE, this will be the sketch's "data" folder. However, when exported (as application or applet), sketch's data folder is exported as part of the applications jar file, and it's not possible to read/write from the jar file in a generic way. If you need to read data from the jar file, you should use createInput().
public java.io.File dataFile(java.lang.String where)
public static void createPath(java.lang.String path)
public static void createPath(java.io.File file)
public static byte[] sort(byte[] what)
public static byte[] sort(byte[] what, int count)
public static char[] sort(char[] what)
public static char[] sort(char[] what, int count)
public static int[] sort(int[] what)
public static int[] sort(int[] what, int count)
public static float[] sort(float[] what)
public static float[] sort(float[] what, int count)
public static java.lang.String[] sort(java.lang.String[] what)
public static java.lang.String[] sort(java.lang.String[] what, int count)
public static void arrayCopy(java.lang.Object src, int srcPosition, java.lang.Object dst, int dstPosition, int length)
public static void arrayCopy(java.lang.Object src, java.lang.Object dst, int length)
arraycopy(src, 0, dst, 0, length);
public static void arrayCopy(java.lang.Object src, java.lang.Object dst)
arraycopy(src, 0, dst, 0, src.length);
public static void arraycopy(java.lang.Object src, int srcPosition, java.lang.Object dst, int dstPosition, int length)
public static void arraycopy(java.lang.Object src, java.lang.Object dst, int length)
public static void arraycopy(java.lang.Object src, java.lang.Object dst)
public static boolean[] expand(boolean[] list)
public static boolean[] expand(boolean[] list, int newSize)
public static byte[] expand(byte[] list)
public static byte[] expand(byte[] list, int newSize)
public static char[] expand(char[] list)
public static char[] expand(char[] list, int newSize)
public static int[] expand(int[] list)
public static int[] expand(int[] list, int newSize)
public static float[] expand(float[] list)
public static float[] expand(float[] list, int newSize)
public static java.lang.String[] expand(java.lang.String[] list)
public static java.lang.String[] expand(java.lang.String[] list, int newSize)
public static java.lang.Object expand(java.lang.Object array)
public static java.lang.Object expand(java.lang.Object list, int newSize)
public static byte[] append(byte[] b, byte value)
public static char[] append(char[] b, char value)
public static int[] append(int[] b, int value)
public static float[] append(float[] b, float value)
public static java.lang.String[] append(java.lang.String[] b, java.lang.String value)
public static java.lang.Object append(java.lang.Object b, java.lang.Object value)
public static boolean[] shorten(boolean[] list)
public static byte[] shorten(byte[] list)
public static char[] shorten(char[] list)
public static int[] shorten(int[] list)
public static float[] shorten(float[] list)
public static java.lang.String[] shorten(java.lang.String[] list)
public static java.lang.Object shorten(java.lang.Object list)
public static final boolean[] splice(boolean[] list, boolean v, int index)
public static final boolean[] splice(boolean[] list, boolean[] v, int index)
public static final byte[] splice(byte[] list, byte v, int index)
public static final byte[] splice(byte[] list, byte[] v, int index)
public static final char[] splice(char[] list, char v, int index)
public static final char[] splice(char[] list, char[] v, int index)
public static final int[] splice(int[] list, int v, int index)
public static final int[] splice(int[] list, int[] v, int index)
public static final float[] splice(float[] list, float v, int index)
public static final float[] splice(float[] list, float[] v, int index)
public static final java.lang.String[] splice(java.lang.String[] list, java.lang.String v, int index)
public static final java.lang.String[] splice(java.lang.String[] list, java.lang.String[] v, int index)
public static final java.lang.Object splice(java.lang.Object list, java.lang.Object v, int index)
public static boolean[] subset(boolean[] list, int start)
public static boolean[] subset(boolean[] list, int start, int count)
public static byte[] subset(byte[] list, int start)
public static byte[] subset(byte[] list, int start, int count)
public static char[] subset(char[] list, int start)
public static char[] subset(char[] list, int start, int count)
public static int[] subset(int[] list, int start)
public static int[] subset(int[] list, int start, int count)
public static float[] subset(float[] list, int start)
public static float[] subset(float[] list, int start, int count)
public static java.lang.String[] subset(java.lang.String[] list, int start)
public static java.lang.String[] subset(java.lang.String[] list, int start, int count)
public static java.lang.Object subset(java.lang.Object list, int start)
public static java.lang.Object subset(java.lang.Object list, int start, int count)
public static boolean[] concat(boolean[] a, boolean[] b)
public static byte[] concat(byte[] a, byte[] b)
public static char[] concat(char[] a, char[] b)
public static int[] concat(int[] a, int[] b)
public static float[] concat(float[] a, float[] b)
public static java.lang.String[] concat(java.lang.String[] a, java.lang.String[] b)
public static java.lang.Object concat(java.lang.Object a, java.lang.Object b)
public static boolean[] reverse(boolean[] list)
public static byte[] reverse(byte[] list)
public static char[] reverse(char[] list)
public static int[] reverse(int[] list)
public static float[] reverse(float[] list)
public static java.lang.String[] reverse(java.lang.String[] list)
public static java.lang.Object reverse(java.lang.Object list)
public static java.lang.String trim(java.lang.String str)
public static java.lang.String[] trim(java.lang.String[] array)
public static java.lang.String join(java.lang.String[] str, char separator)
public static java.lang.String join(java.lang.String[] str, java.lang.String separator)
To use this on numbers, first pass the array to nf() or nfs() to get a list of String objects, then use join on that.
e.g. String stuff[] = { "apple", "bear", "cat" }; String list = join(stuff, ", "); // list is now "apple, bear, cat"
public static java.lang.String[] splitTokens(java.lang.String what)
The whitespace characters are "\t\n\r\f", which are the defaults for java.util.StringTokenizer, plus the unicode non-breaking space character, which is found commonly on files created by or used in conjunction with Mac OS X (character 160, or 0x00A0 in hex).
i.e. splitTokens("a b") -> { "a", "b" } splitTokens("a b") -> { "a", "b" } splitTokens("a\tb") -> { "a", "b" } splitTokens("a \t b ") -> { "a", "b" }
public static java.lang.String[] splitTokens(java.lang.String what, java.lang.String delim)
i.e. splitTokens("a, b", " ,") -> { "a", "b" }To include all the whitespace possibilities, use the variable WHITESPACE, found in PConstants:
i.e. splitTokens("a | b", WHITESPACE + "|"); -> { "a", "b" }
public static java.lang.String[] split(java.lang.String what, char delim)
This operates differently than the others, where the single delimeter is the only breaking point, and consecutive delimeters will produce an empty string (""). This way, one can split on tab characters, but maintain the column alignments (of say an excel file) where there are empty columns.
public static java.lang.String[] split(java.lang.String what, java.lang.String delim)
public static java.lang.String[] match(java.lang.String what, java.lang.String regexp)
public static java.lang.String[][] matchAll(java.lang.String what, java.lang.String regexp)
public static final boolean parseBoolean(int what)
Convert an integer to a boolean. Because of how Java handles upgrading numbers, this will also cover byte and char (as they will upgrade to an int without any sort of explicit cast).
The preprocessor will convert boolean(what) to parseBoolean(what).
public static final boolean parseBoolean(java.lang.String what)
public static final boolean[] parseBoolean(byte[] what)
public static final boolean[] parseBoolean(int[] what)
public static final boolean[] parseBoolean(java.lang.String[] what)
public static final byte parseByte(boolean what)
public static final byte parseByte(char what)
public static final byte parseByte(int what)
public static final byte parseByte(float what)
public static final byte[] parseByte(boolean[] what)
public static final byte[] parseByte(char[] what)
public static final byte[] parseByte(int[] what)
public static final byte[] parseByte(float[] what)
public static final char parseChar(byte what)
public static final char parseChar(int what)
public static final char[] parseChar(byte[] what)
public static final char[] parseChar(int[] what)
public static final int parseInt(boolean what)
public static final int parseInt(byte what)
public static final int parseInt(char what)
public static final int parseInt(float what)
public static final int parseInt(java.lang.String what)
public static final int parseInt(java.lang.String what, int otherwise)
public static final int[] parseInt(boolean[] what)
public static final int[] parseInt(byte[] what)
public static final int[] parseInt(char[] what)
public static int[] parseInt(float[] what)
public static int[] parseInt(java.lang.String[] what)
public static int[] parseInt(java.lang.String[] what, int missing)
public static final float parseFloat(int what)
public static final float parseFloat(java.lang.String what)
public static final float parseFloat(java.lang.String what, float otherwise)
public static final float[] parseByte(byte[] what)
public static final float[] parseFloat(int[] what)
public static final float[] parseFloat(java.lang.String[] what)
public static final float[] parseFloat(java.lang.String[] what, float missing)
public static final java.lang.String str(boolean x)
public static final java.lang.String str(byte x)
public static final java.lang.String str(char x)
public static final java.lang.String str(int x)
public static final java.lang.String str(float x)
public static final java.lang.String[] str(boolean[] x)
public static final java.lang.String[] str(byte[] x)
public static final java.lang.String[] str(char[] x)
public static final java.lang.String[] str(int[] x)
public static final java.lang.String[] str(float[] x)
public static java.lang.String[] nf(int[] num, int digits)
public static java.lang.String nf(int num, int digits)
public static java.lang.String[] nfc(int[] num)
public static java.lang.String nfc(int num)
public static java.lang.String nfs(int num, int digits)
public static java.lang.String[] nfs(int[] num, int digits)
public static java.lang.String nfp(int num, int digits)
public static java.lang.String[] nfp(int[] num, int digits)
public static java.lang.String[] nf(float[] num, int left, int right)
public static java.lang.String nf(float num, int left, int right)
public static java.lang.String[] nfc(float[] num, int right)
public static java.lang.String nfc(float num, int right)
public static java.lang.String[] nfs(float[] num, int left, int right)
public static java.lang.String nfs(float num, int left, int right)
public static java.lang.String[] nfp(float[] num, int left, int right)
public static java.lang.String nfp(float num, int left, int right)
public static final java.lang.String hex(byte what)
public static final java.lang.String hex(char what)
public static final java.lang.String hex(int what)
public static final java.lang.String hex(int what, int digits)
public static final int unhex(java.lang.String what)
public static final java.lang.String binary(byte what)
public static final java.lang.String binary(char what)
public static final java.lang.String binary(int what)
public static final java.lang.String binary(int what, int digits)
public static final int unbinary(java.lang.String what)
public final int color(int gray)
public final int color(float fgray)
public final int color(int gray, int alpha)
public final int color(float fgray, float falpha)
public final int color(int x, int y, int z)
public final int color(float x, float y, float z)
public final int color(int x, int y, int z, int a)
public final int color(float x, float y, float z, float a)
public void setupExternalMessages()
public void setupFrameResizeListener()
public static void main(java.lang.String[] args)
The options shown here are not yet finalized and will be changing over the next several releases.
The simplest way to turn and applet into an application is to add the following code to your program:
static public void main(String args[]) { PApplet.main(new String[] { "YourSketchName" }); }This will properly launch your applet from a double-clickable .jar or from the command line.
Parameters useful for launching or also used by the PDE: --location=x,y upper-lefthand corner of where the applet should appear on screen. if not used, the default is to center on the main screen. --present put the applet into full screen presentation mode. requires java 1.4 or later. --exclusive use full screen exclusive mode when presenting. disables new windows or interaction with other monitors, this is like a "game" mode. --hide-stop use to hide the stop button in situations where you don't want to allow users to exit. also see the FAQ on information for capturing the ESC key when running in presentation mode. --stop-color=#xxxxxx color of the 'stop' text used to quit an sketch when it's in present mode. --bgcolor=#xxxxxx background color of the window. --sketch-path location of where to save files from functions like saveStrings() or saveFrame(). defaults to the folder that the java application was launched from, which means if this isn't set by the pde, everything goes into the same folder as processing.exe. --display=n set what display should be used by this applet. displays are numbered starting from 1. Parameters used by Processing when running via the PDE --external set when the applet is being used by the PDE --editor-location=x,y position of the upper-lefthand corner of the editor window, for placement of applet window
public PGraphics beginRecord(java.lang.String renderer, java.lang.String filename)
public void beginRecord(PGraphics recorder)
public void endRecord()
public PGraphics beginRaw(java.lang.String renderer, java.lang.String filename)
public void beginRaw(PGraphics rawGraphics)
public void endRaw()
public void loadPixels()
public void updatePixels()
public void updatePixels(int x1, int y1, int x2, int y2)
public void flush()
public void hint(int which)
public void beginShape()
public void beginShape(int kind)
public void edge(boolean edge)
public void normal(float nx, float ny, float nz)
public void textureMode(int mode)
public void texture(PImage image)
public void vertex(float x, float y)
public void vertex(float x, float y, float z)
public void vertex(float[] v)
public void vertex(float x, float y, float u, float v)
public void vertex(float x, float y, float z, float u, float v)
public void breakShape()
public void endShape()
public void endShape(int mode)
public void bezierVertex(float x2, float y2, float x3, float y3, float x4, float y4)
public void bezierVertex(float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4)
public void curveVertex(float x, float y)
public void curveVertex(float x, float y, float z)
public void point(float x, float y)
public void point(float x, float y, float z)
public void line(float x1, float y1, float x2, float y2)
public void line(float x1, float y1, float z1, float x2, float y2, float z2)
public void triangle(float x1, float y1, float x2, float y2, float x3, float y3)
public void quad(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
public void rectMode(int mode)
public void rect(float a, float b, float c, float d)
public void ellipseMode(int mode)
public void ellipse(float a, float b, float c, float d)
public void arc(float a, float b, float c, float d, float start, float stop)
public void box(float size)
public void box(float w, float h, float d)
public void sphereDetail(int res)
public void sphereDetail(int ures, int vres)
public void sphere(float r)
public float bezierPoint(float a, float b, float c, float d, float t)
public float bezierTangent(float a, float b, float c, float d, float t)
public void bezierDetail(int detail)
public void bezier(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
public void bezier(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4)
public float curvePoint(float a, float b, float c, float d, float t)
public float curveTangent(float a, float b, float c, float d, float t)
public void curveDetail(int detail)
public void curveTightness(float tightness)
public void curve(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
public void curve(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4)
public void smooth()
public void noSmooth()
public void imageMode(int mode)
public void image(PImage image, float x, float y)
public void image(PImage image, float x, float y, float c, float d)
public void image(PImage image, float a, float b, float c, float d, int u1, int v1, int u2, int v2)
public void shapeMode(int mode)
public void shape(PShape shape)
public void shape(PShape shape, float x, float y)
public void shape(PShape shape, float x, float y, float c, float d)
public void textAlign(int align)
public void textAlign(int alignX, int alignY)
public float textAscent()
public float textDescent()
public void textFont(PFont which)
public void textFont(PFont which, float size)
public void textLeading(float leading)
public void textMode(int mode)
public void textSize(float size)
public float textWidth(char c)
public float textWidth(java.lang.String str)
public void text(char c)
public void text(char c, float x, float y)
public void text(char c, float x, float y, float z)
public void text(java.lang.String str)
public void text(java.lang.String str, float x, float y)
public void text(char[] chars, int start, int stop, float x, float y)
public void text(java.lang.String str, float x, float y, float z)
public void text(char[] chars, int start, int stop, float x, float y, float z)
public void text(java.lang.String str, float x1, float y1, float x2, float y2)
public void text(java.lang.String s, float x1, float y1, float x2, float y2, float z)
public void text(int num, float x, float y)
public void text(int num, float x, float y, float z)
public void text(float num, float x, float y)
public void text(float num, float x, float y, float z)
public void pushMatrix()
public void popMatrix()
public void translate(float tx, float ty)
public void translate(float tx, float ty, float tz)
public void rotate(float angle)
public void rotateX(float angle)
public void rotateY(float angle)
public void rotateZ(float angle)
public void rotate(float angle, float vx, float vy, float vz)
public void scale(float s)
public void scale(float sx, float sy)
public void scale(float x, float y, float z)
public void resetMatrix()
public void applyMatrix(PMatrix source)
public void applyMatrix(PMatrix2D source)
public void applyMatrix(float n00, float n01, float n02, float n10, float n11, float n12)
public void applyMatrix(PMatrix3D source)
public void applyMatrix(float n00, float n01, float n02, float n03, float n10, float n11, float n12, float n13, float n20, float n21, float n22, float n23, float n30, float n31, float n32, float n33)
public PMatrix getMatrix()
public PMatrix2D getMatrix(PMatrix2D target)
public PMatrix3D getMatrix(PMatrix3D target)
public void setMatrix(PMatrix source)
public void setMatrix(PMatrix2D source)
public void setMatrix(PMatrix3D source)
public void printMatrix()
public void beginCamera()
public void endCamera()
public void camera()
public void camera(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ)
public void printCamera()
public void ortho()
public void ortho(float left, float right, float bottom, float top, float near, float far)
public void perspective()
public void perspective(float fovy, float aspect, float zNear, float zFar)
public void frustum(float left, float right, float bottom, float top, float near, float far)
public void printProjection()
public float screenX(float x, float y)
public float screenY(float x, float y)
public float screenX(float x, float y, float z)
public float screenY(float x, float y, float z)
public float screenZ(float x, float y, float z)
public float modelX(float x, float y, float z)
public float modelY(float x, float y, float z)
public float modelZ(float x, float y, float z)
public void pushStyle()
public void popStyle()
public void style(PStyle s)
public void strokeWeight(float weight)
public void strokeJoin(int join)
public void strokeCap(int cap)
public void noStroke()
public void stroke(int rgb)
public void stroke(int rgb, float alpha)
public void stroke(float gray)
public void stroke(float gray, float alpha)
public void stroke(float x, float y, float z)
public void stroke(float x, float y, float z, float a)
public void noTint()
public void tint(int rgb)
public void tint(int rgb, float alpha)
public void tint(float gray)
public void tint(float gray, float alpha)
public void tint(float x, float y, float z)
public void tint(float x, float y, float z, float a)
public void noFill()
public void fill(int rgb)
public void fill(int rgb, float alpha)
public void fill(float gray)
public void fill(float gray, float alpha)
public void fill(float x, float y, float z)
public void fill(float x, float y, float z, float a)
public void ambient(int rgb)
public void ambient(float gray)
public void ambient(float x, float y, float z)
public void specular(int rgb)
public void specular(float gray)
public void specular(float x, float y, float z)
public void shininess(float shine)
public void emissive(int rgb)
public void emissive(float gray)
public void emissive(float x, float y, float z)
public void lights()
public void noLights()
public void ambientLight(float red, float green, float blue)
public void ambientLight(float red, float green, float blue, float x, float y, float z)
public void directionalLight(float red, float green, float blue, float nx, float ny, float nz)
public void pointLight(float red, float green, float blue, float x, float y, float z)
public void spotLight(float red, float green, float blue, float x, float y, float z, float nx, float ny, float nz, float angle, float concentration)
public void lightFalloff(float constant, float linear, float quadratic)
public void lightSpecular(float x, float y, float z)
public void background(int rgb)
public void background(int rgb, float alpha)
public void background(float gray)
public void background(float gray, float alpha)
public void background(float x, float y, float z)
public void background(float x, float y, float z, float a)
public void background(PImage image)
public void colorMode(int mode)
public void colorMode(int mode, float max)
public void colorMode(int mode, float maxX, float maxY, float maxZ)
public void colorMode(int mode, float maxX, float maxY, float maxZ, float maxA)
public final float alpha(int what)
public final float red(int what)
public final float green(int what)
public final float blue(int what)
public final float hue(int what)
public final float saturation(int what)
public final float brightness(int what)
public int lerpColor(int c1, int c2, float amt)
public static int lerpColor(int c1, int c2, float amt, int mode)
public boolean displayable()
public void setCache(java.lang.Object parent, java.lang.Object storage)
public java.lang.Object getCache(java.lang.Object parent)
public void removeCache(java.lang.Object parent)
public int get(int x, int y)
public PImage get(int x, int y, int w, int h)
public PImage get()
public void set(int x, int y, int c)
public void set(int x, int y, PImage src)
public void mask(int[] alpha)
public void mask(PImage alpha)
public void filter(int kind)
public void filter(int kind, float param)
public void copy(int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh)
public void copy(PImage src, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh)
public static int blendColor(int c1, int c2, int mode)
public void blend(int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int mode)
public void blend(PImage src, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int mode)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |