|
|||||||||
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 processing.core.PGraphics2D
public class PGraphics2D
Subclass of PGraphics that handles fast 2D rendering using a MemoryImageSource. The renderer found in this class is not as accurate as PGraphicsJava2D, but offers certain speed tradeoffs, particular when messing with the pixels array, or displaying image or video data.
Field Summary |
---|
Fields inherited from class processing.core.PGraphics |
---|
ambientB, ambientG, ambientR, backgroundColor, bezierDetail, colorMode, colorModeA, colorModeX, colorModeY, colorModeZ, curveTightness, edge, ellipseMode, emissiveB, emissiveG, emissiveR, fill, fillColor, image, imageMode, normalX, normalY, normalZ, pixelCount, rectMode, shapeMode, shininess, smooth, specularB, specularG, specularR, sphereDetailU, sphereDetailV, stroke, strokeCap, strokeColor, strokeJoin, strokeWeight, textAlign, textAlignY, textFont, textLeading, textMode, textSize, textureImage, textureMode, textureU, textureV, tint, tintColor |
Fields inherited from class processing.core.PImage |
---|
format, height, parent, pixels, width |
Constructor Summary | |
---|---|
PGraphics2D()
|
Method Summary | |
---|---|
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 |
beginDraw()
Prepares the PGraphics for drawing. |
void |
beginShape(int kind)
Start a new shape. |
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 |
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 |
boolean |
canDraw()
Some renderers have requirements re: when they are ready to draw. |
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 |
endDraw()
This will finalize rendering so that it can be shown on-screen. |
void |
endShape(int mode)
|
void |
point(float x,
float y,
float z)
|
void |
popMatrix()
Replace the current transformation matrix with the top of the stack. |
void |
printMatrix()
Print the current model (or "transformation") matrix. |
void |
pushMatrix()
Push a copy of the current transformation matrix onto the stack. |
void |
resetMatrix()
Load identity as the transform/model matrix. |
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. |
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 |
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. |
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 |
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 |
vertex(float x,
float y,
float z)
|
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 |
Constructor Detail |
---|
public PGraphics2D()
Method Detail |
---|
public boolean canDraw()
PGraphics
canDraw
in class PGraphics
public void beginDraw()
PGraphics
beginDraw
in class PGraphics
public void endDraw()
PGraphics
endDraw
in class PGraphics
public void beginShape(int kind)
PGraphics
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.
beginShape
in class PGraphics
public void vertex(float x, float y, float z)
vertex
in class PGraphics
public void vertex(float x, float y, float z, float u, float v)
vertex
in class PGraphics
public void breakShape()
PGraphics
breakShape
in class PGraphics
public void endShape(int mode)
endShape
in class PGraphics
public void point(float x, float y, float z)
point
in class PGraphics
public void box(float size)
box
in class PGraphics
public void box(float w, float h, float d)
box
in class PGraphics
public void sphereDetail(int res)
sphereDetail
in class PGraphics
public void sphereDetail(int ures, int vres)
PGraphics
sphereDetail
in class PGraphics
public void sphere(float r)
PGraphics
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
sphere
in class PGraphics
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)
bezier
in class PGraphics
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)
curve
in class PGraphics
public void translate(float tx, float ty)
PGraphics
translate
in class PGraphics
public void translate(float tx, float ty, float tz)
PGraphics
translate
in class PGraphics
public void rotate(float angle)
PGraphics
rotate
in class PGraphics
public void rotateX(float angle)
PGraphics
rotateX
in class PGraphics
public void rotateY(float angle)
PGraphics
rotateY
in class PGraphics
public void rotateZ(float angle)
PGraphics
rotateZ
in class PGraphics
public void rotate(float angle, float vx, float vy, float vz)
PGraphics
rotate
in class PGraphics
public void scale(float s)
PGraphics
scale
in class PGraphics
public void scale(float sx, float sy)
PGraphics
scale
in class PGraphics
public void scale(float x, float y, float z)
PGraphics
scale
in class PGraphics
public void pushMatrix()
PGraphics
pushMatrix
in class PGraphics
public void popMatrix()
PGraphics
popMatrix
in class PGraphics
public void resetMatrix()
resetMatrix
in class PGraphics
public void applyMatrix(float n00, float n01, float n02, float n10, float n11, float n12)
applyMatrix
in class PGraphics
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)
PGraphics
applyMatrix
in class PGraphics
public void printMatrix()
printMatrix
in class PGraphics
public float screenX(float x, float y)
PGraphics
screenX
in class PGraphics
public float screenY(float x, float y)
PGraphics
screenY
in class PGraphics
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |