|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object processing.core.PImage processing.core.PGraphics
public class PGraphics
Main graphics and rendering context, as well as the base API implementation.
Field Summary | |
---|---|
float |
ambientB
|
float |
ambientG
|
float |
ambientR
|
int |
backgroundColor
Last background color that was set, zero if an image |
int |
bezierDetail
|
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 |
curveTightness
|
boolean |
edge
|
int |
ellipseMode
The current ellipse mode (read-only) |
float |
emissiveB
|
float |
emissiveG
|
float |
emissiveR
|
boolean |
fill
true if fill() is enabled, (read-only) |
int |
fillColor
fill that was last set (read-only) |
java.awt.Image |
image
Java AWT Image object associated with this renderer. |
int |
imageMode
The current image alignment (read-only) |
float |
normalX
Current normal vector. |
float |
normalY
Current normal vector. |
float |
normalZ
Current normal vector. |
int |
pixelCount
|
int |
rectMode
The current rect mode (read-only) |
int |
shapeMode
The current shape alignment mode (read-only) |
float |
shininess
|
boolean |
smooth
|
float |
specularB
|
float |
specularG
|
float |
specularR
|
int |
sphereDetailU
|
int |
sphereDetailV
|
boolean |
stroke
true if stroke() is enabled, (read-only) |
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). |
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) |
float |
textLeading
The current text leading (read-only) |
int |
textMode
The current text mode (read-only) |
float |
textSize
The current text size (read-only) |
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. |
boolean |
tint
True if tint() is enabled (read-only). |
int |
tintColor
tint that was last set (read-only) |
Fields inherited from class processing.core.PImage |
---|
format, height, parent, pixels, width |
Constructor Summary | |
---|---|
PGraphics()
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)
Apply a 4x4 transformation matrix. |
void |
applyMatrix(PMatrix source)
|
void |
applyMatrix(PMatrix2D source)
|
void |
applyMatrix(PMatrix3D source)
|
void |
arc(float a,
float b,
float c,
float d,
float start,
float stop)
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()
|
void |
beginDraw()
Prepares the PGraphics for drawing. |
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)
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)
|
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)
Callback to handle clearing the background when begin/endRaw is in use. |
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)
|
void |
curveVertex(float x,
float y,
float z)
|
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 |
edge(boolean edge)
Sets whether the upcoming vertex is part of an edge. |
void |
ellipse(float a,
float b,
float c,
float d)
|
void |
ellipseMode(int mode)
|
void |
emissive(float gray)
|
void |
emissive(float x,
float y,
float z)
|
void |
emissive(int rgb)
|
void |
endCamera()
|
void |
endDraw()
This will finalize rendering so that it can be shown on-screen. |
void |
endRaw()
|
void |
endShape()
|
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 |
flush()
|
void |
frustum(float left,
float right,
float bottom,
float top,
float near,
float far)
|
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. |
PStyle |
getStyle()
|
PStyle |
getStyle(PStyle s)
|
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)
Draw an image(), also specifying u/v coordinates. |
void |
imageMode(int mode)
The mode can only be set to CORNERS, CORNER, and CENTER. |
boolean |
is2D()
Return true if this renderer supports 2D drawing. |
boolean |
is3D()
Return true if this renderer supports 2D drawing. |
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)
|
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)
Sets the current normal vector. |
void |
noSmooth()
Disable smoothing. |
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)
|
void |
point(float x,
float y,
float z)
|
void |
pointLight(float red,
float green,
float blue,
float x,
float y,
float z)
|
void |
popMatrix()
Replace the current transformation matrix with the top of the stack. |
void |
popStyle()
|
void |
printCamera()
|
void |
printMatrix()
Print the current model (or "transformation") matrix. |
void |
printProjection()
|
void |
pushMatrix()
Push a copy of the current transformation matrix onto the stack. |
void |
pushStyle()
|
void |
quad(float x1,
float y1,
float x2,
float y2,
float x3,
float y3,
float x4,
float y4)
|
void |
rect(float a,
float b,
float c,
float d)
|
void |
rectMode(int mode)
|
float |
red(int what)
|
void |
resetMatrix()
Set the current transformation matrix to identity. |
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)
Rotate around the X axis. |
void |
rotateY(float angle)
Rotate around the Y axis. |
void |
rotateZ(float angle)
Rotate around the Z axis. |
float |
saturation(int what)
|
void |
scale(float s)
Scale in all dimensions. |
void |
scale(float sx,
float sy)
Scale in X and Y. |
void |
scale(float x,
float y,
float z)
Scale in X, Y, and 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 |
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 |
shape(PShape shape)
|
void |
shape(PShape shape,
float x,
float y)
Convenience method to draw at a particular location. |
void |
shape(PShape shape,
float x,
float y,
float c,
float d)
|
void |
shapeMode(int mode)
Set the orientation for the shape() command (like imageMode() or rectMode()). |
void |
shininess(float shine)
|
static void |
showException(java.lang.String msg)
Show an renderer-related exception that halts the program. |
static void |
showWarning(java.lang.String msg)
Show a renderer error, and keep track of it so that it's only shown once. |
void |
smooth()
If true in PImage, use bilinear interpolation for copy() operations. |
void |
specular(float gray)
|
void |
specular(float x,
float y,
float z)
|
void |
specular(int rgb)
|
void |
sphere(float r)
Draw a sphere with radius r centered at coordinate 0, 0, 0. |
void |
sphereDetail(int res)
|
void |
sphereDetail(int ures,
int vres)
Set the detail level for approximating a sphere. |
void |
spotLight(float red,
float green,
float blue,
float x,
float y,
float z,
float nx,
float ny,
float nz,
float angle,
float concentration)
|
void |
stroke(float gray)
|
void |
stroke(float gray,
float alpha)
|
void |
stroke(float x,
float y,
float z)
|
void |
stroke(float x,
float y,
float z,
float a)
|
void |
stroke(int rgb)
Set the tint to either a grayscale or ARGB value. |
void |
stroke(int rgb,
float alpha)
|
void |
strokeCap(int cap)
|
void |
strokeJoin(int join)
|
void |
strokeWeight(float weight)
|
void |
style(PStyle s)
|
void |
text(char c)
Write text where we just left off. |
void |
text(char[] chars,
int start,
int stop,
float x,
float y)
Method to draw text from an array of chars. |
void |
text(char[] chars,
int start,
int stop,
float x,
float y,
float z)
|
void |
text(char c,
float x,
float y)
Draw a single character on screen. |
void |
text(char c,
float x,
float y,
float z)
Draw a single character on screen (with a z coordinate) |
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)
Write text where we just left off. |
void |
text(java.lang.String str,
float x,
float y)
Draw a chunk of text. |
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)
Draw text in a box that is constrained to a particular size. |
void |
text(java.lang.String s,
float x1,
float y1,
float x2,
float y2,
float z)
|
void |
textAlign(int align)
Sets the alignment of the text to one of LEFT, CENTER, or RIGHT. |
void |
textAlign(int alignX,
int alignY)
Sets the horizontal and vertical alignment of the text. |
float |
textAscent()
Returns the ascent of the current font at the current size. |
float |
textDescent()
Returns the descent of the current font at the current size. |
void |
textFont(PFont which)
Sets the current font. |
void |
textFont(PFont which,
float size)
Useful function to set the font and size at the same time. |
void |
textLeading(float leading)
Set the text leading to a specific value. |
void |
textMode(int mode)
Sets the text rendering/placement to be either SCREEN (direct to the screen, exact coordinates, only use the font's original size) or MODEL (the default, where text is manipulated by translate() and can have a textSize). |
void |
textSize(float size)
Sets the text size, also resets the value for the leading. |
void |
texture(PImage image)
Set texture image for current shape. |
void |
textureMode(int mode)
Set texture mode to either to use coordinates based on the IMAGE (more intuitive for new users) or NORMALIZED (better for advanced chaps) |
float |
textWidth(char c)
|
float |
textWidth(java.lang.String str)
Return the width of a line of text. |
void |
tint(float gray)
|
void |
tint(float gray,
float alpha)
|
void |
tint(float x,
float y,
float z)
|
void |
tint(float x,
float y,
float z,
float a)
|
void |
tint(int rgb)
Set the tint to either a grayscale or ARGB value. |
void |
tint(int rgb,
float alpha)
|
void |
translate(float tx,
float ty)
Translate in X and Y. |
void |
translate(float tx,
float ty,
float tz)
Translate in X, Y, and Z. |
void |
triangle(float x1,
float y1,
float x2,
float y2,
float x3,
float y3)
|
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)
|
Methods inherited from class processing.core.PImage |
---|
blend, blend, blendColor, clone, copy, copy, filter, filter, get, get, get, getCache, getImage, init, isModified, loadPixels, mask, mask, removeCache, resize, save, set, set, setCache, setModified, setModified, updatePixels, updatePixels |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public int pixelCount
public boolean smooth
public int colorMode
public float colorModeX
public float colorModeY
public float colorModeZ
public float colorModeA
public boolean tint
public int tintColor
public boolean fill
public int fillColor
public boolean stroke
public int strokeColor
public float strokeWeight
public int strokeJoin
public int strokeCap
public int rectMode
public int ellipseMode
public int shapeMode
public int imageMode
public PFont textFont
public int textAlign
public int textAlignY
public int textMode
public float textSize
public float textLeading
public float ambientR
public float ambientG
public float ambientB
public float specularR
public float specularG
public float specularB
public float emissiveR
public float emissiveG
public float emissiveB
public float shininess
public int backgroundColor
public java.awt.Image image
public int bezierDetail
public float curveTightness
public boolean edge
public float normalX
public float normalY
public float normalZ
public int textureMode
public float textureU
public float textureV
public PImage textureImage
public int sphereDetailU
public int sphereDetailV
Constructor Detail |
---|
public PGraphics()
Method Detail |
---|
public void setParent(PApplet parent)
public void setPrimary(boolean primary)
public void setPath(java.lang.String path)
public void setSize(int w, int h)
public void dispose()
This is called when a sketch is shut down and this renderer was specified using the size() command, or inside endRecord() and endRaw(), in order to shut things off.
public boolean canDraw()
public void beginDraw()
public void endDraw()
public void flush()
public void hint(int which)
For the most part, hints are temporary api quirks, for which a proper api hasn't been properly worked out. for instance SMOOTH_IMAGES existed because smooth() wasn't yet implemented, but it will soon go away.
They also exist for obscure features in the graphics engine, like enabling/disabling single pixel lines that ignore the zbuffer, the way they do in alphabot.
Current hint options:
public void beginShape()
public void beginShape(int kind)
Differences between beginShape() and line() and point() methods.
beginShape() is intended to be more flexible at the expense of being a little more complicated to use. it handles more complicated shapes that can consist of many connected lines (so you get joins) or lines mixed with curves.
The line() and point() command are for the far more common cases (particularly for our audience) that simply need to draw a line or a point on the screen.
From the code side of things, line() may or may not call beginShape() to do the drawing. In the beta code, they do, but in the alpha code, they did not. they might be implemented one way or the other depending on tradeoffs of runtime efficiency vs. implementation efficiency &mdash meaning the speed that things run at vs. the speed it takes me to write the code and maintain it. for beta, the latter is most important so that's how things are implemented.
public void edge(boolean edge)
public void normal(float nx, float ny, float nz)
public void textureMode(int mode)
public void texture(PImage image)
image
- reference to a PImage objectpublic 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)
public void breakShape()
public void endShape()
public void endShape(int mode)
public void bezierVertex(float x2, float y2, float x3, float y3, float x4, float y4)
public void bezierVertex(float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4)
public void curveVertex(float x, float y)
public void curveVertex(float x, float y, float z)
public void point(float x, float y)
public void point(float x, float y, float z)
public void line(float x1, float y1, float x2, float y2)
public void line(float x1, float y1, float z1, float x2, float y2, float z2)
public void triangle(float x1, float y1, float x2, float y2, float x3, float y3)
public void quad(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
public void rectMode(int mode)
public void rect(float a, float b, float c, float d)
public void ellipseMode(int mode)
public void ellipse(float a, float b, float c, float d)
public void arc(float a, float b, float c, float d, float start, float stop)
public void box(float size)
public void box(float w, float h, float d)
public void sphereDetail(int res)
public void sphereDetail(int ures, int vres)
public void sphere(float r)
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
public float bezierPoint(float a, float b, float c, float d, float t)
For instance, to convert the following example:
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();
public float bezierTangent(float a, float b, float c, float d, float t)
public void bezierDetail(int detail)
public void bezier(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
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);
public void bezier(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4)
public float curvePoint(float a, float b, float c, float d, float t)
t
- Value between zero and one for how far along the segmentpublic float curveTangent(float a, float b, float c, float d, float t)
public void curveDetail(int detail)
public void curveTightness(float tightness)
public void curve(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
As of 0070, this function no longer doubles the first and last points. The curves are a bit more boring, but it's more mathematically correct, and properly mirrored in curvePoint().
Identical to typing out:
beginShape(); curveVertex(x1, y1); curveVertex(x2, y2); curveVertex(x3, y3); curveVertex(x4, y4); endShape();
public void curve(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4)
public void smooth()
public void noSmooth()
public void imageMode(int mode)
public void image(PImage image, float x, float y)
public void image(PImage image, float x, float y, float c, float d)
public void image(PImage image, float a, float b, float c, float d, int u1, int v1, int u2, int v2)
public void shapeMode(int mode)
mode
- Either CORNER, CORNERS, or CENTER.public void shape(PShape shape)
public void shape(PShape shape, float x, float y)
public void shape(PShape shape, float x, float y, float c, float d)
public void textAlign(int align)
public void textAlign(int alignX, int alignY)
public float textAscent()
public float textDescent()
public void textFont(PFont which)
public void textFont(PFont which, float size)
public void textLeading(float leading)
public void textMode(int mode)
public void textSize(float size)
public float textWidth(char c)
public float textWidth(java.lang.String str)
public void text(char c)
public void text(char c, float x, float y)
public void text(char c, float x, float y, float z)
public void text(java.lang.String str)
public void text(java.lang.String str, float x, float y)
public void text(char[] chars, int start, int stop, float x, float y)
public void text(java.lang.String str, float x, float y, float z)
public void text(char[] chars, int start, int stop, float x, float y, float z)
public void text(java.lang.String str, float x1, float y1, float x2, float y2)
public void text(java.lang.String s, float x1, float y1, float x2, float y2, float z)
public void text(int num, float x, float y)
public void text(int num, float x, float y, float z)
public void text(float num, float x, float y)
public void text(float num, float x, float y, float z)
public void pushMatrix()
public void popMatrix()
public void translate(float tx, float ty)
public void translate(float tx, float ty, float tz)
public void rotate(float angle)
public void rotateX(float angle)
public void rotateY(float angle)
public void rotateZ(float angle)
public void rotate(float angle, float vx, float vy, float vz)
public void scale(float s)
public void scale(float sx, float sy)
public void scale(float x, float y, float z)
public void resetMatrix()
public void applyMatrix(PMatrix source)
public void applyMatrix(PMatrix2D source)
public void applyMatrix(float n00, float n01, float n02, float n10, float n11, float n12)
public void applyMatrix(PMatrix3D source)
public void applyMatrix(float n00, float n01, float n02, float n03, float n10, float n11, float n12, float n13, float n20, float n21, float n22, float n23, float n30, float n31, float n32, float n33)
public PMatrix getMatrix()
public PMatrix2D getMatrix(PMatrix2D target)
public PMatrix3D getMatrix(PMatrix3D target)
public void setMatrix(PMatrix source)
public void setMatrix(PMatrix2D source)
public void setMatrix(PMatrix3D source)
public void printMatrix()
public void beginCamera()
public void endCamera()
public void camera()
public void camera(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ)
public void printCamera()
public void ortho()
public void ortho(float left, float right, float bottom, float top, float near, float far)
public void perspective()
public void perspective(float fovy, float aspect, float zNear, float zFar)
public void frustum(float left, float right, float bottom, float top, float near, float far)
public void printProjection()
public float screenX(float x, float y)
public float screenY(float x, float y)
public float screenX(float x, float y, float z)
Given an (x, y, z) coordinate, returns the x position of where that point would be placed on screen, once affected by translate(), scale(), or any other transformations.
public float screenY(float x, float y, float z)
Given an (x, y, z) coordinate, returns the y position of where that point would be placed on screen, once affected by translate(), scale(), or any other transformations.
public float screenZ(float x, float y, float z)
Given an (x, y, z) coordinate, returns its z value. This value can be used to determine if an (x, y, z) coordinate is in front or in back of another (x, y, z) coordinate. The units are based on how the zbuffer is set up, and don't relate to anything "real". They're only useful for in comparison to another value obtained from screenZ(), or directly out of the zbuffer[].
public float modelX(float x, float y, float z)
This will give you a coordinate after it has been transformed by translate(), rotate(), and camera(), but not yet transformed by the projection matrix. For instance, his can be useful for figuring out how points in 3D space relate to the edge coordinates of a shape.
public float modelY(float x, float y, float z)
public float modelZ(float x, float y, float z)
public void pushStyle()
public void popStyle()
public void style(PStyle s)
public PStyle getStyle()
public PStyle getStyle(PStyle s)
public void strokeWeight(float weight)
public void strokeJoin(int join)
public void strokeCap(int cap)
public void noStroke()
public void stroke(int rgb)
public void stroke(int rgb, float alpha)
public void stroke(float gray)
public void stroke(float gray, float alpha)
public void stroke(float x, float y, float z)
public void stroke(float x, float y, float z, float a)
public void noTint()
public void tint(int rgb)
public void tint(int rgb, float alpha)
public void tint(float gray)
public void tint(float gray, float alpha)
public void tint(float x, float y, float z)
public void tint(float x, float y, float z, float a)
public void noFill()
public void fill(int rgb)
public void fill(int rgb, float alpha)
public void fill(float gray)
public void fill(float gray, float alpha)
public void fill(float x, float y, float z)
public void fill(float x, float y, float z, float a)
public void ambient(int rgb)
public void ambient(float gray)
public void ambient(float x, float y, float z)
public void specular(int rgb)
public void specular(float gray)
public void specular(float x, float y, float z)
public void shininess(float shine)
public void emissive(int rgb)
public void emissive(float gray)
public void emissive(float x, float y, float z)
public void lights()
public void noLights()
public void ambientLight(float red, float green, float blue)
public void ambientLight(float red, float green, float blue, float x, float y, float z)
public void directionalLight(float red, float green, float blue, float nx, float ny, float nz)
public void pointLight(float red, float green, float blue, float x, float y, float z)
public void spotLight(float red, float green, float blue, float x, float y, float z, float nx, float ny, float nz, float angle, float concentration)
public void lightFalloff(float constant, float linear, float quadratic)
public void lightSpecular(float x, float y, float z)
public void background(int rgb)
For the main drawing surface, the alpha value will be ignored. However, alpha can be used on PGraphics objects from createGraphics(). This is the only way to set all the pixels partially transparent, for instance.
Note that background() should be called before any transformations occur, because some implementations may require the current transformation matrix to be identity before drawing.
public void background(int rgb, float alpha)
public void background(float gray)
public void background(float gray, float alpha)
public void background(float x, float y, float z)
public void background(float x, float y, float z, float a)
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.
public void background(PImage image)
Note that even if the image is set as RGB, the high 8 bits of each pixel should be set opaque (0xFF000000), because the image data will be copied directly to the screen, and non-opaque background images may have strange behavior. Using image.filter(OPAQUE) will handle this easily.
When using 3D, this will also clear the zbuffer (if it exists).
public void colorMode(int mode)
public void colorMode(int mode, float max)
public void colorMode(int mode, float maxX, float maxY, float maxZ)
Note that this doesn't set the maximum for the alpha value, which might be confusing if for instance you switched to
colorMode(HSB, 360, 100, 100);because the alpha values were still between 0 and 255.
public void colorMode(int mode, float maxX, float maxY, float maxZ, float maxA)
public final int color(int gray)
public final int color(float gray)
public final int color(int gray, int alpha)
gray
- can be packed ARGB or a gray in this casepublic final int color(int rgb, float alpha)
rgb
- can be packed ARGB or a gray in this casepublic final int color(float gray, float alpha)
public final int color(int x, int y, int z)
public final int color(float x, float y, float z)
public final int color(int x, int y, int z, int a)
public final int color(float x, float y, float z, float a)
public final float alpha(int what)
public final float red(int what)
public final float green(int what)
public final float blue(int what)
public final float hue(int what)
public final float saturation(int what)
public final float brightness(int what)
public int lerpColor(int c1, int c2, float amt)
public static int lerpColor(int c1, int c2, float amt, int mode)
public void beginRaw(PGraphics rawGraphics)
public void endRaw()
public static void showWarning(java.lang.String msg)
msg
- the error message (which will be stored for later comparison)public static void showException(java.lang.String msg)
public boolean displayable()
public boolean is2D()
public boolean is3D()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |