processing.core
Class PGraphics

java.lang.Object
  extended by processing.core.PImage
      extended by processing.core.PGraphics
All Implemented Interfaces:
java.lang.Cloneable, PConstants
Direct Known Subclasses:
PGraphics2D, PGraphics3D, PGraphicsJava2D

public abstract class PGraphics
extends PImage
implements PConstants

Main graphics and rendering context, as well as the base API implementation for processing "core".

As of beta, this class is semi-disabled.


Field Summary
static int A
           
static int AB
           
static int AG
           
 float ambientB
           
 float ambientG
           
 float ambientR
           
static int AR
           
static int AUTO_NORMAL
           
static int B
           
 int backgroundColor
          Last background color that was set, zero if an image
static int BEEN_LIT
           
 int bezierDetail
           
 PMatrix camera
          The camera matrix, the modelview will be set to this on beginDraw.
 float cameraAspect
           
 float cameraFar
           
 float cameraFOV
          Camera field of view (in radians, as of rev 86)
 PMatrix cameraInv
          Inverse camera matrix
 float cameraNear
           
 float cameraX
          Position of the camera
 float cameraY
          Position of the camera
 float cameraZ
          Position of the camera
 int colorMode
          The current colorMode
 float colorModeA
          Max value for alpha set by colorMode
 float colorModeX
          Max value for red (or hue) set by colorMode
 float colorModeY
          Max value for green (or saturation) set by colorMode
 float colorModeZ
          Max value for blue (or value) set by colorMode
 float currentLightFalloffConstant
          Current light falloff
 float currentLightFalloffLinear
           
 float currentLightFalloffQuadratic
           
 float[] currentLightSpecular
          Current specular color for lighting
 float curveTightness
           
static int DA
           
static int DB
           
static int DG
           
static int DR
           
static int EB
           
static int EG
           
 int ellipseMode
          The current ellipse mode (read-only)
 float emissiveB
           
 float emissiveG
           
 float emissiveR
           
static int ER
           
 boolean fill
          true if fill() is enabled, (read-only)
 int fillColor
          fill that was last set (read-only)
static int G
           
 int height1
           
 java.awt.Image image
           
static int INDEX
           
 int lightCount
           
 float[][] lightDiffuse
          Diffuse colors for lights.
 float[] lightFalloffConstant
          Light falloff
 float[] lightFalloffLinear
           
 float[] lightFalloffQuadratic
           
 float[][] lightNormal
          Light direction (normalized vector)
 float[][] lightPosition
          Light positions
 float[][] lightSpecular
          Specular colors for lights.
 float[] lightSpotAngle
          Light spot angle
 float[] lightSpotAngleCos
          Cosine of light spot angle
 float[] lightSpotConcentration
          Light spot concentration
 int[] lightType
          Light types
static int LINE_FIELD_COUNT
           
 float m00
          Model transformation of the form m[row][column], which is a "column vector" (as opposed to "row vector") matrix.
 float m01
          Model transformation of the form m[row][column], which is a "column vector" (as opposed to "row vector") matrix.
 float m02
          Model transformation of the form m[row][column], which is a "column vector" (as opposed to "row vector") matrix.
 float m03
          Model transformation of the form m[row][column], which is a "column vector" (as opposed to "row vector") matrix.
 float m10
           
 float m11
           
 float m12
           
 float m13
           
 float m20
           
 float m21
           
 float m22
           
 float m23
           
 float m30
           
 float m31
           
 float m32
           
 float m33
           
static int MANUAL_SHAPE_NORMAL
           
static int MANUAL_VERTEX_NORMAL
           
static int MAX_LIGHTS
          Maximum lights by default is 8, which is arbitrary, but is the minimum defined by OpenGL
 PMatrix modelview
          The modelview matrix.
 PMatrix modelviewInv
          Inverse modelview matrix, used for lighting.
static int MX
           
static int MY
           
static int MZ
           
 int normalCount
           
 int normalMode
           
 float normalX
          Normals
 float normalY
          Normals
 float normalZ
          Normals
static int NX
           
static int NY
           
static int NZ
           
 int pixelCount
           
 PMatrix projection
           
static int R
           
 PGraphics raw
           
 int rectMode
          The current rect mode (read-only)
static int SA
           
static int SB
           
 boolean settingsInited
           
static int SG
           
static int SHINE
           
 float shininess
           
static int SPA
           
static int SPB
           
 float specularA
           
 float specularB
           
 float specularG
           
 float specularR
           
static int SPG
           
 int sphereDetailU
           
 int sphereDetailV
           
static int SPR
           
static int SR
          stroke argb values
 int[] stencil
           
 boolean stroke
          true if stroke() is enabled, (read-only)
static int STROKE_MODE
           
static int STROKE_WEIGHT
           
 int strokeCap
          Set by strokeCap() (read-only).
 int strokeColor
          stroke that was last set (read-only)
 int strokeJoin
          Set by strokeJoin() (read-only).
 float strokeWeight
          Last value set by strokeWeight() (read-only).
static int SW
          stroke weight
 int textAlign
          The current text align (read-only)
 int textAlignY
          The current vertical text alignment (read-only)
 PFont textFont
          The current text font (read-only)
 java.awt.Font textFontNative
          The current font if a Java version of it is installed
 java.awt.FontMetrics textFontNativeMetrics
          Metrics for the current native Java font
 float textLeading
          The current text leading (read-only)
 int textMode
          The current text mode (read-only)
 float textSize
          The current text size (read-only)
static int TEXTURE_INDEX
           
 PImage textureImage
          Current image being used as a texture
 int textureMode
          Sets whether texture coordinates passed to vertex() calls will be based on coordinates that are based on the IMAGE or NORMALIZED.
 float textureU
          Current horizontal coordinate for texture, will always be between 0 and 1, even if using textureMode(IMAGE).
 float textureV
          Current vertical coordinate for texture, see above.
 float textX
          Last text position, because text often mixed on lines together
 float textY
          Last text position, because text often mixed on lines together
 float textZ
          Last text position, because text often mixed on lines together
 boolean tint
          true if tint() is enabled (read-only).
 int tintColor
          tint that was last set (read-only)
static int TRI_DIFFUSE_A
           
static int TRI_DIFFUSE_B
           
static int TRI_DIFFUSE_G
           
static int TRI_DIFFUSE_R
           
static int TRI_SPECULAR_A
           
static int TRI_SPECULAR_B
           
static int TRI_SPECULAR_G
           
static int TRI_SPECULAR_R
           
static int TRIANGLE_COLOR_COUNT
           
static int TRIANGLE_FIELD_COUNT
           
static int U
           
static int V
           
static int VERTEX1
           
static int VERTEX2
           
static int VERTEX3
           
static int VW
           
static int VX
           
static int VY
           
static int VZ
           
 int width1
           
static int X
           
static int Y
           
static int Z
           
 float[] zbuffer
           
 
Fields inherited from class processing.core.PImage
cache, format, height, imageMode, modified, mx1, mx2, my1, my2, parent, pixels, smooth, width
 
Fields inherited from interface processing.core.PConstants
ADD, ALPHA, ALPHA_MASK, ALT, AMBIENT, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BURN, CENTER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_DEPTH_TEST, DISABLE_ERROR_REPORT, DISABLE_FLYING_POO, DODGE, DOWN, DXF, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENTER, EPSILON, ERODE, ESC, EXCLUSION, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINES, LINUX, MACOS9, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMALIZED, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PDF, PERSPECTIVE, PI, PIXEL_CENTER, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD_STRIP, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPOT, SQUARE, SUBTRACT, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, WAIT, WHITESPACE, WINDOWS
 
Constructor Summary
PGraphics(int iwidth, int iheight, PApplet parent)
          Constructor for the PGraphics object.
 
Method Summary
 float alpha(int what)
           
 void ambient(float gray)
           
 void ambient(float x, float y, float z)
           
 void ambient(int rgb)
           
 void ambientLight(float red, float green, float blue)
           
 void ambientLight(float red, float green, float blue, float x, float y, float z)
           
 void applyMatrix(float n00, float n01, float n02, float n10, float n11, float n12)
          Apply a 3x2 affine transformation matrix.
 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 arc(float a, float b, float c, float d, float start, float stop)
          Identical parameters and placement to ellipse, but draws only an arc of that ellipse.
 void background(float gray)
          Set the background to a grayscale value, based on the current colorMode.
 void background(float gray, float alpha)
          See notes about alpha in background(x, y, z, a).
 void background(float x, float y, float z)
          Set the background to an r, g, b or h, s, b value, based on the current colorMode.
 void background(float x, float y, float z, float a)
          Clear the background with a color that includes an alpha value.
 void background(int rgb)
          Set the background to a gray or ARGB color.
 void background(int rgb, float alpha)
          See notes about alpha in background(x, y, z, a).
 void background(PImage image)
          Takes an RGB or ARGB image and sets it as the background.
 void beginCamera()
           
abstract  void beginDraw()
          Prepares the PGraphics for drawing.
 void beginRaw(PGraphics rawGraphics)
           
 void beginShape()
          Start a new shape of type POLYGON
abstract  void beginShape(int kind)
          Start a new shape.
 void bezier(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
          Draw a cubic bezier curve.
 void bezier(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4)
           
 void bezierDetail(int detail)
           
 float bezierPoint(float a, float b, float c, float d, float t)
          Evalutes quadratic bezier at point t for points a, b, c, d.
 float bezierTangent(float a, float b, float c, float d, float t)
          Provide the tangent at the given point on the 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)
          See notes with the bezier() function.
 float blue(int what)
           
 void box(float size)
           
 void box(float w, float h, float d)
           
 void breakShape()
          This feature is in testing, do not use or rely upon its implementation
 float brightness(int what)
           
 void camera()
           
 void camera(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ)
           
 boolean canDraw()
          Some renderers have requirements re: when they are ready to draw.
 int color(float gray)
           
 int color(float gray, float alpha)
           
 int color(float x, float y, float z)
           
 int color(float x, float y, float z, float a)
           
 int color(int gray)
           
 int color(int rgb, float alpha)
           
 int color(int gray, int alpha)
           
 int color(int x, int y, int z)
           
 int color(int x, int y, int z, int a)
           
 void colorMode(int mode)
           
 void colorMode(int mode, float max)
           
 void colorMode(int mode, float maxX, float maxY, float maxZ)
          Set the colorMode and the maximum values for (r, g, b) or (h, s, b).
 void colorMode(int mode, float maxX, float maxY, float maxZ, float maxA)
           
 void curve(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
          Draws a segment of Catmull-Rom curve.
 void curve(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4)
           
 void curveDetail(int detail)
           
 float curvePoint(float a, float b, float c, float d, float t)
          Get a location along a catmull-rom curve segment.
 float curveTangent(float a, float b, float c, float d, float t)
          Calculate the tangent at a t value (0..1) on a Catmull-Rom curve.
 void curveTightness(float tightness)
           
 void curveVertex(float x, float y)
          See notes with the curve() function.
 void curveVertex(float x, float y, float z)
          See notes with the curve() function.
 void directionalLight(float red, float green, float blue, float nx, float ny, float nz)
           
 boolean displayable()
          Return true if this renderer should be drawn to the screen.
 void dispose()
          Handle any takedown for this graphics context.
 void ellipse(float a, float b, float c, float d)
           
 void ellipseMode(int mode)
           
 void emissive(float gray)
           
 void emissive(float x, float y, float z)
           
 void emissive(int rgb)
           
 void endCamera()
           
abstract  void endDraw()
          This will finalize rendering so that it can be shown on-screen.
 void endRaw()
           
 void endShape()
           
abstract  void endShape(int mode)
           
 void fill(float gray)
           
 void fill(float gray, float alpha)
           
 void fill(float x, float y, float z)
           
 void fill(float x, float y, float z, float a)
           
 void fill(int rgb)
          Set the fill to either a grayscale value or an ARGB int.
 void fill(int rgb, float alpha)
           
 void frustum(float left, float right, float bottom, float top, float znear, float zfar)
           
 float green(int what)
           
 void hint(int which)
          Enable a hint option.
 float hue(int what)
           
 void image(PImage image, float x, float y)
           
 void image(PImage image, float x, float y, float c, float d)
           
 void image(PImage image, float a, float b, float c, float d, int u1, int v1, int u2, int v2)
          u, v coordinates are always based on image space location, regardless of the current textureMode().
 int lerpColor(int c1, int c2, float amt)
          Interpolate between two colors, using the current color mode.
static int lerpColor(int c1, int c2, float amt, int mode)
          Interpolate between two colors.
 void lightFalloff(float constant, float linear, float quadratic)
           
 void lights()
           
 void lightSpecular(float x, float y, float z)
           
 void line(float x1, float y1, float x2, float y2)
           
 void line(float x1, float y1, float z1, float x2, float y2, float z2)
           
 void loadMatrix()
          Loads the current matrix into m00, m01 etc (or modelview and projection when using 3D) so that the values can be read.
 void mask(int[] alpha)
          Use with caution on PGraphics.
 void mask(PImage alpha)
          Use with caution on PGraphics.
 float modelX(float x, float y, float z)
          Returns the model space x value for an x, y, z coordinate.
 float modelY(float x, float y, float z)
          Returns the model space y value for an x, y, z coordinate.
 float modelZ(float x, float y, float z)
          Returns the model space z value for an x, y, z coordinate.
 void noFill()
           
 void noLights()
           
 void normal(float nx, float ny, float nz)
           
 void noStroke()
           
 void noTint()
           
 void ortho()
           
 void ortho(float left, float right, float bottom, float top, float near, float far)
           
 void perspective()
           
 void perspective(float fovy, float aspect, float zNear, float zFar)
           
 void point(float x, float y)
          End a path.
 void point(float x, float y, float z)
           
 void pointLight(float red, float green, float blue, float x, float y, float z)
           
 void popMatrix()
           
 void printCamera()
           
 void printMatrix()
          Print the current model (or "transformation") matrix.
 void printProjection()
           
 void pushMatrix()
           
 void quad(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
           
 void rect(float x1, float y1, float x2, float y2)
           
 void rectMode(int mode)
           
 float red(int what)
           
 void resetMatrix()
          Load identity as the transform/model matrix.
 void resize(int iwidth, int iheight)
          Called in response to a resize event, handles setting the new width and height internally, as well as re-allocating the pixel buffer for the new size.
 void rotate(float angle)
          Two dimensional rotation.
 void rotate(float angle, float vx, float vy, float vz)
          Rotate about a vector in space.
 void rotateX(float angle)
           
 void rotateY(float angle)
           
 void rotateZ(float angle)
          Rotate around the z axis.
 float saturation(int what)
           
 void scale(float s)
           
 void scale(float sx, float sy)
           
 void scale(float x, float y, float z)
           
 float screenX(float x, float y)
          Given an x and y coordinate, returns the x position of where that point would be placed on screen, once affected by translate(), scale(), or any other transformations.
 float screenX(float x, float y, float z)
          Maps a three dimensional point to its placement on-screen.
 float screenY(float x, float y)
          Given an x and y coordinate, returns the y position of where that point would be placed on screen, once affected by translate(), scale(), or any other transformations.
 float screenY(float x, float y, float z)
          Maps a three dimensional point to its placement on-screen.
 float screenZ(float x, float y, float z)
          Maps a three dimensional point to its placement on-screen.
 void setMainDrawingSurface()
          Set this as the main drawing surface.
 void shininess(float shine)
           
 void specular(float gray)
           
 void specular(float gray, float alpha)
           
 void specular(float x, float y, float z)
           
 void specular(float x, float y, float z, float a)
           
 void specular(int rgb)
           
 void sphere(float r)
           
 void sphereDetail(int res)
           
 void sphereDetail(int ures, int vres)