Class PGraphicsJava2D
- java.lang.Object
-
- processing.core.PImage
-
- processing.core.PGraphics
-
- processing.awt.PGraphicsJava2D
-
- All Implemented Interfaces:
- java.lang.Cloneable, PConstants
public class PGraphicsJava2D extends PGraphics
Subclass for PGraphics that implements the graphics API using Java2D.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.
-
-
Field Summary
Fields Modifier and Type Field and Description booleanfillGradientjava.awt.PaintfillGradientObjectjava.awt.Graphics2Dg2booleanstrokeGradientjava.awt.PaintstrokeGradientObject-
Fields inherited from class processing.core.PGraphics
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
-
Fields inherited from class processing.core.PImage
ALPHA_MASK, BLUE_MASK, format, GREEN_MASK, height, loaded, parent, pixelDensity, pixelHeight, pixels, pixelWidth, RED_MASK, width
-
Fields inherited from interface processing.core.PConstants
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 Summary
Constructors Constructor and Description PGraphicsJava2D()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidapplyMatrix(float n00, float n01, float n02, float n10, float n11, float n12)voidapplyMatrix(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)voidbackgroundImpl()Actual implementation of clearing the background, now that the internal variables for background color have been set.voidbeginContour()voidbeginDraw()( begin auto-generated from PGraphics_beginDraw.xml ) Sets the default properties for a PGraphics object.voidbeginRaw(PGraphics recorderRaw)Record individual lines and triangles by echoing them to another renderer.voidbeginShape(int kind)( begin auto-generated from beginShape.xml ) Using the beginShape() and endShape() functions allow creating more complex forms.voidbezierDetail(int detail)Ignored (not needed) in Java 2D.voidbezierVertex(float x1, float y1, float x2, float y2, float x3, float y3)voidbezierVertex(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.voidbox(float w, float h, float d)java.awt.Graphics2DcheckImage()voidcopy(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.voidcopy(PImage src, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh)PSurfacecreateSurface()voidcurveDetail(int detail)Ignored (not needed) in Java 2D.voidcurveVertex(float x, float y, float z)voidendContour()voidendDraw()( begin auto-generated from PGraphics_endDraw.xml ) Finalizes the rendering of a PGraphics object so that it can be shown on screen.voidendRaw()voidendShape(int mode)( begin auto-generated from endShape.xml ) The endShape() function is the companion to beginShape() and may only be called after beginShape().PImageget()Returns a copy of this PImage.intget(int x, int y)( begin auto-generated from PImage_get.xml ) Reads the color of any pixel or grabs a section of an image.PMatrixgetMatrix()PMatrix2DgetMatrix(PMatrix2D target)Copy the current transformation matrix into the specified target.PMatrix3DgetMatrix(PMatrix3D target)Copy the current transformation matrix into the specified target.java.lang.ObjectgetNative()Returns the java.awt.Graphics2D object used by this renderer.voidhint(int which)( begin auto-generated from hint.xml ) Set various hints and hacks for the renderer.voidline(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.voidloadPixels()( begin auto-generated from PImage_loadPixels.xml ) Loads the pixel data for the image into its pixels[] array.PShapeloadShape(java.lang.String filename, java.lang.String options)voidmask(int[] alpha)voidmask(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.voidnoClip()( begin auto-generated from noClip.xml ) Disables the clipping previously started by the clip() function.voidpoint(float x, float y)( begin auto-generated from point.xml ) Draws a point, a coordinate in space at the dimension of one pixel.voidpopMatrix()( begin auto-generated from popMatrix.xml ) Pops the current transformation matrix off the matrix stack.voidprintMatrix()( begin auto-generated from printMatrix.xml ) Prints the current matrix to the Console (the text window at the bottom of Processing).voidpushMatrix()( begin auto-generated from pushMatrix.xml ) Pushes the current transformation matrix onto the matrix stack.voidquad(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.voidquadraticVertex(float ctrlX, float ctrlY, float endX, float endY)voidquadraticVertex(float x2, float y2, float z2, float x4, float y4, float z4)voidresetMatrix()( begin auto-generated from resetMatrix.xml ) Replaces the current matrix with the identity matrix.voidrotate(float angle)( begin auto-generated from rotate.xml ) Rotates a shape the amount specified by the angle parameter.voidrotate(float angle, float vx, float vy, float vz)AdvancedvoidrotateX(float angle)( begin auto-generated from rotateX.xml ) Rotates a shape around the x-axis the amount specified by the angle parameter.voidrotateY(float angle)( begin auto-generated from rotateY.xml ) Rotates a shape around the y-axis the amount specified by the angle parameter.voidrotateZ(float angle)( begin auto-generated from rotateZ.xml ) Rotates a shape around the z-axis the amount specified by the angle parameter.voidscale(float s)( begin auto-generated from scale.xml ) Increases or decreases the size of a shape by expanding and contracting vertices.voidscale(float sx, float sy)Advancedvoidscale(float sx, float sy, float sz)floatscreenX(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.floatscreenX(float x, float y, float z)floatscreenY(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.floatscreenY(float x, float y, float z)floatscreenZ(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.voidset(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.voidsetMatrix(PMatrix2D source)Set the current transformation to the contents of the specified source.voidsetMatrix(PMatrix3D source)Set the current transformation to the contents of the specified source.voidshearX(float angle)( begin auto-generated from shearX.xml ) Shears a shape around the x-axis the amount specified by the angle parameter.voidshearY(float angle)( begin auto-generated from shearY.xml ) Shears a shape around the y-axis the amount specified by the angle parameter.voidsphere(float r)( begin auto-generated from sphere.xml ) A sphere is a hollow ball made from tessellated triangles.voidstrokeCap(int cap)( begin auto-generated from strokeCap.xml ) Sets the style for rendering line endings.voidstrokeJoin(int join)( begin auto-generated from strokeJoin.xml ) Sets the style of the joints which connect line segments.voidstrokeWeight(float weight)( begin auto-generated from strokeWeight.xml ) Sets the width of the stroke used for lines, points, and the border around shapes.floattextAscent()( begin auto-generated from textAscent.xml ) Returns ascent of the current font at its current size.floattextDescent()( begin auto-generated from textDescent.xml ) Returns descent of the current font at its current size.voidtexture(PImage image)( begin auto-generated from texture.xml ) Sets a texture to be applied to vertex points.voidtranslate(float tx, float ty)( begin auto-generated from translate.xml ) Specifies an amount to displace objects within the display window.voidtriangle(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.voidupdatePixels(int x, int y, int c, int d)Update the pixels[] buffer to the PGraphics image.voidvertex(float[] v)Used by renderer subclasses or PShape to efficiently pass in already formatted vertex information.voidvertex(float x, float y)voidvertex(float x, float y, float z)voidvertex(float x, float y, float u, float v)voidvertex(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.-
Methods inherited from class processing.core.PGraphics
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, 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, popStyle, printCamera, printProjection, 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, 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
-
Methods inherited from class processing.core.PImage
blend, blend, blendColor, clone, copy, filter, filter, get, getImage, getModifiedX1, getModifiedX2, getModifiedY1, getModifiedY2, init, init, isLoaded, isModified, resize, set, setLoaded, setLoaded, setModified, setModified, updatePixels
-
-
-
-
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
-
-
Method Detail
-
createSurface
public PSurface createSurface()
- Overrides:
createSurfacein classPGraphics
-
getNative
public java.lang.Object getNative()
Returns the java.awt.Graphics2D object used by this renderer.
-
checkImage
public java.awt.Graphics2D checkImage()
-
beginDraw
public void beginDraw()
Description copied from class:PGraphics( begin auto-generated from PGraphics_beginDraw.xml ) Sets the default properties for a PGraphics object. It should be called before anything is drawn into the object. ( end auto-generated )Advanced
When creating your own PGraphics, you should call this before drawing anything.
-
endDraw
public void endDraw()
Description copied from class:PGraphics( begin auto-generated from PGraphics_endDraw.xml ) Finalizes the rendering of a PGraphics object so that it can be shown on screen. ( end auto-generated )Advanced
When creating your own PGraphics, you should call this when you're finished drawing.
-
hint
public void hint(int which)
Description copied from class:PGraphics( begin auto-generated from hint.xml ) Set various hints and hacks for the renderer. This is used to handle obscure rendering features that cannot be implemented in a consistent manner across renderers. Many options will often graduate to standard features instead of hints over time.
hint(ENABLE_OPENGL_4X_SMOOTH) - Enable 4x anti-aliasing for P3D. This can help force anti-aliasing if it has not been enabled by the user. On some graphics cards, this can also be set by the graphics driver's control panel, however not all cards make this available. This hint must be called immediately after the size() command because it resets the renderer, obliterating any settings and anything drawn (and like size(), re-running the code that came before it again).
hint(DISABLE_OPENGL_2X_SMOOTH) - In Processing 1.0, Processing always enables 2x smoothing when the P3D renderer is used. This hint disables the default 2x smoothing and returns the smoothing behavior found in earlier releases, where smooth() and noSmooth() could be used to enable and disable smoothing, though the quality was inferior.
hint(ENABLE_NATIVE_FONTS) - Use the native version fonts when they are installed, rather than the bitmapped version from a .vlw file. This is useful with the default (or JAVA2D) renderer setting, as it will improve font rendering speed. This is not enabled by default, because it can be misleading while testing because the type will look great on your machine (because you have the font installed) but lousy on others' machines if the identical font is unavailable. This option can only be set per-sketch, and must be called before any use of textFont().
hint(DISABLE_DEPTH_TEST) - Disable the zbuffer, allowing you to draw on top of everything at will. When depth testing is disabled, items will be drawn to the screen sequentially, like a painting. This hint is most often used to draw in 3D, then draw in 2D on top of it (for instance, to draw GUI controls in 2D on top of a 3D interface). Starting in release 0149, this will also clear the depth buffer. Restore the default with hint(ENABLE_DEPTH_TEST), but note that with the depth buffer cleared, any 3D drawing that happens later in draw() will ignore existing shapes on the screen.
hint(ENABLE_DEPTH_SORT) - Enable primitive z-sorting of triangles and lines in P3D and OPENGL. This can slow performance considerably, and the algorithm is not yet perfect. Restore the default with hint(DISABLE_DEPTH_SORT).
hint(DISABLE_OPENGL_ERROR_REPORT) - Speeds up the P3D renderer setting by not checking for errors while running. Undo with hint(ENABLE_OPENGL_ERROR_REPORT).
hint(ENABLE_BUFFER_READING) - Depth and stencil buffers in P2D/P3D will be downsampled to make PGL#readPixels work with multisampling. Enabling this introduces some overhead, so if you experience bad performance, disable multisampling with noSmooth() instead. This hint is not intended to be enabled and disabled repeatedely, so call this once in setup() or after creating your PGraphics2D/3D. You can restore the default with hint(DISABLE_BUFFER_READING) if you don't plan to read depth from this PGraphics anymore.
hint(ENABLE_KEY_REPEAT) - Auto-repeating key events are discarded by default (works only in P2D/P3D); use this hint to get all the key events (including auto-repeated). Call hint(DISABLE_KEY_REPEAT) to get events only when the key goes physically up or down.
hint(DISABLE_ASYNC_SAVEFRAME) - P2D/P3D only - save() and saveFrame() will not use separate threads for saving and will block until the image is written to the drive. This was the default behavior in 3.0b7 and before. To enable, call hint(ENABLE_ASYNC_SAVEFRAME).
As of release 0149, unhint() has been removed in favor of adding additional ENABLE/DISABLE constants to reset the default behavior. This prevents the double negatives, and also reinforces which hints can be enabled or disabled. ( end auto-generated )- Overrides:
hintin classPGraphics- Parameters:
which- name of the hint to be enabled or disabled- See Also:
PGraphics,PApplet.createGraphics(int, int, String, String),PApplet.size(int, int)
-
beginShape
public void beginShape(int kind)
Description copied from class:PGraphics( begin auto-generated from beginShape.xml ) Using the beginShape() and endShape() functions allow creating more complex forms. beginShape() begins recording vertices for a shape and endShape() stops recording. The value of the MODE parameter tells it which types of shapes to create from the provided vertices. With no mode specified, the shape can be any irregular polygon. The parameters available for beginShape() are POINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, and QUAD_STRIP. After calling the beginShape() function, a series of vertex() commands must follow. To stop drawing the shape, call endShape(). The vertex() function with two parameters specifies a position in 2D and the vertex() function with three parameters specifies a position in 3D. Each shape will be outlined with the current stroke color and filled with the fill color.
Transformations such as translate(), rotate(), and scale() do not work within beginShape(). It is also not possible to use other shapes, such as ellipse() or rect() within beginShape().
The P3D renderer settings allow stroke() and fill() settings to be altered per-vertex, however the default P2D renderer does not. Settings such as strokeWeight(), strokeCap(), and strokeJoin() cannot be changed while inside a beginShape()/endShape() block with any renderer. ( end auto-generated )- Overrides:
beginShapein classPGraphics- Parameters:
kind- Either POINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, or QUAD_STRIP- See Also:
PShape,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)
-
texture
public void texture(PImage image)
Description copied from class:PGraphics( begin auto-generated from texture.xml ) Sets a texture to be applied to vertex points. The texture() function must be called between beginShape() and endShape() and before any calls to vertex().
When textures are in use, the fill color is ignored. Instead, use tint() to specify the color of the texture as it is applied to the shape. ( end auto-generated )- Overrides:
texturein classPGraphics- Parameters:
image- reference to a PImage object- See Also:
PGraphics.textureMode(int),PGraphics.textureWrap(int),PGraphics.beginShape(int),PGraphics.endShape(int),PGraphics.vertex(float, float, float, float, float)
-
vertex
public void vertex(float[] v)
Description copied from class:PGraphicsUsed by renderer subclasses or PShape to efficiently pass in already formatted vertex information.
-
vertex
public void vertex(float x, float y, float z, float u, float v)Description copied from class:PGraphics( begin auto-generated from vertex.xml ) All shapes are constructed by connecting a series of vertices. vertex() is used to specify the vertex coordinates for points, lines, triangles, quads, and polygons and is used exclusively within the beginShape() and endShape() function.
Drawing a vertex in 3D using the z parameter requires the P3D parameter in combination with size as shown in the above example.
This function is also used to map a texture onto the geometry. The texture() function declares the texture to apply to the geometry and the u and v coordinates set define the mapping of this texture to the form. By default, the coordinates used for u and v are specified in relation to the image's size in pixels, but this relation can be changed with textureMode(). ( end auto-generated )- Overrides:
vertexin classPGraphics- Parameters:
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 mapping- See Also:
PGraphics.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)
-
beginContour
public void beginContour()
- Overrides:
beginContourin classPGraphics
-
endContour
public void endContour()
- Overrides:
endContourin classPGraphics
-
endShape
public void endShape(int mode)
Description copied from class:PGraphics( begin auto-generated from endShape.xml ) The endShape() function is the companion to beginShape() and may only be called after beginShape(). When endshape() is called, all of image data defined since the previous call to beginShape() is written into the image buffer. The constant CLOSE as the value for the MODE parameter to close the shape (to connect the beginning and the end). ( end auto-generated )- Overrides:
endShapein classPGraphics- Parameters:
mode- use CLOSE to close the shape- See Also:
PShape,PGraphics.beginShape(int)
-
noClip
public void noClip()
Description copied from class:PGraphics( begin auto-generated from noClip.xml ) Disables the clipping previously started by the clip() function. ( end auto-generated )
-
bezierVertex
public void bezierVertex(float x1, float y1, float x2, float y2, float x3, float y3)- Overrides:
bezierVertexin classPGraphics
-
bezierVertex
public void bezierVertex(float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4)Description copied from class:PGraphics( begin auto-generated from bezierVertex.xml ) Specifies vertex coordinates for Bezier curves. Each call to bezierVertex() defines the position of two control points and one anchor point of a Bezier curve, adding a new segment to a line or shape. The first time bezierVertex() is used within a beginShape() call, it must be prefaced with a call to vertex() to set the first anchor point. This function must be used between beginShape() and endShape() and only when there is no MODE parameter specified to beginShape(). Using the 3D version requires rendering with P3D (see the Environment reference for more information). ( end auto-generated )- Overrides:
bezierVertexin classPGraphics- Parameters:
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 point- See Also:
PGraphics.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)
-
quadraticVertex
public void quadraticVertex(float ctrlX, float ctrlY, float endX, float endY)- Overrides:
quadraticVertexin classPGraphics- Parameters:
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 point- See Also:
PGraphics.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)
-
quadraticVertex
public void quadraticVertex(float x2, float y2, float z2, float x4, float y4, float z4)- Overrides:
quadraticVertexin classPGraphicsz2- the z-coordinate of the control pointz4- the z-coordinate of the anchor point
-
curveVertex
public void curveVertex(float x, float y, float z)- Overrides:
curveVertexin classPGraphicsz- the z-coordinate of the vertex
-
point
public void point(float x, float y)Description copied from class:PGraphics( begin auto-generated from point.xml ) Draws a point, a coordinate in space at the dimension of one pixel. The first parameter is the horizontal value for the point, the second value is the vertical value for the point, and the optional third value is the depth value. Drawing this shape in 3D with the z parameter requires the P3D parameter in combination with size() as shown in the above example. ( end auto-generated )
-
line
public void line(float x1, float y1, float x2, float y2)Description copied from class:PGraphics( begin auto-generated from line.xml ) Draws a line (a direct path between two points) to the screen. The version of line() with four parameters draws the line in 2D. To color a line, use the stroke() function. A line cannot be filled, therefore the fill() function will not affect the color of a line. 2D lines are drawn with a width of one pixel by default, but this can be changed with the strokeWeight() function. The version with six parameters allows the line to be placed anywhere within XYZ space. Drawing this shape in 3D with the z parameter requires the P3D parameter in combination with size() as shown in the above example. ( end auto-generated )- Overrides:
linein classPGraphics- Parameters:
x1- x-coordinate of the first pointy1- y-coordinate of the first pointx2- x-coordinate of the second pointy2- y-coordinate of the second point- See Also:
PGraphics.strokeWeight(float),PGraphics.strokeJoin(int),PGraphics.strokeCap(int),PGraphics.beginShape()
-
triangle
public void triangle(float x1, float y1, float x2, float y2, float x3, float y3)Description copied from class:PGraphics( begin auto-generated from triangle.xml ) A triangle is a plane created by connecting three points. The first two arguments specify the first point, the middle two arguments specify the second point, and the last two arguments specify the third point. ( end auto-generated )- Overrides:
trianglein classPGraphics- Parameters:
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 point- See Also:
PApplet.beginShape()
-
quad
public void quad(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)Description copied from class:PGraphics( begin auto-generated from quad.xml ) A quad is a quadrilateral, a four sided polygon. It is similar to a rectangle, but the angles between its edges are not constrained to ninety degrees. The first pair of parameters (x1,y1) sets the first vertex and the subsequent pairs should proceed clockwise or counter-clockwise around the defined shape. ( end auto-generated )- Overrides:
quadin classPGraphics- Parameters:
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 corner
-
box
public void box(float w, float h, float d)
-
sphere
public void sphere(float r)
Description copied from class:PGraphics( begin auto-generated from sphere.xml ) A sphere is a hollow ball made from tessellated triangles. ( end auto-generated )Advanced
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:
spherein classPGraphics- Parameters:
r- the radius of the sphere- See Also:
PGraphics.sphereDetail(int)
-
bezierDetail
public void bezierDetail(int detail)
Ignored (not needed) in Java 2D.- Overrides:
bezierDetailin classPGraphics- Parameters:
detail- resolution of the curves- See Also:
PGraphics.curve(float, float, float, float, float, float, float, float, float, float, float, float),PGraphics.curveVertex(float, float, float),PGraphics.curveTightness(float)
-
curveDetail
public void curveDetail(int detail)
Ignored (not needed) in Java 2D.- Overrides:
curveDetailin classPGraphics- Parameters:
detail- resolution of the curves- See Also:
PGraphics.curve(float, float, float, float, float, float, float, float, float, float, float, float),PGraphics.curveVertex(float, float),PGraphics.curveTightness(float)
-
loadShape
public PShape loadShape(java.lang.String filename, java.lang.String options)
-
textAscent
public float textAscent()
Description copied from class:PGraphics( begin auto-generated from textAscent.xml ) Returns ascent of the current font at its current size. This information is useful for determining the height of the font above the baseline. For example, adding the textAscent() and textDescent() values will give you the total height of the line. ( end auto-generated )- Overrides:
textAscentin classPGraphics- See Also:
PGraphics.textDescent()
-
textDescent
public float textDescent()
Description copied from class:PGraphics( begin auto-generated from textDescent.xml ) Returns descent of the current font at its current size. This information is useful for determining the height of the font below the baseline. For example, adding the textAscent() and textDescent() values will give you the total height of the line. ( end auto-generated )- Overrides:
textDescentin classPGraphics- See Also:
PGraphics.textAscent()
-
pushMatrix
public void pushMatrix()
Description copied from class:PGraphics( begin auto-generated from pushMatrix.xml ) Pushes the current transformation matrix onto the matrix stack. Understanding pushMatrix() and popMatrix() requires understanding the concept of a matrix stack. The pushMatrix() function saves the current coordinate system to the stack and popMatrix() restores the prior coordinate system. pushMatrix() and popMatrix() are used in conjuction with the other transformation functions and may be embedded to control the scope of the transformations. ( end auto-generated )
-
popMatrix
public void popMatrix()
Description copied from class:PGraphics( begin auto-generated from popMatrix.xml ) Pops the current transformation matrix off the matrix stack. Understanding pushing and popping requires understanding the concept of a matrix stack. The pushMatrix() function saves the current coordinate system to the stack and popMatrix() restores the prior coordinate system. pushMatrix() and popMatrix() are used in conjuction with the other transformation functions and may be embedded to control the scope of the transformations. ( end auto-generated )- Overrides:
popMatrixin classPGraphics- See Also:
PGraphics.pushMatrix()
-
translate
public void translate(float tx, float ty)Description copied from class:PGraphics( begin auto-generated from translate.xml ) Specifies an amount to displace objects within the display window. The x parameter specifies left/right translation, the y parameter specifies up/down translation, and the z parameter specifies translations toward/away from the screen. Using this function with the z parameter requires using P3D as a parameter in combination with size as shown in the above example. Transformations apply to everything that happens after and subsequent calls to the function accumulates the effect. For example, calling translate(50, 0) and then translate(20, 0) is the same as translate(70, 0). If translate() is called within draw(), the transformation is reset when the loop begins again. This function can be further controlled by the pushMatrix() and popMatrix(). ( end auto-generated )- Overrides:
translatein classPGraphics- Parameters:
tx- left/right translationty- up/down translation- See Also:
PGraphics.popMatrix(),PGraphics.pushMatrix(),PGraphics.rotate(float),PGraphics.rotateX(float),PGraphics.rotateY(float),PGraphics.rotateZ(float),PGraphics.scale(float, float, float)
-
rotate
public void rotate(float angle)
Description copied from class:PGraphics( begin auto-generated from rotate.xml ) Rotates a shape the amount specified by the angle parameter. Angles should be specified in radians (values from 0 to TWO_PI) or converted to radians with the radians() function.
Objects are always rotated around their relative position to the origin and positive numbers rotate objects in a clockwise direction. Transformations apply to everything that happens after and subsequent calls to the function accumulates the effect. For example, calling rotate(HALF_PI) and then rotate(HALF_PI) is the same as rotate(PI). All tranformations are reset when draw() begins again.
Technically, rotate() multiplies the current transformation matrix by a rotation matrix. This function can be further controlled by the pushMatrix() and popMatrix(). ( end auto-generated )- Overrides:
rotatein classPGraphics- Parameters:
angle- angle of rotation specified in radians- See Also:
PGraphics.popMatrix(),PGraphics.pushMatrix(),PGraphics.rotateX(float),PGraphics.rotateY(float),PGraphics.rotateZ(float),PGraphics.scale(float, float, float),PApplet.radians(float)
-
rotateX
public void rotateX(float angle)
Description copied from class:PGraphics( begin auto-generated from rotateX.xml ) Rotates a shape around the x-axis the amount specified by the angle parameter. Angles should be specified in radians (values from 0 to PI*2) or converted to radians with the radians() function. Objects are always rotated around their relative position to the origin and positive numbers rotate objects in a counterclockwise direction. Transformations apply to everything that happens after and subsequent calls to the function accumulates the effect. For example, calling rotateX(PI/2) and then rotateX(PI/2) is the same as rotateX(PI). If rotateX() is called within the draw(), the transformation is reset when the loop begins again. This function requires using P3D as a third parameter to size() as shown in the example above. ( end auto-generated )- Overrides:
rotateXin classPGraphics- Parameters:
angle- angle of rotation specified in radians- See Also:
PGraphics.popMatrix(),PGraphics.pushMatrix(),PGraphics.rotate(float),PGraphics.rotateY(float),PGraphics.rotateZ(float),PGraphics.scale(float, float, float),PGraphics.translate(float, float, float)
-
rotateY
public void rotateY(float angle)
Description copied from class:PGraphics( begin auto-generated from rotateY.xml ) Rotates a shape around the y-axis the amount specified by the angle parameter. Angles should be specified in radians (values from 0 to PI*2) or converted to radians with the radians() function. Objects are always rotated around their relative position to the origin and positive numbers rotate objects in a counterclockwise direction. Transformations apply to everything that happens after and subsequent calls to the function accumulates the effect. For example, calling rotateY(PI/2) and then rotateY(PI/2) is the same as rotateY(PI). If rotateY() is called within the draw(), the transformation is reset when the loop begins again. This function requires using P3D as a third parameter to size() as shown in the examples above. ( end auto-generated )- Overrides:
rotateYin classPGraphics- Parameters:
angle- angle of rotation specified in radians- See Also:
PGraphics.popMatrix(),PGraphics.pushMatrix(),PGraphics.rotate(float),PGraphics.rotateX(float),PGraphics.rotateZ(float),PGraphics.scale(float, float, float),PGraphics.translate(float, float, float)
-
rotateZ
public void rotateZ(float angle)
Description copied from class:PGraphics( begin auto-generated from rotateZ.xml ) Rotates a shape around the z-axis the amount specified by the angle parameter. Angles should be specified in radians (values from 0 to PI*2) or converted to radians with the radians() function. Objects are always rotated around their relative position to the origin and positive numbers rotate objects in a counterclockwise direction. Transformations apply to everything that happens after and subsequent calls to the function accumulates the effect. For example, calling rotateZ(PI/2) and then rotateZ(PI/2) is the same as rotateZ(PI). If rotateZ() is called within the draw(), the transformation is reset when the loop begins again. This function requires using P3D as a third parameter to size() as shown in the examples above. ( end auto-generated )- Overrides:
rotateZin classPGraphics- Parameters:
angle- angle of rotation specified in radians- See Also:
PGraphics.popMatrix(),PGraphics.pushMatrix(),PGraphics.rotate(float),PGraphics.rotateX(float),PGraphics.rotateY(float),PGraphics.scale(float, float, float),PGraphics.translate(float, float, float)
-
rotate
public void rotate(float angle, float vx, float vy, float vz)Description copied from class:PGraphicsAdvanced
Rotate about a vector in space. Same as the glRotatef() function.
-
scale
public void scale(float s)
Description copied from class:PGraphics( begin auto-generated from scale.xml ) Increases or decreases the size of a shape by expanding and contracting vertices. Objects always scale from their relative origin to the coordinate system. Scale values are specified as decimal percentages. For example, the function call scale(2.0) increases the dimension of a shape by 200%. Transformations apply to everything that happens after and subsequent calls to the function multiply the effect. For example, calling scale(2.0) and then scale(1.5) is the same as scale(3.0). If scale() is called within draw(), the transformation is reset when the loop begins again. Using this fuction with the z parameter requires using P3D as a parameter for size() as shown in the example above. This function can be further controlled by pushMatrix() and popMatrix(). ( end auto-generated )- Overrides:
scalein classPGraphics- Parameters:
s- percentage to scale the object- See Also:
PGraphics.pushMatrix(),PGraphics.popMatrix(),PGraphics.translate(float, float, float),PGraphics.rotate(float),PGraphics.rotateX(float),PGraphics.rotateY(float),PGraphics.rotateZ(float)
-
scale
public void scale(float sx, float sy)Description copied from class:PGraphicsAdvanced
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.
-
scale
public void scale(float sx, float sy, float sz)
-
shearX
public void shearX(float angle)
Description copied from class:PGraphics( begin auto-generated from shearX.xml ) Shears a shape around the x-axis the amount specified by the angle parameter. Angles should be specified in radians (values from 0 to PI*2) or converted to radians with the radians() function. Objects are always sheared around their relative position to the origin and positive numbers shear objects in a clockwise direction. Transformations apply to everything that happens after and subsequent calls to the function accumulates the effect. For example, calling shearX(PI/2) and then shearX(PI/2) is the same as shearX(PI). If shearX() is called within the draw(), the transformation is reset when the loop begins again.
Technically, shearX() multiplies the current transformation matrix by a rotation matrix. This function can be further controlled by the pushMatrix() and popMatrix() functions. ( end auto-generated )- Overrides:
shearXin classPGraphics- Parameters:
angle- angle of shear specified in radians- See Also:
PGraphics.popMatrix(),PGraphics.pushMatrix(),PGraphics.shearY(float),PGraphics.scale(float, float, float),PGraphics.translate(float, float, float),PApplet.radians(float)
-
shearY
public void shearY(float angle)
Description copied from class:PGraphics( begin auto-generated from shearY.xml ) Shears a shape around the y-axis the amount specified by the angle parameter. Angles should be specified in radians (values from 0 to PI*2) or converted to radians with the radians() function. Objects are always sheared around their relative position to the origin and positive numbers shear objects in a clockwise direction. Transformations apply to everything that happens after and subsequent calls to the function accumulates the effect. For example, calling shearY(PI/2) and then shearY(PI/2) is the same as shearY(PI). If shearY() is called within the draw(), the transformation is reset when the loop begins again.
Technically, shearY() multiplies the current transformation matrix by a rotation matrix. This function can be further controlled by the pushMatrix() and popMatrix() functions. ( end auto-generated )- Overrides:
shearYin classPGraphics- Parameters:
angle- angle of shear specified in radians- See Also:
PGraphics.popMatrix(),PGraphics.pushMatrix(),PGraphics.shearX(float),PGraphics.scale(float, float, float),PGraphics.translate(float, float, float),PApplet.radians(float)
-
resetMatrix
public void resetMatrix()
Description copied from class:PGraphics( begin auto-generated from resetMatrix.xml ) Replaces the current matrix with the identity matrix. The equivalent function in OpenGL is glLoadIdentity(). ( end auto-generated )- Overrides:
resetMatrixin classPGraphics- See Also:
PGraphics.pushMatrix(),PGraphics.popMatrix(),PGraphics.applyMatrix(PMatrix),PGraphics.printMatrix()
-
applyMatrix
public void applyMatrix(float n00, float n01, float n02, float n10, float n11, float n12)- Overrides:
applyMatrixin classPGraphics- Parameters:
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 multiplied
-
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)- Overrides:
applyMatrixin classPGraphicsn03- 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 multiplied
-
getMatrix
public PMatrix2D getMatrix(PMatrix2D target)
Description copied from class:PGraphicsCopy the current transformation matrix into the specified target. Pass in null to create a new matrix.
-
getMatrix
public PMatrix3D getMatrix(PMatrix3D target)
Description copied from class:PGraphicsCopy the current transformation matrix into the specified target. Pass in null to create a new matrix.
-
setMatrix
public void setMatrix(PMatrix2D source)
Description copied from class:PGraphicsSet the current transformation to the contents of the specified source.
-
setMatrix
public void setMatrix(PMatrix3D source)
Description copied from class:PGraphicsSet the current transformation to the contents of the specified source.
-
printMatrix
public void printMatrix()
Description copied from class:PGraphics( begin auto-generated from printMatrix.xml ) Prints the current matrix to the Console (the text window at the bottom of Processing). ( end auto-generated )- Overrides:
printMatrixin classPGraphics- See Also:
PGraphics.pushMatrix(),PGraphics.popMatrix(),PGraphics.resetMatrix(),PGraphics.applyMatrix(PMatrix)
-
screenX
public float screenX(float x, float y)Description copied from class:PGraphics( 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. ( end auto-generated )- Overrides:
screenXin classPGraphics- Parameters:
x- 3D x-coordinate to be mappedy- 3D y-coordinate to be mapped- See Also:
PGraphics.screenY(float, float, float),PGraphics.screenZ(float, float, float)
-
screenY
public float screenY(float x, float y)Description copied from class:PGraphics( 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. ( end auto-generated )- Overrides:
screenYin classPGraphics- Parameters:
x- 3D x-coordinate to be mappedy- 3D y-coordinate to be mapped- See Also:
PGraphics.screenX(float, float, float),PGraphics.screenZ(float, float, float)
-
screenX
public float screenX(float x, float y, float z)
-
screenY
public float screenY(float x, float y, float z)
-
screenZ
public float screenZ(float x, float y, float z)Description copied from class:PGraphics( 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. ( end auto-generated )- Overrides:
screenZin classPGraphics- Parameters:
x- 3D x-coordinate to be mappedy- 3D y-coordinate to be mappedz- 3D z-coordinate to be mapped- See Also:
PGraphics.screenX(float, float, float),PGraphics.screenY(float, float, float)
-
strokeCap
public void strokeCap(int cap)
Description copied from class:PGraphics( begin auto-generated from strokeCap.xml ) Sets the style for rendering line endings. These ends are either squared, extended, or rounded and specified with the corresponding parameters SQUARE, PROJECT, and ROUND. The default cap is ROUND.
This function is not available with the P3D renderer (see Issue 123). More information about the renderers can be found in the size() reference. ( end auto-generated )- Overrides:
strokeCapin classPGraphics- Parameters:
cap- either SQUARE, PROJECT, or ROUND- See Also:
PGraphics.stroke(int, float),PGraphics.strokeWeight(float),PGraphics.strokeJoin(int),PApplet.size(int, int, String, String)
-
strokeJoin
public void strokeJoin(int join)
Description copied from class:PGraphics( begin auto-generated from strokeJoin.xml ) Sets the style of the joints which connect line segments. These joints are either mitered, beveled, or rounded and specified with the corresponding parameters MITER, BEVEL, and ROUND. The default joint is MITER.
This function is not available with the P3D renderer, (see Issue 123). More information about the renderers can be found in the size() reference. ( end auto-generated )- Overrides:
strokeJoinin classPGraphics- Parameters:
join- either MITER, BEVEL, ROUND- See Also:
PGraphics.stroke(int, float),PGraphics.strokeWeight(float),PGraphics.strokeCap(int)
-
strokeWeight
public void strokeWeight(float weight)
Description copied from class:PGraphics( begin auto-generated from strokeWeight.xml ) Sets the width of the stroke used for lines, points, and the border around shapes. All widths are set in units of pixels.
When drawing with P3D, series of connected lines (such as the stroke around a polygon, triangle, or ellipse) produce unattractive results when a thick stroke weight is set (see Issue 123). With P3D, the minimum and maximum values for strokeWeight() are controlled by the graphics card and the operating system's OpenGL implementation. For instance, the thickness may not go higher than 10 pixels. ( end auto-generated )- Overrides:
strokeWeightin classPGraphics- Parameters:
weight- the weight (in pixels) of the stroke- See Also:
PGraphics.stroke(int, float),PGraphics.strokeJoin(int),PGraphics.strokeCap(int)
-
backgroundImpl
public void backgroundImpl()
Description copied from class:PGraphicsActual 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:PGraphicsRecord individual lines and triangles by echoing them to another renderer.
-
loadPixels
public void loadPixels()
Description copied from class:PImage( begin auto-generated from PImage_loadPixels.xml ) Loads the pixel data for the image into its pixels[] array. This function must always be called before reading from or writing to pixels[].
renderers may or may not seem to require loadPixels() or updatePixels(). However, the rule is that any time you want to manipulate the pixels[] array, you must first call loadPixels(), and after changes have been made, call updatePixels(). Even if the renderer may not seem to use this function in the current Processing release, this will always be subject to change. ( end auto-generated )Advanced
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:
loadPixelsin classPImage
-
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:
updatePixelsin classPImage- Parameters:
x- x-coordinate of the upper-left cornery- y-coordinate of the upper-left cornerc- widthd- height
-
get
public int get(int x, int y)Description copied from class:PImage( begin auto-generated from PImage_get.xml ) Reads the color of any pixel or grabs a section of an image. If no parameters are specified, the entire image is returned. Use the x and y parameters to get the value of one pixel. Get a section of the display window by specifying an additional width and height parameter. When getting an image, the x and y parameters define the coordinates for the upper-left corner of the image, regardless of the current imageMode().
If the pixel requested is outside of the image window, black is returned. The numbers returned are scaled according to the current color ranges, but only RGB values are returned by this function. For example, even though you may have drawn a shape with colorMode(HSB), the numbers returned will be in RGB format.
Getting the color of a single pixel with get(x, y) is easy, but not as fast as grabbing the data directly from pixels[]. The equivalent statement to get(x, y) using pixels[] is pixels[y*width+x]. See the reference for pixels[] for more information. ( end auto-generated )Advanced
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:
getin classPImage- Parameters:
x- x-coordinate of the pixely- y-coordinate of the pixel- See Also:
PApplet.set(int, int, int),PApplet.pixels,PApplet.copy(PImage, int, int, int, int, int, int, int, int)
-
get
public PImage get()
Description copied from class:PImageReturns a copy of this PImage. Equivalent to get(0, 0, width, height). Deprecated, just use copy() instead.
-
set
public void set(int x, int y, int argb)Description copied from class:PImage( 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. The color parameter is affected by the current color mode (the default is RGB values from 0 to 255). When setting an image, the x and y parameters define the coordinates for the upper-left corner of the image, regardless of the current imageMode().
Setting the color of a single pixel with set(x, y) is easy, but not as fast as putting the data directly into pixels[]. The equivalent statement to set(x, y, #000000) using pixels[] is pixels[y*width+x] = #000000. See the reference for pixels[] for more information. ( end auto-generated )- Overrides:
setin classPImage- Parameters:
x- x-coordinate of the pixely- y-coordinate of the pixelargb- any value of the color datatype- See Also:
PImage.get(int, int, int, int),PImage.pixels,PImage.copy(PImage, int, int, int, int, int, int, int, int)
-
mask
public void mask(PImage alpha)
Description copied from class:PImage( 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. This mask image should only contain grayscale data, but only the blue color channel is used. The mask image needs to be the same size as the image to which it is applied.
In addition to using a mask image, an integer array containing the alpha channel data can be specified directly. This method is useful for creating dynamically generated alpha masks. This array must be of the same length as the target image's pixels array and should contain only grayscale data of values between 0-255. ( end auto-generated )Advanced
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" grayscale by performing a proper luminance-based conversion.
-
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( begin auto-generated from PImage_copy.xml ) Copies a region of pixels from one image into another. If the source and destination regions aren't the same size, it will automatically resize source pixels to fit the specified target region. No alpha information is used in the process, however if the source image has an alpha channel set, it will be copied as well.
As of release 0149, this function ignores imageMode(). ( end auto-generated )- Overrides:
copyin classPImage- Parameters:
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 height- See Also:
PGraphics.alpha(int),PImage.blend(PImage, int, int, int, int, int, int, int, int, int)
-
-
DataMelt 3.0 © DataMelt by jWork.ORG