public class PGraphicsJava2D extends PGraphics
To get access to the Java 2D "Graphics2D" object for the default renderer, use:
Graphics2D g2 = (Graphics2D) g.getNative();This will let you do Graphics2D calls directly, but is not supported in any way shape or form. Which just means "have fun, but don't complain if it breaks."
Advanced debugging notes for Java2D.
Modifier and Type | Field and Description |
---|---|
boolean |
fillGradient |
java.awt.Paint |
fillGradientObject |
java.awt.Graphics2D |
g2 |
boolean |
strokeGradient |
java.awt.Paint |
strokeGradientObject |
A, AB, AG, ambientB, ambientColor, ambientG, ambientR, AR, B, backgroundColor, BEEN_LIT, bezierDetail, colorMode, colorModeA, colorModeX, colorModeY, colorModeZ, curveDetail, curveTightness, DA, DB, DEFAULT_VERTICES, DG, DR, EB, edge, EDGE, EG, ellipseMode, emissiveB, emissiveColor, emissiveG, emissiveR, ER, fill, fillColor, G, HAS_NORMAL, image, imageMode, normalX, normalY, normalZ, NX, NY, NZ, pixelCount, R, rectMode, SA, SB, setAmbient, SG, shapeMode, SHINE, shininess, smooth, SPB, specularB, specularColor, specularG, specularR, SPG, sphereDetailU, sphereDetailV, SPR, SR, stroke, strokeCap, strokeColor, strokeJoin, strokeWeight, SW, textAlign, textAlignY, textFont, textLeading, textMode, textSize, textureImage, textureMode, textureU, textureV, tint, tintColor, TX, TY, TZ, U, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ
ALPHA_MASK, BLUE_MASK, format, GREEN_MASK, height, loaded, parent, pixelDensity, pixelHeight, pixels, pixelWidth, RED_MASK, width
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 |
---|
PGraphicsJava2D() |
Modifier and Type | Method and Description |
---|---|
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 |
backgroundImpl()
Actual implementation of clearing the background, now that the
internal variables for background color have been set.
|
void |
beginContour() |
void |
beginDraw()
( begin auto-generated from PGraphics_beginDraw.xml )
Sets the default properties for a PGraphics object.
|
void |
beginRaw(PGraphics recorderRaw)
Record individual lines and triangles by echoing them to another renderer.
|
void |
beginShape(int kind)
( begin auto-generated from beginShape.xml )
Using the beginShape() and endShape() functions allow
creating more complex forms.
|
void |
bezierDetail(int detail)
Ignored (not needed) in Java 2D.
|
void |
bezierVertex(float x1,
float y1,
float x2,
float y2,
float x3,
float y3) |
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 |
box(float w,
float h,
float d) |
java.awt.Graphics2D |
checkImage() |
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) |
PSurface |
createSurface() |
void |
curveDetail(int detail)
Ignored (not needed) in Java 2D.
|
void |
curveVertex(float x,
float y,
float z) |
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 |
endRaw() |
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().
|
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.
|
java.awt.Image |
getImage()
Still need a means to get the java.awt.Image object, since getNative()
is going to return the
Graphics2D object. |
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.
|
java.lang.Object |
getNative()
Returns the java.awt.Graphics2D object used by this renderer.
|
void |
hint(int which)
( begin auto-generated from hint.xml )
Set various hints and hacks for the renderer.
|
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 |
loadPixels()
( begin auto-generated from PImage_loadPixels.xml )
Loads the pixel data for the image into its pixels[] array.
|
PShape |
loadShape(java.lang.String filename,
java.lang.String options) |
void |
mask(int[] alpha) |
void |
mask(PImage alpha)
( 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.
|
void |
noClip()
( begin auto-generated from noClip.xml )
Disables the clipping previously started by the clip() function.
|
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 |
popMatrix()
( begin auto-generated from popMatrix.xml )
Pops the current transformation matrix off the matrix stack.
|
void |
printMatrix()
( begin auto-generated from printMatrix.xml )
Prints the current matrix to the Console (the text window at the bottom
of Processing).
|
void |
pushMatrix()
( begin auto-generated from pushMatrix.xml )
Pushes the current transformation matrix onto the matrix stack.
|
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 ctrlX,
float ctrlY,
float endX,
float endY) |
void |
quadraticVertex(float x2,
float y2,
float z2,
float x4,
float y4,
float z4) |
void |
resetMatrix()
( begin auto-generated from resetMatrix.xml )
Replaces the current matrix with the identity matrix.
|
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 vx,
float vy,
float vz)
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.
|
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 sx,
float sy)
Advanced
|
void |
scale(float sx,
float sy,
float sz) |
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 |
set(int x,
int y,
int argb)
( 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 |
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 |
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 |
sphere(float r)
( begin auto-generated from sphere.xml )
A sphere is a hollow ball made from tessellated triangles.
|
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.
|
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 |
texture(PImage image)
( begin auto-generated from texture.xml )
Sets a texture to be applied to vertex points.
|
void |
translate(float tx,
float ty)
( begin auto-generated from translate.xml )
Specifies an amount to displace objects within the display window.
|
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 |
updatePixels(int x,
int y,
int c,
int d)
Update the pixels[] buffer to the PGraphics image.
|
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.
|
alpha, ambient, ambient, ambient, ambientLight, ambientLight, applyMatrix, applyMatrix, applyMatrix, arc, arc, attrib, attrib, attrib, attribColor, attribNormal, attribPosition, background, background, background, background, background, background, background, beginCamera, beginPGL, beginShape, bezier, bezier, bezierPoint, bezierTangent, blendMode, blue, box, brightness, camera, camera, circle, clear, clip, color, color, color, color, color, color, color, color, color, colorMode, colorMode, colorMode, colorMode, createShape, createShape, createShape, curve, curve, curvePoint, curveTangent, curveTightness, curveVertex, directionalLight, displayable, dispose, edge, ellipse, ellipseMode, emissive, emissive, emissive, endCamera, endPGL, endShape, fill, fill, fill, fill, fill, fill, filter, flush, frustum, getCache, getRaw, getStyle, getStyle, green, haveRaw, hue, image, image, image, imageMode, is2D, is2X, is3D, isGL, lerpColor, lerpColor, lightFalloff, lights, lightSpecular, line, loadShader, loadShader, loadShape, modelX, modelY, modelZ, noFill, noLights, normal, noSmooth, noStroke, noTexture, noTint, ortho, ortho, ortho, perspective, perspective, point, pointLight, pop, popStyle, printCamera, printProjection, push, pushStyle, rect, rect, rect, rectMode, red, removeCache, resetShader, resetShader, saturation, save, setCache, setMatrix, setParent, setPath, setPrimary, setSize, shader, shader, shape, shape, shape, shapeMode, shininess, showDepthWarning, showDepthWarningXYZ, showException, showMethodWarning, showMissingWarning, showVariationWarning, showWarning, showWarning, smooth, smooth, specular, specular, specular, sphereDetail, sphereDetail, spotLight, square, stroke, stroke, stroke, stroke, stroke, stroke, style, text, text, text, text, text, text, text, text, text, text, text, textAlign, textAlign, textFont, textFont, textLeading, textMode, textSize, textureMode, textureWrap, textWidth, textWidth, textWidth, tint, tint, tint, tint, tint, tint, translate
blend, blend, blendColor, clone, copy, filter, filter, get, get, getModifiedX1, getModifiedX2, getModifiedY1, getModifiedY2, init, init, isLoaded, isModified, resize, set, setLoaded, setLoaded, setModified, setModified, updatePixels
public java.awt.Graphics2D g2
public boolean fillGradient
public java.awt.Paint fillGradientObject
public boolean strokeGradient
public java.awt.Paint strokeGradientObject
public PSurface createSurface()
createSurface
in class PGraphics
public java.awt.Image getImage()
Graphics2D
object.public java.lang.Object getNative()
public java.awt.Graphics2D checkImage()
public void beginDraw()
PGraphics
public void endDraw()
PGraphics
public void hint(int which)
PGraphics
hint
in class PGraphics
which
- name of the hint to be enabled or disabledPGraphics
,
PApplet.createGraphics(int, int, String, String)
,
PApplet.size(int, int)
public void beginShape(int kind)
PGraphics
beginShape
in class PGraphics
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 texture(PImage image)
PGraphics
texture
in class PGraphics
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 vertex(float[] v)
PGraphics
public void vertex(float x, float y, float z, float u, float v)
PGraphics
vertex
in class PGraphics
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()
beginContour
in class PGraphics
public void endContour()
endContour
in class PGraphics
public void endShape(int mode)
PGraphics
endShape
in class PGraphics
mode
- use CLOSE to close the shapePShape
,
PGraphics.beginShape(int)
public void noClip()
PGraphics
public void bezierVertex(float x1, float y1, float x2, float y2, float x3, float y3)
bezierVertex
in class PGraphics
public void bezierVertex(float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4)
PGraphics
bezierVertex
in class PGraphics
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 ctrlX, float ctrlY, float endX, float endY)
quadraticVertex
in class PGraphics
ctrlX
- the x-coordinate of the control pointctrlY
- the y-coordinate of the control pointendX
- the x-coordinate of the anchor pointendY
- 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 x2, float y2, float z2, float x4, float y4, float z4)
quadraticVertex
in class PGraphics
z2
- the z-coordinate of the control pointz4
- the z-coordinate of the anchor pointpublic void curveVertex(float x, float y, float z)
curveVertex
in class PGraphics
z
- the z-coordinate of the vertexpublic void point(float x, float y)
PGraphics
point
in class PGraphics
x
- x-coordinate of the pointy
- y-coordinate of the pointPGraphics.stroke(int)
public void line(float x1, float y1, float x2, float y2)
PGraphics
line
in class PGraphics
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 triangle(float x1, float y1, float x2, float y2, float x3, float y3)
PGraphics
triangle
in class PGraphics
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 pointPApplet.beginShape()
public void quad(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
PGraphics
quad
in class PGraphics
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 box(float w, float h, float d)
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
r
- the radius of the spherePGraphics.sphereDetail(int)
public void bezierDetail(int detail)
bezierDetail
in class PGraphics
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 curveDetail(int detail)
curveDetail
in class PGraphics
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 PShape loadShape(java.lang.String filename, java.lang.String options)
public float textAscent()
PGraphics
textAscent
in class PGraphics
PGraphics.textDescent()
public float textDescent()
PGraphics
textDescent
in class PGraphics
PGraphics.textAscent()
public void pushMatrix()
PGraphics
public void popMatrix()
PGraphics
popMatrix
in class PGraphics
PGraphics.pushMatrix()
public void translate(float tx, float ty)
PGraphics
translate
in class PGraphics
tx
- left/right translationty
- 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 rotate(float angle)
PGraphics
rotate
in class PGraphics
angle
- angle of rotation specified in radiansPGraphics.popMatrix()
,
PGraphics.pushMatrix()
,
PGraphics.rotateX(float)
,
PGraphics.rotateY(float)
,
PGraphics.rotateZ(float)
,
PGraphics.scale(float, float, float)
,
PApplet.radians(float)
public void rotateX(float angle)
PGraphics
rotateX
in class PGraphics
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)
PGraphics
rotateY
in class PGraphics
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)
PGraphics
rotateZ
in class PGraphics
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 vx, float vy, float vz)
PGraphics
public void scale(float s)
PGraphics
scale
in class PGraphics
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 sx, float sy)
PGraphics
public void scale(float sx, float sy, float sz)
public void shearX(float angle)
PGraphics
shearX
in class PGraphics
angle
- angle of shear specified in radiansPGraphics.popMatrix()
,
PGraphics.pushMatrix()
,
PGraphics.shearY(float)
,
PGraphics.scale(float, float, float)
,
PGraphics.translate(float, float, float)
,
PApplet.radians(float)
public void shearY(float angle)
PGraphics
shearY
in class PGraphics
angle
- angle of shear specified in radiansPGraphics.popMatrix()
,
PGraphics.pushMatrix()
,
PGraphics.shearX(float)
,
PGraphics.scale(float, float, float)
,
PGraphics.translate(float, float, float)
,
PApplet.radians(float)
public void resetMatrix()
PGraphics
resetMatrix
in class PGraphics
PGraphics.pushMatrix()
,
PGraphics.popMatrix()
,
PGraphics.applyMatrix(PMatrix)
,
PGraphics.printMatrix()
public void applyMatrix(float n00, float n01, float n02, float n10, float n11, float n12)
applyMatrix
in class PGraphics
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(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)
applyMatrix
in class PGraphics
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 PMatrix2D getMatrix(PMatrix2D target)
PGraphics
public PMatrix3D getMatrix(PMatrix3D target)
PGraphics
public void setMatrix(PMatrix2D source)
PGraphics
public void setMatrix(PMatrix3D source)
PGraphics
public void printMatrix()
PGraphics
printMatrix
in class PGraphics
PGraphics.pushMatrix()
,
PGraphics.popMatrix()
,
PGraphics.resetMatrix()
,
PGraphics.applyMatrix(PMatrix)
public float screenX(float x, float y)
PGraphics
screenX
in class PGraphics
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)
PGraphics
screenY
in class PGraphics
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)
public float screenY(float x, float y, float z)
public float screenZ(float x, float y, float z)
PGraphics
screenZ
in class PGraphics
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 void strokeCap(int cap)
PGraphics
strokeCap
in class PGraphics
cap
- either SQUARE, PROJECT, or ROUNDPGraphics.stroke(int, float)
,
PGraphics.strokeWeight(float)
,
PGraphics.strokeJoin(int)
,
PApplet.size(int, int, String, String)
public void strokeJoin(int join)
PGraphics
strokeJoin
in class PGraphics
join
- either MITER, BEVEL, ROUNDPGraphics.stroke(int, float)
,
PGraphics.strokeWeight(float)
,
PGraphics.strokeCap(int)
public void strokeWeight(float weight)
PGraphics
strokeWeight
in class PGraphics
weight
- the weight (in pixels) of the strokePGraphics.stroke(int, float)
,
PGraphics.strokeJoin(int)
,
PGraphics.strokeCap(int)
public void backgroundImpl()
PGraphics
public void beginRaw(PGraphics recorderRaw)
PGraphics
public void loadPixels()
PImage
loadPixels
in class PImage
public void updatePixels(int x, int y, int c, int d)
Unlike in PImage, where updatePixels() only requests that the update happens, in PGraphicsJava2D, this will happen immediately.
updatePixels
in class PImage
x
- x-coordinate of the upper-left cornery
- y-coordinate of the upper-left cornerc
- widthd
- heightpublic int get(int x, int y)
PImage
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.
get
in class PImage
x
- x-coordinate of the pixely
- y-coordinate of the pixelPApplet.set(int, int, int)
,
PApplet.pixels
,
PApplet.copy(PImage, int, int, int, int, int, int, int, int)
public void set(int x, int y, int argb)
PImage
set
in class PImage
x
- x-coordinate of the pixely
- y-coordinate of the pixelargb
- 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 mask(int[] alpha)
public void mask(PImage alpha)
PImage
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.
public void copy(int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh)
PImage
copy
in class PImage
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)