diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index 8b3500c2c..960a1fe23 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -1220,7 +1220,7 @@ public class PApplet extends Applet /** * ( begin auto-generated from createGraphics.xml ) * - * Creates and returns a new PGraphics object of the types P2D, P3D, and JAVA2D. Use this class if you need to draw into an off-screen graphics buffer. It's not possible to use createGraphics() with OPENGL, because it doesn't allow offscreen use. The PDF renderer requires the filename parameter. The DXF renderer should not be used with createGraphics(), it's only built for use with beginRaw() and endRaw(). + * Oy2. Creates and returns a new PGraphics object of the types P2D, P3D, and JAVA2D. Use this class if you need to draw into an off-screen graphics buffer. It's not possible to use createGraphics() with OPENGL, because it doesn't allow offscreen use. The PDF renderer requires the filename parameter. The DXF renderer should not be used with createGraphics(), it's only built for use with beginRaw() and endRaw(). *

* It's important to call any drawing commands between beginDraw() and endDraw() statements. This is also true for any commands that affect drawing, such as smooth() or colorMode(). *

@@ -7798,6 +7798,7 @@ public class PApplet extends Applet /** * ( begin auto-generated from unbinary.xml ) * + * Converts a String representation of a binary number to its equivalent integer value. For example, unbinary("00001000") will return 8. * * ( end auto-generated ) * @webref data:conversion @@ -8634,22 +8635,32 @@ public class PApplet extends Applet /** + * ( 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 OpenGL. 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 OpenGL 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 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 OPENGL renderer setting by not checking for errors while running. Undo with hint(ENABLE_OPENGL_ERROR_REPORT). - *

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. - * + *

+ * hint(ENABLE_OPENGL_4X_SMOOTH) - Enable 4x anti-aliasing for OpenGL. 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 OpenGL 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 OPENGL renderer setting by not checking for errors while running. Undo with hint(ENABLE_OPENGL_ERROR_REPORT). + *

+ * + * 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 ) * @webref rendering * @param which name of the hint to be enabled or disabled - * - * @see processing.core.PGraphics - * @see processing.core.PApplet#createGraphics(int, int, String, String) - * @see processing.core.PApplet#size(int, int) + * @see PGraphics + * @see PApplet#createGraphics(int, int, String, String) + * @see PApplet#size(int, int) */ public void hint(int which) { if (recorder != null) recorder.hint(which); @@ -8672,26 +8683,21 @@ public class PApplet extends Applet /** - * 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. + * ( 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 P2D, P3D, and OPENGL renderer settings allow stroke() and fill() settings to be altered per-vertex, however the default JAVA2D 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 ) + * @webref shape:vertex + * @param kind either POINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, QUAD_STRIP + * @see PGraphics#endShape() + * @see PGraphics#vertex() + * @see PGraphics#curveVertex() + * @see PGraphics#bezierVertex() */ public void beginShape(int kind) { if (recorder != null) recorder.beginShape(kind); @@ -8710,19 +8716,18 @@ public class PApplet extends Applet /** - * Sets the current normal vector. Only applies with 3D rendering - * and inside a beginShape/endShape block. - *

- * This is for drawing three dimensional shapes and surfaces, - * allowing you to specify a vector perpendicular to the surface - * of the shape, which determines how lighting affects it. - *

- * For the most part, PGraphics3D will attempt to automatically - * assign normals to shapes, but since that's imperfect, - * this is a better option when you want more control. - *

- * For people familiar with OpenGL, this function is basically - * identical to glNormal3f(). + * ( begin auto-generated from normal.xml ) + * + * Sets the current normal vector. This is for drawing three dimensional shapes and surfaces and specifies a vector perpendicular to the surface of the shape which determines how lighting affects it. Processing attempts to automatically assign normals to shapes, but since that's imperfect, this is a better option when you want more control. This function is identical to glNormal3f() in OpenGL. + * + * ( end auto-generated ) + * @webref lights_camera:lights + * @param nx x direction + * @param ny y direction + * @param nz z direction + * @see PGraphics#beginShape(int) + * @see PGraphics#endShape(int) + * @see PGraphics#lights() */ public void normal(float nx, float ny, float nz) { if (recorder != null) recorder.normal(nx, ny, nz); @@ -8731,8 +8736,14 @@ public class PApplet extends Applet /** - * Set texture mode to either to use coordinates based on the IMAGE - * (more intuitive for new users) or NORMALIZED (better for advanced chaps) + * ( begin auto-generated from textureMode.xml ) + * + * Sets the coordinate space for texture mapping. There are two options, IMAGE, which refers to the actual coordinates of the image, and NORMALIZED, which refers to a normalized space of values ranging from 0 to 1. The default mode is IMAGE. In IMAGE, if an image is 100 x 200 pixels, mapping the image onto the entire size of a quad would require the points (0,0) (0,100) (100,200) (0,200). The same mapping in NORMAL_SPACE is (0,0) (0,1) (1,1) (0,1). + * + * ( end auto-generated ) + * @webref shape:vertex + * @param mode either IMAGE or NORMALIZED + * @see PGraphics#texture(PImage) */ public void textureMode(int mode) { if (recorder != null) recorder.textureMode(mode); @@ -8741,8 +8752,19 @@ public class PApplet extends Applet /** - * Set texture image for current shape. - * Needs to be called between @see beginShape and @see endShape + * ( 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 ) + * @webref shape:vertex + * @param image the texture to apply + * @see PGraphics#textureMode(int) + * @see PGraphics#beginShape(int) + * @see PGraphics#endShape(int) + * @see PGraphics#vertex(float, float, float, float, float) * * @param image reference to a PImage object */ @@ -8754,7 +8776,7 @@ public class PApplet extends Applet /** * Removes texture image for current shape. - * Needs to be called between @see beginShape and @see endShape + * Needs to be called between beginShape and endShape * */ public void noTexture() { @@ -8792,6 +8814,24 @@ public class PApplet extends Applet } +/** + * ( 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 or OPENGL 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 ) + * @webref shape:vertex + * @param x x-coordinate of the vertex + * @param y y-coordinate of the vertex + * @param z z-coordinate of the vertex + * @param u horizontal coordinate for the texture mapping + * @param v vertical coordinate for the texture mapping + * @see PGraphics#beginShape(int) + * @see PGraphics#endShape(int) + * @see PGraphics#bezierVertex(float, float, float, float, float, float, float, float, float) + * @see PGraphics#curveVertex(float, float, float) + * @see PGraphics#texture(PImage) + */ public void vertex(float x, float y, float z, float u, float v) { if (recorder != null) recorder.vertex(x, y, z, u, v); g.vertex(x, y, z, u, v); @@ -8811,6 +8851,16 @@ public class PApplet extends Applet } +/** + * ( 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 ) + * @webref shape:vertex + * @param mode use CLOSE to close the shape + * @see PGraphics#beginShape(int) + */ public void endShape(int mode) { if (recorder != null) recorder.endShape(mode); g.endShape(mode); @@ -8825,6 +8875,26 @@ public class PApplet extends Applet } +/** + * ( 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 of requires rendering with P3D or OPENGL (see the Environment reference for more information). + * + * ( end auto-generated ) + * @webref shape:vertex + * @param x2 the x-coordinate of the 1st control point + * @param y2 the y-coordinate of the 1st control point + * @param z2 the z-coordinate of the 1st control point + * @param x3 the x-coordinate of the 2nd control point + * @param y3 the y-coordinate of the 2nd control point + * @param z3 the z-coordinate of the 2nd control point + * @param x4 the x-coordinate of the anchor point + * @param y4 the y-coordinate of the anchor point + * @param z4 the z-coordinate of the anchor point + * @see PGraphics#curveVertex(float, float, float) + * @see PGraphics#vertex(float, float, float, float, float) + * @see PGraphics#bezier(float, float, float, float, float, float, float, float, float, float, float, float) + */ public void bezierVertex(float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4) { @@ -8853,6 +8923,22 @@ public class PApplet extends Applet } +/** + * ( begin auto-generated from curveVertex.xml ) + * + * Specifies vertex coordinates for curves. This function may only be used between beginShape() and endShape() and only when there is no MODE parameter specified to beginShape(). The first and last points in a series of curveVertex() lines will be used to guide the beginning and end of a the curve. A minimum of four points is required to draw a tiny curve between the second and third points. Adding a fifth point with curveVertex() will draw the curve between the second, third, and fourth points. The curveVertex() function is an implementation of Catmull-Rom splines. Using the 3D version of requires rendering with P3D or OPENGL (see the Environment reference for more information). + * + * ( end auto-generated ) + * @webref shape:vertex + * @param x the x-coordinate of the vertex + * @param y the y-coordinate of the vertex + * @param z the z-coordinate of the vertex + * @see PGraphics#curve(float, float, float, float, float, float, float, float, float, float, float, float) + * @see PGraphics#beginShape(int) + * @see PGraphics#endShape(int) + * @see PGraphics#vertex(float, float, float, float, float) + * @see PGraphics#bezier(float, float, float, float, float, float, float, float, float, float, float, float) + */ public void curveVertex(float x, float y, float z) { if (recorder != null) recorder.curveVertex(x, y, z); g.curveVertex(x, y, z); @@ -8866,23 +8952,18 @@ public class PApplet extends Applet /** - * 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 using the z - * parameter requires the P3D or OPENGL parameter in combination with - * size as shown in the above example. - *

Due to what appears to be a bug in Apple's Java implementation, - * the point() and set() methods are extremely slow in some circumstances - * when used with the default renderer. Using P2D or P3D will fix the - * problem. Grouping many calls to point() or set() together can also - * help. (Bug 1094) + * ( 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 using the z parameter requires the P3D or OPENGL parameter in combination with size as shown in the above example. + *

+ * Due to what appears to be a bug in Apple's Java implementation, the point() and set() methods are extremely slow in some circumstances when used with the default renderer. Using P2D or P3D will fix the problem. Grouping many calls to point() or set() together can also help. (Bug 1094) + * + * ( end auto-generated ) * * @webref shape:2d_primitives * @param x x-coordinate of the point * @param y y-coordinate of the point * @param z z-coordinate of the point - * * @see PGraphics#beginShape() */ public void point(float x, float y, float z) { @@ -8898,17 +8979,11 @@ public class PApplet extends Applet /** - * 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() method 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 using the z parameter - * requires the P3D or OPENGL parameter in combination with size as shown - * in the above example. - * + * ( 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() method 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 using the z parameter requires the P3D or OPENGL parameter in combination with size as shown in the above example. + * + * ( end auto-generated ) * @webref shape:2d_primitives * @param x1 x-coordinate of the first point * @param y1 y-coordinate of the first point @@ -8916,7 +8991,6 @@ public class PApplet extends Applet * @param x2 x-coordinate of the second point * @param y2 y-coordinate of the second point * @param z2 z-coordinate of the second point - * * @see PGraphics#strokeWeight(float) * @see PGraphics#strokeJoin(int) * @see PGraphics#strokeCap(int) @@ -8930,10 +9004,11 @@ public class PApplet extends Applet /** - * 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. - * + * ( 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 ) * @webref shape:2d_primitives * @param x1 x-coordinate of the first point * @param y1 y-coordinate of the first point @@ -8941,7 +9016,6 @@ public class PApplet extends Applet * @param y2 y-coordinate of the second point * @param x3 x-coordinate of the third point * @param y3 y-coordinate of the third point - * * @see PApplet#beginShape() */ public void triangle(float x1, float y1, float x2, float y2, @@ -8952,12 +9026,11 @@ public class PApplet extends Applet /** - * A quad is a quadrilateral, a four sided polygon. It is similar to - * a rectangle, but the angles between its edges are not constrained - * 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. - * + * ( 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 ) * @webref shape:2d_primitives * @param x1 x-coordinate of the first corner * @param y1 y-coordinate of the first corner @@ -8967,7 +9040,6 @@ public class PApplet extends Applet * @param y3 y-coordinate of the third corner * @param x4 x-coordinate of the fourth corner * @param y4 y-coordinate of the fourth corner - * */ public void quad(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) { @@ -8976,6 +9048,16 @@ public class PApplet extends Applet } + /** + * ( begin auto-generated from rectMode.xml ) + * + * Modifies the location from which rectangles draw. The default mode is rectMode(CORNER), which specifies the location to be the upper left corner of the shape and uses the third and fourth parameters of rect() to specify the width and height. The syntax rectMode(CORNERS) uses the first and second parameters of rect() to set the location of one corner and uses the third and fourth parameters to set the opposite corner. The syntax rectMode(CENTER) draws the image from its center point and uses the third and forth parameters of rect() to specify the image's width and height. The syntax rectMode(RADIUS) draws the image from its center point and uses the third and forth parameters of rect() to specify half of the image's width and height. The parameter must be written in ALL CAPS because Processing is a case sensitive language. Note: In version 125, the mode named CENTER_RADIUS was shortened to RADIUS. + * + * ( end auto-generated ) + * @webref shape:attributes + * @param mode either CORNER, CORNERS, CENTER, or RADIUS + * @see PGraphics#rect(float, float, float, float) + */ public void rectMode(int mode) { if (recorder != null) recorder.rectMode(mode); g.rectMode(mode); @@ -8983,17 +9065,16 @@ public class PApplet extends Applet /** - * Draws a rectangle to the screen. A rectangle is a four-sided shape with - * every angle at ninety degrees. The first two parameters set the location, - * the third sets the width, and the fourth sets the height. The origin is - * changed with the rectMode() function. - * + * ( begin auto-generated from rect.xml ) + * + * Draws a rectangle to the screen. A rectangle is a four-sided shape with every angle at ninety degrees. By default, the first two parameters set the location of the upper-left corner, the third sets the width, and the fourth sets the height. These parameters may be changed with the rectMode() function. + * + * ( end auto-generated ) * @webref shape:2d_primitives * @param a x-coordinate of the rectangle * @param b y-coordinate of the rectangle * @param c width of the rectangle * @param d height of the rectangle - * * @see PGraphics#rectMode(int) * @see PGraphics#quad(float, float, float, float, float, float, float, float) */ @@ -9003,6 +9084,7 @@ public class PApplet extends Applet } +/** ??? */ public void rect(float a, float b, float c, float d, float r) { if (recorder != null) recorder.rect(a, b, c, d, r); g.rect(a, b, c, d, r); @@ -9017,20 +9099,13 @@ public class PApplet extends Applet /** - * The origin of the ellipse is modified by the ellipseMode() - * function. The default configuration is ellipseMode(CENTER), - * which specifies the location of the ellipse as the center of the shape. - * The RADIUS mode is the same, but the width and height parameters to - * ellipse() specify the radius of the ellipse, rather than the - * diameter. The CORNER mode draws the shape from the upper-left corner - * of its bounding box. The CORNERS mode uses the four parameters to - * ellipse() to set two opposing corners of the ellipse's bounding - * box. The parameter must be written in "ALL CAPS" because Processing - * syntax is case sensitive. - * + * ( begin auto-generated from ellipseMode.xml ) + * + * The origin of the ellipse is modified by the ellipseMode() function. The default configuration is ellipseMode(CENTER), which specifies the location of the ellipse as the center of the shape. The RADIUS mode is the same, but the width and height parameters to ellipse() specify the radius of the ellipse, rather than the diameter. The CORNER mode draws the shape from the upper-left corner of its bounding box. The CORNERS mode uses the four parameters to ellipse() to set two opposing corners of the ellipse's bounding box. The parameter must be written in "ALL CAPS" because Processing is a case sensitive language. + * + * ( end auto-generated ) * @webref shape:attributes - * - * @param mode Either CENTER, RADIUS, CORNER, or CORNERS. + * @param mode either CENTER, RADIUS, CORNER, or CORNERS * @see PApplet#ellipse(float, float, float, float) */ public void ellipseMode(int mode) { @@ -9040,17 +9115,16 @@ public class PApplet extends Applet /** - * Draws an ellipse (oval) in the display window. An ellipse with an equal - * width and height is a circle. The first two parameters set - * the location, the third sets the width, and the fourth sets the height. - * The origin may be changed with the ellipseMode() function. - * + * ( begin auto-generated from ellipse.xml ) + * + * Draws an ellipse (oval) in the display window. An ellipse with an equal width and height is a circle. The first two parameters set the location, the third sets the width, and the fourth sets the height. The origin may be changed with the ellipseMode() function. + * + * ( end auto-generated ) * @webref shape:2d_primitives * @param a x-coordinate of the ellipse * @param b y-coordinate of the ellipse * @param c width of the ellipse * @param d height of the ellipse - * * @see PApplet#ellipseMode(int) */ public void ellipse(float a, float b, float c, float d) { @@ -9060,14 +9134,11 @@ public class PApplet extends Applet /** - * Draws an arc in the display window. - * Arcs are drawn along the outer edge of an ellipse defined by the - * x, y, width and height parameters. - * The origin or the arc's ellipse may be changed with the - * ellipseMode() function. - * The start and stop parameters specify the angles - * at which to draw the arc. - * + * ( begin auto-generated from arc.xml ) + * + * Draws an arc in the display window. Arcs are drawn along the outer edge of an ellipse defined by the x, y, width and height parameters. The origin or the arc's ellipse may be changed with the ellipseMode() function. The start and stop parameters specify the angles at which to draw the arc. + * + * ( end auto-generated ) * @webref shape:2d_primitives * @param a x-coordinate of the arc's ellipse * @param b y-coordinate of the arc's ellipse @@ -9075,7 +9146,6 @@ public class PApplet extends Applet * @param d height of the arc's ellipse * @param start angle to start the arc, specified in radians * @param stop angle to stop the arc, specified in radians - * * @see PGraphics#ellipseMode(int) * @see PGraphics#ellipse(float, float, float, float) */ @@ -9096,15 +9166,16 @@ public class PApplet extends Applet /** - * A box is an extruded rectangle. A box with equal dimension - * on all sides is a cube. - * + * ( begin auto-generated from box.xml ) + * + * A box is an extruded rectangle. A box with equal dimension on all sides is a cube. + * + * ( end auto-generated ) * @webref shape:3d_primitives * @param w dimension of the box in the x-dimension * @param h dimension of the box in the y-dimension * @param d dimension of the box in the z-dimension - * - * @see PApplet#sphere(float) + * @see PGraphics#sphere(float) */ public void box(float w, float h, float d) { if (recorder != null) recorder.box(w, h, d); @@ -9122,29 +9193,18 @@ public class PApplet extends Applet /** - * Controls the detail used to render a sphere by adjusting the number of - * vertices of the sphere mesh. The default resolution is 30, which creates - * a fairly detailed sphere definition with vertices every 360/30 = 12 - * degrees. If you're going to render a great number of spheres per frame, - * it is advised to reduce the level of detail using this function. - * The setting stays active until sphereDetail() is called again with - * a new parameter and so should not be called prior to every - * sphere() statement, unless you wish to render spheres with - * different settings, e.g. using less detail for smaller spheres or ones - * further away from the camera. To control the detail of the horizontal - * and vertical resolution independently, use the version of the functions - * with two parameters. - * + * ( begin auto-generated from sphereDetail.xml ) + * + * Controls the detail used to render a sphere by adjusting the number of vertices of the sphere mesh. The default resolution is 30, which creates a fairly detailed sphere definition with vertices every 360/30 = 12 degrees. If you're going to render a great number of spheres per frame, it is advised to reduce the level of detail using this function. The setting stays active until sphereDetail() is called again with a new parameter and so should not be called prior to every sphere() statement, unless you wish to render spheres with different settings, e.g. using less detail for smaller spheres or ones further away from the camera. To control the detail of the horizontal and vertical resolution independently, use the version of the functions with two parameters. + * + * ( end auto-generated ) *

Advanced

* Code for sphereDetail() submitted by toxi [031031]. * Code for enhanced u/v version from davbol [080801]. * * @webref shape:3d_primitives - * @param ures number of segments used horizontally (longitudinally) - * per full circle revolution - * @param vres number of segments used vertically (latitudinally) - * from top to bottom - * + * @param ures number of segments used longitudinally per full circle revolutoin + * @param vres number of segments used latitudinally from top to bottom * @see PGraphics#sphere(float) */ /** @@ -9159,8 +9219,11 @@ public class PApplet extends Applet /** - * Draw a sphere with radius r centered at coordinate 0, 0, 0. + * ( begin auto-generated from sphere.xml ) + * * A sphere is a hollow ball made from tessellated triangles. + * + * ( end auto-generated ) *

Advanced

*

* Implementation notes: @@ -9192,12 +9255,11 @@ public class PApplet extends Applet /** - * Evalutes quadratic bezier at point t for points a, b, c, d. - * The parameter t varies between 0 and 1. The a and d parameters are the - * on-curve points, b and c are the control points. To make a two-dimensional - * curve, call this function once with the x coordinates and a second time - * with the y coordinates to get the location of a bezier curve at t. - * + * ( begin auto-generated from bezierPoint.xml ) + * + * Evaluates the Bezier at point t for points a, b, c, d. The parameter t varies between 0 and 1, a and d are points on the curve, and b and c are the control points. This can be done once with the x coordinates and a second time with the y coordinates to get the location of a bezier curve at t. + * + * ( end auto-generated ) *

Advanced

* For instance, to convert the following example:
    * stroke(255, 102, 0);
@@ -9225,7 +9287,6 @@ public class PApplet extends Applet
    * @param c coordinate of second control point
    * @param d coordinate of second point on the curve
    * @param t value between 0 and 1
-   *
    * @see PGraphics#bezier(float, float, float, float, float, float, float, float, float, float, float, float)
    * @see PGraphics#bezierVertex(float, float, float, float, float, float)
    * @see PGraphics#curvePoint(float, float, float, float, float)
@@ -9236,9 +9297,11 @@ public class PApplet extends Applet
 
 
   /**
-   * Calculates the tangent of a point on a Bezier curve. There is a good
-   * definition of "tangent" at Wikipedia: http://en.wikipedia.org/wiki/Tangent
-   *
+   * ( begin auto-generated from bezierTangent.xml )
+   * 
+   * Calculates the tangent of a point on a Bezier curve. There is a good definition of "tangent" at Wikipedia: http://en.wikipedia.org/wiki/Tangent
+   * 
+   * ( end auto-generated )
    * 

Advanced

* Code submitted by Dave Bollinger (davol) for release 0136. * @@ -9248,7 +9311,6 @@ public class PApplet extends Applet * @param c coordinate of second control point * @param d coordinate of second point on the curve * @param t value between 0 and 1 - * * @see PGraphics#bezier(float, float, float, float, float, float, float, float, float, float, float, float) * @see PGraphics#bezierVertex(float, float, float, float, float, float) * @see PGraphics#curvePoint(float, float, float, float, float) @@ -9259,14 +9321,16 @@ public class PApplet extends Applet /** + * ( begin auto-generated from bezierDetail.xml ) + * * Sets the resolution at which Beziers display. The default value is 20. This function is only useful when using the P3D or OPENGL renderer as the default (JAVA2D) renderer does not use this information. - * + * + * ( end auto-generated ) * @webref shape:curves * @param detail resolution of the curves - * - * @see PApplet#curve(float, float, float, float, float, float, float, float, float, float, float, float) - * @see PApplet#curveVertex(float, float) - * @see PApplet#curveTightness(float) + * @see PGraphics#curve(float, float, float, float, float, float, float, float, float, float, float, float) + * @see PGraphics#curveVertex(float, float, float) + * @see PGraphics#curveTightness(float) */ public void bezierDetail(int detail) { if (recorder != null) recorder.bezierDetail(detail); @@ -9274,15 +9338,21 @@ public class PApplet extends Applet } + public void bezier(float x1, float y1, + float x2, float y2, + float x3, float y3, + float x4, float y4) { + if (recorder != null) recorder.bezier(x1, y1, x2, y2, x3, y3, x4, y4); + g.bezier(x1, y1, x2, y2, x3, y3, x4, y4); + } + + /** - * Draws a Bezier curve on the screen. These curves are defined by a series - * of anchor and control points. The first two parameters specify the first - * anchor point and the last two parameters specify the other anchor point. - * The middle parameters specify the control points which define the shape - * of the curve. Bezier curves were developed by French engineer Pierre - * Bezier. Using the 3D version of requires rendering with P3D or OPENGL - * (see the Environment reference for more information). - * + * ( begin auto-generated from bezier.xml ) + * + * Draws a Bezier curve on the screen. These curves are defined by a series of anchor and control points. The first two parameters specify the first anchor point and the last two parameters specify the other anchor point. The middle parameters specify the control points which define the shape of the curve. Bezier curves were developed by French engineer Pierre Bezier. Using the 3D version of requires rendering with P3D or OPENGL (see the Environment reference for more information). + * + * ( end auto-generated ) *

Advanced

* Draw a cubic bezier curve. The first and last points are * the on-curve points. The middle two are the 'control' points, @@ -9323,15 +9393,6 @@ public class PApplet extends Applet * @see PGraphics#bezierVertex(float, float, float, float, float, float) * @see PGraphics#curve(float, float, float, float, float, float, float, float, float, float, float, float) */ - public void bezier(float x1, float y1, - float x2, float y2, - float x3, float y3, - float x4, float y4) { - if (recorder != null) recorder.bezier(x1, y1, x2, y2, x3, y3, x4, y4); - g.bezier(x1, y1, x2, y2, x3, y3, x4, y4); - } - - public void bezier(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, @@ -9341,20 +9402,18 @@ public class PApplet extends Applet } - /** - * Evalutes the Catmull-Rom curve at point t for points a, b, c, d. The - * parameter t varies between 0 and 1, a and d are points on the curve, - * and b and c are the control points. This can be done once with the x - * coordinates and a second time with the y coordinates to get the - * location of a curve at t. - * + /* + * ( begin auto-generated from curvePoint.xml ) + * + * Evalutes the curve at point t for points a, b, c, d. The parameter t varies between 0 and 1, a and d are points on the curve, and b and c are the control points. This can be done once with the x coordinates and a second time with the y coordinates to get the location of a curve at t. + * + * ( end auto-generated ) * @webref shape:curves * @param a coordinate of first point on the curve * @param b coordinate of second point on the curve * @param c coordinate of third point on the curve * @param d coordinate of fourth point on the curve * @param t value between 0 and 1 - * * @see PGraphics#curve(float, float, float, float, float, float, float, float, float, float, float, float) * @see PGraphics#curveVertex(float, float) * @see PGraphics#bezierPoint(float, float, float, float, float) @@ -9365,8 +9424,11 @@ public class PApplet extends Applet /** - * Calculates the tangent of a point on a Catmull-Rom curve. There is a good definition of "tangent" at Wikipedia: http://en.wikipedia.org/wiki/Tangent. - * + * ( begin auto-generated from curveTangent.xml ) + * + * Calculates the tangent of a point on a curve. There is a good definition of "tangent" at Wikipedia: http://en.wikipedia.org/wiki/Tangent + * + * ( end auto-generated ) *

Advanced

* Code thanks to Dave Bollinger (Bug #715) * @@ -9376,7 +9438,6 @@ public class PApplet extends Applet * @param c coordinate of second control point * @param d coordinate of second point on the curve * @param t value between 0 and 1 - * * @see PGraphics#curve(float, float, float, float, float, float, float, float, float, float, float, float) * @see PGraphics#curveVertex(float, float) * @see PGraphics#curvePoint(float, float, float, float, float) @@ -9388,13 +9449,13 @@ public class PApplet extends Applet /** - * Sets the resolution at which curves display. The default value is 20. - * This function is only useful when using the P3D or OPENGL renderer as - * the default (JAVA2D) renderer does not use this information. - * + * ( begin auto-generated from curveDetail.xml ) + * + * Sets the resolution at which curves display. The default value is 20. This function is only useful when using the P3D or OPENGL renderer as the default (JAVA2D) renderer does not use this information. + * + * ( end auto-generated ) * @webref shape:curves * @param detail resolution of the curves - * * @see PGraphics#curve(float, float, float, float, float, float, float, float, float, float, float, float) * @see PGraphics#curveVertex(float, float) * @see PGraphics#curveTightness(float) @@ -9406,21 +9467,15 @@ public class PApplet extends Applet /** - * Modifies the quality of forms created with curve() and - *curveVertex(). The parameter squishy determines how the - * curve fits to the vertex points. The value 0.0 is the default value for - * squishy (this value defines the curves to be Catmull-Rom splines) - * and the value 1.0 connects all the points with straight lines. - * Values within the range -5.0 and 5.0 will deform the curves but - * will leave them recognizable and as values increase in magnitude, - * they will continue to deform. - * + * ( begin auto-generated from curveTightness.xml ) + * + * Modifies the quality of forms created with curve() and curveVertex(). The parameter squishy determines how the curve fits to the vertex points. The value 0.0 is the default value for squishy (this value defines the curves to be Catmull-Rom splines) and the value 1.0 connects all the points with straight lines. Values within the range -5.0 and 5.0 will deform the curves but will leave them recognizable and as values increase in magnitude, they will continue to deform. + * + * ( end auto-generated ) * @webref shape:curves * @param tightness amount of deformation from the original vertices - * * @see PGraphics#curve(float, float, float, float, float, float, float, float, float, float, float, float) * @see PGraphics#curveVertex(float, float) - * */ public void curveTightness(float tightness) { if (recorder != null) recorder.curveTightness(tightness); @@ -9428,17 +9483,21 @@ public class PApplet extends Applet } + public void curve(float x1, float y1, + float x2, float y2, + float x3, float y3, + float x4, float y4) { + if (recorder != null) recorder.curve(x1, y1, x2, y2, x3, y3, x4, y4); + g.curve(x1, y1, x2, y2, x3, y3, x4, y4); + } + + /** - * Draws a curved line on the screen. The first and second parameters - * specify the beginning control point and the last two parameters specify - * the ending control point. The middle parameters specify the start and - * stop of the curve. Longer curves can be created by putting a series of - * curve() functions together or using curveVertex(). - * An additional function called curveTightness() provides control - * for the visual quality of the curve. The curve() function is an - * implementation of Catmull-Rom splines. Using the 3D version of requires - * rendering with P3D or OPENGL (see the Environment reference for more - * information). + * ( begin auto-generated from curve.xml ) + * + * Draws a curved line on the screen. The first and second parameters specify the beginning control point and the last two parameters specify the ending control point. The middle parameters specify the start and stop of the curve. Longer curves can be created by putting a series of curve() functions together or using curveVertex(). An additional function called curveTightness() provides control for the visual quality of the curve. The curve() function is an implementation of Catmull-Rom splines. Using the 3D version of requires rendering with P3D or OPENGL (see the Environment reference for more information). + * + * ( end auto-generated ) * *

Advanced

* As of revision 0070, this function no longer doubles the first @@ -9467,20 +9526,10 @@ public class PApplet extends Applet * @param x4 coordinates for the ending control point * @param y4 coordinates for the ending control point * @param z4 coordinates for the ending control point - * * @see PGraphics#curveVertex(float, float) * @see PGraphics#curveTightness(float) * @see PGraphics#bezier(float, float, float, float, float, float, float, float, float, float, float, float) */ - public void curve(float x1, float y1, - float x2, float y2, - float x3, float y3, - float x4, float y4) { - if (recorder != null) recorder.curve(x1, y1, x2, y2, x3, y3, x4, y4); - g.curve(x1, y1, x2, y2, x3, y3, x4, y4); - } - - public void curve(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, @@ -9491,8 +9540,21 @@ public class PApplet extends Applet /** - * If true in PImage, use bilinear interpolation for copy() - * operations. When inherited by PGraphics, also controls shapes. + * ( begin auto-generated from smooth.xml ) + * + * Draws all geometry with smooth (anti-aliased) edges. This will slow down the frame rate of the application, but will enhance the visual refinement. + *

+ * Note that smooth() will also improve image quality of resized images, and noSmooth() will disable image (and font) smoothing altogether. + *

+ * Starting in Processing 1.0, smoothing is always enabled with the OPENGL renderer setting. The smooth() and noSmooth() methods are ignored. See the hint() reference for information on disabling smoothing with OpenGL. + *

+ * In the current release, smoothing is imperfect with the P2D and P3D renderers. In some situations, drawing with smooth() will create small hairlines inside filled shapes or inaccuracies with shape depth can cause odd visual artifacts at the edges of shapes. + * + * ( end auto-generated ) + * @webref shape:attributes + * @see PGraphics#noSmooth() + * @see PGraphics#hint(int) + * @see PApplet#size(int, int, String) */ public void smooth() { if (recorder != null) recorder.smooth(); @@ -9501,7 +9563,13 @@ public class PApplet extends Applet /** - * Disable smoothing. See smooth(). + * ( begin auto-generated from noSmooth.xml ) + * + * Draws all geometry with jagged (aliased) edges. + * + * ( end auto-generated ) + * @webref shape:attributes + * @see PGraphics#smooth() */ public void noSmooth() { if (recorder != null) recorder.noSmooth(); @@ -9510,25 +9578,19 @@ public class PApplet extends Applet /** - * Modifies the location from which images draw. The default mode is - * imageMode(CORNER), which specifies the location to be the - * upper-left corner and uses the fourth and fifth parameters of - * image() to set the image's width and height. The syntax - * imageMode(CORNERS) uses the second and third parameters of - * image() to set the location of one corner of the image and - * uses the fourth and fifth parameters to set the opposite corner. - * Use imageMode(CENTER) to draw images centered at the given - * x and y position. - *

The parameter to imageMode() must be written in - * ALL CAPS because Processing syntax is case sensitive. - * + * ( begin auto-generated from imageMode.xml ) + * + * Modifies the location from which images draw. The default mode is imageMode(CORNER), which specifies the location to be the upper left corner and uses the fourth and fifth parameters of image() to set the image's width and height. The syntax imageMode(CORNERS) uses the second and third parameters of image() to set the location of one corner of the image and uses the fourth and fifth parameters to set the opposite corner. Use imageMode(CENTER) to draw images centered at the given x and y position. + *

+ * The parameter to imageMode() must be written in ALL CAPS because Processing is a case sensitive language. + * + * ( end auto-generated ) * @webref image:loading_displaying - * @param mode Either CORNER, CORNERS, or CENTER - * - * @see processing.core.PApplet#loadImage(String, String) - * @see processing.core.PImage - * @see processing.core.PApplet#image(PImage, float, float, float, float) - * @see processing.core.PGraphics#background(float, float, float, float) + * @param mode either CORNER, CORNERS, or CENTER + * @see PApplet#loadImage(String, String) + * @see PImage + * @see PGraphics#image(PImage, float, float, float, float) + * @see PGraphics#background(float, float, float, float) */ public void imageMode(int mode) { if (recorder != null) recorder.imageMode(mode); @@ -9543,20 +9605,14 @@ public class PApplet extends Applet /** - * Displays images to the screen. The images must be in the sketch's "data" - * directory to load correctly. Select "Add file..." from the "Sketch" menu - * to add the image. Processing currently works with GIF, JPEG, and Targa - * images. The color of an image may be modified with the tint() - * function and if a GIF has transparency, it will maintain its transparency. - * The img parameter specifies the image to display and the x - * and y parameters define the location of the image from its - * upper-left corner. The image is displayed at its original size unless - * the width and height parameters specify a different size. - * The imageMode() function changes the way the parameters work. - * A call to imageMode(CORNERS) will change the width and height - * parameters to define the x and y values of the opposite corner of the - * image. - * + * ( begin auto-generated from image.xml ) + * + * Displays images to the screen. The images must be in the sketch's "data" directory to load correctly. Select "Add file..." from the "Sketch" menu to add the image. Processing currently works with GIF, JPEG, and Targa images. The color of an image may be modified with the tint() function and if a GIF has transparency, it will maintain its transparency. The img parameter specifies the image to display and the x and y parameters define the location of the image from its upper-left corner. The image is displayed at its original size unless the width and height parameters specify a different size. The imageMode() function changes the way the parameters work. A call to imageMode(CORNERS) will change the width and height parameters to define the x and y values of the opposite corner of the image. + *

+ * Starting with release 0124, when using the default (JAVA2D) renderer, + * smooth() will also improve image quality of resized images. + * + * ( end auto-generated ) *

Advanced

* Starting with release 0124, when using the default (JAVA2D) renderer, * smooth() will also improve image quality of resized images. @@ -9567,13 +9623,12 @@ public class PApplet extends Applet * @param y y-coordinate of the image * @param c width to display the image * @param d height to display the image - * - * @see processing.core.PApplet#loadImage(String, String) - * @see processing.core.PImage - * @see processing.core.PGraphics#imageMode(int) - * @see processing.core.PGraphics#tint(float) - * @see processing.core.PGraphics#background(float, float, float, float) - * @see processing.core.PGraphics#alpha(int) + * @see PApplet#loadImage(String, String) + * @see PImage + * @see PGraphics#imageMode(int) + * @see PGraphics#tint(float) + * @see PGraphics#background(float, float, float, float) + * @see PGraphics#alpha(int) */ public void image(PImage image, float x, float y, float c, float d) { if (recorder != null) recorder.image(image, x, y, c, d); @@ -9586,6 +9641,7 @@ public class PApplet extends Applet * In this method, the u, v coordinates are always based on image space * location, regardless of the current textureMode(). */ + /** ??? */ public void image(PImage image, float a, float b, float c, float d, int u1, int v1, int u2, int v2) { @@ -9595,22 +9651,13 @@ public class PApplet extends Applet /** - * Modifies the location from which shapes draw. - * The default mode is shapeMode(CORNER), which specifies the - * location to be the upper left corner of the shape and uses the third - * and fourth parameters of shape() to specify the width and height. - * The syntax shapeMode(CORNERS) uses the first and second parameters - * of shape() to set the location of one corner and uses the third - * and fourth parameters to set the opposite corner. - * The syntax shapeMode(CENTER) draws the shape from its center point - * and uses the third and forth parameters of shape() to specify the - * width and height. - * The parameter must be written in "ALL CAPS" because Processing syntax - * is case sensitive. - * - * @param mode One of CORNER, CORNERS, CENTER - * + * ( begin auto-generated from shapeMode.xml ) + * + * Modifies the location from which shapes draw. The default mode is shapeMode(CORNER), which specifies the location to be the upper left corner of the shape and uses the third and fourth parameters of shape() to specify the width and height. The syntax shapeMode(CORNERS) uses the first and second parameters of shape() to set the location of one corner and uses the third and fourth parameters to set the opposite corner. The syntax shapeMode(CENTER) draws the shape from its center point and uses the third and forth parameters of shape() to specify the width and height. The parameter must be written in "ALL CAPS" because Processing is a case sensitive language. + * + * ( end auto-generated ) * @webref shape:loading_displaying + * @param mode either CORNER, CORNERS, CENTER * @see PGraphics#shape(PShape) * @see PGraphics#rectMode(int) */ @@ -9636,30 +9683,19 @@ public class PApplet extends Applet /** - * Displays shapes to the screen. The shapes must be in the sketch's "data" - * directory to load correctly. Select "Add file..." from the "Sketch" menu - * to add the shape. - * Processing currently works with SVG shapes only. - * The sh parameter specifies the shape to display and the x - * and y parameters define the location of the shape from its - * upper-left corner. - * The shape is displayed at its original size unless the width - * and height parameters specify a different size. - * The shapeMode() function changes the way the parameters work. - * A call to shapeMode(CORNERS), for example, will change the width - * and height parameters to define the x and y values of the opposite corner - * of the shape. - *

- * Note complex shapes may draw awkwardly with P2D, P3D, and OPENGL. Those - * renderers do not yet support shapes that have holes or complicated breaks. - * - * @param shape + * ( begin auto-generated from shape.xml ) + * + * Displays shapes to the screen. The shapes must be in the sketch's "data" directory to load correctly. Select "Add file..." from the "Sketch" menu to add the shape. Processing currently works with SVG shapes only. The sh parameter specifies the shape to display and the x and y parameters define the location of the shape from its upper-left corner. The shape is displayed at its original size unless the width and height parameters specify a different size. The shapeMode() function changes the way the parameters work. A call to shapeMode(CORNERS), for example, will change the width and height parameters to define the x and y values of the opposite corner of the shape. + *

+ * Note complex shapes may draw awkwardly with P2D, P3D, and OPENGL. Those renderers do not yet support shapes that have holes or complicated breaks. + * + * ( end auto-generated ) + * @webref shape:loading_displaying + * @param shape the shape to display * @param x x-coordinate of the shape * @param y y-coordinate of the shape * @param c width to display the shape * @param d height to display the shape - * - * @webref shape:loading_displaying * @see PShape * @see PApplet#loadShape(String) * @see PGraphics#shapeMode(int) @@ -9670,10 +9706,6 @@ public class PApplet extends Applet } - /** - * Sets the alignment of the text to one of LEFT, CENTER, or RIGHT. - * This will also reset the vertical text alignment to BASELINE. - */ public void textAlign(int align) { if (recorder != null) recorder.textAlign(align); g.textAlign(align); @@ -9681,9 +9713,23 @@ public class PApplet extends Applet /** - * Sets the horizontal and vertical alignment of the text. The horizontal - * alignment can be one of LEFT, CENTER, or RIGHT. The vertical alignment - * can be TOP, BOTTOM, CENTER, or the BASELINE (the default). + * ( begin auto-generated from textAlign.xml ) + * + * Sets the current alignment for drawing text. The parameters LEFT, CENTER, and RIGHT set the display characteristics of the letters in relation to the values for the x and y parameters of the text() function. + *

+ * In Processing 0125 and later, an optional second parameter can be used to vertically align the text. BASELINE is the default, and the vertical alignment will be reset to BASELINE if the second parameter is not used. The TOP and CENTER parameters are straightforward. The BOTTOM parameter offsets the line based on the current textDescent(). For multiple lines, the final line will be aligned to the bottom, with the previous lines appearing above it. + *

+ * When using text() with width and height parameters, BASELINE is ignored, and treated as TOP. (Otherwise, text would by default draw outside the box, since BASELINE is the default setting. BASELINE is not a useful drawing mode for text drawn in a rectangle.) + *

+ * The vertical alignment is based on the value of textAscent(), which many fonts do not specify correctly. It may be necessary to use a hack and offset by a few pixels by hand so that the offset looks correct. To do this as less of a hack, use some percentage of textAscent() or textDescent() so that the hack works even if you change the size of the font. + * + * ( end auto-generated ) + * @webref typography:attributes + * @param alignX horizontal alignment, either LEFT, CENTER, or RIGHT + * @param alignY vertical alignment, either TOP, BOTTOM, CENTER, or BASELINE + * @see PApplet#loadFont() + * @see PFont + * @see PGraphics#text() */ public void textAlign(int alignX, int alignY) { if (recorder != null) recorder.textAlign(alignX, alignY); @@ -11548,9 +11594,9 @@ public class PApplet extends Applet * @param dh destination image height * @param mode Either BLEND, ADD, SUBTRACT, LIGHTEST, DARKEST, DIFFERENCE, EXCLUSION, MULTIPLY, SCREEN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, BURN * - * @see processing.core.PGraphics#alpha(int) - * @see processing.core.PGraphics#copy(PImage, int, int, int, int, int, int, int, int) - * @see processing.core.PImage#blendColor(int,int,int) + * @see PGraphics#alpha(int) + * @see PImage#copy(PImage, int, int, int, int, int, int, int, int) + * @see PImage#blendColor(int,int,int) */ public void blend(PImage src, int sx, int sy, int sw, int sh, diff --git a/core/src/processing/core/PFont.java b/core/src/processing/core/PFont.java index f2047cdf8..80a1e1d3d 100644 --- a/core/src/processing/core/PFont.java +++ b/core/src/processing/core/PFont.java @@ -167,7 +167,8 @@ public class PFont implements PConstants { /** * ( begin auto-generated from PFont.xml ) * - * PFont is the font class for Processing. To create a font to use with Processing, select "Create Font..." from the Tools menu. This will create a font in the format Processing requires and also adds it to the current sketch's data directory. Processing displays fonts using the .vlw font format, which uses images for each letter, rather than defining them through vector data. The + * PFont is the font class for Processing. To create a font to use with Processing, select "Create Font..." from the Tools menu. This will create a font in the format Processing requires and also adds it to the current sketch's data directory. Processing displays fonts using the .vlw font format, which uses images for each letter, rather than defining them through vector data. The loadFont() function constructs a new font and textFont() makes a font active. The list() method creates a list of the fonts installed on the computer, which is useful information to use with the createFont() function for dynamically converting fonts into a format to use with Processing. + * * ( end auto-generated ) * @webref typography:pfont * @param font diff --git a/core/src/processing/core/PGraphics.java b/core/src/processing/core/PGraphics.java index 832b362e5..83ceae051 100644 --- a/core/src/processing/core/PGraphics.java +++ b/core/src/processing/core/PGraphics.java @@ -31,7 +31,8 @@ import java.util.HashMap; /** * ( begin auto-generated from PGraphics.xml ) * - * Main graphics and rendering context, as well as the base API implementation for processing "core". Use this class if you need to draw into an off-screen graphics buffer. A PGraphics object can be constructed with the + * Main graphics and rendering context, as well as the base API implementation for processing "core". Use this class if you need to draw into an off-screen graphics buffer. A PGraphics object can be constructed with the createGraphics() function. The beginDraw() and endDraw() methods (see above example) are necessary to set up the buffer and to finalize it. The fields and methods for this class are extensive; for a complete list visit the developer's reference: http://dev.processing.org/reference/core/ + * * ( end auto-generated ) *

Advanced

* Main graphics and rendering context, as well as the base API implementation. @@ -823,6 +824,22 @@ public class PGraphics extends PImage implements PConstants { * ( 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 OpenGL. 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 OpenGL 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 OPENGL renderer setting by not checking for errors while running. Undo with hint(ENABLE_OPENGL_ERROR_REPORT). + *

+ * + * 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 ) * @webref rendering @@ -831,7 +848,7 @@ public class PGraphics extends PImage implements PConstants { * @see PApplet#createGraphics(int, int, String, String) * @see PApplet#size(int, int) */ - public void sizint which) { + public void hint(int which) { if (which > 0) { hints[which] = true; } else { @@ -863,7 +880,12 @@ public class PGraphics extends PImage implements PConstants { /** * ( begin auto-generated from beginShape.xml ) * - * Using the + * 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 P2D, P3D, and OPENGL renderer settings allow stroke() and fill() settings to be altered per-vertex, however the default JAVA2D 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 ) * @webref shape:vertex * @param kind either POINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, QUAD_STRIP @@ -944,7 +966,10 @@ public class PGraphics extends PImage implements PConstants { /** * ( begin auto-generated from texture.xml ) * - * Sets a texture to be applied to vertex points. The + * 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 ) * @webref shape:vertex * @param image the texture to apply @@ -1186,7 +1211,8 @@ public class PGraphics extends PImage implements PConstants { /** * ( begin auto-generated from vertex.xml ) * - * All shapes are constructed by connecting a series of vertices. + * 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 or OPENGL 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 ) * @webref shape:vertex * @param x x-coordinate of the vertex @@ -1264,7 +1290,8 @@ public class PGraphics extends PImage implements PConstants { /** * ( begin auto-generated from endShape.xml ) * - * The + * 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 ) * @webref shape:vertex * @param mode use CLOSE to close the shape @@ -1321,7 +1348,8 @@ public class PGraphics extends PImage implements PConstants { /** * ( begin auto-generated from bezierVertex.xml ) * - * Specifies vertex coordinates for Bezier curves. Each call to + * 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 of requires rendering with P3D or OPENGL (see the Environment reference for more information). + * * ( end auto-generated ) * @webref shape:vertex * @param x2 the x-coordinate of the 1st control point @@ -1442,7 +1470,8 @@ public class PGraphics extends PImage implements PConstants { /** * ( begin auto-generated from curveVertex.xml ) * - * Specifies vertex coordinates for curves. This function may only be used between + * Specifies vertex coordinates for curves. This function may only be used between beginShape() and endShape() and only when there is no MODE parameter specified to beginShape(). The first and last points in a series of curveVertex() lines will be used to guide the beginning and end of a the curve. A minimum of four points is required to draw a tiny curve between the second and third points. Adding a fifth point with curveVertex() will draw the curve between the second, third, and fourth points. The curveVertex() function is an implementation of Catmull-Rom splines. Using the 3D version of requires rendering with P3D or OPENGL (see the Environment reference for more information). + * * ( end auto-generated ) * @webref shape:vertex * @param x the x-coordinate of the vertex @@ -1570,7 +1599,10 @@ public class PGraphics extends PImage implements PConstants { /** * ( 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 using the + * 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 using the z parameter requires the P3D or OPENGL parameter in combination with size as shown in the above example. + *

+ * Due to what appears to be a bug in Apple's Java implementation, the point() and set() methods are extremely slow in some circumstances when used with the default renderer. Using P2D or P3D will fix the problem. Grouping many calls to point() or set() together can also help. (Bug 1094) + * * ( end auto-generated ) * * @webref shape:2d_primitives @@ -1598,7 +1630,8 @@ public class PGraphics extends PImage implements PConstants { /** * ( begin auto-generated from line.xml ) * - * Draws a line (a direct path between two points) to the screen. The version of + * 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() method 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 using the z parameter requires the P3D or OPENGL parameter in combination with size as shown in the above example. + * * ( end auto-generated ) * @webref shape:2d_primitives * @param x1 x-coordinate of the first point @@ -1681,7 +1714,8 @@ public class PGraphics extends PImage implements PConstants { /** * ( begin auto-generated from rectMode.xml ) * - * Modifies the location from which rectangles draw. The default mode is + * Modifies the location from which rectangles draw. The default mode is rectMode(CORNER), which specifies the location to be the upper left corner of the shape and uses the third and fourth parameters of rect() to specify the width and height. The syntax rectMode(CORNERS) uses the first and second parameters of rect() to set the location of one corner and uses the third and fourth parameters to set the opposite corner. The syntax rectMode(CENTER) draws the image from its center point and uses the third and forth parameters of rect() to specify the image's width and height. The syntax rectMode(RADIUS) draws the image from its center point and uses the third and forth parameters of rect() to specify half of the image's width and height. The parameter must be written in ALL CAPS because Processing is a case sensitive language. Note: In version 125, the mode named CENTER_RADIUS was shortened to RADIUS. + * * ( end auto-generated ) * @webref shape:attributes * @param mode either CORNER, CORNERS, CENTER, or RADIUS @@ -1695,7 +1729,8 @@ public class PGraphics extends PImage implements PConstants { /** * ( begin auto-generated from rect.xml ) * - * Draws a rectangle to the screen. A rectangle is a four-sided shape with every angle at ninety degrees. By default, the first two parameters set the location of the upper-left corner, the third sets the width, and the fourth sets the height. These parameters may be changed with the + * Draws a rectangle to the screen. A rectangle is a four-sided shape with every angle at ninety degrees. By default, the first two parameters set the location of the upper-left corner, the third sets the width, and the fourth sets the height. These parameters may be changed with the rectMode() function. + * * ( end auto-generated ) * @webref shape:2d_primitives * @param a x-coordinate of the rectangle @@ -1848,7 +1883,8 @@ public class PGraphics extends PImage implements PConstants { /** * ( begin auto-generated from ellipseMode.xml ) * - * The origin of the ellipse is modified by the + * The origin of the ellipse is modified by the ellipseMode() function. The default configuration is ellipseMode(CENTER), which specifies the location of the ellipse as the center of the shape. The RADIUS mode is the same, but the width and height parameters to ellipse() specify the radius of the ellipse, rather than the diameter. The CORNER mode draws the shape from the upper-left corner of its bounding box. The CORNERS mode uses the four parameters to ellipse() to set two opposing corners of the ellipse's bounding box. The parameter must be written in "ALL CAPS" because Processing is a case sensitive language. + * * ( end auto-generated ) * @webref shape:attributes * @param mode either CENTER, RADIUS, CORNER, or CORNERS @@ -1862,7 +1898,8 @@ public class PGraphics extends PImage implements PConstants { /** * ( begin auto-generated from ellipse.xml ) * - * Draws an ellipse (oval) in the display window. An ellipse with an equal + * Draws an ellipse (oval) in the display window. An ellipse with an equal width and height is a circle. The first two parameters set the location, the third sets the width, and the fourth sets the height. The origin may be changed with the ellipseMode() function. + * * ( end auto-generated ) * @webref shape:2d_primitives * @param a x-coordinate of the ellipse @@ -1913,7 +1950,8 @@ public class PGraphics extends PImage implements PConstants { /** * ( begin auto-generated from arc.xml ) * - * Draws an arc in the display window. Arcs are drawn along the outer edge of an ellipse defined by the + * Draws an arc in the display window. Arcs are drawn along the outer edge of an ellipse defined by the x, y, width and height parameters. The origin or the arc's ellipse may be changed with the ellipseMode() function. The start and stop parameters specify the angles at which to draw the arc. + * * ( end auto-generated ) * @webref shape:2d_primitives * @param a x-coordinate of the arc's ellipse @@ -2077,7 +2115,8 @@ public class PGraphics extends PImage implements PConstants { /** * ( begin auto-generated from sphereDetail.xml ) * - * Controls the detail used to render a sphere by adjusting the number of vertices of the sphere mesh. The default resolution is 30, which creates a fairly detailed sphere definition with vertices every 360/30 = 12 degrees. If you're going to render a great number of spheres per frame, it is advised to reduce the level of detail using this function. The setting stays active until + * Controls the detail used to render a sphere by adjusting the number of vertices of the sphere mesh. The default resolution is 30, which creates a fairly detailed sphere definition with vertices every 360/30 = 12 degrees. If you're going to render a great number of spheres per frame, it is advised to reduce the level of detail using this function. The setting stays active until sphereDetail() is called again with a new parameter and so should not be called prior to every sphere() statement, unless you wish to render spheres with different settings, e.g. using less detail for smaller spheres or ones further away from the camera. To control the detail of the horizontal and vertical resolution independently, use the version of the functions with two parameters. + * * ( end auto-generated ) *

Advanced

* Code for sphereDetail() submitted by toxi [031031]. @@ -2281,7 +2320,8 @@ public class PGraphics extends PImage implements PConstants { /** * ( begin auto-generated from bezierTangent.xml ) * - * Calculates the tangent of a point on a Bezier curve. There is a good definition of "tangent" at Wikipedia: + * Calculates the tangent of a point on a Bezier curve. There is a good definition of "tangent" at Wikipedia: http://en.wikipedia.org/wiki/Tangent + * * ( end auto-generated ) *

Advanced

* Code submitted by Dave Bollinger (davol) for release 0136. @@ -2422,8 +2462,12 @@ public class PGraphics extends PImage implements PConstants { // CATMULL-ROM CURVE - - /**@generate curvePoint.xml + /* + * ( begin auto-generated from curvePoint.xml ) + * + * Evalutes the curve at point t for points a, b, c, d. The parameter t varies between 0 and 1, a and d are points on the curve, and b and c are the control points. This can be done once with the x coordinates and a second time with the y coordinates to get the location of a curve at t. + * + * ( end auto-generated ) * @webref shape:curves * @param a coordinate of first point on the curve * @param b coordinate of second point on the curve @@ -2450,7 +2494,11 @@ public class PGraphics extends PImage implements PConstants { /** - * @generate curveTangent.xml + * ( begin auto-generated from curveTangent.xml ) + * + * Calculates the tangent of a point on a curve. There is a good definition of "tangent" at Wikipedia: http://en.wikipedia.org/wiki/Tangent + * + * ( end auto-generated ) *

Advanced

* Code thanks to Dave Bollinger (Bug #715) * @@ -2481,7 +2529,11 @@ public class PGraphics extends PImage implements PConstants { /** - * @generate curveDetail.xml + * ( begin auto-generated from curveDetail.xml ) + * + * Sets the resolution at which curves display. The default value is 20. This function is only useful when using the P3D or OPENGL renderer as the default (JAVA2D) renderer does not use this information. + * + * ( end auto-generated ) * @webref shape:curves * @param detail resolution of the curves * @see PGraphics#curve(float, float, float, float, float, float, float, float, float, float, float, float) @@ -2495,7 +2547,11 @@ public class PGraphics extends PImage implements PConstants { /** - * @generate curveTightness.xml + * ( begin auto-generated from curveTightness.xml ) + * + * Modifies the quality of forms created with curve() and curveVertex(). The parameter squishy determines how the curve fits to the vertex points. The value 0.0 is the default value for squishy (this value defines the curves to be Catmull-Rom splines) and the value 1.0 connects all the points with straight lines. Values within the range -5.0 and 5.0 will deform the curves but will leave them recognizable and as values increase in magnitude, they will continue to deform. + * + * ( end auto-generated ) * @webref shape:curves * @param tightness amount of deformation from the original vertices * @see PGraphics#curve(float, float, float, float, float, float, float, float, float, float, float, float) @@ -2573,8 +2629,13 @@ public class PGraphics extends PImage implements PConstants { endShape(); } - /** - * @generate curve.xml + /** + * ( begin auto-generated from curve.xml ) + * + * Draws a curved line on the screen. The first and second parameters specify the beginning control point and the last two parameters specify the ending control point. The middle parameters specify the start and stop of the curve. Longer curves can be created by putting a series of curve() functions together or using curveVertex(). An additional function called curveTightness() provides control for the visual quality of the curve. The curve() function is an implementation of Catmull-Rom splines. Using the 3D version of requires rendering with P3D or OPENGL (see the Environment reference for more information). + * + * ( end auto-generated ) + * *

Advanced

* As of revision 0070, this function no longer doubles the first * and last points. The curves are a bit more boring, but it's more @@ -2658,7 +2719,17 @@ public class PGraphics extends PImage implements PConstants { */ /** - * @generate smooth.xml + * ( begin auto-generated from smooth.xml ) + * + * Draws all geometry with smooth (anti-aliased) edges. This will slow down the frame rate of the application, but will enhance the visual refinement. + *

+ * Note that smooth() will also improve image quality of resized images, and noSmooth() will disable image (and font) smoothing altogether. + *

+ * Starting in Processing 1.0, smoothing is always enabled with the OPENGL renderer setting. The smooth() and noSmooth() methods are ignored. See the hint() reference for information on disabling smoothing with OpenGL. + *

+ * In the current release, smoothing is imperfect with the P2D and P3D renderers. In some situations, drawing with smooth() will create small hairlines inside filled shapes or inaccuracies with shape depth can cause odd visual artifacts at the edges of shapes. + * + * ( end auto-generated ) * @webref shape:attributes * @see PGraphics#noSmooth() * @see PGraphics#hint(int) @@ -2669,7 +2740,11 @@ public class PGraphics extends PImage implements PConstants { } /** - * @generate noSmooth.xml + * ( begin auto-generated from noSmooth.xml ) + * + * Draws all geometry with jagged (aliased) edges. + * + * ( end auto-generated ) * @webref shape:attributes * @see PGraphics#smooth() */ @@ -2685,7 +2760,13 @@ public class PGraphics extends PImage implements PConstants { /** - * @generate imageMode.xml + * ( begin auto-generated from imageMode.xml ) + * + * Modifies the location from which images draw. The default mode is imageMode(CORNER), which specifies the location to be the upper left corner and uses the fourth and fifth parameters of image() to set the image's width and height. The syntax imageMode(CORNERS) uses the second and third parameters of image() to set the location of one corner of the image and uses the fourth and fifth parameters to set the opposite corner. Use imageMode(CENTER) to draw images centered at the given x and y position. + *

+ * The parameter to imageMode() must be written in ALL CAPS because Processing is a case sensitive language. + * + * ( end auto-generated ) * @webref image:loading_displaying * @param mode either CORNER, CORNERS, or CENTER * @see PApplet#loadImage(String, String) @@ -2725,7 +2806,14 @@ public class PGraphics extends PImage implements PConstants { /** - * @generate image.xml + * ( begin auto-generated from image.xml ) + * + * Displays images to the screen. The images must be in the sketch's "data" directory to load correctly. Select "Add file..." from the "Sketch" menu to add the image. Processing currently works with GIF, JPEG, and Targa images. The color of an image may be modified with the tint() function and if a GIF has transparency, it will maintain its transparency. The img parameter specifies the image to display and the x and y parameters define the location of the image from its upper-left corner. The image is displayed at its original size unless the width and height parameters specify a different size. The imageMode() function changes the way the parameters work. A call to imageMode(CORNERS) will change the width and height parameters to define the x and y values of the opposite corner of the image. + *

+ * Starting with release 0124, when using the default (JAVA2D) renderer, + * smooth() will also improve image quality of resized images. + * + * ( end auto-generated ) *

Advanced

* Starting with release 0124, when using the default (JAVA2D) renderer, * smooth() will also improve image quality of resized images. @@ -2861,7 +2949,11 @@ public class PGraphics extends PImage implements PConstants { /** - * @generate shapeMode.xml + * ( begin auto-generated from shapeMode.xml ) + * + * Modifies the location from which shapes draw. The default mode is shapeMode(CORNER), which specifies the location to be the upper left corner of the shape and uses the third and fourth parameters of shape() to specify the width and height. The syntax shapeMode(CORNERS) uses the first and second parameters of shape() to set the location of one corner and uses the third and fourth parameters to set the opposite corner. The syntax shapeMode(CENTER) draws the shape from its center point and uses the third and forth parameters of shape() to specify the width and height. The parameter must be written in "ALL CAPS" because Processing is a case sensitive language. + * + * ( end auto-generated ) * @webref shape:loading_displaying * @param mode either CORNER, CORNERS, CENTER * @see PGraphics#shape(PShape) @@ -2909,7 +3001,13 @@ public class PGraphics extends PImage implements PConstants { /** - * @generate shape.xml + * ( begin auto-generated from shape.xml ) + * + * Displays shapes to the screen. The shapes must be in the sketch's "data" directory to load correctly. Select "Add file..." from the "Sketch" menu to add the shape. Processing currently works with SVG shapes only. The sh parameter specifies the shape to display and the x and y parameters define the location of the shape from its upper-left corner. The shape is displayed at its original size unless the width and height parameters specify a different size. The shapeMode() function changes the way the parameters work. A call to shapeMode(CORNERS), for example, will change the width and height parameters to define the x and y values of the opposite corner of the shape. + *

+ * Note complex shapes may draw awkwardly with P2D, P3D, and OPENGL. Those renderers do not yet support shapes that have holes or complicated breaks. + * + * ( end auto-generated ) * @webref shape:loading_displaying * @param shape the shape to display * @param x x-coordinate of the shape @@ -2960,7 +3058,17 @@ public class PGraphics extends PImage implements PConstants { /** - * @generate textAlign.xml + * ( begin auto-generated from textAlign.xml ) + * + * Sets the current alignment for drawing text. The parameters LEFT, CENTER, and RIGHT set the display characteristics of the letters in relation to the values for the x and y parameters of the text() function. + *

+ * In Processing 0125 and later, an optional second parameter can be used to vertically align the text. BASELINE is the default, and the vertical alignment will be reset to BASELINE if the second parameter is not used. The TOP and CENTER parameters are straightforward. The BOTTOM parameter offsets the line based on the current textDescent(). For multiple lines, the final line will be aligned to the bottom, with the previous lines appearing above it. + *

+ * When using text() with width and height parameters, BASELINE is ignored, and treated as TOP. (Otherwise, text would by default draw outside the box, since BASELINE is the default setting. BASELINE is not a useful drawing mode for text drawn in a rectangle.) + *

+ * The vertical alignment is based on the value of textAscent(), which many fonts do not specify correctly. It may be necessary to use a hack and offset by a few pixels by hand so that the offset looks correct. To do this as less of a hack, use some percentage of textAscent() or textDescent() so that the hack works even if you change the size of the font. + * + * ( end auto-generated ) * @webref typography:attributes * @param alignX horizontal alignment, either LEFT, CENTER, or RIGHT * @param alignY vertical alignment, either TOP, BOTTOM, CENTER, or BASELINE