processing.core
Class PGraphicsJava2D

java.lang.Object
  extended by processing.core.PImage
      extended by processing.core.PGraphics
          extended by processing.core.PGraphicsJava2D
All Implemented Interfaces:
java.lang.Cloneable, PConstants

public class PGraphicsJava2D
extends PGraphics

Subclass for PGraphics that implements the graphics API using Java2D.

Pixel operations too slow? As of release 0085 (the first beta), the default renderer uses Java2D. It's more accurate than the renderer used in alpha releases of Processing (it handles stroke caps and joins, and has better polygon tessellation), but it's super slow for handling pixels. At least until we get a chance to get the old 2D renderer (now called P2D) working in a similar fashion, you can use size(w, h, P3D) instead of size(w, h) which will be faster for general pixel flipping madness.

To get access to the Java 2D "Graphics2D" object for the default renderer, use:

Graphics2D g2 = ((PGraphicsJava2D)g).g2;
This will let you do Java 2D stuff directly, but is not supported in any way shape or form. Which just means "have fun, but don't complain if it breaks."


Field Summary
 boolean fillGradient
           
 java.awt.Paint fillGradientObject
           
 java.awt.Graphics2D g2
           
 boolean strokeGradient
           
 java.awt.Paint strokeGradientObject
           
 
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
 
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
 
Constructor Summary
PGraphicsJava2D()
           
 
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 backgroundImpl()
          Actual implementation of clearing the background, now that the internal variables for background color have been set.
 void beginDraw()
          Prepares the PGraphics for drawing.
 void beginRaw(PGraphics recorderRaw)
          Record individual lines and triangles by echoing them to another renderer.
 void beginShape(int kind)
          Start a new shape.
 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)
           
 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 copy(int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh)
          Copy things from one area of this image to another area in the same image.
 void curveDetail(int detail)
          Ignored (not needed) in Java 2D.
 void curveVertex(float x, float y, float z)
           
 void endDraw()
          This will finalize rendering so that it can be shown on-screen.
 void endRaw()
           
 void endShape(int mode)
           
 PImage get()
          Returns a copy of this PImage.
 int get(int x, int y)
          Returns an ARGB "color" type (a packed 32 bit int with the color.
 PImage getImpl(int x, int y, int w, int h)
          Internal function to actually handle getting a block of pixels that has already been properly cropped to a valid region.
 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.
 void line(float x1, float y1, float x2, float y2)
           
 void loadPixels()
          Call this when you want to mess with the pixels[] array.
 void mask(int[] alpha)
          Set alpha channel for an image.
 void mask(PImage alpha)
          Set alpha channel for an image using another image as the source.
 void noSmooth()
          Disable smoothing.
 void point(float x, float y)
           
 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 quad(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
           
 void resetMatrix()
          Set the current transformation matrix to identity.
 void resize(int wide, int high)
          Resize this image to a new width and height.
 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 sx, float sy, float sz)
          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 set(int x, int y, int argb)
          Set a single pixel to the specified color.
 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 setSize(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 smooth()
          If true in PImage, use bilinear interpolation for copy() operations.
 void sphere(float r)
          Draw a sphere with radius r centered at coordinate 0, 0, 0.
 void strokeCap(int cap)
           
 void strokeJoin(int join)
           
 void strokeWeight(float weight)
           
 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 textSize(float size)
          Same as parent, but override for native version of the font.
 void texture(PImage image)
          Set texture image for current shape.
 void translate(float tx, float ty)
          Translate in X and Y.
 void triangle(float x1, float y1, float x2, float y2, float x3, float y3)
           
 void updatePixels()
          Update the pixels[] buffer to the PGraphics image.
 void updatePixels(int x, int y, int c, int d)
          Update the pixels[] buffer to the PGraphics image.
 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.PGraphics
alpha, ambient, ambient, ambient, ambientLight, ambientLight, applyMatrix, applyMatrix, applyMatrix, arc, background, background, background, background, background, background, background, beginCamera, beginShape, bezier, bezier, bezierPoint, bezierTangent, blue, box, brightness, camera, camera, color, color, color, color, color, color, color, color, color, colorMode, colorMode, colorMode, colorMode, curve, curve, curvePoint, curveTangent, curveTightness, curveVertex, directionalLight, displayable, dispose, edge, ellipse, ellipseMode, emissive, emissive, emissive, endCamera, endShape, fill, fill, fill, fill, fill, fill, flush, frustum, getStyle, getStyle, green, hint, hue, image, image, image, imageMode, is2D, is3D, lerpColor, lerpColor, lightFalloff, lights, lightSpecular, line, modelX, modelY, modelZ, noFill, noLights, normal, noStroke, noTint, ortho, ortho, perspective, perspective, point, pointLight, popStyle, printCamera, printProjection, pushStyle, rect, rectMode, red, saturation, setMatrix, setParent, setPath, setPrimary, shape, shape, shape, shapeMode, shininess, showException, showWarning, specular, specular, specular, sphereDetail, sphereDetail, spotLight, stroke, stroke, stroke, stroke, stroke, stroke, style, text, text, text, text, text, text, text, text, text, text, text, text, text, text, textAlign, textAlign, textFont, textFont, textLeading, textMode, textureMode, textWidth, textWidth, tint, tint, tint, tint, tint, tint, translate, vertex
 
Methods inherited from class processing.core.PImage
blend, blend, blendColor, clone, copy, filter, filter, get, getCache, getImage, init, isModified, removeCache, save, set, setCache, setModified, setModified
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

g2

public java.awt.Graphics2D g2

fillGradient

public boolean fillGradient

fillGradientObject

public java.awt.Paint fillGradientObject

strokeGradient

public boolean strokeGradient

strokeGradientObject

public java.awt.Paint strokeGradientObject
Constructor Detail

PGraphicsJava2D

public PGraphicsJava2D()
Method Detail

setSize

public void setSize(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. Note that this will nuke any cameraMode() settings.

Overrides:
setSize in class PGraphics

canDraw

public boolean canDraw()
Description copied from class: PGraphics
Some renderers have requirements re: when they are ready to draw.

Overrides:
canDraw in class PGraphics

beginDraw

public void beginDraw()
Description copied from class: PGraphics
Prepares the PGraphics for drawing.

When creating your own PGraphics, you should call this before drawing anything.

Overrides:
beginDraw in class PGraphics

endDraw

public void endDraw()
Description copied from class: PGraphics
This will finalize rendering so that it can be shown on-screen.

When creating your own PGraphics, you should call this when you're finished drawing.

Overrides:
endDraw in class PGraphics

beginShape

public void beginShape(int kind)
Description copied from class: PGraphics
Start a new shape.

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.

Overrides:
beginShape in class PGraphics

texture

public void texture(PImage image)
Description copied from class: PGraphics
Set texture image for current shape. Needs to be called between @see beginShape and @see endShape

Overrides:
texture in class PGraphics
Parameters:
image - reference to a PImage object

vertex

public void vertex(float x,
                   float y)
Overrides:
vertex in class PGraphics

vertex

public void vertex(float x,
                   float y,
                   float z)
Overrides:
vertex in class PGraphics

vertex

public void vertex(float x,
                   float y,
                   float u,
                   float v)
Overrides:
vertex in class PGraphics

vertex

public void vertex(float x,
                   float y,
                   float z,
                   float u,
                   float v)
Overrides:
vertex in class PGraphics

breakShape

public void breakShape()
Description copied from class: PGraphics
This feature is in testing, do not use or rely upon its implementation

Overrides:
breakShape in class PGraphics

endShape

public void endShape(int mode)
Overrides:
endShape in class PGraphics

bezierVertex

public void bezierVertex(float x1,
                         float y1,
                         float x2,
                         float y2,
                         float x3,
                         float y3)
Overrides:
bezierVertex in class PGraphics

bezierVertex

public void bezierVertex(float x2,
                         float y2,
                         float z2,
                         float x3,
                         float y3,
                         float z3,
                         float x4,
                         float y4,
                         float z4)
Overrides:
bezierVertex in class PGraphics

curveVertex

public void curveVertex(float x,
                        float y,
                        float z)
Overrides:
curveVertex in class PGraphics

point

public void point(float x,
                  float y)
Overrides:
point in class PGraphics

line

public void line(float x1,
                 float y1,
                 float x2,
                 float y2)
Overrides:
line in class PGraphics

triangle

public void triangle(float x1,
                     float y1,
                     float x2,
                     float y2,
                     float x3,
                     float y3)
Overrides:
triangle in class PGraphics

quad

public void quad(float x1,
                 float y1,
                 float x2,
                 float y2,
                 float x3,
                 float y3,
                 float x4,
                 float y4)
Overrides:
quad in class PGraphics

box

public void box(float w,
                float h,
                float d)
Overrides:
box in class PGraphics

sphere

public void sphere(float r)
Description copied from class: PGraphics
Draw a sphere with radius r centered at coordinate 0, 0, 0.

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
 

Overrides:
sphere in class PGraphics

bezierDetail

public void bezierDetail(int detail)
Ignored (not needed) in Java 2D.

Overrides:
bezierDetail in class PGraphics

curveDetail

public void curveDetail(int detail)
Ignored (not needed) in Java 2D.

Overrides:
curveDetail in class PGraphics

smooth

public void smooth()
Description copied from class: PGraphics
If true in PImage, use bilinear interpolation for copy() operations. When inherited by PGraphics, also controls shapes.

Overrides:
smooth in class PGraphics

noSmooth

public void noSmooth()
Description copied from class: PGraphics
Disable smoothing. See smooth().

Overrides:
noSmooth in class PGraphics

textAscent

public float textAscent()
Description copied from class: PGraphics
Returns the ascent of the current font at the current size. This is a method, rather than a variable inside the PGraphics object because it requires calculation.

Overrides:
textAscent in class PGraphics

textDescent

public float textDescent()
Description copied from class: PGraphics
Returns the descent of the current font at the current size. This is a method, rather than a variable inside the PGraphics object because it requires calculation.

Overrides:
textDescent in class PGraphics

textSize

public void textSize(float size)
Same as parent, but override for native version of the font.

Also gets called by textFont, so the metrics will get recorded properly.

Overrides:
textSize in class PGraphics

pushMatrix

public void pushMatrix()
Description copied from class: PGraphics
Push a copy of the current transformation matrix onto the stack.

Overrides:
pushMatrix in class PGraphics

popMatrix

public void popMatrix()
Description copied from class: PGraphics
Replace the current transformation matrix with the top of the stack.

Overrides:
popMatrix in class PGraphics

translate

public void translate(float tx,
                      float ty)
Description copied from class: PGraphics
Translate in X and Y.

Overrides:
translate in class PGraphics

rotate

public void rotate(float angle)
Description copied from class: PGraphics
Two dimensional rotation. Same as rotateZ (this is identical to a 3D rotation along the z-axis) but included for clarity. It'd be weird for people drawing 2D graphics to be using rotateZ. And they might kick our a-- for the confusion. Additional background.

Overrides:
rotate in class PGraphics

rotateX

public void rotateX(float angle)
Description copied from class: PGraphics
Rotate around the X axis.

Overrides:
rotateX in class PGraphics

rotateY

public void rotateY(float angle)
Description copied from class: PGraphics
Rotate around the Y axis.

Overrides:
rotateY in class PGraphics

rotateZ

public void rotateZ(float angle)
Description copied from class: PGraphics
Rotate around the Z axis. The functions rotate() and rotateZ() are identical, it's just that it make sense to have rotate() and then rotateX() and rotateY() when using 3D; nor does it make sense to use a function called rotateZ() if you're only doing things in 2D. so we just decided to have them both be the same.

Overrides:
rotateZ in class PGraphics

rotate

public void rotate(float angle,
                   float vx,
                   float vy,
                   float vz)
Description copied from class: PGraphics
Rotate about a vector in space. Same as the glRotatef() function.

Overrides:
rotate in class PGraphics

scale

public void scale(float s)
Description copied from class: PGraphics
Scale in all dimensions.

Overrides:
scale in class PGraphics

scale

public void scale(float sx,
                  float sy)
Description copied from class: PGraphics
Scale in X and Y. Equivalent to scale(sx, sy, 1). Not recommended for use in 3D, because the z-dimension is just scaled by 1, since there's no way to know what else to scale it by.

Overrides:
scale in class PGraphics

scale

public void scale(float sx,
                  float sy,
                  float sz)
Description copied from class: PGraphics
Scale in X, Y, and Z.

Overrides:
scale in class PGraphics

resetMatrix

public void resetMatrix()
Description copied from class: PGraphics
Set the current transformation matrix to identity.

Overrides:
resetMatrix in class PGraphics

applyMatrix

public void applyMatrix(float n00,
                        float n01,
                        float n02,
                        float n10,
                        float n11,
                        float n12)
Description copied from class: PGraphics
Apply a 3x2 affine transformation matrix.

Overrides:
applyMatrix in class PGraphics

applyMatrix

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)
Description copied from class: PGraphics
Apply a 4x4 transformation matrix.

Overrides:
applyMatrix in class PGraphics

getMatrix

public PMatrix getMatrix()
Overrides:
getMatrix in class PGraphics

getMatrix

public PMatrix2D getMatrix(PMatrix2D target)
Description copied from class: PGraphics
Copy the current transformation matrix into the specified target. Pass in null to create a new matrix.

Overrides:
getMatrix in class PGraphics

getMatrix

public PMatrix3D getMatrix(PMatrix3D target)
Description copied from class: PGraphics
Copy the current transformation matrix into the specified target. Pass in null to create a new matrix.

Overrides:
getMatrix in class PGraphics

setMatrix

public void setMatrix(PMatrix2D source)
Description copied from class: PGraphics
Set the current transformation to the contents of the specified source.

Overrides:
setMatrix in class PGraphics

setMatrix

public void setMatrix(PMatrix3D source)
Description copied from class: PGraphics
Set the current transformation to the contents of the specified source.

Overrides:
setMatrix in class PGraphics

printMatrix

public void printMatrix()
Description copied from class: PGraphics
Print the current model (or "transformation") matrix.

Overrides:
printMatrix in class PGraphics

screenX

public float screenX(float x,
                     float y)
Description copied from class: PGraphics
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.

Overrides:
screenX in class PGraphics

screenY

public float screenY(float x,
                     float y)
Description copied from class: PGraphics
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.

Overrides:
screenY in class PGraphics

screenX

public float screenX(float x,
                     float y,
                     float z)
Description copied from class: PGraphics
Maps a three dimensional point to its placement on-screen.

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.

Overrides:
screenX in class PGraphics

screenY

public float screenY(float x,
                     float y,
                     float z)
Description copied from class: PGraphics
Maps a three dimensional point to its placement on-screen.

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.

Overrides:
screenY in class PGraphics

screenZ

public float screenZ(float x,
                     float y,
                     float z)
Description copied from class: PGraphics
Maps a three dimensional point to its placement on-screen.

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

Overrides:
screenZ in class PGraphics

strokeCap

public void strokeCap(int cap)
Overrides:
strokeCap in class PGraphics

strokeJoin

public void strokeJoin(int join)
Overrides:
strokeJoin in class PGraphics

strokeWeight

public void strokeWeight(float weight)
Overrides:
strokeWeight in class PGraphics

backgroundImpl

public void backgroundImpl()
Description copied from class: PGraphics
Actual implementation of clearing the background, now that the internal variables for background color have been set. Called by the backgroundFromCalc() method, which is what all the other background() methods call once the work is done.


beginRaw

public void beginRaw(PGraphics recorderRaw)
Description copied from class: PGraphics
Record individual lines and triangles by echoing them to another renderer.

Overrides:
beginRaw in class PGraphics

endRaw

public void endRaw()
Overrides:
endRaw in class PGraphics

loadPixels

public void loadPixels()
Description copied from class: PImage
Call this when you want to mess with the pixels[] array.

For subclasses where the pixels[] buffer isn't set by default, this should copy all data into the pixels[] array

Overrides:
loadPixels in class PImage

updatePixels

public void updatePixels()
Update the pixels[] buffer to the PGraphics image.

Unlike in PImage, where updatePixels() only requests that the update happens, in PGraphicsJava2D, this will happen immediately.

Overrides:
updatePixels in class PImage

updatePixels

public void updatePixels(int x,
                         int y,
                         int c,
                         int d)
Update the pixels[] buffer to the PGraphics image.

Unlike in PImage, where updatePixels() only requests that the update happens, in PGraphicsJava2D, this will happen immediately.

Overrides:
updatePixels in class PImage

resize

public void resize(int wide,
                   int high)
Description copied from class: PImage
Resize this image to a new width and height. Use 0 for wide or high to make that dimension scale proportionally.

Overrides:
resize in class PImage

get

public int get(int x,
               int y)
Description copied from class: PImage
Returns an ARGB "color" type (a packed 32 bit int with the color. If the coordinate is outside the image, zero is returned (black, but completely transparent).

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.

Overrides:
get in class PImage

getImpl

public PImage getImpl(int x,
                      int y,
                      int w,
                      int h)
Description copied from class: PImage
Internal function to actually handle getting a block of pixels that has already been properly cropped to a valid region. That is, x/y/w/h are guaranteed to be inside the image space, so the implementation can use the fastest possible pixel copying method.


get

public PImage get()
Description copied from class: PImage
Returns a copy of this PImage. Equivalent to get(0, 0, width, height).

Overrides:
get in class PImage

set

public void set(int x,
                int y,
                int argb)
Description copied from class: PImage
Set a single pixel to the specified color.

Overrides:
set in class PImage

mask

public void mask(int[] alpha)
Description copied from class: PImage
Set alpha channel for an image. Black colors in the source image will make the destination image completely transparent, and white will make things fully opaque. Gray values will be in-between steps.

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" grayscake by performing a proper luminance-based conversion.

Overrides:
mask in class PImage

mask

public void mask(PImage alpha)
Description copied from class: PImage
Set alpha channel for an image using another image as the source.

Overrides:
mask in class PImage

copy

public void copy(int sx,
                 int sy,
                 int sw,
                 int sh,
                 int dx,
                 int dy,
                 int dw,
                 int dh)
Description copied from class: PImage
Copy things from one area of this image to another area in the same image.

Overrides:
copy in class PImage