diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java
index ae1fdf0c2..2c84fb4e9 100644
--- a/core/src/processing/core/PApplet.java
+++ b/core/src/processing/core/PApplet.java
@@ -7416,7 +7416,10 @@ public class PApplet extends Applet
//////////////////////////////////////////////////////////////
- // everything below this line is automatically generated. no touch.
+ // EVERYTHING BELOW THIS LINE IS AUTOMATICALLY GENERATED. DO NOT TOUCH!
+ // This includes the Javadoc comments, which are automatically copied from
+ // the PImage and PGraphics source code files.
+
// public functions for processing.core
@@ -7426,24 +7429,6 @@ public class PApplet extends Applet
}
- /**
- * 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.
- *
- * @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)
- */
public void hint(int which) {
if (recorder != null) recorder.hint(which);
g.hint(which);
@@ -7567,17 +7552,7 @@ public class PApplet extends Applet
g.point(x, y);
}
- /**
- * 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)
- *
- * @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 PApplet#beginShape()
- */
+
public void point(float x, float y, float z) {
if (recorder != null) recorder.point(x, y, z);
g.point(x, y, z);
@@ -7589,61 +7564,21 @@ public class PApplet extends Applet
g.line(x1, y1, x2, y2);
}
- /**
- * 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.
- *
- * @webref shape:2d_primitives
- * @param x1 x-coordinate of the first point
- * @param y1 y-coordinate of the first point
- * @param z1 z-coordinate of the first point
- * @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 PApplet#strokeWeight(float)
- * @see PApplet#strokeJoin(int)
- * @see PApplet#strokeCap(int)
- * @see PApplet#beginShape()
- */
+
public void line(float x1, float y1, float z1,
float x2, float y2, float z2) {
if (recorder != null) recorder.line(x1, y1, z1, x2, y2, z2);
g.line(x1, y1, z1, x2, y2, z2);
}
- /**
- * 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.
- *
- * @webref shape:2d_primitives
- * @param x1 x-coordinate of the first point
- * @param y1 y-coordinate of the first point
- * @param x2 x-coordinate of the second point
- * @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,
float x3, float y3) {
if (recorder != null) recorder.triangle(x1, y1, x2, y2, x3, y3);
g.triangle(x1, y1, x2, y2, x3, y3);
}
- /**
- * 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.
- *
- * @webref shape:2d_primitives
- * @param x1 x-coordinate of the first corner
- * @param y1 y-coordinate of the first corner
- * @param x2 x-coordinate of the second corner
- * @param y2 y-coordinate of the second corner
- * @param x3 x-coordinate of the third corner
- * @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) {
if (recorder != null) recorder.quad(x1, y1, x2, y2, x3, y3, x4, y4);
@@ -7656,181 +7591,72 @@ public class PApplet extends Applet
g.rectMode(mode);
}
- /**
- * 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.
- *
- * @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 PApplet#rectMode(int)
- * @see PApplet#quad(float, float, float, float, float, float, float, float)
- */
+
public void rect(float a, float b, float c, float d) {
if (recorder != null) recorder.rect(a, b, c, d);
g.rect(a, b, c, d);
}
- /**
- * 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.
- *
- * @webref shape:attributes
- *
- * @param mode Either CENTER, RADIUS, CORNER, or CORNERS.
- * @see PApplet#ellipse(float, float, float, float)
- */
+
public void ellipseMode(int mode) {
if (recorder != null) recorder.ellipseMode(mode);
g.ellipseMode(mode);
}
- /**
- * 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.
- *
- * @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) {
if (recorder != null) recorder.ellipse(a, b, c, d);
g.ellipse(a, b, c, d);
}
- /**
- * 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.
- *
- * @webref shape:2d_primitives
- * @param a x-coordinate of the arc's ellipse
- * @param b y-coordinate of the arc's ellipse
- * @param c width of the arc's ellipse
- * @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 PApplet#ellipseMode(int)
- * @see PApplet#ellipse(float, float, float, float)
- */
public void arc(float a, float b, float c, float d,
float start, float stop) {
if (recorder != null) recorder.arc(a, b, c, d, start, stop);
g.arc(a, b, c, d, start, stop);
}
- /**
- *
- * @param size dimension of the box in all dimensions, creates a cube
- */
+
public void box(float size) {
if (recorder != null) recorder.box(size);
g.box(size);
}
- /**
- * A box is an extruded rectangle. A box with equal dimension on all sides is a cube.
- *
- * @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)
- */
+
public void box(float w, float h, float d) {
if (recorder != null) recorder.box(w, h, d);
g.box(w, h, d);
}
- /**
- *
- * @param res number of segments (minimum of 3) used per full circle revolution
- */
+
public void sphereDetail(int res) {
if (recorder != null) recorder.sphereDetail(res);
g.sphereDetail(res);
}
- /**
- * 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.
- *
- * @webref shape:3d_primitives
- * @param ures number of segments used longitudinally per full circle revolution
- * @param vres number of segments used latitudinally from top to bottom
- *
- * @see PApplet#sphere(float)
- */
+
public void sphereDetail(int ures, int vres) {
if (recorder != null) recorder.sphereDetail(ures, vres);
g.sphereDetail(ures, vres);
}
- /**
- * A sphere is a hollow ball made from tessellated triangles.
- *
- * @webref shape:3d_primitives
- * @param r the radius of the sphere
- */
+
public void sphere(float r) {
if (recorder != null) recorder.sphere(r);
g.sphere(r);
}
- /**
- * 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.
- *
- * @webref shape:curves
- * @param a coordinate of first point on the curve
- * @param b coordinate of first control point
- * @param c coordinate of second control point
- * @param d coordinate of second point on the curve
- * @param t value between 0 and 1
- *
- * @see PApplet#bezier(float, float, float, float, float, float, float, float, float, float, float, float)
- * @see PApplet#bezierVertex(float, float, float, float, float, float)
- * @see PApplet#curvePoint(float, float, float, float, float)
- */
+
public float bezierPoint(float a, float b, float c, float d, float t) {
return g.bezierPoint(a, b, c, d, t);
}
- /**
- * 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
- *
- * @webref shape:curves
- * @param a coordinate of first point on the curve
- * @param b coordinate of first control point
- * @param c coordinate of second control point
- * @param d coordinate of second point on the curve
- * @param t value between 0 and 1
- *
- * @see PApplet#bezier(float, float, float, float, float, float, float, float, float, float, float, float)
- * @see PApplet#bezierVertex(float, float, float, float, float, float)
- * @see PApplet#curvePoint(float, float, float, float, float)
- */
+
public float bezierTangent(float a, float b, float c, float d, float t) {
return g.bezierTangent(a, b, c, d, t);
}
- /**
- * 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.
- *
- * @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)
- */
public void bezierDetail(int detail) {
if (recorder != null) recorder.bezierDetail(detail);
g.bezierDetail(detail);
@@ -7846,26 +7672,6 @@ public class PApplet extends Applet
}
- /**
- * 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).
- *
- * @webref shape:curves
- * @param x1 coordinates for the first anchor point
- * @param y1 coordinates for the first anchor point
- * @param z1 coordinates for the first anchor point
- * @param x2 coordinates for the first control point
- * @param y2 coordinates for the first control point
- * @param z2 coordinates for the first control point
- * @param x3 coordinates for the second control point
- * @param y3 coordinates for the second control point
- * @param z3 coordinates for the second control point
- * @param x4 coordinates for the second anchor point
- * @param y4 coordinates for the second anchor point
- * @param z4 coordinates for the second anchor point
- *
- * @see PApplet#bezierVertex(float, float, float, float, float, float)
- * @see PApplet#curve(float, float, float, float, float, float, float, float, float, float, float, float)
- */
public void bezier(float x1, float y1, float z1,
float x2, float y2, float z2,
float x3, float y3, float z3,
@@ -7874,71 +7680,23 @@ public class PApplet extends Applet
g.bezier(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4);
}
- /**
- * 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.
- *
- * @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 PApplet#curve(float, float, float, float, float, float, float, float, float, float, float, float)
- * @see PApplet#curveVertex(float, float)
- * @see PApplet#bezierPoint(float, float, float, float, float)
- */
+
public float curvePoint(float a, float b, float c, float d, float t) {
return g.curvePoint(a, b, c, d, t);
}
- /**
- * Calculates the tangent of a point on a curve. There is a good definition of "tangent" at Wikipedia: http://en.wikipedia.org/wiki/Tangent
- *
- * @webref shape:curves
- * @param a coordinate of first point on the curve
- * @param b coordinate of first control point
- * @param c coordinate of second control point
- * @param d coordinate of second point on the curve
- * @param t value between 0 and 1
- *
- * @see PApplet#curve(float, float, float, float, float, float, float, float, float, float, float, float)
- * @see PApplet#curveVertex(float, float)
- * @see PApplet#curvePoint(float, float, float, float, float)
- * @see PApplet#bezierTangent(float, float, float, float, float)
- */
public float curveTangent(float a, float b, float c, float d, float t) {
return g.curveTangent(a, b, c, d, t);
}
- /**
- * 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.
- *
- * @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)
- */
public void curveDetail(int detail) {
if (recorder != null) recorder.curveDetail(detail);
g.curveDetail(detail);
}
- /**
- * 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.
- *
- * @webref shape:curves
- * @param tightness amount of deformation from the original vertices
- *
- * @see PApplet#curve(float, float, float, float, float, float, float, float, float, float, float, float)
- * @see PApplet#curveVertex(float, float)
- *
- */
public void curveTightness(float tightness) {
if (recorder != null) recorder.curveTightness(tightness);
g.curveTightness(tightness);
@@ -7953,27 +7711,7 @@ public class PApplet extends Applet
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).
- *
- * @webref shape:curves
- * @param x1 coordinates for the beginning control point
- * @param y1 coordinates for the beginning control point
- * @param z1 coordinates for the beginning control point
- * @param x2 coordinates for the first point
- * @param y2 coordinates for the first point
- * @param z2 coordinates for the first point
- * @param x3 coordinates for the second point
- * @param y3 coordinates for the second point
- * @param z3 coordinates for the second point
- * @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 PApplet#curveVertex(float, float)
- * @see PApplet#curveTightness(float)
- * @see PApplet#bezier(float, float, float, float, float, float, float, float, float, float, float, float)
- */
+
public void curve(float x1, float y1, float z1,
float x2, float y2, float z2,
float x3, float y3, float z3,
@@ -7994,18 +7732,7 @@ public class PApplet extends Applet
g.noSmooth();
}
- /**
- * 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.
- *
- * @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.PApplet#background(float, float, float, float)
- */
+
public void imageMode(int mode) {
if (recorder != null) recorder.imageMode(mode);
g.imageMode(mode);
@@ -8017,30 +7744,13 @@ public class PApplet extends Applet
g.image(image, x, y);
}
- /**
- * 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.
- *
- * @webref image:loading_displaying
- * @param image the image to display
- * @param x x-coordinate of the image
- * @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.PApplet#imageMode(int)
- * @see processing.core.PApplet#tint(float)
- * @see processing.core.PApplet#background(float, float, float, float)
- * @see processing.core.PApplet#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);
g.image(image, x, y, c, d);
}
+
public void image(PImage image,
float a, float b, float c, float d,
int u1, int v1, int u2, int v2) {
@@ -8048,26 +7758,13 @@ public class PApplet extends Applet
g.image(image, a, b, c, d, u1, v1, u2, v2);
}
- /**
- * 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.
- * @param mode One of CORNER, CORNERS, CENTER
- *
- * @webref shape:loading_displaying
- * @see PApplet#shape(PShape)
- * @see PApplet#rectMode(int)
- */
+
public void shapeMode(int mode) {
if (recorder != null) recorder.shapeMode(mode);
g.shapeMode(mode);
}
+
public void shape(PShape shape) {
if (recorder != null) recorder.shape(shape);
g.shape(shape);
@@ -8079,26 +7776,7 @@ public class PApplet extends Applet
g.shape(shape, x, y);
}
- /**
- * 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
- * @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 PApplet#shapeMode(int)
- */
+
public void shape(PShape shape, float x, float y, float c, float d) {
if (recorder != null) recorder.shape(shape, x, y, c, d);
g.shape(shape, x, y, c, d);
@@ -8556,22 +8234,12 @@ public class PApplet extends Applet
}
- /**
- * Disables drawing the stroke (outline). If both noStroke() and noFill() are called, nothing will be drawn to the screen.
- *
- * @webref color:setting
- *
- * @see PApplet#stroke(float, float, float, float)
- */
public void noStroke() {
if (recorder != null) recorder.noStroke();
g.noStroke();
}
- /**
- *
- * @param rgb color value in hexadecimal notation (i.e. #FFCC00 or 0xFFFFCC00) or any value of the color datatype
- */
+
public void stroke(int rgb) {
if (recorder != null) recorder.stroke(rgb);
g.stroke(rgb);
@@ -8583,10 +8251,7 @@ public class PApplet extends Applet
g.stroke(rgb, alpha);
}
- /**
- *
- * @param gray specifies a value between white and black
- */
+
public void stroke(float gray) {
if (recorder != null) recorder.stroke(gray);
g.stroke(gray);
@@ -8604,29 +8269,13 @@ public class PApplet extends Applet
g.stroke(x, y, z);
}
- /**
- * Sets the color used to draw lines and borders around shapes. This color is either specified in terms of the RGB or HSB color depending on the current colorMode() (the default color space is RGB, with each value in the range from 0 to 255).
- *
When using hexadecimal notation to specify a color, use "#" or "0x" before the values (e.g. #CCFFAA, 0xFFCCFFAA). The # syntax uses six digits to specify a color (the way colors are specified in HTML and CSS). When using the hexadecimal notation starting with "0x", the hexadecimal value must be specified with eight characters; the first two characters define the alpha component and the remainder the red, green, and blue components.
- *
The value for the parameter "gray" must be less than or equal to the current maximum value as specified by colorMode(). The default maximum value is 255.
- *
- * @webref color:setting
- * @param alpha opacity of the stroke
- * @param x red or hue value (depending on the current color mode)
- * @param y green or saturation value (depending on the current color mode)
- * @param z blue or brightness value (depending on the current color mode)
- */
- public void stroke(float x, float y, float z, float alpha) {
- if (recorder != null) recorder.stroke(x, y, z, alpha);
- g.stroke(x, y, z, alpha);
+
+ public void stroke(float x, float y, float z, float a) {
+ if (recorder != null) recorder.stroke(x, y, z, a);
+ g.stroke(x, y, z, a);
}
- /**
- * Removes the current fill value for displaying images and reverts to displaying images with their original hues.
- *
- * @webref image:loading_displaying
- * @see processing.core.PApplet#tint(float, float, float, float)
- * @see processing.core.PApplet#image(PImage, float, float, float, float)
- */
+
public void noTint() {
if (recorder != null) recorder.noTint();
g.noTint();
@@ -8638,20 +8287,13 @@ public class PApplet extends Applet
g.tint(rgb);
}
- /**
- *
- * @param rgb color value in hexadecimal notation (i.e. #FFCC00 or 0xFFFFCC00) or any value of the color datatype
- * @param alpha opacity of the image
- */
+
public void tint(int rgb, float alpha) {
if (recorder != null) recorder.tint(rgb, alpha);
g.tint(rgb, alpha);
}
- /**
- *
- * @param gray any valid number
- */
+
public void tint(float gray) {
if (recorder != null) recorder.tint(gray);
g.tint(gray);
@@ -8669,43 +8311,19 @@ public class PApplet extends Applet
g.tint(x, y, z);
}
- /**
- * Sets the fill value for displaying images. Images can be tinted to specified colors or made transparent by setting the alpha.
- *
To make an image transparent, but not change it's color, use white as the tint color and specify an alpha value. For instance, tint(255, 128) will make an image 50% transparent (unless colorMode() has been used).
- *
When using hexadecimal notation to specify a color, use "#" or "0x" before the values (e.g. #CCFFAA, 0xFFCCFFAA). The # syntax uses six digits to specify a color (the way colors are specified in HTML and CSS). When using the hexadecimal notation starting with "0x", the hexadecimal value must be specified with eight characters; the first two characters define the alpha component and the remainder the red, green, and blue components.
- *
The value for the parameter "gray" must be less than or equal to the current maximum value as specified by colorMode(). The default maximum value is 255.
- *
The tint() method is also used to control the coloring of textures in 3D.
- *
- * @webref image:loading_displaying
- * @param x red or hue value
- * @param y green or saturation value
- * @param z blue or brightness value
- *
- * @see processing.core.PApplet#noTint()
- * @see processing.core.PApplet#image(PImage, float, float, float, float)
- */
- public void tint(float x, float y, float z, float alpha) {
- if (recorder != null) recorder.tint(x, y, z, alpha);
- g.tint(x, y, z, alpha);
+
+ public void tint(float x, float y, float z, float a) {
+ if (recorder != null) recorder.tint(x, y, z, a);
+ g.tint(x, y, z, a);
}
- /**
- * Disables filling geometry. If both noStroke() and noFill() are called, nothing will be drawn to the screen.
- *
- * @webref color:setting
- *
- * @see PApplet#fill(float, float, float, float)
- *
- */
+
public void noFill() {
if (recorder != null) recorder.noFill();
g.noFill();
}
- /**
- *
- * @param rgb color value in hexadecimal notation (i.e. #FFCC00 or 0xFFFFCC00) or any value of the color datatype
- */
+
public void fill(int rgb) {
if (recorder != null) recorder.fill(rgb);
g.fill(rgb);
@@ -8717,10 +8335,7 @@ public class PApplet extends Applet
g.fill(rgb, alpha);
}
- /**
- *
- * @param gray number specifying value between white and black
- */
+
public void fill(float gray) {
if (recorder != null) recorder.fill(gray);
g.fill(gray);
@@ -8738,27 +8353,10 @@ public class PApplet extends Applet
g.fill(x, y, z);
}
- /**
- * Sets the color used to fill shapes. For example, if you run fill(204, 102, 0), all subsequent shapes will be filled with orange. This color is either specified in terms of the RGB or HSB color depending on the current colorMode() (the default color space is RGB, with each value in the range from 0 to 255).
- *
When using hexadecimal notation to specify a color, use "#" or "0x" before the values (e.g. #CCFFAA, 0xFFCCFFAA). The # syntax uses six digits to specify a color (the way colors are specified in HTML and CSS). When using the hexadecimal notation starting with "0x", the hexadecimal value must be specified with eight characters; the first two characters define the alpha component and the remainder the red, green, and blue components.
- *
The value for the parameter "gray" must be less than or equal to the current maximum value as specified by colorMode(). The default maximum value is 255.
- *
To change the color of an image (or a texture), use tint().
- *
- * @webref color:setting
- * @param x red or hue value
- * @param y green or saturation value
- * @param z blue or brightness value
- * @param alpha opacity of the fill
- *
- * @see PApplet#noFill()
- * @see PApplet#stroke(float)
- * @see PApplet#tint(float)
- * @see PApplet#background(float, float, float, float)
- * @see PApplet#colorMode(int, float, float, float, float)
- */
- public void fill(float x, float y, float z, float alpha) {
- if (recorder != null) recorder.fill(x, y, z, alpha);
- g.fill(x, y, z, alpha);
+
+ public void fill(float x, float y, float z, float a) {
+ if (recorder != null) recorder.fill(x, y, z, a);
+ g.fill(x, y, z, a);
}
@@ -8881,31 +8479,25 @@ public class PApplet extends Applet
g.lightSpecular(x, y, z);
}
- /**
- *
- * @param rgb color value in hexadecimal notation (i.e. #FFCC00 or 0xFFFFCC00)
or any value of the color datatype
- */
+
public void background(int rgb) {
if (recorder != null) recorder.background(rgb);
g.background(rgb);
}
+
public void background(int rgb, float alpha) {
if (recorder != null) recorder.background(rgb, alpha);
g.background(rgb, alpha);
}
+
public void background(float gray) {
if (recorder != null) recorder.background(gray);
g.background(gray);
}
- /**
- *
- * @param gray specifies a value between white and black
- * @param alpha opacity of the background
- */
public void background(float gray, float alpha) {
if (recorder != null) recorder.background(gray, alpha);
g.background(gray, alpha);
@@ -8918,31 +8510,12 @@ public class PApplet extends Applet
}
- /**
- * The background() function sets the color used for the background of the Processing window. The default background is light gray. In the draw() function, the background color is used to clear the display window at the beginning of each frame.
- *
An image can also be used as the background for a sketch, however its width and height must be the same size as the sketch window. To resize an image 'b' to the size of the sketch window, use b.resize(width, height).
- *
Images used as background will ignore the current tint() setting.
- *
It is not possible to use transparency (alpha) in background colors with the main drawing surface, however they will work properly with createGraphics.
- *
- * @webref color:setting
- * @param x red or hue value (depending on the current color mode)
- * @param y green or saturation value (depending on the current color mode)
- * @param z blue or brightness value (depending on the current color mode)
- *
- * @see PApplet#stroke(float)
- * @see PApplet#fill(float)
- * @see PApplet#tint(float)
- * @see PApplet#colorMode(int)
- */
- public void background(float x, float y, float z, float alpha) {
- if (recorder != null) recorder.background(x, y, z, alpha);
- g.background(x, y, z, alpha);
+ public void background(float x, float y, float z, float a) {
+ if (recorder != null) recorder.background(x, y, z, a);
+ g.background(x, y, z, a);
}
- /**
- *
- * @param image any value of type PImage
- */
+
public void background(PImage image) {
if (recorder != null) recorder.background(image);
g.background(image);
@@ -8954,11 +8527,7 @@ public class PApplet extends Applet
g.colorMode(mode);
}
- /**
- *
- * @param mode Either RGB or HSB, corresponding to Red/Green/Blue and Hue/Saturation/Brightness
- * @param max range for all color elements
- */
+
public void colorMode(int mode, float max) {
if (recorder != null) recorder.colorMode(mode, max);
g.colorMode(mode, max);
@@ -8970,146 +8539,49 @@ public class PApplet extends Applet
g.colorMode(mode, maxX, maxY, maxZ);
}
- /**
- * Changes the way Processing interprets color data. By default, the parameters for fill(), stroke(), background(), and color() are defined by values between 0 and 255 using the RGB color model. The colorMode() function is used to change the numerical range used for specifying colors and to switch color systems. For example, calling colorMode(RGB, 1.0) will specify that values are specified between 0 and 1. The limits for defining colors are altered by setting the parameters range1, range2, range3, and range 4.
- *
- * @webref color:setting
- * @param maxX range for the red or hue depending on the current color mode
- * @param maxY range for the green or saturation depending on the current color mode
- * @param maxZ range for the blue or brightness depending on the current color mode
- * @param maxA range for the alpha
- *
- * @see PApplet#background(float)
- * @see PApplet#fill(float)
- * @see PApplet#stroke(float)
- */
+
public void colorMode(int mode,
float maxX, float maxY, float maxZ, float maxA) {
if (recorder != null) recorder.colorMode(mode, maxX, maxY, maxZ, maxA);
g.colorMode(mode, maxX, maxY, maxZ, maxA);
}
- /**
- * Extracts the alpha value from a color.
- *
- * @webref color:creating_reading
- * @param what any value of the color datatype
- */
+
public final float alpha(int what) {
return g.alpha(what);
}
- /**
- * Extracts the red value from a color, scaled to match current colorMode(). This value is always returned as a float so be careful not to assign it to an int value.
The red() function is easy to use and undestand, but is slower than another technique. To achieve the same results when working in colorMode(RGB, 255), but with greater speed, use the >> (right shift) operator with a bit mask. For example, the following two lines of code are equivalent:
float r1 = red(myColor);- * - * @webref color:creating_reading - * @param what any value of the color datatype - * - * @see PApplet#green(int) - * @see PApplet#blue(int) - * @see PApplet#hue(int) - * @see PApplet#saturation(int) - * @see PApplet#brightness(int) - * @ref rightshift - */ + public final float red(int what) { return g.red(what); } - /** - * Extracts the green value from a color, scaled to match current colorMode(). This value is always returned as a float so be careful not to assign it to an int value.
float r2 = myColor >> 16 & 0xFF;
float r1 = green(myColor);- * - * @webref color:creating_reading - * @param what any value of the color datatype - * - * @see PApplet#red(int) - * @see PApplet#blue(int) - * @see PApplet#hue(int) - * @see PApplet#saturation(int) - * @see PApplet#brightness(int) - * @ref rightshift - */ + public final float green(int what) { return g.green(what); } - /** - * Extracts the blue value from a color, scaled to match current colorMode(). This value is always returned as a float so be careful not to assign it to an int value.
float r2 = myColor >> 8 & 0xFF;
float r1 = blue(myColor);- * - * @webref color:creating_reading - * @param what any value of the color datatype - * - * @see PApplet#red(int) - * @see PApplet#green(int) - * @see PApplet#hue(int) - * @see PApplet#saturation(int) - * @see PApplet#brightness(int) - */ + public final float blue(int what) { return g.blue(what); } - /** - * Extracts the hue value from a color. - * - * @webref color:creating_reading - * @param what any value of the color datatype - * - * @see PApplet#red(int) - * @see PApplet#green(int) - * @see PApplet#blue(int) - * @see PApplet#saturation(int) - * @see PApplet#brightness(int) - */ + public final float hue(int what) { return g.hue(what); } - /** - * Extracts the saturation value from a color. - * - * @webref color:creating_reading - * @param what any value of the color datatype - * - * @see PApplet#red(int) - * @see PApplet#green(int) - * @see PApplet#blue(int) - * @see PApplet#hue(int) - * @see PApplet#brightness(int) - */ + public final float saturation(int what) { return g.saturation(what); } - /** - * Extracts the brightness value from a color. - * - * - * @webref color:creating_reading - * @param what any value of the color datatype - * - * @see PApplet#red(int) - * @see PApplet#green(int) - * @see PApplet#blue(int) - * @see PApplet#hue(int) - * @see PApplet#saturation(int) - */ public final float brightness(int what) { return g.brightness(what); } - /** - * Calculates a color or colors between two color at a specific increment. The amt parameter is the amount to interpolate between the two values where 0.0 equal to the first point, 0.1 is very near the first point, 0.5 is half-way in between, etc. - * - * @webref color:creating_reading - * @param c1 interpolate from this color - * @param c2 interpolate to this color - * @param amt between 0.0 and 1.0 - * - * @see PApplet#blendColor(int, int, int) - * @see PApplet#color(float, float, float, float) - */ + public int lerpColor(int c1, int c2, float amt) { return g.lerpColor(c1, c2, amt); } @@ -9146,21 +8618,7 @@ public class PApplet extends Applet return g.get(x, y); } - /** - * Reads the color of any pixel or grabs a section of an image. If no parameters are specified, the entire image is returned. Get the value of one pixel by specifying an x,y coordinate. Get a section of the display window by specifying an additional width and height parameter. 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. - *
float r2 = myColor & 0xFF;
- * For the most part, hints are temporary api quirks, - * for which a proper api hasn't been properly worked out. - * for instance SMOOTH_IMAGES existed because smooth() - * wasn't yet implemented, but it will soon go away. - *
- * They also exist for obscure features in the graphics - * engine, like enabling/disabling single pixel lines - * that ignore the zbuffer, the way they do in alphabot. - *
- * Current hint options: - *
* Implementation notes: *
@@ -1775,6 +1955,9 @@ public class PGraphics extends PImage implements PConstants { * * [davbol 080801] now using separate sphereDetailU/V * + * + * @webref shape:3d_primitives + * @param r the radius of the sphere */ public void sphere(float r) { if ((sphereDetailU < 3) || (sphereDetailV < 2)) { @@ -1849,14 +2032,18 @@ public class PGraphics extends PImage implements PConstants { // BEZIER + /** + * 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. + */ /** * Evalutes quadratic bezier at point t for points a, b, c, d. - * t varies between 0 and 1, and a and d are the on curve points, - * 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. - *
+ * 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. + * + * =advanced * For instance, to convert the following example:
* stroke(255, 102, 0);
* line(85, 20, 10, 10);
@@ -1876,6 +2063,17 @@ public class PGraphics extends PImage implements PConstants {
* vertex(x, y);
* }
* endShape();
+ *
+ * @webref shape:curves
+ * @param a coordinate of first point on the curve
+ * @param b coordinate of first control point
+ * @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)
*/
public float bezierPoint(float a, float b, float c, float d, float t) {
float t1 = 1.0f - t;
@@ -1884,8 +2082,22 @@ public class PGraphics extends PImage implements PConstants {
/**
- * Provide the tangent at the given point on the bezier curve.
- * Fix from davbol for 0136.
+ * 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
+ *
+ * =advanced
+ * Code submitted by Dave Bollinger (davol) for release 0136.
+ *
+ * @webref shape:curves
+ * @param a coordinate of first point on the curve
+ * @param b coordinate of first control point
+ * @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)
*/
public float bezierTangent(float a, float b, float c, float d, float t) {
return (3*t*t * (-a+3*b-3*c+d) +
@@ -1908,6 +2120,16 @@ public class PGraphics extends PImage implements PConstants {
}
+ /**
+ * 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.
+ *
+ * @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)
+ */
public void bezierDetail(int detail) {
bezierDetail = detail;
@@ -1927,6 +2149,15 @@ public class PGraphics extends PImage implements PConstants {
/**
+ * 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).
+ *
+ * =advanced
* Draw a cubic bezier curve. The first and last points are
* the on-curve points. The middle two are the 'control' points,
* or 'handles' in an application like Illustrator.
@@ -1948,6 +2179,23 @@ public class PGraphics extends PImage implements PConstants {
* To draw a quadratic (instead of cubic) curve,
* use the control point twice by doubling it:
* bezier(x1, y1, cx, cy, cx, cy, x2, y2);+ * + * @webref shape:curves + * @param x1 coordinates for the first anchor point + * @param y1 coordinates for the first anchor point + * @param z1 coordinates for the first anchor point + * @param x2 coordinates for the first control point + * @param y2 coordinates for the first control point + * @param z2 coordinates for the first control point + * @param x3 coordinates for the second control point + * @param y3 coordinates for the second control point + * @param z3 coordinates for the second control point + * @param x4 coordinates for the second anchor point + * @param y4 coordinates for the second anchor point + * @param z4 coordinates for the second anchor point + * + * @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, @@ -1980,9 +2228,22 @@ public class PGraphics extends PImage implements PConstants { /** - * Get a location along a catmull-rom curve segment. + * 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. * - * @param t Value between zero and one for how far along the segment + * @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) */ public float curvePoint(float a, float b, float c, float d, float t) { curveInitCheck(); @@ -2000,8 +2261,22 @@ public class PGraphics extends PImage implements PConstants { /** - * Calculate the tangent at a t value (0..1) on a Catmull-Rom curve. + * 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. + * + * =advanced * Code thanks to Dave Bollinger (Bug #715) + * + * @webref shape:curves + * @param a coordinate of first point on the curve + * @param b coordinate of first control point + * @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) + * @see PGraphics#bezierTangent(float, float, float, float, float) */ public float curveTangent(float a, float b, float c, float d, float t) { curveInitCheck(); @@ -2018,12 +2293,41 @@ public class PGraphics extends PImage implements PConstants { } + /** + * 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. + * + * @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) + */ public void curveDetail(int detail) { curveDetail = detail; curveInit(); } + /** + * 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. + * + * @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) { curveTightness = tightness; curveInit(); @@ -2084,10 +2388,20 @@ public class PGraphics extends PImage implements PConstants { /** - * Draws a segment of Catmull-Rom curve. - *
- * As of 0070, this function no longer doubles the first and - * last points. The curves are a bit more boring, but it's more + * 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). + * + * =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 * mathematically correct, and properly mirrored in curvePoint(). *
* Identical to typing out:
@@ -2098,6 +2412,24 @@ public class PGraphics extends PImage implements PConstants {
* curveVertex(x4, y4);
* endShape();
*
+ *
+ * @webref shape:curves
+ * @param x1 coordinates for the beginning control point
+ * @param y1 coordinates for the beginning control point
+ * @param z1 coordinates for the beginning control point
+ * @param x2 coordinates for the first point
+ * @param y2 coordinates for the first point
+ * @param z2 coordinates for the first point
+ * @param x3 coordinates for the second point
+ * @param y3 coordinates for the second point
+ * @param z3 coordinates for the second point
+ * @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,
@@ -2182,9 +2514,25 @@ public class PGraphics extends PImage implements PConstants {
/**
- * The mode can only be set to CORNERS, CORNER, and CENTER.
- *
- * Support for CENTER was added in release 0146.
+ * 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.
+ *
@@ -4230,6 +4728,8 @@ public class PGraphics extends PImage implements PConstants {
* Note that background() should be called before any transformations occur,
* because some implementations may require the current transformation matrix
* to be identity before drawing.
+ *
+ * @param rgb color value in hexadecimal notation (i.e. #FFCC00 or 0xFFFFCC00)
or any value of the color datatype
*/
public void background(int rgb) {
// if (((rgb & 0xff000000) == 0) && (rgb <= colorModeX)) {
@@ -4283,6 +4783,8 @@ public class PGraphics extends PImage implements PConstants {
/**
* See notes about alpha in background(x, y, z, a).
+ * @param gray specifies a value between white and black
+ * @param alpha opacity of the background
*/
public void background(float gray, float alpha) {
if (format == RGB) {
@@ -4308,15 +4810,30 @@ public class PGraphics extends PImage implements PConstants {
/**
- * Clear the background with a color that includes an alpha value. This can
+ * The background() function sets the color used for the background of the Processing window. The default background is light gray. In the draw() function, the background color is used to clear the display window at the beginning of each frame.
+ *
An image can also be used as the background for a sketch, however its width and height must be the same size as the sketch window. To resize an image 'b' to the size of the sketch window, use b.resize(width, height).
+ *
Images used as background will ignore the current tint() setting.
+ *
It is not possible to use transparency (alpha) in background colors with the main drawing surface, however they will work properly with createGraphics.
+ *
+ * =advanced
+ *
Clear the background with a color that includes an alpha value. This can * only be used with objects created by createGraphics(), because the main - * drawing surface cannot be set transparent. - *
- * It might be tempting to use this function to partially clear the screen + * drawing surface cannot be set transparent.
+ *It might be tempting to use this function to partially clear the screen * on each frame, however that's not how this function works. When calling * background(), the pixels will be replaced with pixels that have that level * of transparency. To do a semi-transparent overlay, use fill() with alpha - * and draw a rectangle. + * and draw a rectangle.
+ * + * @webref color:setting + * @param x red or hue value (depending on the current color mode) + * @param y green or saturation value (depending on the current color mode) + * @param z blue or brightness value (depending on the current color mode) + * + * @see PGraphics#stroke(float) + * @see PGraphics#fill(float) + * @see PGraphics#tint(float) + * @see PGraphics#colorMode(int) */ public void background(float x, float y, float z, float a) { // if (format == RGB) { @@ -4430,6 +4947,10 @@ public class PGraphics extends PImage implements PConstants { // COLOR MODE + /** + * @param mode Either RGB or HSB, corresponding to Red/Green/Blue and Hue/Saturation/Brightness + * @param max range for all color elements + */ public void colorMode(int mode) { colorMode(mode, colorModeX, colorModeY, colorModeZ, colorModeA); } @@ -4454,6 +4975,19 @@ public class PGraphics extends PImage implements PConstants { } + /** + * Changes the way Processing interprets color data. By default, the parameters for fill(), stroke(), background(), and color() are defined by values between 0 and 255 using the RGB color model. The colorMode() function is used to change the numerical range used for specifying colors and to switch color systems. For example, calling colorMode(RGB, 1.0) will specify that values are specified between 0 and 1. The limits for defining colors are altered by setting the parameters range1, range2, range3, and range 4. + * + * @webref color:setting + * @param maxX range for the red or hue depending on the current color mode + * @param maxY range for the green or saturation depending on the current color mode + * @param maxZ range for the blue or brightness depending on the current color mode + * @param maxA range for the alpha + * + * @see PGraphics#background(float) + * @see PGraphics#fill(float) + * @see PGraphics#stroke(float) + */ public void colorMode(int mode, float maxX, float maxY, float maxZ, float maxA) { colorMode = mode; @@ -4768,6 +5302,12 @@ public class PGraphics extends PImage implements PConstants { // Vee have veys of making the colors talk. + /** + * Extracts the alpha value from a color. + * + * @webref color:creating_reading + * @param what any value of the color datatype + */ public final float alpha(int what) { float c = (what >> 24) & 0xff; if (colorModeA == 255) return c; @@ -4775,6 +5315,19 @@ public class PGraphics extends PImage implements PConstants { } + /** + * Extracts the red value from a color, scaled to match current colorMode(). This value is always returned as a float so be careful not to assign it to an int value.float r1 = red(myColor);+ * + * @webref color:creating_reading + * @param what any value of the color datatype + * + * @see PGraphics#green(int) + * @see PGraphics#blue(int) + * @see PGraphics#hue(int) + * @see PGraphics#saturation(int) + * @see PGraphics#brightness(int) + * @ref rightshift + */ public final float red(int what) { float c = (what >> 16) & 0xff; if (colorModeDefault) return c; @@ -4782,6 +5335,19 @@ public class PGraphics extends PImage implements PConstants { } + /** + * Extracts the green value from a color, scaled to match current colorMode(). This value is always returned as a float so be careful not to assign it to an int value.
float r2 = myColor >> 16 & 0xFF;
float r1 = green(myColor);+ * + * @webref color:creating_reading + * @param what any value of the color datatype + * + * @see PGraphics#red(int) + * @see PGraphics#blue(int) + * @see PGraphics#hue(int) + * @see PGraphics#saturation(int) + * @see PGraphics#brightness(int) + * @ref rightshift + */ public final float green(int what) { float c = (what >> 8) & 0xff; if (colorModeDefault) return c; @@ -4789,6 +5355,18 @@ public class PGraphics extends PImage implements PConstants { } + /** + * Extracts the blue value from a color, scaled to match current colorMode(). This value is always returned as a float so be careful not to assign it to an int value.
float r2 = myColor >> 8 & 0xFF;
float r1 = blue(myColor);+ * + * @webref color:creating_reading + * @param what any value of the color datatype + * + * @see PGraphics#red(int) + * @see PGraphics#green(int) + * @see PGraphics#hue(int) + * @see PGraphics#saturation(int) + * @see PGraphics#brightness(int) + */ public final float blue(int what) { float c = (what) & 0xff; if (colorModeDefault) return c; @@ -4796,6 +5374,18 @@ public class PGraphics extends PImage implements PConstants { } + /** + * Extracts the hue value from a color. + * + * @webref color:creating_reading + * @param what any value of the color datatype + * + * @see PGraphics#red(int) + * @see PGraphics#green(int) + * @see PGraphics#blue(int) + * @see PGraphics#saturation(int) + * @see PGraphics#brightness(int) + */ public final float hue(int what) { if (what != cacheHsbKey) { Color.RGBtoHSB((what >> 16) & 0xff, (what >> 8) & 0xff, @@ -4806,6 +5396,18 @@ public class PGraphics extends PImage implements PConstants { } + /** + * Extracts the saturation value from a color. + * + * @webref color:creating_reading + * @param what any value of the color datatype + * + * @see PGraphics#red(int) + * @see PGraphics#green(int) + * @see PGraphics#blue(int) + * @see PGraphics#hue(int) + * @see PGraphics#brightness(int) + */ public final float saturation(int what) { if (what != cacheHsbKey) { Color.RGBtoHSB((what >> 16) & 0xff, (what >> 8) & 0xff, @@ -4816,6 +5418,19 @@ public class PGraphics extends PImage implements PConstants { } + /** + * Extracts the brightness value from a color. + * + * + * @webref color:creating_reading + * @param what any value of the color datatype + * + * @see PGraphics#red(int) + * @see PGraphics#green(int) + * @see PGraphics#blue(int) + * @see PGraphics#hue(int) + * @see PGraphics#saturation(int) + */ public final float brightness(int what) { if (what != cacheHsbKey) { Color.RGBtoHSB((what >> 16) & 0xff, (what >> 8) & 0xff, @@ -4835,7 +5450,15 @@ public class PGraphics extends PImage implements PConstants { /** - * Interpolate between two colors, using the current color mode. + * Calculates a color or colors between two color at a specific increment. The amt parameter is the amount to interpolate between the two values where 0.0 equal to the first point, 0.1 is very near the first point, 0.5 is half-way in between, etc. + * + * @webref color:creating_reading + * @param c1 interpolate from this color + * @param c2 interpolate to this color + * @param amt between 0.0 and 1.0 + * + * @see PGraphics#blendColor(int, int, int) + * @see PGraphics#color(float, float, float, float) */ public int lerpColor(int c1, int c2, float amt) { return lerpColor(c1, c2, amt, colorMode); diff --git a/core/src/processing/core/PImage.java b/core/src/processing/core/PImage.java index 276617825..eaac2b6e7 100644 --- a/core/src/processing/core/PImage.java +++ b/core/src/processing/core/PImage.java @@ -38,23 +38,23 @@ import javax.imageio.ImageIO; * Before an image is used, it must be loaded with the loadImage() function. * The PImage object contains fields for the width and height of the image, * as well as an array called pixels[] which contains the values for every pixel in the image. - * A group of methods, described below, allow easy access to the image's pixels and alpha channel and simplify the process of compositing. + * A group of methods, described below, allow easy access to the image's pixels and alpha channel and simplify the process of compositing. *
float r2 = myColor & 0xFF;
* Code for copying, resizing, scaling, and blending contributed * by toxi. *
- * + * * @webref image * @usage Web & Application * @instanceName img any variable of type PImage * @see processing.core.PApplet#loadImage(String) - * @see processing.core.PApplet#imageMode(int) + * @see processing.core.PGraphics#imageMode(int) * @see processing.core.PApplet#createImage(int, int) */ public class PImage implements PConstants, Cloneable { @@ -76,20 +76,20 @@ public class PImage implements PConstants, Cloneable { * After the array data has been modified, the updatePixels() method must be run to update the changes. * Without loadPixels(), running the code may (or will in future releases) result in a NullPointerException. * @webref - * @brief Array containing the color of every pixel in the image + * @brief Array containing the color of every pixel in the image */ public int[] pixels; - + /** * The width of the image in units of pixels. * @webref - * @brief Image width + * @brief Image width */ public int width; /** * The height of the image in units of pixels. * @webref - * @brief Image height + * @brief Image height */ public int height; @@ -168,7 +168,7 @@ public class PImage implements PConstants, Cloneable { } /** - * + * * @param width image width * @param height image height * @param format Either RGB, ARGB, ALPHA (grayscale alpha channel) @@ -218,7 +218,7 @@ public class PImage implements PConstants, Cloneable { * Construct a new PImage from a java.awt.Image. This constructor assumes * that you've done the work of making sure a MediaTracker has been used * to fully download the data and that the img is valid. - * + * * @param img assumes a MediaTracker has been used to fully download the data and the img is valid */ public PImage(java.awt.Image img) { @@ -331,7 +331,7 @@ public class PImage implements PConstants, Cloneable { *
* For subclasses where the pixels[] buffer isn't set by default, * this should copy all data into the pixels[] array - * + * * @webref * @brief Loads the pixel data for the image into its pixels[] array */ @@ -427,12 +427,12 @@ public class PImage implements PConstants, Cloneable { /** * Resize the image to a new width and height. To make the image scale proportionally, use 0 as the value for the wide or high parameter. - * + * * @webref * @brief Changes the size of an image to a new width and height * @param wide the resized image width * @param high the resized image height - * + * * @see processing.core.PImage#get(int, int, int, int) */ public void resize(int wide, int high) { // ignore @@ -508,14 +508,14 @@ public class PImage implements PConstants, Cloneable { * Reads the color of any pixel or grabs a group of pixels. If no parameters are specified, the entire image is returned. Get the value of one pixel by specifying an x,y coordinate. Get a section of the display window by specifing an additional width and height parameter. 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. Even though you may have drawn a shape with colorMode(HSB), the numbers returned will be in RGB. *@@ -2795,7 +2794,7 @@ public class PImage implements PConstants, Cloneable { * The ImageIO API claims to support wbmp files, however they probably * require a black and white image. Basic testing produced a zero-length * file with no error. - * + * * @webref * @brief Saves the image to a TIFF, TARGA, PNG, or JPEG file * @param filename a sequence of letters and numbers