PGraphics

All Methods Static Methods Instance Methods Concrete Methods  Modifier and Type Method and Description 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)  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)  void attrib(java.lang.String name, boolean... values)  void attrib(java.lang.String name, float... values)  void attrib(java.lang.String name, int... values)  void attribColor(java.lang.String name, int color)  void attribNormal(java.lang.String name, float nx, float ny, float nz)  void attribPosition(java.lang.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()  void beginDraw()

( begin auto-generated from PGraphics_beginDraw.xml ) Sets the default properties for a PGraphics object.

PGL beginPGL()  void beginRaw(PGraphics rawGraphics)

Record individual lines and triangles by echoing them to another renderer.

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.

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)  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 gray)  int color(float gray, float alpha)  int color(float v1, float v2, float v3)  int color(float v1, float v2, float v3, float a)  int color(int c)  int color(int c, float alpha)  int color(int c, int alpha)  int color(int v1, int v2, int v3)  int color(int v1, int v2, int v3, int a)  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)  PShape createShape()  PShape createShape(int type)  PShape createShape(int kind, float... p)  PSurface createSurface()  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)  void directionalLight(float v1, float v2, float v3, float nx, float ny, float nz)

( begin auto-generated from directionalLight.xml ) Adds a directional light.

boolean displayable()

Return true if this renderer should be drawn to the screen.

void dispose()

Handle any takedown for this graphics context.

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 endDraw()

( begin auto-generated from PGraphics_endDraw.xml ) Finalizes the rendering of a PGraphics object so that it can be shown on screen.

void endPGL()  void endRaw()  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().

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(PShader shader)  void flush()  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.

java.lang.Object getCache(PImage image)

Get cache storage data for the specified renderer.

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.

PGraphics getRaw()  PStyle getStyle()  PStyle getStyle(PStyle s)  float green(int rgb)

( begin auto-generated from green.xml ) Extracts the green value from a color, scaled to match current colorMode().

boolean haveRaw()  void hint(int which)

( begin auto-generated from hint.xml ) Set various hints and hacks for the renderer.

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.

boolean is2D()

Return true if this renderer supports 2D drawing.

boolean is2X()  boolean is3D()

Return true if this renderer supports 3D drawing.

boolean isGL()

Return true if this renderer does rendering through OpenGL.

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)  PShader loadShader(java.lang.String fragFilename)

( begin auto-generated from loadShader.xml ) This is a new reference entry for Processing 2.0.

PShader loadShader(java.lang.String fragFilename, java.lang.String vertFilename)  PShape loadShape(java.lang.String filename)  PShape loadShape(java.lang.String filename, java.lang.String options)  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.

void noClip()

( begin auto-generated from noClip.xml ) Disables the clipping previously started by the clip() function.

void noFill()

( begin auto-generated from noFill.xml ) Disables filling geometry.

void noLights()

( begin auto-generated from noLights.xml ) Disable all lighting.

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 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)  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 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 printCamera()

( begin auto-generated from printCamera.xml ) Prints the current camera matrix to the Console (the text window at the bottom of Processing).

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)  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 removeCache(PImage image)

Remove information associated with this renderer from the cache, if any.

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 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.

float saturation(int rgb)

( begin auto-generated from saturation.xml ) Extracts the saturation value from a color.

boolean save(java.lang.String filename)

( begin auto-generated from PImage_save.xml ) Saves the image into a file.

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.

void setCache(PImage image, java.lang.Object storage)

Store data of some kind for the renderer that requires extra metadata of some kind.

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 setParent(PApplet parent)  void setPath(java.lang.String path)  void setPrimary(boolean primary)

Set (or unset) this as the main drawing surface.

void setSize(int w, int h)

The final step in setting up a renderer, set its size of this renderer.

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.

void shininess(float shine)

( begin auto-generated from shininess.xml ) Sets the amount of gloss in the surface of shapes.

static void showDepthWarning(java.lang.String method)

Display a warning that the specified method is only available with 3D.

static void showDepthWarningXYZ(java.lang.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 showException(java.lang.String msg)

Show an renderer-related exception that halts the program.

static void showMethodWarning(java.lang.String method)

Display a warning that the specified method is simply unavailable.

static void showMissingWarning(java.lang.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(java.lang.String str)

Error that a particular variation of a method is unavailable (even though other variations are).

static void showWarning(java.lang.String msg)

Show a renderer error, and keep track of it so that it's only shown once.

static void showWarning(java.lang.String msg, java.lang.Object... args)

Version of showWarning() that takes a parsed String.

void smooth()  void smooth(int quality)  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)  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.

void square(float x, float y, float extent)

( begin auto-generated from square.xml ) Draws a square to the screen.

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)  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(java.lang.String str, float x, float y)

Advanced

void text(java.lang.String str, float x, float y, float z)

Same as above but with a z coordinate.

void text(java.lang.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(java.lang.String str)

( begin auto-generated from textWidth.xml ) Calculates and returns the width of any character or text string.

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.

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.