public class PApplet extends Object implements PConstants
Modifier and Type | Field and Description |
---|---|
String[] |
args
Command line options passed in from main().
|
static String |
ARGS_DENSITY |
static String |
ARGS_DISPLAY
Used by the PDE to suggest a display (set in prefs, passed on Run)
|
static String |
ARGS_EDITOR_LOCATION
Position of the upper-lefthand corner of the editor window
that launched this applet.
|
static String |
ARGS_EXTERNAL |
static String |
ARGS_HIDE_STOP |
static String |
ARGS_LOCATION
Location for where to position the applet window on screen.
|
static String |
ARGS_PRESENT |
static String |
ARGS_SKETCH_FOLDER
Allows the user or PdeEditor to set a specific sketch folder path.
|
static String |
ARGS_STOP_COLOR |
static String |
ARGS_WINDOW_COLOR |
static int |
DEFAULT_HEIGHT |
static int |
DEFAULT_WIDTH
Default width and height for sketch when not specified
|
int |
displayHeight
( begin auto-generated from displayHeight.xml )
System variable that stores the height of the computer screen.
|
int |
displayWidth
( begin auto-generated from displayWidth.xml )
System variable which stores the width of the computer screen.
|
static String |
EXTERNAL_MOVE
When run externally to a PDE Editor, this is sent by the applet
whenever the window is moved.
|
static String |
EXTERNAL_STOP
When run externally to a PdeEditor,
this is sent by the sketch when it quits.
|
boolean |
finished
true if the sketch has stopped permanently.
|
boolean |
firstMouse
Deprecated.
Please refrain from using this variable, it will be removed
from future releases of Processing because it cannot be used consistently
across platforms and input methods.
|
boolean |
focused
( begin auto-generated from focused.xml )
Confirms if a Processing program is "focused", meaning that it is active
and will accept input from mouse or keyboard.
|
Frame |
frame
A dummy frame to keep compatibility with 2.x code
and encourage users to update.
|
int |
frameCount
( begin auto-generated from frameCount.xml )
The system variable frameCount contains the number of frames
displayed since the program started.
|
float |
frameRate
( begin auto-generated from frameRate_var.xml )
The system variable frameRate contains the approximate frame rate
of the software as it executes.
|
PGraphics |
g
The PGraphics renderer associated with this PApplet
|
int |
height
( begin auto-generated from height.xml )
System variable which stores the height of the display window.
|
static int |
javaPlatform |
static float |
javaVersion
Deprecated.
|
static String |
javaVersionName
Full name of the Java version (i.e.
|
char |
key
( begin auto-generated from key.xml )
The system variable key always contains the value of the most
recent key on the keyboard that was used (either pressed or released).
|
int |
keyCode
( begin auto-generated from keyCode.xml )
The variable keyCode is used to detect special keys such as the
UP, DOWN, LEFT, RIGHT arrow keys and ALT, CONTROL, SHIFT.
|
KeyEvent |
keyEvent
Deprecated.
Use a key event handler that passes an event instead.
|
boolean |
keyPressed
( begin auto-generated from keyPressed_var.xml )
The boolean system variable keyPressed is true if any key
is pressed and false if no keys are pressed.
|
int |
mouseButton
( begin auto-generated from mouseButton.xml )
Processing automatically tracks if the mouse button is pressed and which
button is pressed.
|
MouseEvent |
mouseEvent
Deprecated.
Use a mouse event handler that passes an event instead.
|
boolean |
mousePressed
( begin auto-generated from mousePressed_var.xml )
Variable storing if a mouse button is pressed.
|
int |
mouseX
( begin auto-generated from mouseX.xml )
The system variable mouseX always contains the current horizontal
coordinate of the mouse.
|
int |
mouseY
( begin auto-generated from mouseY.xml )
The system variable mouseY always contains the current vertical
coordinate of the mouse.
|
int |
pixelDensity |
int |
pixelHeight
( begin auto-generated from pixelHeight.xml )
When pixelDensity(2) is used to make use of a high resolution
display (called a Retina display on OS X or high-dpi on Windows and
Linux), the width and height of the sketch do not change, but the
number of pixels is doubled.
|
int[] |
pixels
( begin auto-generated from pixels.xml )
Array containing the values for all the pixels in the display window.
|
int |
pixelWidth
( begin auto-generated from pixelWidth.xml )
When pixelDensity(2) is used to make use of a high resolution
display (called a Retina display on OS X or high-dpi on Windows and
Linux), the width and height of the sketch do not change, but the
number of pixels is doubled.
|
static int |
platform
Current platform in use, one of the
PConstants WINDOWS, MACOSX, MACOS9, LINUX or OTHER.
|
int |
pmouseX
( begin auto-generated from pmouseX.xml )
The system variable pmouseX always contains the horizontal
position of the mouse in the frame previous to the current frame.
You may find that pmouseX and pmouseY have different values inside draw() and inside events like mousePressed() and mouseMoved(). |
int |
pmouseY
( begin auto-generated from pmouseY.xml )
The system variable pmouseY always contains the vertical position
of the mouse in the frame previous to the current frame.
|
PGraphics |
recorder
A leech graphics object that is echoing all events.
|
static boolean |
useNativeSelect
Whether to use native (AWT) dialogs for selectInput and selectOutput.
|
int |
width
( begin auto-generated from width.xml )
System variable which stores the width of the display window.
|
ADD, ALPHA, ALT, AMBIENT, ARC, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BEZIER_VERTEX, BLEND, BLUR, BOTTOM, BOX, BREAK, BURN, CENTER, CHATTER, CHORD, CLAMP, CLOSE, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CURVE_VERTEX, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ASYNC_SAVEFRAME, DISABLE_BUFFER_READING, DISABLE_DEPTH_MASK, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_KEY_REPEAT, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERRORS, DISABLE_OPTIMIZED_STROKE, DISABLE_STROKE_PERSPECTIVE, DISABLE_STROKE_PURE, DISABLE_TEXTURE_MIPMAPS, DODGE, DOWN, DXF, ELLIPSE, ENABLE_ASYNC_SAVEFRAME, ENABLE_BUFFER_READING, ENABLE_DEPTH_MASK, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_KEY_REPEAT, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_ERRORS, ENABLE_OPTIMIZED_STROKE, ENABLE_STROKE_PERSPECTIVE, ENABLE_STROKE_PURE, ENABLE_TEXTURE_MIPMAPS, ENTER, EPSILON, ERODE, ESC, EXCLUSION, FX2D, GIF, GRAY, GROUP, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LANDSCAPE, LEFT, LIGHTEST, LINE, LINE_LOOP, LINE_STRIP, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MODELVIEW, MOVE, MULTIPLY, NORMAL, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, PIE, platformNames, POINT, POINTS, POLYGON, PORTRAIT, POSTERIZE, PROBLEM, PROJECT, PROJECTION, QUAD, QUAD_BEZIER_VERTEX, QUAD_STRIP, QUADRATIC_VERTEX, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RECT, REPEAT, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPAN, SPHERE, SPOT, SQUARE, SUBTRACT, SVG, TAB, TARGA, TAU, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, VERTEX, WAIT, WHITESPACE, WINDOWS, X, Y, Z
Constructor and Description |
---|
PApplet() |
Modifier and Type | Method and Description |
---|---|
static float |
abs(float n)
( begin auto-generated from abs.xml )
Calculates the absolute value (magnitude) of a number.
|
static int |
abs(int n) |
static float |
acos(float value)
( begin auto-generated from acos.xml )
The inverse of cos(), returns the arc cosine of a value.
|
float |
alpha(int rgb)
( begin auto-generated from alpha.xml )
Extracts the alpha value from a color.
|
void |
ambient(float gray) |
void |
ambient(float v1,
float v2,
float v3) |
void |
ambient(int rgb)
( begin auto-generated from ambient.xml )
Sets the ambient reflectance for shapes drawn to the screen.
|
void |
ambientLight(float v1,
float v2,
float v3)
( begin auto-generated from ambientLight.xml )
Adds an ambient light.
|
void |
ambientLight(float v1,
float v2,
float v3,
float x,
float y,
float z) |
static byte[] |
append(byte[] array,
byte value)
( begin auto-generated from append.xml )
Expands an array by one element and adds data to the new position.
|
static char[] |
append(char[] array,
char value) |
static float[] |
append(float[] array,
float value) |
static int[] |
append(int[] array,
int value) |
static Object |
append(Object array,
Object value) |
static String[] |
append(String[] array,
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)
( begin auto-generated from applyMatrix.xml )
Multiplies the current matrix by the one specified through the
parameters.
|
void |
applyMatrix(PMatrix2D source) |
void |
applyMatrix(PMatrix3D source) |
void |
arc(float a,
float b,
float c,
float d,
float start,
float stop)
( begin auto-generated from arc.xml )
Draws an arc in the display window.
|
void |
arc(float a,
float b,
float c,
float d,
float start,
float stop,
int mode) |
static void |
arraycopy(Object src,
int srcPosition,
Object dst,
int dstPosition,
int length)
Deprecated.
|
static void |
arrayCopy(Object src,
int srcPosition,
Object dst,
int dstPosition,
int length)
( begin auto-generated from arrayCopy.xml )
Copies an array (or part of an array) to another array.
|
static void |
arraycopy(Object src,
Object dst)
Deprecated.
|
static void |
arrayCopy(Object src,
Object dst)
Shortcut to copy the entire contents of
the source into the destination array.
|
static void |
arraycopy(Object src,
Object dst,
int length)
Deprecated.
|
static void |
arrayCopy(Object src,
Object dst,
int length)
Convenience method for arraycopy().
|
static float |
asin(float value)
( begin auto-generated from asin.xml )
The inverse of sin(), returns the arc sine of a value.
|
static float |
atan(float value)
( begin auto-generated from atan.xml )
The inverse of tan(), returns the arc tangent of a value.
|
static float |
atan2(float y,
float x)
( begin auto-generated from atan2.xml )
Calculates the angle (in radians) from a specified point to the
coordinate origin as measured from the positive x-axis.
|
void |
attrib(String name,
boolean... values) |
void |
attrib(String name,
float... values) |
void |
attrib(String name,
int... values) |
void |
attribColor(String name,
int color) |
void |
attribNormal(String name,
float nx,
float ny,
float nz) |
void |
attribPosition(String name,
float x,
float y,
float z) |
void |
background(float gray) |
void |
background(float gray,
float alpha) |
void |
background(float v1,
float v2,
float v3) |
void |
background(float v1,
float v2,
float v3,
float alpha) |
void |
background(int rgb)
( begin auto-generated from background.xml )
The background() function sets the color used for the background
of the Processing window.
|
void |
background(int rgb,
float alpha) |
void |
background(PImage image)
Takes an RGB or ARGB image and sets it as the background.
|
void |
beginCamera()
( begin auto-generated from beginCamera.xml )
The beginCamera() and endCamera() functions enable
advanced customization of the camera space.
|
void |
beginContour() |
PGL |
beginPGL() |
void |
beginRaw(PGraphics rawGraphics) |
PGraphics |
beginRaw(String renderer,
String filename)
( begin auto-generated from beginRaw.xml )
To create vectors from 3D data, use the beginRaw() and
endRaw() commands.
|
void |
beginRecord(PGraphics recorder) |
PGraphics |
beginRecord(String renderer,
String filename)
( begin auto-generated from beginRecord.xml )
Opens a new file and all subsequent drawing functions are echoed to this
file as well as the display window.
|
void |
beginShape()
Start a new shape of type POLYGON
|
void |
beginShape(int kind)
( begin auto-generated from beginShape.xml )
Using the beginShape() and endShape() functions allow
creating more complex forms.
|
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)
( begin auto-generated from bezier.xml )
Draws a Bezier curve on the screen.
|
void |
bezierDetail(int detail)
( begin auto-generated from bezierDetail.xml )
Sets the resolution at which Beziers display.
|
float |
bezierPoint(float a,
float b,
float c,
float d,
float t)
( begin auto-generated from bezierPoint.xml )
Evaluates the Bezier at point t for points a, b, c, d.
|
float |
bezierTangent(float a,
float b,
float c,
float d,
float t)
( begin auto-generated from bezierTangent.xml )
Calculates the tangent of a point on a Bezier curve.
|
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)
( begin auto-generated from bezierVertex.xml )
Specifies vertex coordinates for Bezier curves.
|
static String |
binary(byte value)
Returns a String that contains the binary value of a byte.
|
static String |
binary(char value)
Returns a String that contains the binary value of a char.
|
static String |
binary(int value)
Returns a String that contains the binary value of an int.
|
static String |
binary(int value,
int digits)
( begin auto-generated from binary.xml )
Converts a byte, char, int, or color to a String containing the
equivalent binary notation.
|
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)
( begin auto-generated from PImage_blend.xml )
Blends a region of pixels into the image specified by the img
parameter.
|
static int |
blendColor(int c1,
int c2,
int mode) |
void |
blendMode(int mode)
( begin auto-generated from blendMode.xml )
This is a new reference entry for Processing 2.0.
|
float |
blue(int rgb)
( begin auto-generated from blue.xml )
Extracts the blue value from a color, scaled to match current
colorMode().
|
void |
box(float size)
( begin auto-generated from box.xml )
A box is an extruded rectangle.
|
void |
box(float w,
float h,
float d) |
float |
brightness(int rgb)
( begin auto-generated from brightness.xml )
Extracts the brightness value from a color.
|
void |
camera()
( begin auto-generated from camera.xml )
Sets the position of the camera through setting the eye position, the
center of the scene, and which axis is facing upward.
|
void |
camera(float eyeX,
float eyeY,
float eyeZ,
float centerX,
float centerY,
float centerZ,
float upX,
float upY,
float upZ) |
static int |
ceil(float n)
( begin auto-generated from ceil.xml )
Calculates the closest int value that is greater than or equal to the
value of the parameter.
|
static String |
checkExtension(String filename)
Get the compression-free extension for this filename.
|
void |
circle(float x,
float y,
float extent)
( begin auto-generated from circle.xml )
Draws a circle to the screen.
|
void |
clear() |
void |
clip(float a,
float b,
float c,
float d)
( begin auto-generated from clip.xml )
Limits the rendering to the boundaries of a rectangle defined
by the parameters.
|
int |
color(float fgray) |
int |
color(float fgray,
float falpha) |
int |
color(float v1,
float v2,
float v3) |
int |
color(float v1,
float v2,
float v3,
float alpha) |
int |
color(int gray)
( begin auto-generated from color.xml )
Creates colors for storing in variables of the color datatype.
|
int |
color(int gray,
int alpha)
As of 0116 this also takes color(#FF8800, alpha)
|
int |
color(int v1,
int v2,
int v3) |
int |
color(int v1,
int v2,
int v3,
int alpha) |
void |
colorMode(int mode)
( begin auto-generated from colorMode.xml )
Changes the way Processing interprets color data.
|
void |
colorMode(int mode,
float max) |
void |
colorMode(int mode,
float max1,
float max2,
float max3) |
void |
colorMode(int mode,
float max1,
float max2,
float max3,
float maxA) |
static boolean[] |
concat(boolean[] a,
boolean[] b)
( begin auto-generated from concat.xml )
Concatenates two arrays.
|
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 Object |
concat(Object a,
Object b) |
static String[] |
concat(String[] a,
String[] b) |
static float |
constrain(float amt,
float low,
float high)
( begin auto-generated from constrain.xml )
Constrains a value to not exceed a maximum and minimum value.
|
static int |
constrain(int amt,
int low,
int high) |
PImage |
copy() |
void |
copy(int sx,
int sy,
int sw,
int sh,
int dx,
int dy,
int dw,
int dh)
( begin auto-generated from PImage_copy.xml )
Copies a region of pixels from one image into another.
|
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)
( begin auto-generated from cos.xml )
Calculates the cosine of an angle.
|
PFont |
createFont(String name,
float size) |
PFont |
createFont(String name,
float size,
boolean smooth) |
PFont |
createFont(String name,
float size,
boolean smooth,
char[] charset)
( begin auto-generated from createFont.xml )
Dynamically converts a font to the format used by Processing from either
a font name that's installed on the computer, or from a .ttf or .otf
file inside the sketches "data" folder.
|
PGraphics |
createGraphics(int w,
int h) |
PGraphics |
createGraphics(int w,
int h,
String renderer)
( begin auto-generated from createGraphics.xml )
Creates and returns a new PGraphics object of the types P2D or
P3D.
|
PGraphics |
createGraphics(int w,
int h,
String renderer,
String path)
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 w,
int h,
int format)
( begin auto-generated from createImage.xml )
Creates a new PImage (the datatype for storing images).
|
static InputStream |
createInput(File file) |
InputStream |
createInput(String filename)
( begin auto-generated from createInput.xml )
This is a function for advanced programmers to open a Java InputStream.
|
InputStream |
createInputRaw(String filename)
Call openStream() without automatic gzip decompression.
|
static OutputStream |
createOutput(File file) |
OutputStream |
createOutput(String filename)
( begin auto-generated from createOutput.xml )
Similar to createInput(), this creates a Java OutputStream
for a given filename or path.
|
static void |
createPath(File file) |
static void |
createPath(String path)
Takes a path and creates any in-between folders if they don't
already exist.
|
static BufferedReader |
createReader(File file) |
static BufferedReader |
createReader(InputStream input) |
BufferedReader |
createReader(String filename)
( begin auto-generated from createReader.xml )
Creates a BufferedReader object that can be used to read files
line-by-line as individual String objects.
|
PShape |
createShape() |
PShape |
createShape(int type) |
PShape |
createShape(int kind,
float... p) |
static PrintWriter |
createWriter(File file) |
static PrintWriter |
createWriter(OutputStream output) |
PrintWriter |
createWriter(String filename)
( begin auto-generated from createWriter.xml )
Creates a new file in the sketch folder, and a PrintWriter object
to write to it.
|
void |
cursor()
Show the cursor after noCursor() was called.
|
void |
cursor(int kind)
Set the cursor type
|
void |
cursor(PImage img)
Replace the cursor with the specified PImage.
|
void |
cursor(PImage img,
int x,
int y)
( begin auto-generated from cursor.xml )
Sets the cursor to a predefined symbol, an image, or makes it visible if
already hidden.
|
void |
curve(float x1,
float y1,
float x2,
float y2,
float x3,
float y3,
float x4,
float y4)
( begin auto-generated from curve.xml )
Draws a curved line on the screen.
|
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)
( begin auto-generated from curveDetail.xml )
Sets the resolution at which curves display.
|
float |
curvePoint(float a,
float b,
float c,
float d,
float t)
( begin auto-generated from curvePoint.xml )
Evalutes the curve at point t for points a, b, c, d.
|
float |
curveTangent(float a,
float b,
float c,
float d,
float t)
( begin auto-generated from curveTangent.xml )
Calculates the tangent of a point on a curve.
|
void |
curveTightness(float tightness)
( begin auto-generated from curveTightness.xml )
Modifies the quality of forms created with curve() and
curveVertex().
|
void |
curveVertex(float x,
float y)
( begin auto-generated from curveVertex.xml )
Specifies vertex coordinates for curves.
|
void |
curveVertex(float x,
float y,
float z) |
File |
dataFile(String where)
Return a full path to an item in the data folder as a File object.
|
String |
dataPath(String where)
This function almost certainly does not do the thing you want it to.
The data path is handled differently on each platform, and should not be
considered a location to write files.
|
static int |
day()
( begin auto-generated from day.xml )
Processing communicates with the clock on your computer.
|
static void |
debug(String msg) |
static float |
degrees(float radians)
( begin auto-generated from degrees.xml )
Converts a radian measurement to its corresponding value in degrees.
|
void |
delay(int napTime)
( begin auto-generated from delay.xml )
The delay() function causes the program to halt for a specified time.
|
static File |
desktopFile(String what)
Not a supported function.
|
static String |
desktopPath(String what)
Not a supported function.
|
void |
die(String what)
Function for an applet/application to kill itself and
display an error.
|
void |
die(String what,
Exception e)
Same as above but with an exception.
|
void |
directionalLight(float v1,
float v2,
float v3,
float nx,
float ny,
float nz)
( begin auto-generated from directionalLight.xml )
Adds a directional light.
|
int |
displayDensity()
( begin auto-generated from displayDensity.xml )
This function returns the number "2" if the screen is a high-density
screen (called a Retina display on OS X or high-dpi on Windows and Linux)
and a "1" if not.
|
int |
displayDensity(int display) |
void |
dispose()
Called to dispose of resources and shut down the sketch.
|
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)
( begin auto-generated from dist.xml )
Calculates the distance between two points.
|
void |
draw()
( begin auto-generated from draw.xml )
Called directly after setup() and continuously executes the lines
of code contained inside its block until the program is stopped or
noLoop() is called.
|
void |
edge(boolean edge)
Sets whether the upcoming vertex is part of an edge.
|
void |
ellipse(float a,
float b,
float c,
float d)
( begin auto-generated from ellipse.xml )
Draws an ellipse (oval) in the display window.
|
void |
ellipseMode(int mode)
( begin auto-generated from ellipseMode.xml )
The origin of the ellipse is modified by the ellipseMode()
function.
|
void |
emissive(float gray)
gray number specifying value between white and black
|
void |
emissive(float v1,
float v2,
float v3) |
void |
emissive(int rgb)
( begin auto-generated from emissive.xml )
Sets the emissive color of the material used for drawing shapes drawn to
the screen.
|
void |
endCamera()
( begin auto-generated from endCamera.xml )
The beginCamera() and endCamera() functions enable
advanced customization of the camera space.
|
void |
endContour() |
void |
endPGL() |
void |
endRaw()
( begin auto-generated from endRaw.xml )
Complement to beginRaw(); they must always be used together.
|
void |
endRecord()
( begin auto-generated from endRecord.xml )
Stops the recording process started by beginRecord() and closes
the file.
|
void |
endShape() |
void |
endShape(int mode)
( begin auto-generated from endShape.xml )
The endShape() function is the companion to beginShape()
and may only be called after beginShape().
|
static Process |
exec(String... args)
Pass a set of arguments directly to the command line.
|
static int |
exec(StringList stdout,
StringList stderr,
String... args)
Alternative version of exec() that retrieves stdout and stderr into the
StringList objects provided.
|
void |
exit()
( begin auto-generated from exit.xml )
Quits/stops/exits the program.
|
void |
exitActual()
Some subclasses (I'm looking at you, processing.py) might wish to do something
other than actually terminate the JVM.
|
boolean |
exitCalled() |
static float |
exp(float n)
( begin auto-generated from exp.xml )
Returns Euler's number e (2.71828...) raised to the power of the
value parameter.
|
static boolean[] |
expand(boolean[] list)
( begin auto-generated from expand.xml )
Increases the size of an array.
|
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 double[] |
expand(double[] list) |
static double[] |
expand(double[] 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 long[] |
expand(long[] list) |
static long[] |
expand(long[] list,
int newSize) |
static Object |
expand(Object array) |
static Object |
expand(Object list,
int newSize) |
static String[] |
expand(String[] list) |
static String[] |
expand(String[] list,
int newSize) |
void |
fill(float gray) |
void |
fill(float gray,
float alpha) |
void |
fill(float v1,
float v2,
float v3) |
void |
fill(float v1,
float v2,
float v3,
float alpha) |
void |
fill(int rgb)
( begin auto-generated from fill.xml )
Sets the color used to fill shapes.
|
void |
fill(int rgb,
float alpha) |
void |
filter(int kind) |
void |
filter(int kind,
float param)
( begin auto-generated from PImage_filter.xml )
Filters an image as defined by one of the following modes:
THRESHOLD - converts the image to black and white pixels depending if they are above or below the threshold defined by the level parameter. |
void |
filter(PShader shader) |
static int |
floor(float n)
( begin auto-generated from floor.xml )
Calculates the closest int value that is less than or equal to the value
of the parameter.
|
void |
flush() |
void |
focusGained() |
void |
focusLost() |
void |
frameMoved(int x,
int y) |
void |
frameRate(float fps)
( begin auto-generated from frameRate.xml )
Specifies the number of frames to be displayed every second.
|
void |
frameResized(int w,
int h) |
void |
frustum(float left,
float right,
float bottom,
float top,
float near,
float far)
( begin auto-generated from frustum.xml )
Sets a perspective matrix defined through the parameters.
|
void |
fullScreen()
Create a full-screen sketch using the default renderer.
|
void |
fullScreen(int display) |
void |
fullScreen(String renderer)
( begin auto-generated from fullScreen.xml )
Description to come...
|
void |
fullScreen(String renderer,
int display) |
PImage |
get()
Returns a copy of this PImage.
|
int |
get(int x,
int y)
( begin auto-generated from PImage_get.xml )
Reads the color of any pixel or grabs a section of an image.
|
PImage |
get(int x,
int y,
int w,
int h) |
static String |
getExtension(String filename) |
PGraphics |
getGraphics() |
PMatrix |
getMatrix() |
PMatrix2D |
getMatrix(PMatrix2D target)
Copy the current transformation matrix into the specified target.
|
PMatrix3D |
getMatrix(PMatrix3D target)
Copy the current transformation matrix into the specified target.
|
PSurface |
getSurface() |
float |
green(int rgb)
( begin auto-generated from green.xml )
Extracts the green value from a color, scaled to match current
colorMode().
|
void |
handleDraw() |
static String |
hex(byte value)
( begin auto-generated from hex.xml )
Converts a byte, char, int, or color to a String containing the
equivalent hexadecimal notation.
|
static String |
hex(char value) |
static String |
hex(int value) |
static String |
hex(int value,
int digits) |
static void |
hideMenuBar()
Convenience method, should only be called by PSurface subclasses.
|
void |
hint(int which) |
static int |
hour()
( begin auto-generated from hour.xml )
Processing communicates with the clock on your computer.
|
float |
hue(int rgb)
( begin auto-generated from hue.xml )
Extracts the hue value from a color.
|
void |
image(PImage img,
float a,
float b)
( begin auto-generated from image.xml )
Displays images to the screen.
|
void |
image(PImage img,
float a,
float b,
float c,
float d) |
void |
image(PImage img,
float a,
float b,
float c,
float d,
int u1,
int v1,
int u2,
int v2)
Draw an image(), also specifying u/v coordinates.
|
void |
imageMode(int mode)
( begin auto-generated from imageMode.xml )
Modifies the location from which images draw.
|
String |
insertFrame(String what)
Check a string for #### signs to see if the frame number should be
inserted.
|
boolean |
isLooping() |
static String |
join(String[] list,
char separator)
( begin auto-generated from join.xml )
Combines an array of Strings into one String, each separated by the
character(s) used for the separator parameter.
|
static String |
join(String[] list,
String separator) |
void |
keyPressed()
( begin auto-generated from keyPressed.xml )
The keyPressed() function is called once every time a key is
pressed.
|
void |
keyPressed(KeyEvent event) |
void |
keyReleased()
( begin auto-generated from keyReleased.xml )
The keyReleased() function is called once every time a key is
released.
|
void |
keyReleased(KeyEvent event) |
void |
keyTyped()
( begin auto-generated from keyTyped.xml )
The keyTyped() function is called once every time a key is
pressed, but action keys such as Ctrl, Shift, and Alt are ignored.
|
void |
keyTyped(KeyEvent event) |
static Process |
launch(String... args)
( begin auto-generated from launch.xml )
Attempts to open an application or file using your platform's launcher.
|
static float |
lerp(float start,
float stop,
float amt)
( begin auto-generated from lerp.xml )
Calculates a number between two numbers at a specific increment.
|
int |
lerpColor(int c1,
int c2,
float amt)
( begin auto-generated from lerpColor.xml )
Calculates a color or colors between two color at a specific increment.
|
static int |
lerpColor(int c1,
int c2,
float amt,
int mode) |
void |
lightFalloff(float constant,
float linear,
float quadratic)
( begin auto-generated from lightFalloff.xml )
Sets the falloff rates for point lights, spot lights, and ambient
lights.
|
void |
lights()
( begin auto-generated from lights.xml )
Sets the default ambient light, directional light, falloff, and specular
values.
|
void |
lightSpecular(float v1,
float v2,
float v3)
( begin auto-generated from lightSpecular.xml )
Sets the specular color for lights.
|
void |
line(float x1,
float y1,
float x2,
float y2)
( begin auto-generated from line.xml )
Draws a line (a direct path between two points) to the screen.
|
void |
line(float x1,
float y1,
float z1,
float x2,
float y2,
float z2) |
void |
link(String url)
Links to a webpage either in the same window or in a new window.
|
static File[] |
listFiles(File base,
String... options) |
File[] |
listFiles(String path,
String... options) |
String[] |
listPaths(String path,
String... options) |
static byte[] |
loadBytes(File file) |
static byte[] |
loadBytes(InputStream input) |
byte[] |
loadBytes(String filename)
( begin auto-generated from loadBytes.xml )
Reads the contents of a file or url and places it in a byte array.
|
PFont |
loadFont(String filename)
( begin auto-generated from loadFont.xml )
Loads a font into a variable of type PFont.
|
PImage |
loadImage(String filename)
( begin auto-generated from loadImage.xml )
Loads an image into a variable of type PImage.
|
PImage |
loadImage(String filename,
String extension) |
static JSONArray |
loadJSONArray(File file) |
JSONArray |
loadJSONArray(String filename) |
static JSONObject |
loadJSONObject(File file) |
JSONObject |
loadJSONObject(String filename) |
void |
loadPixels()
( begin auto-generated from loadPixels.xml )
Loads the pixel data for the display window into the pixels[]
array.
|
PShader |
loadShader(String fragFilename)
( begin auto-generated from loadShader.xml )
This is a new reference entry for Processing 2.0.
|
PShader |
loadShader(String fragFilename,
String vertFilename) |
PShape |
loadShape(String filename) |
PShape |
loadShape(String filename,
String options) |
static String[] |
loadStrings(BufferedReader reader) |
static String[] |
loadStrings(File file) |
static String[] |
loadStrings(InputStream input) |
String[] |
loadStrings(String filename)
( begin auto-generated from loadStrings.xml )
Reads the contents of a file or url and creates a String array of its
individual lines.
|
Table |
loadTable(String filename) |
Table |
loadTable(String filename,
String options)
Options may contain "header", "tsv", "csv", or "bin" separated by commas.
|
XML |
loadXML(String filename) |
XML |
loadXML(String filename,
String options) |
static float |
log(float n)
( begin auto-generated from log.xml )
Calculates the natural logarithm (the base-e logarithm) of a
number.
|
void |
loop()
( begin auto-generated from loop.xml )
Causes Processing to continuously execute the code within draw().
|
static float |
mag(float a,
float b) |
static float |
mag(float a,
float b,
float c)
( begin auto-generated from mag.xml )
Calculates the magnitude (or length) of a vector.
|
static void |
main(Class<?> mainClass,
String... args)
Convenience method so that PApplet.main(YourSketch.class)
launches a sketch, rather than having to call getName() on it.
|
static void |
main(String mainClass)
Convenience method so that PApplet.main("YourSketch") launches a sketch,
rather than having to wrap it into a single element String array.
|
static void |
main(String[] args)
main() method for running this class from the command line.
|
static void |
main(String mainClass,
String[] sketchArgs)
Convenience method so that PApplet.main("YourSketch", args) launches a
sketch, rather than having to wrap it into a String array, and appending
the 'args' array when not null.
|
static float |
map(float value,
float start1,
float stop1,
float start2,
float stop2)
( begin auto-generated from map.xml )
Re-maps a number from one range to another.
|
void |
mask(PImage img)
( begin auto-generated from PImage_mask.xml )
Masks part of an image from displaying by loading another image and
using it as an alpha channel.
|
static String[] |
match(String str,
String regexp)
( begin auto-generated from match.xml )
The match() function is used to apply a regular expression to a piece of
text, and return matching groups (elements found inside parentheses) as
a String array.
|
static String[][] |
matchAll(String str,
String regexp)
( begin auto-generated from matchAll.xml )
This function is used to apply a regular expression to a piece of text,
and return a list of matching groups (elements found inside parentheses)
as a two-dimensional String array.
|
static float |
max(float[] list) |
static float |
max(float a,
float b) |
static float |
max(float a,
float b,
float c) |
static int |
max(int[] list) |
static int |
max(int a,
int b)
( begin auto-generated from max.xml )
Determines the largest value in a sequence of numbers.
|
static int |
max(int a,
int b,
int c) |
void |
method(String name)
Call a method in the current class based on its name.
|
int |
millis()
( begin auto-generated from millis.xml )
Returns the number of milliseconds (thousandths of a second) since
starting an applet.
|
static float |
min(float[] list) |
static float |
min(float a,
float b) |
static float |
min(float a,
float b,
float c)
( begin auto-generated from min.xml )
Determines the smallest value in a sequence of numbers.
|
static int |
min(int[] list) |
static int |
min(int a,
int b) |
static int |
min(int a,
int b,
int c) |
static int |
minute()
( begin auto-generated from minute.xml )
Processing communicates with the clock on your computer.
|
float |
modelX(float x,
float y,
float z)
( begin auto-generated from modelX.xml )
Returns the three-dimensional X, Y, Z position in model space.
|
float |
modelY(float x,
float y,
float z)
( begin auto-generated from modelY.xml )
Returns the three-dimensional X, Y, Z position in model space.
|
float |
modelZ(float x,
float y,
float z)
( begin auto-generated from modelZ.xml )
Returns the three-dimensional X, Y, Z position in model space.
|
static int |
month()
( begin auto-generated from month.xml )
Processing communicates with the clock on your computer.
|
void |
mouseClicked()
( begin auto-generated from mouseClicked.xml )
The mouseClicked() function is called once after a mouse button
has been pressed and then released.
|
void |
mouseClicked(MouseEvent event) |
void |
mouseDragged()
( begin auto-generated from mouseDragged.xml )
The mouseDragged() function is called once every time the mouse
moves and a mouse button is pressed.
|
void |
mouseDragged(MouseEvent event) |
void |
mouseEntered() |
void |
mouseEntered(MouseEvent event) |
void |
mouseExited() |
void |
mouseExited(MouseEvent event) |
void |
mouseMoved()
( begin auto-generated from mouseMoved.xml )
The mouseMoved() function is called every time the mouse moves
and a mouse button is not pressed.
|
void |
mouseMoved(MouseEvent event) |
void |
mousePressed()
( begin auto-generated from mousePressed.xml )
The mousePressed() function is called once after every time a
mouse button is pressed.
|
void |
mousePressed(MouseEvent event) |
void |
mouseReleased()
( begin auto-generated from mouseReleased.xml )
The mouseReleased() function is called every time a mouse button
is released.
|
void |
mouseReleased(MouseEvent event) |
void |
mouseWheel() |
void |
mouseWheel(MouseEvent event)
The event.getAmount() method returns negative values if the mouse wheel
if rotated up or away from the user and positive in the other direction.
|
static String |
nf(float num) |
static String[] |
nf(float[] nums) |
static String[] |
nf(float[] nums,
int left,
int right) |
static String |
nf(float num,
int left,
int right) |
static String[] |
nf(int[] nums,
int digits)
( begin auto-generated from nf.xml )
Utility function for formatting numbers into strings.
|
static String |
nf(int num,
int digits) |
static String[] |
nfc(float[] nums,
int right) |
static String |
nfc(float num,
int right) |
static String |
nfc(int num) |
static String[] |
nfc(int[] nums)
( begin auto-generated from nfc.xml )
Utility function for formatting numbers into strings and placing
appropriate commas to mark units of 1000.
|
static String[] |
nfp(float[] nums,
int left,
int right) |
static String |
nfp(float num,
int left,
int right) |
static String[] |
nfp(int[] nums,
int digits) |
static String |
nfp(int num,
int digits)
( begin auto-generated from nfp.xml )
Utility function for formatting numbers into strings.
|
static String[] |
nfs(float[] nums,
int left,
int right) |
static String |
nfs(float num,
int left,
int right) |
static String[] |
nfs(int[] nums,
int digits) |
static String |
nfs(int num,
int digits)
( begin auto-generated from nfs.xml )
Utility function for formatting numbers into strings.
|
void |
noClip()
( begin auto-generated from noClip.xml )
Disables the clipping previously started by the clip() function.
|
void |
noCursor()
( begin auto-generated from noCursor.xml )
Hides the cursor from view.
|
void |
noFill()
( begin auto-generated from noFill.xml )
Disables filling geometry.
|
float |
noise(float x) |
float |
noise(float x,
float y) |
float |
noise(float x,
float y,
float z)
( begin auto-generated from noise.xml )
Returns the Perlin noise value at specified coordinates.
|
void |
noiseDetail(int lod)
( begin auto-generated from noiseDetail.xml )
Adjusts the character and level of detail produced by the Perlin noise
function.
|
void |
noiseDetail(int lod,
float falloff) |
void |
noiseSeed(long seed)
( begin auto-generated from noiseSeed.xml )
Sets the seed value for noise().
|
void |
noLights()
( begin auto-generated from noLights.xml )
Disable all lighting.
|
void |
noLoop()
( begin auto-generated from noLoop.xml )
Stops Processing from continuously executing the code within
draw().
|
static float |
norm(float value,
float start,
float stop)
( begin auto-generated from norm.xml )
Normalizes a number from another range into a value between 0 and 1.
|
void |
normal(float nx,
float ny,
float nz)
( begin auto-generated from normal.xml )
Sets the current normal vector.
|
void |
noSmooth() |
void |
noStroke()
( begin auto-generated from noStroke.xml )
Disables drawing the stroke (outline).
|
void |
noTexture()
Removes texture image for current shape.
|
void |
noTint()
( begin auto-generated from noTint.xml )
Removes the current fill value for displaying images and reverts to
displaying images with their original hues.
|
void |
orientation(int which) |
void |
ortho()
( begin auto-generated from ortho.xml )
Sets an orthographic projection and defines a parallel clipping volume.
|
void |
ortho(float left,
float right,
float bottom,
float top) |
void |
ortho(float left,
float right,
float bottom,
float top,
float near,
float far) |
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(String what)
Convert the string "true" or "false" to a boolean.
|
static boolean[] |
parseBoolean(String[] what) |
static byte |
parseByte(boolean what) |
static byte[] |
parseByte(boolean[] 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(byte[] what) |
static float |
parseFloat(int what)
Convert an int to a float value.
|
static float[] |
parseFloat(int[] what) |
static float |
parseFloat(String what) |
static float[] |
parseFloat(String[] what) |
static float[] |
parseFloat(String[] what,
float missing) |
static float |
parseFloat(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(String what)
Parse a String into an int value.
|
static int[] |
parseInt(String[] what)
Make an array of int elements from an array of String objects.
|
static int[] |
parseInt(String[] what,
int missing)
Make an array of int elements from an array of String objects.
|
static int |
parseInt(String what,
int otherwise)
Parse a String to an int, and provide an alternate value that
should be used when the number is invalid.
|
JSONArray |
parseJSONArray(String input) |
JSONObject |
parseJSONObject(String input) |
XML |
parseXML(String xmlString) |
XML |
parseXML(String xmlString,
String options) |
void |
pause()
Sketch has been paused.
|
void |
perspective()
( begin auto-generated from perspective.xml )
Sets a perspective projection applying foreshortening, making distant
objects appear smaller than closer ones.
|
void |
perspective(float fovy,
float aspect,
float zNear,
float zFar) |
void |
pixelDensity(int density) |
void |
point(float x,
float y)
( begin auto-generated from point.xml )
Draws a point, a coordinate in space at the dimension of one pixel.
|
void |
point(float x,
float y,
float z) |
void |
pointLight(float v1,
float v2,
float v3,
float x,
float y,
float z)
( begin auto-generated from pointLight.xml )
Adds a point light.
|
void |
pop()
( begin auto-generated from pop.xml )
The pop() function restores the previous drawing style
settings and transformations after push() has changed them.
|
void |
popMatrix()
( begin auto-generated from popMatrix.xml )
Pops the current transformation matrix off the matrix stack.
|
void |
popStyle()
( begin auto-generated from popStyle.xml )
The pushStyle() function saves the current style settings and
popStyle() restores the prior settings; these functions are
always used together.
|
void |
postEvent(Event pe)
Add an event to the internal event queue, or process it immediately if
the sketch is not currently looping.
|
static float |
pow(float n,
float e)
( begin auto-generated from pow.xml )
Facilitates exponential expressions.
|
static void |
print(boolean what) |
static void |
print(byte what)
( begin auto-generated from print.xml )
Writes to the console area of the Processing environment.
|
static void |
print(char what) |
static void |
print(double what) |
static void |
print(float what) |
static void |
print(int what) |
static void |
print(long what) |
static void |
print(Object... variables) |
static void |
print(String what) |
static void |
printArray(Object what)
( begin auto-generated from printArray.xml )
To come...
|
void |
printCamera()
( begin auto-generated from printCamera.xml )
Prints the current camera matrix to the Console (the text window at the
bottom of Processing).
|
static void |
println()
( begin auto-generated from println.xml )
Writes to the text area of the Processing environment's console.
|
static void |
println(boolean what) |
static void |
println(byte what) |
static void |
println(char what) |
static void |
println(double what) |
static void |
println(float what) |
static void |
println(int what) |
static void |
println(long what) |
static void |
println(Object... variables) |
static void |
println(Object what)
For arrays, use printArray() instead.
|
static void |
println(String what) |
void |
printMatrix()
( begin auto-generated from printMatrix.xml )
Prints the current matrix to the Console (the text window at the bottom
of Processing).
|
void |
printProjection()
( begin auto-generated from printProjection.xml )
Prints the current projection matrix to the Console (the text window at
the bottom of Processing).
|
void |
push()
( begin auto-generated from push.xml )
The push() function saves the current drawing style
settings and transformations, while pop() restores these
settings.
|
void |
pushMatrix()
( begin auto-generated from pushMatrix.xml )
Pushes the current transformation matrix onto the matrix stack.
|
void |
pushStyle()
( begin auto-generated from pushStyle.xml )
The pushStyle() function saves the current style settings and
popStyle() restores the prior settings.
|
void |
quad(float x1,
float y1,
float x2,
float y2,
float x3,
float y3,
float x4,
float y4)
( begin auto-generated from quad.xml )
A quad is a quadrilateral, a four sided polygon.
|
void |
quadraticVertex(float cx,
float cy,
float x3,
float y3) |
void |
quadraticVertex(float cx,
float cy,
float cz,
float x3,
float y3,
float z3) |
static float |
radians(float degrees)
( begin auto-generated from radians.xml )
Converts a degree measurement to its corresponding value in radians.
|
float |
random(float high) |
float |
random(float low,
float high)
( begin auto-generated from random.xml )
Generates random numbers.
|
float |
randomGaussian()
( begin auto-generated from randomGaussian.xml )
Returns a float from a random series of numbers having a mean of 0
and standard deviation of 1.
|
void |
randomSeed(long seed)
( begin auto-generated from randomSeed.xml )
Sets the seed value for random().
|
void |
rect(float a,
float b,
float c,
float d)
( begin auto-generated from rect.xml )
Draws a rectangle to the screen.
|
void |
rect(float a,
float b,
float c,
float d,
float r) |
void |
rect(float a,
float b,
float c,
float d,
float tl,
float tr,
float br,
float bl) |
void |
rectMode(int mode)
( begin auto-generated from rectMode.xml )
Modifies the location from which rectangles draw.
|
float |
red(int rgb)
( begin auto-generated from red.xml )
Extracts the red value from a color, scaled to match current
colorMode().
|
void |
redraw()
( begin auto-generated from redraw.xml )
Executes the code within draw() one time.
|
void |
registerMethod(String methodName,
Object target)
Register a built-in event so that it can be fired for libraries, etc.
|
PImage |
requestImage(String filename) |
PImage |
requestImage(String filename,
String extension)
( begin auto-generated from requestImage.xml )
This function load images on a separate thread so that your sketch does
not freeze while images load during setup().
|
void |
resetMatrix()
( begin auto-generated from resetMatrix.xml )
Replaces the current matrix with the identity matrix.
|
void |
resetShader()
( begin auto-generated from resetShader.xml )
This is a new reference entry for Processing 2.0.
|
void |
resetShader(int kind) |
void |
resume()
Sketch has resumed.
|
static boolean[] |
reverse(boolean[] list)
( begin auto-generated from reverse.xml )
Reverses the order of an array.
|
static byte[] |
reverse(byte[] list) |
static char[] |
reverse(char[] list) |
static float[] |
reverse(float[] list) |
static int[] |
reverse(int[] list) |
static Object |
reverse(Object list) |
static String[] |
reverse(String[] list) |
void |
rotate(float angle)
( begin auto-generated from rotate.xml )
Rotates a shape the amount specified by the angle parameter.
|
void |
rotate(float angle,
float x,
float y,
float z)
Advanced
|
void |
rotateX(float angle)
( begin auto-generated from rotateX.xml )
Rotates a shape around the x-axis the amount specified by the
angle parameter.
|
void |
rotateY(float angle)
( begin auto-generated from rotateY.xml )
Rotates a shape around the y-axis the amount specified by the
angle parameter.
|
void |
rotateZ(float angle)
( begin auto-generated from rotateZ.xml )
Rotates a shape around the z-axis the amount specified by the
angle parameter.
|
static int |
round(float n)
( begin auto-generated from round.xml )
Calculates the integer closest to the value parameter.
|
static void |
runSketch(String[] args,
PApplet constructedSketch) |
float |
saturation(int rgb)
( begin auto-generated from saturation.xml )
Extracts the saturation value from a color.
|
void |
save(String filename)
( begin auto-generated from save.xml )
Saves an image from the display window.
|
static void |
saveBytes(File file,
byte[] data) |
static void |
saveBytes(OutputStream output,
byte[] data) |
void |
saveBytes(String filename,
byte[] data)
( begin auto-generated from saveBytes.xml )
Opposite of loadBytes(), will write an entire array of bytes to a
file.
|
File |
saveFile(String where)
Identical to savePath(), but returns a File object.
|
void |
saveFrame() |
void |
saveFrame(String filename)
( begin auto-generated from saveFrame.xml )
Saves a numbered sequence of images, one image each time the function is
run.
|
boolean |
saveJSONArray(JSONArray json,
String filename) |
boolean |
saveJSONArray(JSONArray json,
String filename,
String options) |
boolean |
saveJSONObject(JSONObject json,
String filename) |
boolean |
saveJSONObject(JSONObject json,
String filename,
String options) |
String |
savePath(String where)
Returns a path inside the applet folder to save to.
|
static boolean |
saveStream(File target,
InputStream source) |
boolean |
saveStream(File target,
String source)
Identical to the other saveStream(), but writes to a File
object, for greater control over the file location.
|
static void |
saveStream(OutputStream target,
InputStream source) |
boolean |
saveStream(String target,
InputStream source) |
boolean |
saveStream(String target,
String source)
( begin auto-generated from saveStream.xml )
Save the contents of a stream to a file in the sketch folder.
|
static void |
saveStrings(File file,
String[] data) |
static void |
saveStrings(OutputStream output,
String[] data) |
void |
saveStrings(String filename,
String[] data)
( begin auto-generated from saveStrings.xml )
Writes an array of strings to a file, one line per string.
|
boolean |
saveTable(Table table,
String filename) |
boolean |
saveTable(Table table,
String filename,
String options) |
boolean |
saveXML(XML xml,
String filename) |
boolean |
saveXML(XML xml,
String filename,
String options) |
void |
scale(float s)
( begin auto-generated from scale.xml )
Increases or decreases the size of a shape by expanding and contracting
vertices.
|
void |
scale(float x,
float y)
Advanced
|
void |
scale(float x,
float y,
float z) |
float |
screenX(float x,
float y)
( begin auto-generated from screenX.xml )
Takes a three-dimensional X, Y, Z position and returns the X value for
where it will appear on a (two-dimensional) screen.
|
float |
screenX(float x,
float y,
float z) |
float |
screenY(float x,
float y)
( begin auto-generated from screenY.xml )
Takes a three-dimensional X, Y, Z position and returns the Y value for
where it will appear on a (two-dimensional) screen.
|
float |
screenY(float x,
float y,
float z) |
float |
screenZ(float x,
float y,
float z)
( begin auto-generated from screenZ.xml )
Takes a three-dimensional X, Y, Z position and returns the Z value for
where it will appear on a (two-dimensional) screen.
|
static int |
second()
( begin auto-generated from second.xml )
Processing communicates with the clock on your computer.
|
void |
selectFolder(String prompt,
String callback)
See selectInput() for details.
|
void |
selectFolder(String prompt,
String callback,
File file) |
void |
selectFolder(String prompt,
String callback,
File file,
Object callbackObject) |
static void |
selectFolder(String prompt,
String callbackMethod,
File defaultSelection,
Object callbackObject,
Frame parentFrame) |
static void |
selectFolder(String prompt,
String callbackMethod,
File defaultSelection,
Object callbackObject,
Frame parentFrame,
PApplet sketch) |
void |
selectInput(String prompt,
String callback)
Open a platform-specific file chooser dialog to select a file for input.
|
void |
selectInput(String prompt,
String callback,
File file) |
void |
selectInput(String prompt,
String callback,
File file,
Object callbackObject) |
static void |
selectInput(String prompt,
String callbackMethod,
File file,
Object callbackObject,
Frame parent) |
static void |
selectInput(String prompt,
String callbackMethod,
File file,
Object callbackObject,
Frame parent,
PApplet sketch) |
void |
selectOutput(String prompt,
String callback)
See selectInput() for details.
|
void |
selectOutput(String prompt,
String callback,
File file) |
void |
selectOutput(String prompt,
String callback,
File file,
Object callbackObject) |
static void |
selectOutput(String prompt,
String callbackMethod,
File file,
Object callbackObject,
Frame parent) |
static void |
selectOutput(String prompt,
String callbackMethod,
File file,
Object callbackObject,
Frame parent,
PApplet sketch) |
void |
set(int x,
int y,
int c)
( begin auto-generated from PImage_set.xml )
Changes the color of any pixel or writes an image directly into the
display window.
The x and y parameters specify the pixel to change and the color parameter specifies the color value. |
void |
set(int x,
int y,
PImage img)
Advanced
|
void |
setMatrix(PMatrix source)
Set the current transformation matrix to the contents of another.
|
void |
setMatrix(PMatrix2D source)
Set the current transformation to the contents of the specified source.
|
void |
setMatrix(PMatrix3D source)
Set the current transformation to the contents of the specified source.
|
void |
setSize(int width,
int height)
Called by PSurface objects to set the width and height variables,
and update the pixelWidth and pixelHeight variables.
|
void |
settings()
( begin auto-generated from settings.xml )
Description to come...
|
void |
setup()
( begin auto-generated from setup.xml )
The setup() function is called once when the program starts.
|
void |
shader(PShader shader)
( begin auto-generated from shader.xml )
This is a new reference entry for Processing 2.0.
|
void |
shader(PShader shader,
int kind) |
void |
shape(PShape shape) |
void |
shape(PShape shape,
float x,
float y)
( begin auto-generated from shape.xml )
Displays shapes to the screen.
|
void |
shape(PShape shape,
float a,
float b,
float c,
float d) |
void |
shapeMode(int mode)
( begin auto-generated from shapeMode.xml )
Modifies the location from which shapes draw.
|
void |
shearX(float angle)
( begin auto-generated from shearX.xml )
Shears a shape around the x-axis the amount specified by the
angle parameter.
|
void |
shearY(float angle)
( begin auto-generated from shearY.xml )
Shears a shape around the y-axis the amount specified by the
angle parameter.
|
static int |
shell(StringList stdout,
StringList stderr,
String... args)
Same as exec() above, but prefixes the call with a shell.
|
void |
shininess(float shine)
( begin auto-generated from shininess.xml )
Sets the amount of gloss in the surface of shapes.
|
static boolean[] |
shorten(boolean[] list)
( begin auto-generated from shorten.xml )
Decreases an array by one element and returns the shortened array.
|
static byte[] |
shorten(byte[] list) |
static char[] |
shorten(char[] list) |
static float[] |
shorten(float[] list) |
static int[] |
shorten(int[] list) |
static Object |
shorten(Object list) |
static String[] |
shorten(String[] list) |
static void |
showDepthWarning(String method)
Display a warning that the specified method is only available with 3D.
|
static void |
showDepthWarningXYZ(String method)
Display a warning that the specified method that takes x, y, z parameters
can only be used with x and y parameters in this renderer.
|
static void |
showMethodWarning(String method)
Display a warning that the specified method is simply unavailable.
|
static void |
showMissingWarning(String method)
Display a warning that the specified method is not implemented, meaning
that it could be either a completely missing function, although other
variations of it may still work properly.
|
static void |
showVariationWarning(String str)
Error that a particular variation of a method is unavailable (even though
other variations are).
|
static float |
sin(float angle)
( begin auto-generated from sin.xml )
Calculates the sine of an angle.
|
void |
size(int width,
int height)
( begin auto-generated from size.xml )
Defines the dimension of the display window in units of pixels.
|
void |
size(int width,
int height,
String renderer) |
void |
size(int width,
int height,
String renderer,
String path) |
int |
sketchDisplay() |
File |
sketchFile(String where) |
boolean |
sketchFullScreen() |
int |
sketchHeight() |
String |
sketchOutputPath() |
OutputStream |
sketchOutputStream() |
String |
sketchPath() |
String |
sketchPath(String where)
Prepend the sketch folder path to the filename (or path) that is
passed in.
|
int |
sketchPixelDensity() |
String |
sketchRenderer() |
int |
sketchSmooth() |
int |
sketchWidth() |
int |
sketchWindowColor() |
void |
smooth() |
void |
smooth(int level) |
static byte[] |
sort(byte[] list)
( begin auto-generated from sort.xml )
Sorts an array of numbers from smallest to largest and puts an array of
words in alphabetical order.
|
static byte[] |
sort(byte[] list,
int count) |
static char[] |
sort(char[] list) |
static char[] |
sort(char[] list,
int count) |
static float[] |
sort(float[] list) |
static float[] |
sort(float[] list,
int count) |
static int[] |
sort(int[] list) |
static int[] |
sort(int[] list,
int count) |
static String[] |
sort(String[] list) |
static String[] |
sort(String[] list,
int count) |
void |
specular(float gray)
gray number specifying value between white and black
|
void |
specular(float v1,
float v2,
float v3) |
void |
specular(int rgb)
( begin auto-generated from specular.xml )
Sets the specular color of the materials used for shapes drawn to the
screen, which sets the color of hightlights.
|
void |
sphere(float r)
( begin auto-generated from sphere.xml )
A sphere is a hollow ball made from tessellated triangles.
|
void |
sphereDetail(int res)
( begin auto-generated from sphereDetail.xml )
Controls the detail used to render a sphere by adjusting the number of
vertices of the sphere mesh.
|
void |
sphereDetail(int ures,
int vres) |
static boolean[] |
splice(boolean[] list,
boolean[] value,
int index) |
static boolean[] |
splice(boolean[] list,
boolean value,
int index)
( begin auto-generated from splice.xml )
Inserts a value or array of values into an existing array.
|
static byte[] |
splice(byte[] list,
byte[] value,
int index) |
static byte[] |
splice(byte[] list,
byte value,
int index) |
static char[] |
splice(char[] list,
char[] value,
int index) |
static char[] |
splice(char[] list,
char value,
int index) |
static float[] |
splice(float[] list,
float[] value,
int index) |
static float[] |
splice(float[] list,
float value,
int index) |
static int[] |
splice(int[] list,
int[] value,
int index) |
static int[] |
splice(int[] list,
int value,
int index) |
static Object |
splice(Object list,
Object value,
int index) |
static String[] |
splice(String[] list,
String[] value,
int index) |
static String[] |
splice(String[] list,
String value,
int index) |
static String[] |
split(String value,
char delim)
( begin auto-generated from split.xml )
The split() function breaks a string into pieces using a character or
string as the divider.
|
static String[] |
split(String value,
String delim) |
static String[] |
splitTokens(String value) |
static String[] |
splitTokens(String value,
String delim)
( begin auto-generated from splitTokens.xml )
The splitTokens() function splits a String at one or many character
"tokens." The tokens parameter specifies the character or
characters to be used as a boundary.
|
void |
spotLight(float v1,
float v2,
float v3,
float x,
float y,
float z,
float nx,
float ny,
float nz,
float angle,
float concentration)
( begin auto-generated from spotLight.xml )
Adds a spot light.
|
static float |
sq(float n)
( begin auto-generated from sq.xml )
Squares a number (multiplies a number by itself).
|
static float |
sqrt(float n)
( begin auto-generated from sqrt.xml )
Calculates the square root of a number.
|
void |
square(float x,
float y,
float extent)
( begin auto-generated from square.xml )
Draws a square to the screen.
|
void |
start()
Called by the browser or applet viewer to inform this applet that it
should start its execution.
|
void |
stop()
Called by the browser or applet viewer to inform
this applet that it should stop its execution.
|
static String |
str(boolean x) |
static String[] |
str(boolean[] x) |
static String |
str(byte x) |
static String[] |
str(byte[] x) |
static String |
str(char x) |
static String[] |
str(char[] x) |
static String |
str(float x) |
static String[] |
str(float[] x) |
static String |
str(int x) |
static String[] |
str(int[] x) |
void |
stroke(float gray) |
void |
stroke(float gray,
float alpha) |
void |
stroke(float v1,
float v2,
float v3) |
void |
stroke(float v1,
float v2,
float v3,
float alpha) |
void |
stroke(int rgb)
( begin auto-generated from stroke.xml )
Sets the color used to draw lines and borders around shapes.
|
void |
stroke(int rgb,
float alpha) |
void |
strokeCap(int cap)
( begin auto-generated from strokeCap.xml )
Sets the style for rendering line endings.
|
void |
strokeJoin(int join)
( begin auto-generated from strokeJoin.xml )
Sets the style of the joints which connect line segments.
|
void |
strokeWeight(float weight)
( begin auto-generated from strokeWeight.xml )
Sets the width of the stroke used for lines, points, and the border
around shapes.
|
void |
style(PStyle s) |
static boolean[] |
subset(boolean[] list,
int start) |
static boolean[] |
subset(boolean[] list,
int start,
int count)
( begin auto-generated from subset.xml )
Extracts an array of elements from an existing array.
|
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 double[] |
subset(double[] list,
int start) |
static double[] |
subset(double[] 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 long[] |
subset(long[] list,
int start) |
static long[] |
subset(long[] list,
int start,
int count) |
static Object |
subset(Object list,
int start) |
static Object |
subset(Object list,
int start,
int count) |
static String[] |
subset(String[] list,
int start) |
static String[] |
subset(String[] list,
int start,
int count) |
static float |
tan(float angle)
( begin auto-generated from tan.xml )
Calculates the ratio of the sine and cosine of an angle.
|
void |
text(char[] chars,
int start,
int stop,
float x,
float y)
Advanced
|
void |
text(char[] chars,
int start,
int stop,
float x,
float y,
float z) |
void |
text(char c,
float x,
float y)
( begin auto-generated from text.xml )
Draws text to the screen.
|
void |
text(char c,
float x,
float y,
float z) |
void |
text(float num,
float x,
float y)
This does a basic number formatting, to avoid the
generally ugly appearance of printing floats.
|
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(String str,
float x,
float y)
Advanced
|
void |
text(String str,
float x,
float y,
float z)
Same as above but with a z coordinate.
|
void |
text(String str,
float x1,
float y1,
float x2,
float y2)
Advanced
|
void |
textAlign(int alignX) |
void |
textAlign(int alignX,
int alignY)
( begin auto-generated from textAlign.xml )
Sets the current alignment for drawing text.
|
float |
textAscent()
( begin auto-generated from textAscent.xml )
Returns ascent of the current font at its current size.
|
float |
textDescent()
( begin auto-generated from textDescent.xml )
Returns descent of the current font at its current size.
|
void |
textFont(PFont which)
( begin auto-generated from textFont.xml )
Sets the current font that will be drawn with the text()
function.
|
void |
textFont(PFont which,
float size) |
void |
textLeading(float leading)
( begin auto-generated from textLeading.xml )
Sets the spacing between lines of text in units of pixels.
|
void |
textMode(int mode)
( begin auto-generated from textMode.xml )
Sets the way text draws to the screen.
|
void |
textSize(float size)
( begin auto-generated from textSize.xml )
Sets the current font size.
|
void |
texture(PImage image)
( begin auto-generated from texture.xml )
Sets a texture to be applied to vertex points.
|
void |
textureMode(int mode)
( begin auto-generated from textureMode.xml )
Sets the coordinate space for texture mapping.
|
void |
textureWrap(int wrap)
( begin auto-generated from textureWrap.xml )
Description to come...
|
float |
textWidth(char c) |
float |
textWidth(char[] chars,
int start,
int length) |
float |
textWidth(String str)
( begin auto-generated from textWidth.xml )
Calculates and returns the width of any character or text string.
|
void |
thread(String name)
Launch a new thread and call the specified function from that new thread.
|
void |
tint(float gray) |
void |
tint(float gray,
float alpha) |
void |
tint(float v1,
float v2,
float v3) |
void |
tint(float v1,
float v2,
float v3,
float alpha) |
void |
tint(int rgb)
( begin auto-generated from tint.xml )
Sets the fill value for displaying images.
|
void |
tint(int rgb,
float alpha) |
void |
translate(float x,
float y)
( begin auto-generated from translate.xml )
Specifies an amount to displace objects within the display window.
|
void |
translate(float x,
float y,
float z) |
void |
triangle(float x1,
float y1,
float x2,
float y2,
float x3,
float y3)
( begin auto-generated from triangle.xml )
A triangle is a plane created by connecting three points.
|
static String |
trim(String str)
( begin auto-generated from trim.xml )
Removes whitespace characters from the beginning and end of a String.
|
static String[] |
trim(String[] array) |
static int |
unbinary(String value)
( begin auto-generated from unbinary.xml )
Converts a String representation of a binary number to its equivalent
integer value.
|
static int |
unhex(String value)
( begin auto-generated from unhex.xml )
Converts a String representation of a hexadecimal number to its
equivalent integer value.
|
void |
unregisterMethod(String name,
Object target) |
void |
updatePixels()
( begin auto-generated from updatePixels.xml )
Updates the display window with the data in the pixels[] array.
|
void |
updatePixels(int x1,
int y1,
int x2,
int y2) |
static String |
urlDecode(String str) |
static String |
urlEncode(String str) |
void |
vertex(float[] v)
Used by renderer subclasses or PShape to efficiently pass in already
formatted vertex information.
|
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)
( begin auto-generated from vertex.xml )
All shapes are constructed by connecting a series of vertices.
|
static int |
year()
( begin auto-generated from year.xml )
Processing communicates with the clock on your computer.
|
public static final String javaVersionName
public static final int javaPlatform
@Deprecated public static final float javaVersion
public static int platform
public static boolean useNativeSelect
public PGraphics g
public int displayWidth
public int displayHeight
public PGraphics recorder
public String[] args
main(java.lang.String[])
public static final int DEFAULT_WIDTH
public static final int DEFAULT_HEIGHT
public int[] pixels
loadPixels()
,
updatePixels()
,
get(int, int, int, int)
,
set(int, int, int)
,
PImage
,
PApplet#pixelDensity()
,
pixelWidth
,
pixelHeight
public int width
height
,
size(int, int)
public int height
width
,
size(int, int)
public int pixelWidth
pixelHeight
,
pixelDensity(int)
,
displayDensity()
public int pixelHeight
pixelWidth
,
pixelDensity(int)
,
displayDensity()
public int mouseX
public int mouseY
public int pmouseX
public int pmouseY
@Deprecated 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
public boolean mousePressed
@Deprecated public 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).
keyCode
,
keyPressed
,
keyPressed()
,
keyReleased()
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.
key
,
keyPressed
,
keyPressed()
,
keyReleased()
public boolean keyPressed
key
,
keyCode
,
keyPressed()
,
keyReleased()
@Deprecated public KeyEvent keyEvent
public boolean focused
public float frameRate
frameRate(float)
,
frameCount
public int frameCount
frameRate(float)
,
frameRate
public volatile boolean finished
public static final String ARGS_EDITOR_LOCATION
public static final String ARGS_EXTERNAL
public static final String ARGS_LOCATION
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 String ARGS_DISPLAY
public static final String ARGS_WINDOW_COLOR
public static final String ARGS_PRESENT
public static final String ARGS_STOP_COLOR
public static final String ARGS_HIDE_STOP
public static final String ARGS_SKETCH_FOLDER
Used by PdeEditor to pass in the location where saveFrame() and all that stuff should write things.
public static final String ARGS_DENSITY
public static final String EXTERNAL_STOP
public static final 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 Frame frame
public int pixelDensity
public PSurface getSurface()
public void settings()
fullScreen()
,
setup()
,
size(int,int)
,
smooth()
public final int sketchWidth()
public final int sketchHeight()
public final String sketchRenderer()
public final int sketchSmooth()
public final boolean sketchFullScreen()
public final int sketchDisplay()
public final String sketchOutputPath()
public final OutputStream sketchOutputStream()
public final int sketchWindowColor()
public final int sketchPixelDensity()
public int displayDensity()
pixelDensity(int)
,
size(int,int)
public int displayDensity(int display)
display
- the display number to checkpublic void pixelDensity(int density)
density
- 1 or 2pixelWidth
,
pixelHeight
public void setSize(int width, int height)
public void smooth()
public void smooth(int level)
level
- either 2, 3, 4, or 8 depending on the rendererpublic void noSmooth()
public PGraphics getGraphics()
public void orientation(int which)
public void start()
public void stop()
public void pause()
public void resume()
public void registerMethod(String methodName, Object target)
methodName
- name of the method to be calledtarget
- the target object that should receive the eventpublic void unregisterMethod(String name, Object target)
public void setup()
size(int, int)
,
loop()
,
noLoop()
,
draw()
public void draw()
setup()
,
loop()
,
noLoop()
,
redraw()
,
frameRate(float)
,
PGraphics.background(float, float, float, float)
public void fullScreen()
public void fullScreen(int display)
public void fullScreen(String renderer)
renderer
- the renderer to use, e.g. P2D, P3D, JAVA2D (default)settings()
,
setup()
,
size(int,int)
,
smooth()
public void fullScreen(String renderer, int display)
display
- the screen to run the sketch on (1, 2, 3, etc. or on multiple screens using SPAN)public void size(int width, int height)
If called once a renderer has already been set, this will use the previous renderer and simply resize it.
width
- width of the display window in units of pixelsheight
- height of the display window in units of pixelswidth
,
height
,
setup()
,
settings()
,
fullScreen()
public void size(int width, int height, String renderer)
public void size(int width, int height, String renderer, String path)
public PGraphics createGraphics(int w, int h)
public PGraphics createGraphics(int w, int h, String renderer)
PGraphics big; void setup() { big = createGraphics(3000, 3000); 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"); }
w
- width in pixelsh
- height in pixelsrenderer
- Either P2D, P3D, or PDFPGraphics.PGraphics()
public PGraphics createGraphics(int w, int h, String renderer, String path)
path
- the name of the file (can be an absolute or relative path)public PImage createImage(int w, int h, int format)
public void handleDraw()
public void redraw()
draw()
,
loop()
,
noLoop()
,
frameRate(float)
public void loop()
public void noLoop()
public boolean isLooping()
public void postEvent(Event pe)
public void mousePressed()
public void mousePressed(MouseEvent event)
public void mouseReleased()
public void mouseReleased(MouseEvent event)
public void mouseClicked()
public void mouseClicked(MouseEvent event)
public void mouseDragged()
public void mouseDragged(MouseEvent event)
public void mouseMoved()
public void mouseMoved(MouseEvent event)
public void mouseEntered()
public void mouseEntered(MouseEvent event)
public void mouseExited()
public void mouseExited(MouseEvent event)
public void mouseWheel()
public void mouseWheel(MouseEvent event)
event
- the MouseEventmouseX
,
mouseY
,
pmouseX
,
pmouseY
,
mousePressed
,
mousePressed()
,
mouseReleased()
,
mouseClicked()
,
mouseMoved()
,
mouseDragged()
,
mouseButton
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.
key
,
keyCode
,
keyPressed
,
keyReleased()
public void keyPressed(KeyEvent event)
public void keyReleased()
key
,
keyCode
,
keyPressed
,
keyPressed()
public void keyReleased(KeyEvent event)
public void keyTyped()
keyPressed
,
key
,
keyCode
,
keyReleased()
public void keyTyped(KeyEvent event)
public void focusGained()
public void focusLost()
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()
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 fps)
public void link(String url)
When run with an applet, uses the browser to open the url, for applications, attempts to launch a browser with the url.
url
- the complete URL, as a String in quotespublic static Process launch(String... args)
args
- arguments to the launcher, eg. a filename.public static Process exec(String... args)
exec("/usr/bin/say", "welcome to the command line");Or if you want to wait until it's completed, something like this:
Process p = exec("/usr/bin/say", "waiting until done"); try { int result = p.waitFor(); println("the process returned " + result); } catch (InterruptedException e) { }You can also get the system output and error streams from the Process object, but that's more that we'd like to cover here.
public static int exec(StringList stdout, StringList stderr, String... args)
stdout
- a non-null StringList object to be filled with any outputstderr
- a non-null StringList object to be filled with error linesargs
- each argument to be passed as a series of String objectspublic static int shell(StringList stdout, StringList stderr, String... args)
public void die(String what)
public void die(String what, Exception e)
public void exit()
public boolean exitCalled()
public void exitActual()
public void dispose()
Not to be called or overriden by users. If called multiple times, will only notify listeners once. Register a dispose listener instead.
public void method(String name)
public void thread(String name)
public void save(String filename)
filename
- any sequence of letters and numberssaveFrame()
,
createGraphics(int, int, String)
public void saveFrame()
public void saveFrame(String filename)
filename
- any sequence of letters or numbers that ends with either ".tif", ".tga", ".jpg", or ".png"save(String)
,
createGraphics(int, int, String, String)
,
frameCount
public String insertFrame(String what)
public void cursor(int kind)
kind
- either ARROW, CROSS, HAND, MOVE, TEXT, or WAITpublic void cursor(PImage img)
public void cursor(PImage img, int x, int y)
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.
img
- any variable of type PImagex
- the horizontal active spot of the cursory
- the vertical active spot of the cursornoCursor()
public void cursor()
public void noCursor()
cursor()
public static void print(byte what)
what
- data to print to consoleprintln()
,
printArray(Object)
,
join(String[], char)
public static void print(boolean what)
public static void print(char what)
public static void print(int what)
public static void print(long what)
public static void print(float what)
public static void print(double what)
public static void print(String what)
public static void print(Object... variables)
variables
- list of data, separated by commaspublic static void println()
print(byte)
,
printArray(Object)
public static void println(byte what)
what
- data to print to consolepublic static void println(boolean what)
public static void println(char what)
public static void println(int what)
public static void println(long what)
public static void println(float what)
public static void println(double what)
public static void println(String what)
public static void println(Object... variables)
variables
- list of data, separated by commaspublic static void println(Object what)
public static void printArray(Object what)
what
- one-dimensional arrayprint(byte)
,
println()
public static void debug(String msg)
public static final float abs(float n)
n
- number to computepublic static final int abs(int n)
public static final float sq(float n)
n
- number to squaresqrt(float)
public static final float sqrt(float n)
n
- non-negative numberpow(float, float)
,
sq(float)
public static final float log(float n)
n
- number greater than 0.0public static final float exp(float n)
n
- exponent to raisepublic static final float pow(float n, float e)
n
- base of the exponential expressione
- power by which to raise the basesqrt(float)
public static final int max(int a, int b)
a
- first number to compareb
- second number to comparemin(float, float, float)
public static final float max(float a, float b)
public static final int max(int a, int b, int c)
c
- third number to comparepublic static final float max(float a, float b, float c)
public static final int max(int[] list)
list
- array of numbers to comparepublic static final float max(float[] list)
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)
a
- first numberb
- second numberc
- third numbermax(float, float, float)
public static final int min(int[] list)
list
- array of numbers to comparepublic static final float min(float[] list)
public static final int constrain(int amt, int low, int high)
public static final float constrain(float amt, float low, float high)
amt
- the value to constrainlow
- minimum limithigh
- maximum limitmax(float, float, float)
,
min(float, float, float)
public static final float sin(float angle)
angle
- an angle in radianscos(float)
,
tan(float)
,
radians(float)
public static final float cos(float angle)
angle
- an angle in radianssin(float)
,
tan(float)
,
radians(float)
public static final float tan(float angle)
angle
- an angle in radianscos(float)
,
sin(float)
,
radians(float)
public static final float asin(float value)
value
- the value whose arc sine is to be returnedsin(float)
,
acos(float)
,
atan(float)
public static final float acos(float value)
value
- the value whose arc cosine is to be returnedcos(float)
,
asin(float)
,
atan(float)
public static final float atan(float value)
value
- -Infinity to Infinity (exclusive)tan(float)
,
asin(float)
,
acos(float)
public static final float atan2(float y, float x)
y
- y-coordinate of the pointx
- x-coordinate of the pointtan(float)
public static final float degrees(float radians)
radians
- radian value to convert to degreesradians(float)
public static final float radians(float degrees)
degrees
- degree value to convert to radiansdegrees(float)
public static final int ceil(float n)
n
- number to round upfloor(float)
,
round(float)
public static final int floor(float n)
n
- number to round downceil(float)
,
round(float)
public static final int round(float n)
n
- number to roundfloor(float)
,
ceil(float)
public static final float mag(float a, float b)
public static final float mag(float a, float b, float c)
a
- first valueb
- second valuec
- third valuedist(float, float, float, float)
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)
x1
- x-coordinate of the first pointy1
- y-coordinate of the first pointz1
- z-coordinate of the first pointx2
- x-coordinate of the second pointy2
- y-coordinate of the second pointz2
- z-coordinate of the second pointpublic static final float lerp(float start, float stop, float amt)
start
- first valuestop
- second valueamt
- float between 0.0 and 1.0PGraphics.curvePoint(float, float, float, float, float)
,
PGraphics.bezierPoint(float, float, float, float, float)
,
PVector.lerp(PVector, float)
,
PGraphics.lerpColor(int, int, float)
public static final float norm(float value, float start, float stop)
value
- the incoming value to be convertedstart
- lower bound of the value's current rangestop
- upper bound of the value's current rangemap(float, float, float, float, float)
,
lerp(float, float, float)
public static final float map(float value, float start1, float stop1, float start2, float stop2)
value
- the incoming value to be convertedstart1
- lower bound of the value's current rangestop1
- upper bound of the value's current rangestart2
- lower bound of the value's target rangestop2
- upper bound of the value's target rangenorm(float, float, float)
,
lerp(float, float, float)
public final float random(float high)
public final float randomGaussian()
random(float,float)
,
noise(float, float, float)
public final float random(float low, float high)
low
- lower limithigh
- upper limitrandomSeed(long)
,
noise(float, float, float)
public final void randomSeed(long seed)
seed
- seed valuerandom(float,float)
,
noise(float, float, float)
,
noiseSeed(long)
public float noise(float x)
public float noise(float x, float y)
public float noise(float x, float y, float z)
x
- x-coordinate in noise spacey
- y-coordinate in noise spacez
- z-coordinate in noise spacenoiseSeed(long)
,
noiseDetail(int, float)
,
random(float,float)
public void noiseDetail(int lod)
lod
- number of octaves to be used by the noisenoise(float, float, float)
public void noiseDetail(int lod, float falloff)
falloff
- falloff factor for each octavenoiseDetail(int)
public void noiseSeed(long seed)
seed
- seed valuenoise(float, float, float)
,
noiseDetail(int, float)
,
random(float,float)
,
randomSeed(long)
public PImage loadImage(String filename)
filename
- name of file to load, can be .gif, .jpg, .tga, or a handful of other image types depending on your platformPImage
,
PGraphics.image(PImage, float, float, float, float)
,
PGraphics.imageMode(int)
,
PGraphics.background(float, float, float, float)
public PImage loadImage(String filename, String extension)
extension
- type of image to load, for example "png", "gif", "jpg"public PImage requestImage(String filename)
public PImage requestImage(String filename, String extension)
filename
- name of the file to load, can be .gif, .jpg, .tga, or a handful of other image types depending on your platformextension
- the type of image to load, for example "png", "gif", "jpg"PImage
,
loadImage(String, String)
public XML loadXML(String filename)
filename
- name of a file in the data folder or a URL.XML
,
parseXML(String)
,
saveXML(XML, String)
,
loadBytes(String)
,
loadStrings(String)
,
loadTable(String)
public XML loadXML(String filename, String options)
public XML parseXML(String xmlString)
xmlString
- the content to be parsed as XMLXML
,
loadXML(String)
,
saveXML(XML, String)
public XML parseXML(String xmlString, String options)
public boolean saveXML(XML xml, String filename)
xml
- the XML object to save to diskfilename
- name of the file to write toXML
,
loadXML(String)
,
parseXML(String)
public boolean saveXML(XML xml, String filename, String options)
public JSONObject parseJSONObject(String input)
input
- String to parse as a JSONObjectloadJSONObject(String)
,
saveJSONObject(JSONObject, String)
public JSONObject loadJSONObject(String filename)
filename
- name of a file in the data folder or a URLJSONObject
,
JSONArray
,
loadJSONArray(String)
,
saveJSONObject(JSONObject, String)
,
saveJSONArray(JSONArray, String)
public static JSONObject loadJSONObject(File file)
public boolean saveJSONObject(JSONObject json, String filename)
json
- the JSONObject to savefilename
- the name of the file to save toJSONObject
,
JSONArray
,
loadJSONObject(String)
,
loadJSONArray(String)
,
saveJSONArray(JSONArray, String)
public boolean saveJSONObject(JSONObject json, String filename, String options)
options
- "compact" and "indent=N", replace N with the number of spacespublic JSONArray parseJSONArray(String input)
input
- String to parse as a JSONArrayJSONObject
,
loadJSONObject(String)
,
saveJSONObject(JSONObject, String)
public JSONArray loadJSONArray(String filename)
filename
- name of a file in the data folder or a URLJSONArray
,
loadJSONObject(String)
,
saveJSONObject(JSONObject, String)
,
saveJSONArray(JSONArray, String)
public static JSONArray loadJSONArray(File file)
public boolean saveJSONArray(JSONArray json, String filename)
json
- the JSONArray to savefilename
- the name of the file to save toJSONObject
,
JSONArray
,
loadJSONObject(String)
,
loadJSONArray(String)
,
saveJSONObject(JSONObject, String)
public boolean saveJSONArray(JSONArray json, String filename, String options)
options
- "compact" and "indent=N", replace N with the number of spacespublic Table loadTable(String filename)
filename
- name of a file in the data folder or a URL.Table
,
saveTable(Table, String)
,
loadBytes(String)
,
loadStrings(String)
,
loadXML(String)
public Table loadTable(String filename, String options)
options
- may contain "header", "tsv", "csv", or "bin" separated by commaspublic boolean saveTable(Table table, String filename)
table
- the Table object to save to a filefilename
- the filename to which the Table should be savedTable
,
loadTable(String)
public boolean saveTable(Table table, String filename, String options)
options
- can be one of "tsv", "csv", "bin", or "html"public PFont loadFont(String filename)
filename
- name of the font to loadPFont
,
PGraphics.textFont(PFont, float)
,
createFont(String, float, boolean, char[])
public PFont createFont(String name, float size)
public PFont createFont(String name, float size, boolean smooth)
public PFont createFont(String name, float size, boolean smooth, char[] charset)
name
- name of the font to loadsize
- point size of the fontsmooth
- true for an antialiased font, false for aliasedcharset
- array containing characters to be generatedPFont
,
PGraphics.textFont(PFont, float)
,
PGraphics.text(String, float, float, float, float)
,
loadFont(String)
public void selectInput(String prompt, String callback)
void setup() { selectInput("Select a file to process:", "fileSelected"); } void fileSelected(File selection) { if (selection == null) { println("Window was closed or the user hit cancel."); } else { println("User selected " + fileSeleted.getAbsolutePath()); } }For advanced users, the method must be 'public', which is true for all methods inside a sketch when run from the PDE, but must explicitly be set when using Eclipse or other development environments.
prompt
- message to the usercallback
- name of the method to be called when the selection is madepublic void selectInput(String prompt, String callback, File file)
public void selectInput(String prompt, String callback, File file, Object callbackObject)
public static void selectInput(String prompt, String callbackMethod, File file, Object callbackObject, Frame parent, PApplet sketch)
public static void selectInput(String prompt, String callbackMethod, File file, Object callbackObject, Frame parent)
public void selectOutput(String prompt, String callback)
prompt
- message to the usercallback
- name of the method to be called when the selection is madepublic void selectOutput(String prompt, String callback, File file)
public void selectOutput(String prompt, String callback, File file, Object callbackObject)
public static void selectOutput(String prompt, String callbackMethod, File file, Object callbackObject, Frame parent)
public static void selectOutput(String prompt, String callbackMethod, File file, Object callbackObject, Frame parent, PApplet sketch)
public void selectFolder(String prompt, String callback)
prompt
- message to the usercallback
- name of the method to be called when the selection is madepublic void selectFolder(String prompt, String callback, File file)
public void selectFolder(String prompt, String callback, File file, Object callbackObject)
public static void selectFolder(String prompt, String callbackMethod, File defaultSelection, Object callbackObject, Frame parentFrame)
public static void selectFolder(String prompt, String callbackMethod, File defaultSelection, Object callbackObject, Frame parentFrame, PApplet sketch)
public String[] listPaths(String path, String... options)
public File[] listFiles(String path, String... options)
public static File[] listFiles(File base, String... options)
public static String checkExtension(String filename)
filename
- The filename to checkpublic BufferedReader createReader(String filename)
filename
- name of the file to be openedBufferedReader
,
createWriter(String)
,
PrintWriter
public static BufferedReader createReader(File file)
public static BufferedReader createReader(InputStream input)
public PrintWriter createWriter(String filename)
filename
- name of the file to be createdPrintWriter
,
createReader(java.lang.String)
,
BufferedReader
public static PrintWriter createWriter(File file)
public static PrintWriter createWriter(OutputStream output)
public InputStream createInput(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:
filename
- the name of the file to use as inputcreateOutput(String)
,
selectOutput(String,String)
,
selectInput(String,String)
public InputStream createInputRaw(String filename)
public static InputStream createInput(File file)
public byte[] loadBytes(String filename)
filename
- name of a file in the data folder or a URL.loadStrings(String)
,
saveStrings(String, String[])
,
saveBytes(String, byte[])
public static byte[] loadBytes(InputStream input)
public static byte[] loadBytes(File file)
public static String[] loadStrings(File file)
public String[] loadStrings(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.
filename
- name of the file or url to loadloadBytes(String)
,
saveStrings(String, String[])
,
saveBytes(String, byte[])
public static String[] loadStrings(InputStream input)
public static String[] loadStrings(BufferedReader reader)
public OutputStream createOutput(String filename)
filename
- name of the file to opencreateInput(String)
,
selectOutput(String,String)
public static OutputStream createOutput(File file)
public boolean saveStream(String target, String source)
target
- name of the file to write tosource
- location to read from (a filename, path, or URL)createOutput(String)
public boolean saveStream(File target, String source)
public boolean saveStream(String target, InputStream source)
public static boolean saveStream(File target, InputStream source)
public static void saveStream(OutputStream target, InputStream source) throws IOException
IOException
public void saveBytes(String filename, byte[] data)
filename
- name of the file to write todata
- array of bytes to be writtenloadStrings(String)
,
loadBytes(String)
,
saveStrings(String, String[])
public static void saveBytes(File file, byte[] data)
public static void saveBytes(OutputStream output, byte[] data)
public void saveStrings(String filename, String[] data)
filename
- filename for outputdata
- string array to be writtenloadStrings(String)
,
loadBytes(String)
,
saveBytes(String, byte[])
public static void saveStrings(File file, String[] data)
public static void saveStrings(OutputStream output, String[] data)
public String sketchPath()
public String sketchPath(String where)
public File sketchFile(String where)
public String savePath(String where)
public File saveFile(String where)
public static File desktopFile(String what)
public static String desktopPath(String what)
public String dataPath(String where)
Libraries should use createInput() to get an InputStream or createOutput() to get an OutputStream. sketchPath() can be used to get a location relative to the sketch. Again, do not use this to get relative locations of files. You'll be disappointed when your app runs on different platforms.
public File dataFile(String where)
public static void createPath(String path)
public static void createPath(File file)
public static String getExtension(String filename)
public static String urlEncode(String str)
public static String urlDecode(String str)
public static byte[] sort(byte[] list)
list
- array to sortreverse(boolean[])
public static byte[] sort(byte[] list, int count)
count
- number of elements to sort, starting from 0public static char[] sort(char[] list)
public static char[] sort(char[] list, int count)
public static int[] sort(int[] list)
public static int[] sort(int[] list, int count)
public static float[] sort(float[] list)
public static float[] sort(float[] list, int count)
public static String[] sort(String[] list)
public static String[] sort(String[] list, int count)
public static void arrayCopy(Object src, int srcPosition, Object dst, int dstPosition, int length)
src
- the source arraysrcPosition
- starting position in the source arraydst
- the destination array of the same data type as the source arraydstPosition
- starting position in the destination arraylength
- number of array elements to be copiedconcat(boolean[], boolean[])
public static void arrayCopy(Object src, Object dst, int length)
arraycopy(src, 0, dst, 0, length);
public static void arrayCopy(Object src, Object dst)
arraycopy(src, 0, dst, 0, src.length);
@Deprecated public static void arraycopy(Object src, int srcPosition, Object dst, int dstPosition, int length)
@Deprecated public static void arraycopy(Object src, Object dst, int length)
@Deprecated public static void arraycopy(Object src, Object dst)
public static boolean[] expand(boolean[] list)
list
- the array to expandshorten(boolean[])
public static boolean[] expand(boolean[] list, int newSize)
newSize
- new size for the arraypublic 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 long[] expand(long[] list)
public static long[] expand(long[] list, int newSize)
public static float[] expand(float[] list)
public static float[] expand(float[] list, int newSize)
public static double[] expand(double[] list)
public static double[] expand(double[] list, int newSize)
public static String[] expand(String[] list)
public static String[] expand(String[] list, int newSize)
public static Object expand(Object array)
public static Object expand(Object list, int newSize)
public static byte[] append(byte[] array, byte value)
array
- array to appendvalue
- new data for the arrayshorten(boolean[])
,
expand(boolean[])
public static char[] append(char[] array, char value)
public static int[] append(int[] array, int value)
public static float[] append(float[] array, float value)
public static String[] append(String[] array, String value)
public static Object append(Object array, Object value)
public static boolean[] shorten(boolean[] list)
list
- array to shortenappend(byte[], byte)
,
expand(boolean[])
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 String[] shorten(String[] list)
public static Object shorten(Object list)
public static final boolean[] splice(boolean[] list, boolean value, int index)
list
- array to splice intovalue
- value to be spliced inindex
- position in the array from which to insert dataconcat(boolean[], boolean[])
,
subset(boolean[], int, int)
public static final boolean[] splice(boolean[] list, boolean[] value, int index)
public static final byte[] splice(byte[] list, byte value, int index)
public static final byte[] splice(byte[] list, byte[] value, int index)
public static final char[] splice(char[] list, char value, int index)
public static final char[] splice(char[] list, char[] value, int index)
public static final int[] splice(int[] list, int value, int index)
public static final int[] splice(int[] list, int[] value, int index)
public static final float[] splice(float[] list, float value, int index)
public static final float[] splice(float[] list, float[] value, int index)
public static final String[] splice(String[] list, String value, int index)
public static final String[] splice(String[] list, String[] value, int index)
public static final Object splice(Object list, Object value, int index)
public static boolean[] subset(boolean[] list, int start)
public static boolean[] subset(boolean[] list, int start, int count)
list
- array to extract fromstart
- position to begincount
- number of values to extractsplice(boolean[], boolean, int)
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 long[] subset(long[] list, int start)
public static long[] subset(long[] 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 double[] subset(double[] list, int start)
public static double[] subset(double[] list, int start, int count)
public static String[] subset(String[] list, int start)
public static String[] subset(String[] list, int start, int count)
public static Object subset(Object list, int start)
public static Object subset(Object list, int start, int count)
public static boolean[] concat(boolean[] a, boolean[] b)
a
- first array to concatenateb
- second array to concatenatesplice(boolean[], boolean, int)
,
arrayCopy(Object, int, Object, int, int)
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 String[] concat(String[] a, String[] b)
public static Object concat(Object a, Object b)
public static boolean[] reverse(boolean[] list)
list
- booleans[], bytes[], chars[], ints[], floats[], or Strings[]sort(String[], int)
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 String[] reverse(String[] list)
public static Object reverse(Object list)
public static String trim(String str)
str
- any stringsplit(String, String)
,
join(String[], char)
public static String[] trim(String[] array)
array
- a String arraypublic static String join(String[] list, char separator)
list
- array of Stringsseparator
- char or String to be placed between each itemsplit(String, String)
,
trim(String)
,
nf(float, int, int)
,
nfs(float, int, int)
public static String join(String[] list, String separator)
public static String[] splitTokens(String value)
public static String[] splitTokens(String value, String delim)
value
- the String to be splitdelim
- list of individual characters that will be used as separatorssplit(String, String)
,
join(String[], String)
,
trim(String)
public static String[] split(String value, char delim)
value
- the String to be splitdelim
- the character or String used to separate the datapublic static String[] split(String value, String delim)
public static String[] match(String str, String regexp)
str
- the String to be searchedregexp
- the regexp to be used for matchingmatchAll(String, String)
,
split(String, String)
,
splitTokens(String, String)
,
join(String[], String)
,
trim(String)
public static String[][] matchAll(String str, String regexp)
str
- the String to be searchedregexp
- the regexp to be used for matchingmatch(String, String)
,
split(String, String)
,
splitTokens(String, String)
,
join(String[], String)
,
trim(String)
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(String what)
public static final boolean[] parseBoolean(int[] what)
public static final boolean[] parseBoolean(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(String what)
public static final int parseInt(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(String[] what)
public static int[] parseInt(String[] what, int missing)
public static final float parseFloat(int what)
public static final float parseFloat(String what)
public static final float parseFloat(String what, float otherwise)
public static final float[] parseFloat(byte[] what)
public static final float[] parseFloat(int[] what)
public static final float[] parseFloat(String[] what)
public static final float[] parseFloat(String[] what, float missing)
public static final String str(boolean x)
public static final String str(byte x)
public static final String str(char x)
public static final String str(int x)
public static final String str(float x)
public static final String[] str(boolean[] x)
public static final String[] str(byte[] x)
public static final String[] str(char[] x)
public static final String[] str(int[] x)
public static final String[] str(float[] x)
public static String nf(float num)
public static String[] nf(float[] nums)
public static String[] nf(int[] nums, int digits)
nums
- the numbers to formatdigits
- number of digits to pad with zeronfs(float, int, int)
,
nfp(float, int, int)
,
nfc(float, int)
,
int(float)public static String nf(int num, int digits)
num
- the number to formatpublic static String[] nfc(int[] nums)
nums
- the numbers to formatnf(float, int, int)
,
nfp(float, int, int)
,
nfs(float, int, int)
public static String nfc(int num)
num
- the number to formatpublic static String nfs(int num, int digits)
num
- the number to formatdigits
- number of digits to pad with zeroesnf(float, int, int)
,
nfp(float, int, int)
,
nfc(float, int)
public static String[] nfs(int[] nums, int digits)
nums
- the numbers to formatpublic static String nfp(int num, int digits)
num
- the number to formatdigits
- number of digits to pad with zeroesnf(float, int, int)
,
nfs(float, int, int)
,
nfc(float, int)
public static String[] nfp(int[] nums, int digits)
nums
- the numbers to formatpublic static String[] nf(float[] nums, int left, int right)
left
- number of digits to the left of the decimal pointright
- number of digits to the right of the decimal pointpublic static String nf(float num, int left, int right)
public static String[] nfc(float[] nums, int right)
right
- number of digits to the right of the decimal pointpublic static String nfc(float num, int right)
public static String[] nfs(float[] nums, int left, int right)
left
- the number of digits to the left of the decimal pointright
- the number of digits to the right of the decimal pointpublic static String nfs(float num, int left, int right)
public static String[] nfp(float[] nums, int left, int right)
left
- the number of digits to the left of the decimal pointright
- the number of digits to the right of the decimal pointpublic static String nfp(float num, int left, int right)
public static final String hex(byte value)
value
- the value to convertunhex(String)
,
binary(byte)
,
unbinary(String)
public static final String hex(char value)
public static final String hex(int value)
public static final String hex(int value, int digits)
digits
- the number of digits (maximum 8)public static final int unhex(String value)
value
- String to convert to an integerhex(int, int)
,
binary(byte)
,
unbinary(String)
public static final String binary(byte value)
public static final String binary(char value)
public static final String binary(int value)
public static final String binary(int value, int digits)
value
- value to convertdigits
- number of digits to returnunbinary(String)
,
hex(int,int)
,
unhex(String)
public static final int unbinary(String value)
value
- String to convert to an integerbinary(byte)
,
hex(int,int)
,
unhex(String)
public final int color(int gray)
gray
- number specifying value between white and blackcolorMode(int)
public final int color(float fgray)
fgray
- number specifying value between white and blackpublic final int color(int gray, int alpha)
alpha
- relative to current color rangepublic final int color(float fgray, float falpha)
public final int color(int v1, int v2, int v3)
v1
- red or hue values relative to the current color rangev2
- green or saturation values relative to the current color rangev3
- blue or brightness values relative to the current color rangepublic final int color(int v1, int v2, int v3, int alpha)
public final int color(float v1, float v2, float v3)
public final int color(float v1, float v2, float v3, float alpha)
public int lerpColor(int c1, int c2, float amt)
c1
- interpolate from this colorc2
- interpolate to this coloramt
- between 0.0 and 1.0PImage.blendColor(int, int, int)
,
PGraphics.color(float, float, float, float)
,
lerp(float, float, float)
public static int blendColor(int c1, int c2, int mode)
public void frameMoved(int x, int y)
public void frameResized(int w, int h)
public static void main(String[] args)
Usage: PApplet [options] <class name> [sketch args]
The simplest way to turn and sketch into an application is to add the following code to your program:
static public void main(String args[]) { PApplet.main("YourSketchName"); }That will properly launch your code 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 Presentation mode: blanks the entire screen and shows the sketch by itself. If the sketch is smaller than the screen, the background around it will use the --window-color setting. --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. --window-color=#xxxxxx Background color of the window. The color used around the sketch when it's smaller than the minimum window size for the OS, and the matte color when using 'present' mode. --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 sketch. Displays are numbered starting from 1. This will be overridden by fullScreen() calls that specify a display. Omitting this option will cause the default display to be used. 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 All parameters *after* the sketch class name are passed to the sketch itself and available from its 'args' array while the sketch is running.
public static void main(Class<?> mainClass, String... args)
public static void main(String mainClass)
mainClass
- name of the class to load (with package if any)public static void main(String mainClass, String[] sketchArgs)
mainClass
- name of the class to load (with package if any)sketchArgs
- command line arguments to pass to the sketch's 'args'
array. Note that this is not the same as the args passed
to (and understood by) PApplet such as --display.public static void runSketch(String[] args, PApplet constructedSketch)
public static void hideMenuBar()
public PGraphics beginRecord(String renderer, String filename)
renderer
- PDF or SVGfilename
- filename for outputendRecord()
public void beginRecord(PGraphics recorder)
public void endRecord()
beginRecord(String, String)
public PGraphics beginRaw(String renderer, String filename)
public void beginRaw(PGraphics rawGraphics)
rawGraphics
- ???public void endRaw()
beginRaw(String, String)
public void loadPixels()
pixels
,
updatePixels()
public void updatePixels()
loadPixels()
,
pixels
public void updatePixels(int x1, int y1, int x2, int y2)
x1
- x-coordinate of the upper-left cornery1
- y-coordinate of the upper-left cornerx2
- width of the regiony2
- height of the regionpublic PGL beginPGL()
public void endPGL()
public void flush()
public void hint(int which)
public void beginShape()
public void beginShape(int kind)
kind
- Either POINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, or QUAD_STRIPPShape
,
PGraphics.endShape()
,
PGraphics.vertex(float, float, float, float, float)
,
PGraphics.curveVertex(float, float, float)
,
PGraphics.bezierVertex(float, float, float, float, float, float, float, float, float)
public void edge(boolean edge)
public void normal(float nx, float ny, float nz)
nx
- x directionny
- y directionnz
- z directionPGraphics.beginShape(int)
,
PGraphics.endShape(int)
,
PGraphics.lights()
public void attribPosition(String name, float x, float y, float z)
public void attribNormal(String name, float nx, float ny, float nz)
public void attribColor(String name, int color)
public void attrib(String name, float... values)
public void attrib(String name, int... values)
public void attrib(String name, boolean... values)
public void textureMode(int mode)
mode
- either IMAGE or NORMALPGraphics.texture(PImage)
,
PGraphics.textureWrap(int)
public void textureWrap(int wrap)
wrap
- Either CLAMP (default) or REPEATPGraphics.texture(PImage)
,
PGraphics.textureMode(int)
public void texture(PImage image)
image
- reference to a PImage objectPGraphics.textureMode(int)
,
PGraphics.textureWrap(int)
,
PGraphics.beginShape(int)
,
PGraphics.endShape(int)
,
PGraphics.vertex(float, float, float, float, float)
public void noTexture()
public void vertex(float x, float y)
public void vertex(float x, float y, float z)
public void vertex(float[] v)
v
- vertex parameters, as a float array of length VERTEX_FIELD_COUNTpublic void vertex(float x, float y, float u, float v)
public void vertex(float x, float y, float z, float u, float v)
x
- x-coordinate of the vertexy
- y-coordinate of the vertexz
- z-coordinate of the vertexu
- horizontal coordinate for the texture mappingv
- vertical coordinate for the texture mappingPGraphics.beginShape(int)
,
PGraphics.endShape(int)
,
PGraphics.bezierVertex(float, float, float, float, float, float, float, float, float)
,
PGraphics.quadraticVertex(float, float, float, float, float, float)
,
PGraphics.curveVertex(float, float, float)
,
PGraphics.texture(PImage)
public void beginContour()
public void endContour()
public void endShape()
public void endShape(int mode)
mode
- use CLOSE to close the shapePShape
,
PGraphics.beginShape(int)
public PShape loadShape(String filename)
filename
- name of file to load, can be .svg or .objPShape
,
createShape()
public PShape loadShape(String filename, String options)
public PShape createShape()
PShape
,
PShape.endShape()
,
loadShape(String)
public PShape createShape(int type)
public PShape createShape(int kind, float... p)
kind
- either POINT, LINE, TRIANGLE, QUAD, RECT, ELLIPSE, ARC, BOX, SPHEREp
- parameters that match the kind of shapepublic PShader loadShader(String fragFilename)
fragFilename
- name of fragment shader filepublic PShader loadShader(String fragFilename, String vertFilename)
vertFilename
- name of vertex shader filepublic void shader(PShader shader)
shader
- name of shader filepublic void shader(PShader shader, int kind)
kind
- type of shader, either POINTS, LINES, or TRIANGLESpublic void resetShader()
public void resetShader(int kind)
kind
- type of shader, either POINTS, LINES, or TRIANGLESpublic void filter(PShader shader)
shader
- the fragment shader to applypublic void clip(float a, float b, float c, float d)
a
- x-coordinate of the rectangle, by defaultb
- y-coordinate of the rectangle, by defaultc
- width of the rectangle, by defaultd
- height of the rectangle, by defaultpublic void noClip()
public void blendMode(int mode)
mode
- the blending mode to usepublic 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)
x2
- the x-coordinate of the 1st control pointy2
- the y-coordinate of the 1st control pointz2
- the z-coordinate of the 1st control pointx3
- the x-coordinate of the 2nd control pointy3
- the y-coordinate of the 2nd control pointz3
- the z-coordinate of the 2nd control pointx4
- the x-coordinate of the anchor pointy4
- the y-coordinate of the anchor pointz4
- the z-coordinate of the anchor pointPGraphics.curveVertex(float, float, float)
,
PGraphics.vertex(float, float, float, float, float)
,
PGraphics.quadraticVertex(float, float, float, float, float, float)
,
PGraphics.bezier(float, float, float, float, float, float, float, float, float, float, float, float)
public void quadraticVertex(float cx, float cy, float x3, float y3)
cx
- the x-coordinate of the control pointcy
- the y-coordinate of the control pointx3
- the x-coordinate of the anchor pointy3
- the y-coordinate of the anchor pointPGraphics.curveVertex(float, float, float)
,
PGraphics.vertex(float, float, float, float, float)
,
PGraphics.bezierVertex(float, float, float, float, float, float)
,
PGraphics.bezier(float, float, float, float, float, float, float, float, float, float, float, float)
public void quadraticVertex(float cx, float cy, float cz, float x3, float y3, float z3)
cz
- the z-coordinate of the control pointz3
- the z-coordinate of the anchor pointpublic void curveVertex(float x, float y)
x
- the x-coordinate of the vertexy
- the y-coordinate of the vertexPGraphics.curve(float, float, float, float, float, float, float, float, float, float, float, float)
,
PGraphics.beginShape(int)
,
PGraphics.endShape(int)
,
PGraphics.vertex(float, float, float, float, float)
,
PGraphics.bezier(float, float, float, float, float, float, float, float, float, float, float, float)
,
PGraphics.quadraticVertex(float, float, float, float, float, float)
public void curveVertex(float x, float y, float z)
z
- the z-coordinate of the vertexpublic void point(float x, float y)
x
- x-coordinate of the pointy
- y-coordinate of the pointPGraphics.stroke(int)
public void point(float x, float y, float z)
z
- z-coordinate of the pointpublic void line(float x1, float y1, float x2, float y2)
x1
- x-coordinate of the first pointy1
- y-coordinate of the first pointx2
- x-coordinate of the second pointy2
- y-coordinate of the second pointPGraphics.strokeWeight(float)
,
PGraphics.strokeJoin(int)
,
PGraphics.strokeCap(int)
,
PGraphics.beginShape()
public void line(float x1, float y1, float z1, float x2, float y2, float z2)
z1
- z-coordinate of the first pointz2
- z-coordinate of the second pointpublic void triangle(float x1, float y1, float x2, float y2, float x3, float y3)
x1
- x-coordinate of the first pointy1
- y-coordinate of the first pointx2
- x-coordinate of the second pointy2
- y-coordinate of the second pointx3
- x-coordinate of the third pointy3
- y-coordinate of the third pointbeginShape()
public void quad(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
x1
- x-coordinate of the first cornery1
- y-coordinate of the first cornerx2
- x-coordinate of the second cornery2
- y-coordinate of the second cornerx3
- x-coordinate of the third cornery3
- y-coordinate of the third cornerx4
- x-coordinate of the fourth cornery4
- y-coordinate of the fourth cornerpublic void rectMode(int mode)
mode
- either CORNER, CORNERS, CENTER, or RADIUSPGraphics.rect(float, float, float, float)
public void rect(float a, float b, float c, float d)
a
- x-coordinate of the rectangle by defaultb
- y-coordinate of the rectangle by defaultc
- width of the rectangle by defaultd
- height of the rectangle by defaultPGraphics.rectMode(int)
,
PGraphics.quad(float, float, float, float, float, float, float, float)
public void rect(float a, float b, float c, float d, float r)
r
- radii for all four cornerspublic void rect(float a, float b, float c, float d, float tl, float tr, float br, float bl)
tl
- radius for top-left cornertr
- radius for top-right cornerbr
- radius for bottom-right cornerbl
- radius for bottom-left cornerpublic void square(float x, float y, float extent)
x
- x-coordinate of the rectangle by defaulty
- y-coordinate of the rectangle by defaultextent
- width and height of the rectangle by defaultPGraphics.rect(float, float, float, float)
,
PGraphics.rectMode(int)
public void ellipseMode(int mode)
mode
- either CENTER, RADIUS, CORNER, or CORNERSellipse(float, float, float, float)
,
arc(float, float, float, float, float, float)
public void ellipse(float a, float b, float c, float d)
a
- x-coordinate of the ellipseb
- y-coordinate of the ellipsec
- width of the ellipse by defaultd
- height of the ellipse by defaultellipseMode(int)
,
arc(float, float, float, float, float, float)
public void arc(float a, float b, float c, float d, float start, float stop)
a
- x-coordinate of the arc's ellipseb
- y-coordinate of the arc's ellipsec
- width of the arc's ellipse by defaultd
- height of the arc's ellipse by defaultstart
- angle to start the arc, specified in radiansstop
- angle to stop the arc, specified in radiansellipse(float, float, float, float)
,
ellipseMode(int)
,
radians(float)
,
degrees(float)
public void arc(float a, float b, float c, float d, float start, float stop, int mode)
public void circle(float x, float y, float extent)
x
- x-coordinate of the ellipsey
- y-coordinate of the ellipseextent
- width and height of the ellipse by defaultellipse(float, float, float, float)
,
ellipseMode(int)
public void box(float size)
size
- dimension of the box in all dimensions (creates a cube)PGraphics.sphere(float)
public void box(float w, float h, float d)
w
- dimension of the box in the x-dimensionh
- dimension of the box in the y-dimensiond
- dimension of the box in the z-dimensionpublic void sphereDetail(int res)
res
- number of segments (minimum 3) used per full circle revolutionPGraphics.sphere(float)
public void sphereDetail(int ures, int vres)
ures
- number of segments used longitudinally per full circle revolutoinvres
- number of segments used latitudinally from top to bottompublic void sphere(float r)
Implementation notes:
cache all the points of the sphere in a static array top and bottom are just a bunch of triangles that land in the center point
sphere is a series of concentric circles who radii vary along the shape, based on, er.. cos or something
[toxi 031031] new sphere code. removed all multiplies with radius, as scale() will take care of that anyway [toxi 031223] updated sphere code (removed modulos) and introduced sphereAt(x,y,z,r) to avoid additional translate()'s on the user/sketch side [davbol 080801] now using separate sphereDetailU/V
r
- the radius of the spherePGraphics.sphereDetail(int)
public float bezierPoint(float a, float b, float c, float d, float t)
stroke(255, 102, 0); line(85, 20, 10, 10); line(90, 90, 15, 80); stroke(0, 0, 0); bezier(85, 20, 10, 10, 90, 90, 15, 80); // draw it in gray, using 10 steps instead of the default 20 // this is a slower way to do it, but useful if you need // to do things with the coordinates at each step stroke(128); beginShape(LINE_STRIP); for (int i = 0; i <= 10; i++) { float t = i / 10.0f; float x = bezierPoint(85, 10, 90, 15, t); float y = bezierPoint(20, 10, 90, 80, t); vertex(x, y); } endShape();
a
- coordinate of first point on the curveb
- coordinate of first control pointc
- coordinate of second control pointd
- coordinate of second point on the curvet
- value between 0 and 1PGraphics.bezier(float, float, float, float, float, float, float, float, float, float, float, float)
,
PGraphics.bezierVertex(float, float, float, float, float, float)
,
PGraphics.curvePoint(float, float, float, float, float)
public float bezierTangent(float a, float b, float c, float d, float t)
a
- coordinate of first point on the curveb
- coordinate of first control pointc
- coordinate of second control pointd
- coordinate of second point on the curvet
- value between 0 and 1PGraphics.bezier(float, float, float, float, float, float, float, float, float, float, float, float)
,
PGraphics.bezierVertex(float, float, float, float, float, float)
,
PGraphics.curvePoint(float, float, float, float, float)
public void bezierDetail(int detail)
detail
- resolution of the curvesPGraphics.curve(float, float, float, float, float, float, float, float, float, float, float, float)
,
PGraphics.curveVertex(float, float, float)
,
PGraphics.curveTightness(float)
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)
Identical to typing:
beginShape(); vertex(x1, y1); bezierVertex(x2, y2, x3, y3, x4, y4); endShape();In Postscript-speak, this would be:
moveto(x1, y1); curveto(x2, y2, x3, y3, x4, y4);If you were to try and continue that curve like so:
curveto(x5, y5, x6, y6, x7, y7);This would be done in processing by adding these statements:
bezierVertex(x5, y5, x6, y6, x7, y7)To draw a quadratic (instead of cubic) curve, use the control point twice by doubling it:
bezier(x1, y1, cx, cy, cx, cy, x2, y2);
x1
- coordinates for the first anchor pointy1
- coordinates for the first anchor pointz1
- coordinates for the first anchor pointx2
- coordinates for the first control pointy2
- coordinates for the first control pointz2
- coordinates for the first control pointx3
- coordinates for the second control pointy3
- coordinates for the second control pointz3
- coordinates for the second control pointx4
- coordinates for the second anchor pointy4
- coordinates for the second anchor pointz4
- coordinates for the second anchor pointPGraphics.bezierVertex(float, float, float, float, float, float)
,
PGraphics.curve(float, float, float, float, float, float, float, float, float, float, float, float)
public float curvePoint(float a, float b, float c, float d, float t)
a
- coordinate of first control pointb
- coordinate of first point on the curvec
- coordinate of second point on the curved
- coordinate of second control pointt
- value between 0 and 1PGraphics.curve(float, float, float, float, float, float, float, float, float, float, float, float)
,
PGraphics.curveVertex(float, float)
,
PGraphics.bezierPoint(float, float, float, float, float)
public float curveTangent(float a, float b, float c, float d, float t)
a
- coordinate of first point on the curveb
- coordinate of first control pointc
- coordinate of second control pointd
- coordinate of second point on the curvet
- value between 0 and 1PGraphics.curve(float, float, float, float, float, float, float, float, float, float, float, float)
,
PGraphics.curveVertex(float, float)
,
PGraphics.curvePoint(float, float, float, float, float)
,
PGraphics.bezierTangent(float, float, float, float, float)
public void curveDetail(int detail)
detail
- resolution of the curvesPGraphics.curve(float, float, float, float, float, float, float, float, float, float, float, float)
,
PGraphics.curveVertex(float, float)
,
PGraphics.curveTightness(float)
public void curveTightness(float tightness)
tightness
- amount of deformation from the original verticesPGraphics.curve(float, float, float, float, float, float, float, float, float, float, float, float)
,
PGraphics.curveVertex(float, float)
public void curve(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
Identical to typing out:
beginShape(); curveVertex(x1, y1); curveVertex(x2, y2); curveVertex(x3, y3); curveVertex(x4, y4); endShape();
x1
- coordinates for the beginning control pointy1
- coordinates for the beginning control pointx2
- coordinates for the first pointy2
- coordinates for the first pointx3
- coordinates for the second pointy3
- coordinates for the second pointx4
- coordinates for the ending control pointy4
- coordinates for the ending control pointPGraphics.curveVertex(float, float)
,
PGraphics.curveTightness(float)
,
PGraphics.bezier(float, float, float, float, float, float, float, float, float, float, float, float)
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)
z1
- coordinates for the beginning control pointz2
- coordinates for the first pointz3
- coordinates for the second pointz4
- coordinates for the ending control pointpublic void imageMode(int mode)
mode
- either CORNER, CORNERS, or CENTERloadImage(String, String)
,
PImage
,
PGraphics.image(PImage, float, float, float, float)
,
PGraphics.background(float, float, float, float)
public void image(PImage img, float a, float b)
img
- the image to displaya
- x-coordinate of the image by defaultb
- y-coordinate of the image by defaultloadImage(String, String)
,
PImage
,
PGraphics.imageMode(int)
,
PGraphics.tint(float)
,
PGraphics.background(float, float, float, float)
,
PGraphics.alpha(int)
public void image(PImage img, float a, float b, float c, float d)
c
- width to display the image by defaultd
- height to display the image by defaultpublic void image(PImage img, float a, float b, float c, float d, int u1, int v1, int u2, int v2)
public void shapeMode(int mode)
mode
- either CORNER, CORNERS, CENTERPShape
,
PGraphics.shape(PShape)
,
PGraphics.rectMode(int)
public void shape(PShape shape)
public void shape(PShape shape, float x, float y)
shape
- the shape to displayx
- x-coordinate of the shapey
- y-coordinate of the shapePShape
,
loadShape(String)
,
Convenience method to draw at a particular location.
public void shape(PShape shape, float a, float b, float c, float d)
a
- x-coordinate of the shapeb
- y-coordinate of the shapec
- width to display the shaped
- height to display the shapepublic void textAlign(int alignX)
public void textAlign(int alignX, int alignY)
alignX
- horizontal alignment, either LEFT, CENTER, or RIGHTalignY
- vertical alignment, either TOP, BOTTOM, CENTER, or BASELINEloadFont(String)
,
PFont
,
PGraphics.text(String, float, float)
,
PGraphics.textSize(float)
,
PGraphics.textAscent()
,
PGraphics.textDescent()
public float textAscent()
PGraphics.textDescent()
public float textDescent()
PGraphics.textAscent()
public void textFont(PFont which)
which
- any variable of the type PFontcreateFont(String, float, boolean)
,
loadFont(String)
,
PFont
,
PGraphics.text(String, float, float)
,
PGraphics.textSize(float)
public void textFont(PFont which, float size)
size
- the size of the letters in units of pixelspublic void textLeading(float leading)
leading
- the size in pixels for spacing between linesloadFont(String)
,
PFont.PFont(java.io.InputStream)
,
PGraphics.text(String, float, float)
,
PGraphics.textFont(PFont)
,
PGraphics.textSize(float)
public void textMode(int mode)
mode
- either MODEL or SHAPEloadFont(String)
,
PFont.PFont(java.io.InputStream)
,
PGraphics.text(String, float, float)
,
PGraphics.textFont(PFont)
,
PGraphics.beginRaw(PGraphics)
,
createFont(String, float, boolean)
public void textSize(float size)
size
- the size of the letters in units of pixelsloadFont(String)
,
PFont.PFont(java.io.InputStream)
,
PGraphics.text(String, float, float)
,
PGraphics.textFont(PFont)
public float textWidth(char c)
c
- the character to measurepublic float textWidth(String str)
str
- the String of characters to measureloadFont(String)
,
PFont.PFont(java.io.InputStream)
,
PGraphics.text(String, float, float)
,
PGraphics.textFont(PFont)
,
PGraphics.textSize(float)
public float textWidth(char[] chars, int start, int length)
public void text(char c, float x, float y)
c
- the alphanumeric character to be displayedx
- x-coordinate of texty
- y-coordinate of textPGraphics.textAlign(int, int)
,
PGraphics.textFont(PFont)
,
PGraphics.textMode(int)
,
PGraphics.textSize(float)
,
PGraphics.textLeading(float)
,
PGraphics.textWidth(String)
,
PGraphics.textAscent()
,
PGraphics.textDescent()
,
PGraphics.rectMode(int)
,
PGraphics.fill(int, float)
public void text(char c, float x, float y, float z)
z
- z-coordinate of textpublic void text(String str, float x, float y)
public void text(char[] chars, int start, int stop, float x, float y)
chars
- the alphanumberic symbols to be displayedstart
- array index at which to start writing charactersstop
- array index at which to stop writing characterspublic void text(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(String str, float x1, float y1, float x2, float y2)
x1
- by default, the x-coordinate of text, see rectMode() for more infoy1
- by default, the y-coordinate of text, see rectMode() for more infox2
- by default, the width of the text box, see rectMode() for more infoy2
- by default, the height of the text box, see rectMode() for more infopublic 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)
num
- the numeric value to be displayedpublic void text(float num, float x, float y, float z)
public void push()
PGraphics.pop()
public void pop()
PGraphics.push()
public void pushMatrix()
public void popMatrix()
PGraphics.pushMatrix()
public void translate(float x, float y)
x
- left/right translationy
- up/down translationPGraphics.popMatrix()
,
PGraphics.pushMatrix()
,
PGraphics.rotate(float)
,
PGraphics.rotateX(float)
,
PGraphics.rotateY(float)
,
PGraphics.rotateZ(float)
,
PGraphics.scale(float, float, float)
public void translate(float x, float y, float z)
z
- forward/backward translationpublic void rotate(float angle)
angle
- angle of rotation specified in radiansPGraphics.popMatrix()
,
PGraphics.pushMatrix()
,
PGraphics.rotateX(float)
,
PGraphics.rotateY(float)
,
PGraphics.rotateZ(float)
,
PGraphics.scale(float, float, float)
,
radians(float)
public void rotateX(float angle)
angle
- angle of rotation specified in radiansPGraphics.popMatrix()
,
PGraphics.pushMatrix()
,
PGraphics.rotate(float)
,
PGraphics.rotateY(float)
,
PGraphics.rotateZ(float)
,
PGraphics.scale(float, float, float)
,
PGraphics.translate(float, float, float)
public void rotateY(float angle)
angle
- angle of rotation specified in radiansPGraphics.popMatrix()
,
PGraphics.pushMatrix()
,
PGraphics.rotate(float)
,
PGraphics.rotateX(float)
,
PGraphics.rotateZ(float)
,
PGraphics.scale(float, float, float)
,
PGraphics.translate(float, float, float)
public void rotateZ(float angle)
angle
- angle of rotation specified in radiansPGraphics.popMatrix()
,
PGraphics.pushMatrix()
,
PGraphics.rotate(float)
,
PGraphics.rotateX(float)
,
PGraphics.rotateY(float)
,
PGraphics.scale(float, float, float)
,
PGraphics.translate(float, float, float)
public void rotate(float angle, float x, float y, float z)
x
- y
- z
- public void scale(float s)
s
- percentage to scale the objectPGraphics.pushMatrix()
,
PGraphics.popMatrix()
,
PGraphics.translate(float, float, float)
,
PGraphics.rotate(float)
,
PGraphics.rotateX(float)
,
PGraphics.rotateY(float)
,
PGraphics.rotateZ(float)
public void scale(float x, float y)
x
- percentage to scale the object in the x-axisy
- percentage to scale the object in the y-axispublic void scale(float x, float y, float z)
z
- percentage to scale the object in the z-axispublic void shearX(float angle)
angle
- angle of shear specified in radiansPGraphics.popMatrix()
,
PGraphics.pushMatrix()
,
PGraphics.shearY(float)
,
PGraphics.scale(float, float, float)
,
PGraphics.translate(float, float, float)
,
radians(float)
public void shearY(float angle)
angle
- angle of shear specified in radiansPGraphics.popMatrix()
,
PGraphics.pushMatrix()
,
PGraphics.shearX(float)
,
PGraphics.scale(float, float, float)
,
PGraphics.translate(float, float, float)
,
radians(float)
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)
n00
- numbers which define the 4x4 matrix to be multipliedn01
- numbers which define the 4x4 matrix to be multipliedn02
- numbers which define the 4x4 matrix to be multipliedn10
- numbers which define the 4x4 matrix to be multipliedn11
- numbers which define the 4x4 matrix to be multipliedn12
- numbers which define the 4x4 matrix to be multipliedpublic 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)
n03
- numbers which define the 4x4 matrix to be multipliedn13
- numbers which define the 4x4 matrix to be multipliedn20
- numbers which define the 4x4 matrix to be multipliedn21
- numbers which define the 4x4 matrix to be multipliedn22
- numbers which define the 4x4 matrix to be multipliedn23
- numbers which define the 4x4 matrix to be multipliedn30
- numbers which define the 4x4 matrix to be multipliedn31
- numbers which define the 4x4 matrix to be multipliedn32
- numbers which define the 4x4 matrix to be multipliedn33
- numbers which define the 4x4 matrix to be multipliedpublic 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)
eyeX
- x-coordinate for the eyeeyeY
- y-coordinate for the eyeeyeZ
- z-coordinate for the eyecenterX
- x-coordinate for the center of the scenecenterY
- y-coordinate for the center of the scenecenterZ
- z-coordinate for the center of the sceneupX
- usually 0.0, 1.0, or -1.0upY
- usually 0.0, 1.0, or -1.0upZ
- usually 0.0, 1.0, or -1.0public void printCamera()
public void ortho()
public void ortho(float left, float right, float bottom, float top)
left
- left plane of the clipping volumeright
- right plane of the clipping volumebottom
- bottom plane of the clipping volumetop
- top plane of the clipping volumepublic void ortho(float left, float right, float bottom, float top, float near, float far)
near
- maximum distance from the origin to the viewerfar
- maximum distance from the origin away from the viewerpublic void perspective()
public void perspective(float fovy, float aspect, float zNear, float zFar)
fovy
- field-of-view angle (in radians) for vertical directionaspect
- ratio of width to heightzNear
- z-position of nearest clipping planezFar
- z-position of farthest clipping planepublic void frustum(float left, float right, float bottom, float top, float near, float far)
left
- left coordinate of the clipping planeright
- right coordinate of the clipping planebottom
- bottom coordinate of the clipping planetop
- top coordinate of the clipping planenear
- near component of the clipping plane; must be greater than zerofar
- far component of the clipping plane; must be greater than the near valuePGraphics.camera(float, float, float, float, float, float, float, float, float)
,
PGraphics.beginCamera()
,
PGraphics.endCamera()
,
PGraphics.perspective(float, float, float, float)
public void printProjection()
public float screenX(float x, float y)
x
- 3D x-coordinate to be mappedy
- 3D y-coordinate to be mappedPGraphics.screenY(float, float, float)
,
PGraphics.screenZ(float, float, float)
public float screenY(float x, float y)
x
- 3D x-coordinate to be mappedy
- 3D y-coordinate to be mappedPGraphics.screenX(float, float, float)
,
PGraphics.screenZ(float, float, float)
public float screenX(float x, float y, float z)
z
- 3D z-coordinate to be mappedpublic float screenY(float x, float y, float z)
z
- 3D z-coordinate to be mappedpublic float screenZ(float x, float y, float z)
x
- 3D x-coordinate to be mappedy
- 3D y-coordinate to be mappedz
- 3D z-coordinate to be mappedPGraphics.screenX(float, float, float)
,
PGraphics.screenY(float, float, float)
public float modelX(float x, float y, float z)
x
- 3D x-coordinate to be mappedy
- 3D y-coordinate to be mappedz
- 3D z-coordinate to be mappedPGraphics.modelY(float, float, float)
,
PGraphics.modelZ(float, float, float)
public float modelY(float x, float y, float z)
x
- 3D x-coordinate to be mappedy
- 3D y-coordinate to be mappedz
- 3D z-coordinate to be mappedPGraphics.modelX(float, float, float)
,
PGraphics.modelZ(float, float, float)
public float modelZ(float x, float y, float z)
x
- 3D x-coordinate to be mappedy
- 3D y-coordinate to be mappedz
- 3D z-coordinate to be mappedPGraphics.modelX(float, float, float)
,
PGraphics.modelY(float, float, float)
public void pushStyle()
PGraphics.popStyle()
public void popStyle()
PGraphics.pushStyle()
public void style(PStyle s)
public void strokeWeight(float weight)
weight
- the weight (in pixels) of the strokePGraphics.stroke(int, float)
,
PGraphics.strokeJoin(int)
,
PGraphics.strokeCap(int)
public void strokeJoin(int join)
join
- either MITER, BEVEL, ROUNDPGraphics.stroke(int, float)
,
PGraphics.strokeWeight(float)
,
PGraphics.strokeCap(int)
public void strokeCap(int cap)
cap
- either SQUARE, PROJECT, or ROUNDPGraphics.stroke(int, float)
,
PGraphics.strokeWeight(float)
,
PGraphics.strokeJoin(int)
,
size(int, int, String, String)
public void noStroke()
public void stroke(int rgb)
rgb
- color value in hexadecimal notationPGraphics.noStroke()
,
PGraphics.strokeWeight(float)
,
PGraphics.strokeJoin(int)
,
PGraphics.strokeCap(int)
,
PGraphics.fill(int, float)
,
PGraphics.noFill()
,
PGraphics.tint(int, float)
,
PGraphics.background(float, float, float, float)
,
PGraphics.colorMode(int, float, float, float, float)
public void stroke(int rgb, float alpha)
alpha
- opacity of the strokepublic void stroke(float gray)
gray
- specifies a value between white and blackpublic void stroke(float gray, float alpha)
public void stroke(float v1, float v2, float v3)
v1
- red or hue value (depending on current color mode)v2
- green or saturation value (depending on current color mode)v3
- blue or brightness value (depending on current color mode)public void stroke(float v1, float v2, float v3, float alpha)
public void noTint()
PGraphics.tint(float, float, float, float)
,
PGraphics.image(PImage, float, float, float, float)
public void tint(int rgb)
rgb
- color value in hexadecimal notationPGraphics.noTint()
,
PGraphics.image(PImage, float, float, float, float)
public void tint(int rgb, float alpha)
alpha
- opacity of the imagepublic void tint(float gray)
gray
- specifies a value between white and blackpublic void tint(float gray, float alpha)
public void tint(float v1, float v2, float v3)
v1
- red or hue value (depending on current color mode)v2
- green or saturation value (depending on current color mode)v3
- blue or brightness value (depending on current color mode)public void tint(float v1, float v2, float v3, float alpha)
public void noFill()
PGraphics.fill(float, float, float, float)
,
PGraphics.stroke(int, float)
,
PGraphics.noStroke()
public void fill(int rgb)
rgb
- color variable or hex valuePGraphics.noFill()
,
PGraphics.stroke(int, float)
,
PGraphics.noStroke()
,
PGraphics.tint(int, float)
,
PGraphics.background(float, float, float, float)
,
PGraphics.colorMode(int, float, float, float, float)
public void fill(int rgb, float alpha)
alpha
- opacity of the fillpublic void fill(float gray)
gray
- number specifying value between white and blackpublic void fill(float gray, float alpha)
public void fill(float v1, float v2, float v3)
v1
- red or hue value (depending on current color mode)v2
- green or saturation value (depending on current color mode)v3
- blue or brightness value (depending on current color mode)public void fill(float v1, float v2, float v3, float alpha)
public void ambient(int rgb)
rgb
- any value of the color datatypePGraphics.emissive(float, float, float)
,
PGraphics.specular(float, float, float)
,
PGraphics.shininess(float)
public void ambient(float gray)
gray
- number specifying value between white and blackpublic void ambient(float v1, float v2, float v3)
v1
- red or hue value (depending on current color mode)v2
- green or saturation value (depending on current color mode)v3
- blue or brightness value (depending on current color mode)public void specular(int rgb)
rgb
- color to setPGraphics.lightSpecular(float, float, float)
,
PGraphics.ambient(float, float, float)
,
PGraphics.emissive(float, float, float)
,
PGraphics.shininess(float)
public void specular(float gray)
gray
- value between black and white, by default 0 to 255public void specular(float v1, float v2, float v3)
v1
- red or hue value (depending on current color mode)v2
- green or saturation value (depending on current color mode)v3
- blue or brightness value (depending on current color mode)public void shininess(float shine)
shine
- degree of shininessPGraphics.emissive(float, float, float)
,
PGraphics.ambient(float, float, float)
,
PGraphics.specular(float, float, float)
public void emissive(int rgb)
rgb
- color to setPGraphics.ambient(float, float, float)
,
PGraphics.specular(float, float, float)
,
PGraphics.shininess(float)
public void emissive(float gray)
gray
- value between black and white, by default 0 to 255public void emissive(float v1, float v2, float v3)
v1
- red or hue value (depending on current color mode)v2
- green or saturation value (depending on current color mode)v3
- blue or brightness value (depending on current color mode)public void lights()
PGraphics.ambientLight(float, float, float, float, float, float)
,
PGraphics.directionalLight(float, float, float, float, float, float)
,
PGraphics.pointLight(float, float, float, float, float, float)
,
PGraphics.spotLight(float, float, float, float, float, float, float, float, float, float, float)
,
PGraphics.noLights()
public void noLights()
PGraphics.lights()
public void ambientLight(float v1, float v2, float v3)
v1
- red or hue value (depending on current color mode)v2
- green or saturation value (depending on current color mode)v3
- blue or brightness value (depending on current color mode)PGraphics.lights()
,
PGraphics.directionalLight(float, float, float, float, float, float)
,
PGraphics.pointLight(float, float, float, float, float, float)
,
PGraphics.spotLight(float, float, float, float, float, float, float, float, float, float, float)
public void ambientLight(float v1, float v2, float v3, float x, float y, float z)
x
- x-coordinate of the lighty
- y-coordinate of the lightz
- z-coordinate of the lightpublic void directionalLight(float v1, float v2, float v3, float nx, float ny, float nz)
v1
- red or hue value (depending on current color mode)v2
- green or saturation value (depending on current color mode)v3
- blue or brightness value (depending on current color mode)nx
- direction along the x-axisny
- direction along the y-axisnz
- direction along the z-axisPGraphics.lights()
,
PGraphics.ambientLight(float, float, float, float, float, float)
,
PGraphics.pointLight(float, float, float, float, float, float)
,
PGraphics.spotLight(float, float, float, float, float, float, float, float, float, float, float)
public void pointLight(float v1, float v2, float v3, float x, float y, float z)
v1
- red or hue value (depending on current color mode)v2
- green or saturation value (depending on current color mode)v3
- blue or brightness value (depending on current color mode)x
- x-coordinate of the lighty
- y-coordinate of the lightz
- z-coordinate of the lightPGraphics.lights()
,
PGraphics.directionalLight(float, float, float, float, float, float)
,
PGraphics.ambientLight(float, float, float, float, float, float)
,
PGraphics.spotLight(float, float, float, float, float, float, float, float, float, float, float)
public void spotLight(float v1, float v2, float v3, float x, float y, float z, float nx, float ny, float nz, float angle, float concentration)
v1
- red or hue value (depending on current color mode)v2
- green or saturation value (depending on current color mode)v3
- blue or brightness value (depending on current color mode)x
- x-coordinate of the lighty
- y-coordinate of the lightz
- z-coordinate of the lightnx
- direction along the x axisny
- direction along the y axisnz
- direction along the z axisangle
- angle of the spotlight coneconcentration
- exponent determining the center bias of the conePGraphics.lights()
,
PGraphics.directionalLight(float, float, float, float, float, float)
,
PGraphics.pointLight(float, float, float, float, float, float)
,
PGraphics.ambientLight(float, float, float, float, float, float)
public void lightFalloff(float constant, float linear, float quadratic)
constant
- constant value or determining fallofflinear
- linear value for determining falloffquadratic
- quadratic value for determining falloffPGraphics.lights()
,
PGraphics.ambientLight(float, float, float, float, float, float)
,
PGraphics.pointLight(float, float, float, float, float, float)
,
PGraphics.spotLight(float, float, float, float, float, float, float, float, float, float, float)
,
PGraphics.lightSpecular(float, float, float)
public void lightSpecular(float v1, float v2, float v3)
v1
- red or hue value (depending on current color mode)v2
- green or saturation value (depending on current color mode)v3
- blue or brightness value (depending on current color mode)PGraphics.specular(float, float, float)
,
PGraphics.lights()
,
PGraphics.ambientLight(float, float, float, float, float, float)
,
PGraphics.pointLight(float, float, float, float, float, float)
,
PGraphics.spotLight(float, float, float, float, float, float, float, float, float, float, float)
public void background(int rgb)
Clear the background with a color that includes an alpha value. This can only be used with objects created by createGraphics(), because the main drawing surface cannot be set transparent.
It might be tempting to use this function to partially clear the screen on each frame, however that's not how this function works. When calling background(), the pixels will be replaced with pixels that have that level of transparency. To do a semi-transparent overlay, use fill() with alpha and draw a rectangle.
rgb
- any value of the color datatypePGraphics.stroke(float)
,
PGraphics.fill(float)
,
PGraphics.tint(float)
,
PGraphics.colorMode(int)
public void background(int rgb, float alpha)
alpha
- opacity of the backgroundpublic void background(float gray)
gray
- specifies a value between white and blackpublic void background(float gray, float alpha)
public void background(float v1, float v2, float v3)
v1
- red or hue value (depending on the current color mode)v2
- green or saturation value (depending on the current color mode)v3
- blue or brightness value (depending on the current color mode)public void background(float v1, float v2, float v3, float alpha)
public void clear()
public void background(PImage image)
image
- PImage to set as background (must be same size as the sketch window)public void colorMode(int mode)
mode
- Either RGB or HSB, corresponding to Red/Green/Blue and Hue/Saturation/BrightnessPGraphics.background(float)
,
PGraphics.fill(float)
,
PGraphics.stroke(float)
public void colorMode(int mode, float max)
max
- range for all color elementspublic void colorMode(int mode, float max1, float max2, float max3)
max1
- range for the red or hue depending on the current color modemax2
- range for the green or saturation depending on the current color modemax3
- range for the blue or brightness depending on the current color modepublic void colorMode(int mode, float max1, float max2, float max3, float maxA)
maxA
- range for the alphapublic final float alpha(int rgb)
rgb
- any value of the color datatypePGraphics.red(int)
,
PGraphics.green(int)
,
PGraphics.blue(int)
,
PGraphics.hue(int)
,
PGraphics.saturation(int)
,
PGraphics.brightness(int)
public final float red(int rgb)
float r1 = red(myColor);( end auto-generated )
float r2 = myColor >> 16 & 0xFF;
rgb
- any value of the color datatypePGraphics.green(int)
,
PGraphics.blue(int)
,
PGraphics.alpha(int)
,
PGraphics.hue(int)
,
PGraphics.saturation(int)
,
PGraphics.brightness(int)
public final float green(int rgb)
float r1 = green(myColor);( end auto-generated )
float r2 = myColor >> 8 & 0xFF;
rgb
- any value of the color datatypePGraphics.red(int)
,
PGraphics.blue(int)
,
PGraphics.alpha(int)
,
PGraphics.hue(int)
,
PGraphics.saturation(int)
,
PGraphics.brightness(int)
public final float blue(int rgb)
float r1 = blue(myColor);( end auto-generated )
float r2 = myColor & 0xFF;
rgb
- any value of the color datatypePGraphics.red(int)
,
PGraphics.green(int)
,
PGraphics.alpha(int)
,
PGraphics.hue(int)
,
PGraphics.saturation(int)
,
PGraphics.brightness(int)
public final float hue(int rgb)
rgb
- any value of the color datatypePGraphics.red(int)
,
PGraphics.green(int)
,
PGraphics.blue(int)
,
PGraphics.alpha(int)
,
PGraphics.saturation(int)
,
PGraphics.brightness(int)
public final float saturation(int rgb)
rgb
- any value of the color datatypePGraphics.red(int)
,
PGraphics.green(int)
,
PGraphics.blue(int)
,
PGraphics.alpha(int)
,
PGraphics.hue(int)
,
PGraphics.brightness(int)
public final float brightness(int rgb)
rgb
- any value of the color datatypePGraphics.red(int)
,
PGraphics.green(int)
,
PGraphics.blue(int)
,
PGraphics.alpha(int)
,
PGraphics.hue(int)
,
PGraphics.saturation(int)
public static int lerpColor(int c1, int c2, float amt, int mode)
public static void showDepthWarning(String method)
method
- The method name (no parentheses)public static void showDepthWarningXYZ(String method)
method
- The method name (no parentheses)public static void showMethodWarning(String method)
public static void showVariationWarning(String str)
public static void showMissingWarning(String method)
public int get(int x, int y)
If the image is in RGB format (i.e. on a PVideo object), the value will get its high bits set, just to avoid cases where they haven't been set already.
If the image is in ALPHA format, this returns a white with its alpha value set.
This function is included primarily for beginners. It is quite slow because it has to check to see if the x, y that was provided is inside the bounds, and then has to check to see what image type it is. If you want things to be more efficient, access the pixels[] array directly.
x
- x-coordinate of the pixely
- y-coordinate of the pixelset(int, int, int)
,
pixels
,
copy(PImage, int, int, int, int, int, int, int, int)
public PImage get(int x, int y, int w, int h)
w
- width of pixel rectangle to geth
- height of pixel rectangle to getpublic PImage get()
public PImage copy()
public void set(int x, int y, int c)
x
- x-coordinate of the pixely
- y-coordinate of the pixelc
- any value of the color datatypePImage.get(int, int, int, int)
,
PImage.pixels
,
PImage.copy(PImage, int, int, int, int, int, int, int, int)
public void set(int x, int y, PImage img)
img
- image to copy into the original imagepublic void mask(PImage img)
Strictly speaking the "blue" value from the source image is used as the alpha color. For a fully grayscale image, this is correct, but for a color image it's not 100% accurate. For a more accurate conversion, first use filter(GRAY) which will make the image into a "correct" grayscale by performing a proper luminance-based conversion.
img
- image to use as the maskpublic void filter(int kind)
public void filter(int kind, float param)
kind
- Either THRESHOLD, GRAY, OPAQUE, INVERT, POSTERIZE, BLUR, ERODE, or DILATEparam
- unique for each, see abovepublic void copy(int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh)
sx
- X coordinate of the source's upper left cornersy
- Y coordinate of the source's upper left cornersw
- source image widthsh
- source image heightdx
- X coordinate of the destination's upper left cornerdy
- Y coordinate of the destination's upper left cornerdw
- destination image widthdh
- destination image heightPGraphics.alpha(int)
,
PImage.blend(PImage, int, int, int, int, int, int, int, int, int)
public void copy(PImage src, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh)
src
- an image variable referring to the source image.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)
src
- an image variable referring to the source imagesx
- X coordinate of the source's upper left cornersy
- Y coordinate of the source's upper left cornersw
- source image widthsh
- source image heightdx
- X coordinate of the destinations's upper left cornerdy
- Y coordinate of the destinations's upper left cornerdw
- destination image widthdh
- destination image heightmode
- Either BLEND, ADD, SUBTRACT, LIGHTEST, DARKEST, DIFFERENCE, EXCLUSION, MULTIPLY, SCREEN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, BURNalpha(int)
,
PImage.copy(PImage, int, int, int, int, int, int, int, int)
,
PImage.blendColor(int,int,int)