diff --git a/core/src/processing/core/PGraphics.java b/core/src/processing/core/PGraphics.java index 583bdb60e..4252c609c 100644 --- a/core/src/processing/core/PGraphics.java +++ b/core/src/processing/core/PGraphics.java @@ -81,7 +81,7 @@ import processing.opengl.PShader; * renderer to complete its initialization routine. * * The functions were broken out because of the growing number of parameters - * such as these that might be used by a renderer, yet with the exception of + * such as these that might be used by a renderer, but except for * setSize(), it's not clear which will be necessary. So while the size could be * passed in to the constructor instead of a setSize() function, a function * would still be needed that would notify the renderer that it was time to @@ -140,7 +140,7 @@ import processing.opengl.PShader; * the time. That is, it's not something that to be done once—it's a * matter of keeping the multiple references synchronized (to say nothing of the * translation issues), while targeting them for their separate audiences. Ouch. - * + *
* We're working right now on synchronizing the two references, so the website * reference is generated from the javadoc comments. Yay. * @@ -153,39 +153,23 @@ import processing.opengl.PShader; */ public class PGraphics extends PImage implements PConstants { -// /// Canvas object that covers rendering this graphics on screen. -// public Canvas canvas; - - // ........................................................ - - // width and height are already inherited from PImage - - -// /// width minus one (useful for many calculations) -// protected int width1; -// -// /// height minus one (useful for many calculations) -// protected int height1; - - /// width * height (useful for many calculations) + /** width * height (useful for many calculations) */ + @SuppressWarnings("unused") public int pixelCount; -// /// true if smoothing is enabled (read-only) -// public boolean smooth; - - /// the anti-aliasing level for renderers that support it + /** the anti-aliasing level for renderers that support it */ public int smooth; // ........................................................ - /// true if defaults() has been called a first time + /** true if defaults() has been called a first time */ protected boolean settingsInited; - /// true if settings should be re-applied on next beginDraw() + /** true if settings should be re-applied on next beginDraw() */ protected boolean reapplySettings; - /// set to a PGraphics object being used inside a beginRaw/endRaw() block + /** set to a PGraphics object being used inside a beginRaw/endRaw() block */ protected PGraphics raw; // ........................................................ @@ -199,9 +183,6 @@ public class PGraphics extends PImage implements PConstants { */ protected boolean primaryGraphics; -// // TODO nervous about leaving this here since it seems likely to create -// // back-references where we don't want them -// protected PSurface surface; // ........................................................ @@ -266,13 +247,20 @@ public class PGraphics extends PImage implements PConstants { // transformations (2D and 3D) + @SuppressWarnings("unused") static public final int TX = 18; // transformed xyzw + @SuppressWarnings("unused") static public final int TY = 19; + @SuppressWarnings("unused") static public final int TZ = 20; + @SuppressWarnings("unused") static public final int VX = 21; // view space coords + @SuppressWarnings("unused") static public final int VY = 22; + @SuppressWarnings("unused") static public final int VZ = 23; + @SuppressWarnings("unused") static public final int VW = 24; @@ -285,9 +273,13 @@ public class PGraphics extends PImage implements PConstants { static public final int AB = 27; // Diffuse is shared with fill. + @SuppressWarnings("unused") static public final int DR = 3; // TODO needs to not be shared, this is a material property + @SuppressWarnings("unused") static public final int DG = 4; + @SuppressWarnings("unused") static public final int DB = 5; + @SuppressWarnings("unused") static public final int DA = 6; // specular (by default kept white) @@ -347,7 +339,7 @@ public class PGraphics extends PImage implements PConstants { /** * True if tint() is enabled (read-only). - * + * * Using tint/tintColor seems a better option for naming than * tintEnabled/tint because the latter seems ugly, even though * g.tint as the actual color seems a little more intuitive, @@ -664,9 +656,6 @@ public class PGraphics extends PImage implements PConstants { /// Current mode for normals, one of AUTO, SHAPE, or VERTEX protected int normalMode; - /// Keep track of how many calls to normal, to determine the mode. - //protected int normalCount; - protected boolean autoNormal; /** Current normal vector. */ @@ -764,7 +753,7 @@ public class PGraphics extends PImage implements PConstants { * The final step in setting up a renderer, set its size of this renderer. * This was formerly handled by the constructor, but instead it's been broken * out so that setParent/setPrimary/setPath can be handled differently. - * + * * Important: this is ignored by the Methods task because otherwise it will * override setSize() in PApplet/Applet/Component, which will 1) not call * super.setSize(), and 2) will cause the renderer to be resized from the @@ -933,7 +922,7 @@ public class PGraphics extends PImage implements PConstants { * graphics buffer, meaning that for subclasses like OpenGL, there * needs to be a valid graphics context to mess with otherwise * you'll get some good crashing action. - * + * * This is currently called by checkSettings(), during beginDraw(). */ protected void defaultSettings() { // ignore @@ -995,7 +984,7 @@ public class PGraphics extends PImage implements PConstants { * their methods be called (rather than simply setting the textFont variable) * because they affect the graphics context, or they require parameters from * the context (e.g. getting native fonts for text). - * + * * This will only be called from an allocate(), which is only called from * size(), which is safely called from inside beginDraw(). And it cannot be * called before defaultSettings(), so we should be safe. @@ -1223,12 +1212,12 @@ public class PGraphics extends PImage implements PConstants { /** * - * Sets the current normal vector. Used for drawing three dimensional shapes and - * surfaces, normal() specifies a vector perpendicular to a shape's - * surface which, in turn, 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. + * Sets the current normal vector. Used for drawing three-dimensional + * shapes and surfaces, normal() specifies a vector perpendicular + * to a shape's surface which, in turn, 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. * * @webref lights_camera:lights * @webBrief Sets the current normal vector @@ -1313,12 +1302,10 @@ public class PGraphics extends PImage implements PConstants { } /** - * * Defines if textures repeat or draw once within a texture map. * The two parameters are CLAMP (the default behavior) and REPEAT. * This function only works with the P2D and P3D renderers. * - * * @webref image:textures * @webBrief Defines if textures repeat or draw once within a texture map * @param wrap Either CLAMP (default) or REPEAT @@ -1331,12 +1318,11 @@ public class PGraphics extends PImage implements PConstants { /** - * * 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(). This function only works with the P2D and P3D - * renderers.* Implementation notes: @@ -3269,7 +3238,7 @@ public class PGraphics extends PImage implements PConstants { * in the center point *
* sphere is a series of concentric circles who radii vary - * along the shape, based on, er.. cos or something + * along the shape, based on, err... cos or something *
* [toxi 031031] new sphere code. removed all multiplies with
* radius, as scale() will take care of that anyway
@@ -3294,7 +3263,7 @@ public class PGraphics extends PImage implements PConstants {
edge(false);
- // 1st ring from south pole
+ // 1st ring from southern pole
beginShape(TRIANGLE_STRIP);
for (int i = 0; i < sphereDetailU; i++) {
normal(0, -1, 0);
@@ -3362,10 +3331,9 @@ public class PGraphics extends PImage implements PConstants {
* 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
+ * second time with the y coordinates to get the location of a Bézier curve
* at t.
*
- *
* Advanced
* For instance, to convert the following example:
* stroke(255, 102, 0);
@@ -3403,17 +3371,15 @@ public class PGraphics extends PImage implements PConstants {
return (a*t1 + 3*b*t)*t1*t1 + (3*c*t1 + d*t)*t*t;
}
/**
- *
- * Calculates the tangent of a point on a Bezier curve. There is a good
+ * Calculates the tangent of a point on a Bézier curve. There is a good
* definition of tangent on Wikipedia.
*
- *
* Advanced
* Code submitted by Dave Bollinger (davbol) for release 0136.
*
* @webref shape:curves
- * @webBrief Calculates the tangent of a point on a Bezier curve
+ * @webBrief Calculates the tangent of a point on a Bézier curve
* @param a coordinate of first point on the curve
* @param b coordinate of first control point
* @param c coordinate of second control point
@@ -3445,14 +3411,12 @@ 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 renderer; the default
- * P2D renderer does not use this information.
- *
+ * Sets the resolution at which Bézier curves display. The default value is 20.
+ * This function is only useful when using the P2D or P3D renderer;
+ * the default (JAVA2D) renderer does not use this information.
*
* @webref shape:curves
- * @webBrief Sets the resolution at which Beziers display
+ * @webBrief Sets the resolution at which Bézier curves display
* @param detail resolution of the curves
* @see PGraphics#curve(float, float, float, float, float, float, float, float,
* float, float, float, float)
@@ -3490,17 +3454,16 @@ public class PGraphics extends PImage implements PConstants {
/**
*
- * Draws a Bezier curve on the screen. These curves are defined by a series
+ * Draws a Bézier 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
+ * of the curve. The curves were developed by French engineer Pierre
* Bezier. Using the 3D version requires rendering with P3D (see the
* Environment reference for more information).
*
- *
* Advanced
- * Draw a cubic bezier curve. The first and last points are
+ * Draw a cubic Bézier 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.
*
@@ -3523,7 +3486,7 @@ public class PGraphics extends PImage implements PConstants {
*
bezier(x1, y1, cx, cy, cx, cy, x2, y2);
*
* @webref shape:curves
- * @webBrief Draws a Bezier curve on the screen
+ * @webBrief Draws a Bézier curve on the screen
* @param x1 coordinates for the first anchor point
* @param y1 coordinates for the first anchor point
* @param z1 coordinates for the first anchor point
@@ -3559,7 +3522,6 @@ public class PGraphics extends PImage implements PConstants {
// CATMULL-ROM CURVE
/**
- *
* Evaluates the curve at point t for points a, b,
* c, d. The parameter t may range from 0 (the start of the
* curve) and 1 (the end of the curve). a and d are the control
@@ -3568,7 +3530,6 @@ public class PGraphics extends PImage implements PConstants {
* second time with the y coordinates to get the location of a curve at
* t.
*
- *
* @webref shape:curves
* @webBrief Evaluates the curve at point t for points a, b, c, d
* @param a coordinate of first control point
@@ -3597,12 +3558,10 @@ public class PGraphics extends PImage implements PConstants {
/**
- *
* Calculates the tangent of a point on a curve. There's a good definition
* of tangent on Wikipedia.
*
- *
* Advanced
* Code thanks to Dave Bollinger (Bug #715)
*
@@ -3634,12 +3593,10 @@ 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 renderer as the default
* P2D renderer does not use this information.
*
- *
* @webref shape:curves
* @webBrief Sets the resolution at which curves display
* @param detail resolution of the curves
@@ -3743,12 +3700,11 @@ public class PGraphics extends PImage implements PConstants {
* implementation of Catmull-Rom splines. Using the 3D version requires
* rendering with P3D (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:
* beginShape();
* curveVertex(x1, y1);
@@ -3895,7 +3851,6 @@ public class PGraphics extends PImage implements PConstants {
* The parameter must be written in ALL CAPS because Processing is a
* case-sensitive language.
*
- *
* @webref image:loading & displaying
* @webBrief Modifies the location from which images draw
* @param mode either CORNER, CORNERS, or CENTER
@@ -4105,8 +4060,7 @@ public class PGraphics extends PImage implements PConstants {
* 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.
- *
+ * Processing is a case-sensitive language.
*
* @webref shape:loading & displaying
* @webBrief Modifies the location from which shapes draw
@@ -4141,7 +4095,6 @@ public class PGraphics extends PImage implements PConstants {
/**
- *
* Draws shapes to the display window. 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, OBJ, and custom-created
@@ -4151,7 +4104,6 @@ public class PGraphics extends PImage implements PConstants {
* d parameters specify a different size. The shapeMode() function
* can be used to change the way these parameters are interpreted.
*
- *
* @webref shape:loading & displaying
* @webBrief Displays shapes to the screen
* @param shape the shape to display
@@ -4160,8 +4112,6 @@ public class PGraphics extends PImage implements PConstants {
* @see PShape
* @see PApplet#loadShape(String)
* @see PGraphics#shapeMode(int)
- *
- * Convenience method to draw at a particular location.
*/
public void shape(PShape shape, float x, float y) {
if (shape.isVisible()) { // don't do expensive matrix ops if invisible
@@ -4306,7 +4256,6 @@ public class PGraphics extends PImage implements PConstants {
/**
- *
* 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()
@@ -4331,8 +4280,6 @@ public class PGraphics extends PImage implements PConstants {
* textDescent() so that the hack works even if you change the size of
* the font.
*
- *
- *
* @webref typography:attributes
* @webBrief Sets the current alignment for drawing text
* @param alignX horizontal alignment, either LEFT, CENTER, or RIGHT
@@ -4351,11 +4298,9 @@ public class PGraphics extends PImage implements PConstants {
/**
- *
* Returns ascent of the current font at its current size. This information is
* useful for determining the height of the font above the baseline.
*
- *
* @webref typography:metrics
* @webBrief Returns ascent of the current font at its current size
* @see PGraphics#textDescent()
@@ -4369,7 +4314,6 @@ public class PGraphics extends PImage implements PConstants {
/**
- *
* Returns descent of the current font at its current size. This information is
* useful for determining the height of the font below the baseline.
*
@@ -4486,7 +4430,6 @@ public class PGraphics extends PImage implements PConstants {
/**
- *
* Sets the spacing between lines of text in units of pixels. This setting will
* be used in all subsequent calls to the text() function. Note, however,
* that the leading is reset by textSize(). For example, if the leading
@@ -4494,7 +4437,6 @@ public class PGraphics extends PImage implements PConstants {
* at a later point, the leading will be reset to the default for the text size
* of 48.
*
- *
* @webref typography:attributes
* @webBrief Sets the spacing between lines of text in units of pixels
* @param leading the size in pixels for spacing between lines
@@ -4510,7 +4452,6 @@ public class PGraphics extends PImage implements PConstants {
/**
- *
* Sets the way text draws to the screen, either as texture maps or as vector
* geometry. The default textMode(MODEL), uses textures to render the
* fonts. The textMode(SHAPE) mode draws text using the glyph outlines of
@@ -4551,11 +4492,11 @@ public class PGraphics extends PImage implements PConstants {
if (textModeCheck(mode)) {
textMode = mode;
} else {
- String modeStr = String.valueOf(mode);
- switch (mode) {
- case MODEL: modeStr = "MODEL"; break;
- case SHAPE: modeStr = "SHAPE"; break;
- }
+ String modeStr = switch (mode) {
+ case MODEL -> "MODEL";
+ case SHAPE -> "SHAPE";
+ default -> String.valueOf(mode);
+ };
showWarning("textMode(" + modeStr + ") is not supported by this renderer.");
}
}
@@ -4567,11 +4508,9 @@ public class PGraphics extends PImage implements PConstants {
/**
- *
* Sets the current font size. This size will be used in all subsequent
* calls to the text() function. Font size is measured in units of pixels.
*
- *
* @webref typography:attributes
* @webBrief Sets the current font size
* @param size the size of the letters in units of pixels
@@ -4631,10 +4570,8 @@ public class PGraphics extends PImage implements PConstants {
/**
- *
* Calculates and returns the width of any character or text string.
*
- *
* @webref typography:attributes
* @webBrief Calculates and returns the width of any character or text string
* @param str the String of characters to measure
@@ -4683,7 +4620,7 @@ public class PGraphics extends PImage implements PConstants {
/**
* Implementation of returning the text width of
- * the chars [start, stop) in the buffer.
+ * the chars [start, stop) in the buffer.
* Unlike the previous version that was inside PFont, this will
* return the size not of a 1 pixel font, but the actual current size.
*/
@@ -4701,7 +4638,6 @@ public class PGraphics extends PImage implements PConstants {
/**
- *
* Draws text to the screen. Displays the information specified in the first
* parameter on the screen in the position specified by the additional
* parameters. A default font will be used unless a font is set with the
@@ -4721,7 +4657,6 @@ public class PGraphics extends PImage implements PConstants {
* a PFont with textFont(). In that case, a generic sans-serif font will
* be used instead. (See the third example above.)
*
- *
* @webref typography:loading & displaying
* @webBrief Draws text to the screen
* @param c the alphanumeric character to be displayed
@@ -4898,24 +4833,26 @@ public class PGraphics extends PImage implements PConstants {
float hradius, vradius;
switch (rectMode) {
- case CORNER:
- x2 += x1; y2 += y1;
- break;
- case RADIUS:
- hradius = x2;
- vradius = y2;
- x2 = x1 + hradius;
- y2 = y1 + vradius;
- x1 -= hradius;
- y1 -= vradius;
- break;
- case CENTER:
- hradius = x2 / 2.0f;
- vradius = y2 / 2.0f;
- x2 = x1 + hradius;
- y2 = y1 + vradius;
- x1 -= hradius;
- y1 -= vradius;
+ case CORNER -> {
+ x2 += x1;
+ y2 += y1;
+ }
+ case RADIUS -> {
+ hradius = x2;
+ vradius = y2;
+ x2 = x1 + hradius;
+ y2 = y1 + vradius;
+ x1 -= hradius;
+ y1 -= vradius;
+ }
+ case CENTER -> {
+ hradius = x2 / 2.0f;
+ vradius = y2 / 2.0f;
+ x2 = x1 + hradius;
+ y2 = y1 + vradius;
+ x1 -= hradius;
+ y1 -= vradius;
+ }
}
if (x2 < x1) {
float temp = x1; x1 = x2; x2 = temp;
@@ -5008,7 +4945,7 @@ public class PGraphics extends PImage implements PConstants {
/**
* Emit a sentence of text, defined as a chunk of text without any newlines.
* @param stop non-inclusive, the end of the text in question
- * @return false if cannot fit
+ * @return false if it cannot fit
*/
protected boolean textSentence(char[] buffer, int start, int stop,
float boxWidth) {
@@ -5323,7 +5260,6 @@ public class PGraphics extends PImage implements PConstants {
* transformations (rotate, scale, translate) and the drawing styles
* at the same time.
*
- *
* @webref structure
* @webBrief The push() function saves the current drawing style
* settings and transformations, while pop() restores these
@@ -5361,7 +5297,6 @@ public class PGraphics extends PImage implements PConstants {
* transformations (rotate, scale, translate) and the drawing styles
* at the same time.
*
- *
* @webref structure
* @webBrief The pop() function restores the previous drawing style
* settings and transformations after push() has changed them
@@ -5380,7 +5315,6 @@ public class PGraphics extends PImage implements PConstants {
/**
- *
* Pushes the current transformation matrix onto the matrix stack.
* Understanding pushMatrix() and popMatrix() requires
* understanding the concept of a matrix stack. The pushMatrix()
@@ -5390,7 +5324,6 @@ public class PGraphics extends PImage implements PConstants {
* the other transformation functions and may be embedded to control the
* scope of the transformations.
*
- *
* @webref transform
* @webBrief Pushes the current transformation matrix onto the matrix stack
* @see PGraphics#popMatrix()
@@ -5407,7 +5340,6 @@ public class PGraphics extends PImage implements PConstants {
/**
- *
* Pops the current transformation matrix off the matrix stack.
* Understanding pushing and popping requires understanding the concept of
* a matrix stack. The pushMatrix() function saves the current
@@ -5416,7 +5348,6 @@ public class PGraphics extends PImage implements PConstants {
* in conjunction with the other transformation functions and may be
* embedded to control the scope of the transformations.
*
- *
* @webref transform
* @webBrief Pops the current transformation matrix off the matrix stack
* @see PGraphics#pushMatrix()
@@ -5433,14 +5364,13 @@ public class PGraphics extends PImage implements PConstants {
/**
- *
* Specifies an amount to displace objects within the display window. The
* x parameter specifies left/right translation, the y parameter
* specifies up/down translation, and the z parameter specifies
* translations toward/away from the screen. Using this function with the
* z parameter requires using P3D as a parameter in combination with size
- * as shown in the above example.
- *
+ * as shown in the above example.
+ *
* Transformations are cumulative and apply to everything that happens after and
* subsequent calls to the function accumulates the effect. For example, calling
* translate(50, 0) and then translate(20, 0) is the same as
@@ -5449,7 +5379,6 @@ public class PGraphics extends PImage implements PConstants {
* function can be further controlled by using pushMatrix() and
* popMatrix().
*
- *
* @webref transform
* @webBrief Specifies an amount to displace objects within the display window
* @param x left/right translation
@@ -5493,7 +5422,6 @@ public class PGraphics extends PImage implements PConstants {
* matrix by a rotation matrix. This function can be further controlled by
* the pushMatrix() and popMatrix().
*
- *
* @webref transform
* @webBrief Rotates a shape the amount specified by the angle parameter
* @param angle angle of rotation specified in radians
@@ -5525,7 +5453,6 @@ public class PGraphics extends PImage implements PConstants {
* This function requires using P3D as a third parameter to size()
* as shown in the example above.
*
- *
* @webref transform
* @webBrief Rotates a shape around the x-axis the amount specified by the
* angle parameter
@@ -5558,7 +5485,6 @@ public class PGraphics extends PImage implements PConstants {
* This function requires using P3D as a third parameter to size()
* as shown in the examples above.
*
- *
* @webref transform
* @webBrief Rotates a shape around the y-axis the amount specified by the
* angle parameter
@@ -5591,7 +5517,6 @@ public class PGraphics extends PImage implements PConstants {
* This function requires using P3D as a third parameter to size()
* as shown in the examples above.
*
- *
* @webref transform
* @webBrief Rotates a shape around the z-axis the amount specified by the
* angle parameter
@@ -5636,7 +5561,6 @@ public class PGraphics extends PImage implements PConstants {
* example above. This function can be further controlled with
* pushMatrix() and popMatrix().
*
- *
* @webref transform
* @webBrief Increases or decreases the size of a shape by expanding and
* contracting vertices
@@ -5657,7 +5581,7 @@ public class PGraphics extends PImage implements PConstants {
/**
* Advanced
* Scale in X and Y. Equivalent to scale(sx, sy, 1).
- *
+ *
* Not recommended for use in 3D, because the z-dimension is just
* scaled by 1, since there's no way to know what else to scale it by.
*
@@ -5694,7 +5618,6 @@ public class PGraphics extends PImage implements PConstants {
* matrix by a rotation matrix. This function can be further controlled by
* the pushMatrix() and popMatrix() functions.
*
- *
* @webref transform
* @webBrief Shears a shape around the x-axis the amount specified by the
* angle parameter
@@ -5728,7 +5651,6 @@ public class PGraphics extends PImage implements PConstants {
* matrix by a rotation matrix. This function can be further controlled by
* the pushMatrix() and popMatrix() functions.
*
- *
* @webref transform
* @webBrief Shears a shape around the y-axis the amount specified by the
* angle parameter
@@ -5751,10 +5673,8 @@ public class PGraphics extends PImage implements PConstants {
/**
- *
- * Replaces the current matrix with the identity matrix. The equivalent function
- * in OpenGL is glLoadIdentity().
- *
+ * Replaces the current matrix with the identity matrix.
+ * The equivalent function in OpenGL is glLoadIdentity().
*
* @webref transform
* @webBrief Replaces the current matrix with the identity matrix
@@ -5768,16 +5688,14 @@ public class PGraphics extends PImage implements PConstants {
}
/**
- *
* Multiplies the current matrix by the one specified through the
* parameters. This is very slow because it will try to calculate the
* inverse of the transform, so avoid it whenever possible. The equivalent
* function in OpenGL is glMultMatrix().
*
- *
* @webref transform
- * @webBrief Multiplies the current matrix by the one specified through the
- * parameters
+ * @webBrief Multiplies the current matrix by the one specified in the
+ * parameter
* @see PGraphics#pushMatrix()
* @see PGraphics#popMatrix()
* @see PGraphics#resetMatrix()
@@ -5900,11 +5818,9 @@ public class PGraphics extends PImage implements PConstants {
/**
- *
* Prints the current matrix to the Console (the text window at the bottom
* of Processing).
*
- *
* @webref transform
* @webBrief Prints the current matrix to the Console (the text window at the bottom
* of Processing)
@@ -5923,7 +5839,6 @@ public class PGraphics extends PImage implements PConstants {
// CAMERA
/**
- *
* The beginCamera() and endCamera() functions enable
* advanced customization of the camera space. The functions are useful if
* you want to more control over camera movement, however for most users,
@@ -5941,7 +5856,6 @@ public class PGraphics extends PImage implements PConstants {
* following endCamera() and pairs of beginCamera() and
* endCamera() cannot be nested.
*
- *
* @webref lights_camera:camera
* @webBrief The beginCamera() and endCamera() functions enable
* advanced customization of the camera space
@@ -5957,12 +5871,10 @@ public class PGraphics extends PImage implements PConstants {
}
/**
- *
* The beginCamera() and endCamera() functions enable
* advanced customization of the camera space. Please see the reference for
* beginCamera() for a description of how the functions are used.
*
- *
* @webref lights_camera:camera
* @webBrief The beginCamera() and endCamera() functions enable
* advanced customization of the camera space
@@ -5974,7 +5886,6 @@ public class PGraphics extends PImage implements PConstants {
}
/**
- *
* Sets the position of the camera through setting the eye position, the
* center of the scene, and which axis is facing upward. Moving the eye
* position and the direction it is pointing (the center of the scene)
@@ -5985,7 +5896,6 @@ public class PGraphics extends PImage implements PConstants {
* 180.0), width/2.0, height/2.0, 0, 0, 1, 0). This function is similar
* to gluLookAt() in OpenGL, but it first clears the current camera settings.
*
- *
* @webref lights_camera:camera
* @webBrief Sets the position of the camera
* @see PGraphics#beginCamera()
@@ -6043,7 +5953,6 @@ public class PGraphics extends PImage implements PConstants {
* are the minimum and maximum z values. If no parameters are given, the default
* is used: ortho(-width/2, width/2, -height/2, height/2).
*
- *
* @webref lights_camera:camera
* @webBrief Sets an orthographic projection and defines a parallel clipping
* volume
@@ -6086,7 +5995,6 @@ public class PGraphics extends PImage implements PConstants {
* default values are: perspective(PI/3.0, width/height, cameraZ/10.0,
* cameraZ*10.0) where cameraZ is ((height/2.0) / tan(PI*60.0/360.0))
*
- *
* @webref lights_camera:camera
* @webBrief Sets a perspective projection applying foreshortening, making distant
* objects appear smaller than closer ones
@@ -6099,7 +6007,7 @@ public class PGraphics extends PImage implements PConstants {
* @param fovy field-of-view angle (in radians) for vertical direction
* @param aspect ratio of width to height
* @param zNear z-position of nearest clipping plane
- * @param zFar z-position of farthest clipping plane
+ * @param zFar z-position of the farthest clipping plane
*/
public void perspective(float fovy, float aspect, float zNear, float zFar) {
showMissingWarning("perspective");
@@ -6127,7 +6035,6 @@ public class PGraphics extends PImage implements PConstants {
* Works like glFrustum, except it wipes out the current perspective matrix
* rather than multiplying itself with it.
*
- *
* @webref lights_camera:camera
* @webBrief Sets a perspective matrix defined through the parameters
* @param left left coordinate of the clipping plane
@@ -6150,11 +6057,9 @@ public class PGraphics extends PImage implements PConstants {
}
/**
- *
* Prints the current projection matrix to the Console (the text window at
* the bottom of Processing).
*
- *
* @webref lights_camera:camera
* @webBrief Prints the current projection matrix to the Console
* @see PGraphics#camera(float, float, float, float, float, float, float, float, float)
@@ -6171,11 +6076,9 @@ public class PGraphics extends PImage implements PConstants {
/**
- *
* Takes a three-dimensional X, Y, Z position and returns the X value for
* where it will appear on a (two-dimensional) screen.
*
- *
* @webref lights_camera:coordinates
* @webBrief Takes a three-dimensional X, Y, Z position and returns the X value for
* where it will appear on a (two-dimensional) screen
@@ -6191,11 +6094,9 @@ public class PGraphics extends PImage implements PConstants {
/**
- *
* Takes a three-dimensional X, Y, Z position and returns the Y value for
* where it will appear on a (two-dimensional) screen.
*
- *
* @webref lights_camera:coordinates
* @webBrief Takes a three-dimensional X, Y, Z position and returns the Y value for
* where it will appear on a (two-dimensional) screen
@@ -6230,11 +6131,9 @@ public class PGraphics extends PImage implements PConstants {
/**
- *
* Takes a three-dimensional X, Y, Z position and returns the Z value for
* where it will appear on a (two-dimensional) screen.
*
- *
* @webref lights_camera:coordinates
* @webBrief Takes a three-dimensional X, Y, Z position and returns the Z value for
* where it will appear on a (two-dimensional) screen
@@ -6265,7 +6164,6 @@ public class PGraphics extends PImage implements PConstants {
* (x, y, z) coordinate returned by the model functions is used to place
* another box in the same location.
*
- *
* @webref lights_camera:coordinates
* @webBrief Returns the three-dimensional X, Y, Z position in model space
* @param x 3D x-coordinate to be mapped
@@ -6281,7 +6179,6 @@ public class PGraphics extends PImage implements PConstants {
/**
- *
* Returns the three-dimensional X, Y, Z position in model space. This
* returns the Y value for a given coordinate based on the current set of
* transformations (scale, rotate, translate, etc.) The Y value can be used
@@ -6295,7 +6192,6 @@ public class PGraphics extends PImage implements PConstants {
* (x, y, z) coordinate returned by the model functions is used to place
* another box in the same location.
*
- *
* @webref lights_camera:coordinates
* @webBrief Returns the three-dimensional X, Y, Z position in model space
* @param x 3D x-coordinate to be mapped
@@ -6325,7 +6221,6 @@ public class PGraphics extends PImage implements PConstants {
* (x, y, z) coordinate returned by the model functions is used to place
* another box in the same location.
*
- *
* @webref lights_camera:coordinates
* @webBrief Returns the three-dimensional X, Y, Z position in model space
* @param x 3D x-coordinate to be mapped
@@ -6362,7 +6257,6 @@ public class PGraphics extends PImage implements PConstants {
* textAlign(), textFont(), textMode(), textSize(), textLeading(),
* emissive(), specular(), shininess(), ambient()
*
- *
* @webref structure
* @webBrief Saves the current style settings and popStyle() restores the prior settings
* @see PGraphics#popStyle()
@@ -6379,7 +6273,6 @@ public class PGraphics extends PImage implements PConstants {
}
/**
- *
* The pushStyle() function saves the current style settings and
* popStyle() restores the prior settings; these functions are
* always used together. They allow you to change the style settings and
@@ -6388,7 +6281,6 @@ public class PGraphics extends PImage implements PConstants {
* pushStyle() and popStyle() functions can be embedded to
* provide more control (see the second example above for a demonstration.)
*
- *
* @webref structure
* @webBrief Saves the current style settings and popStyle() restores the prior settings
* @see PGraphics#pushStyle()
@@ -6542,7 +6434,6 @@ public class PGraphics extends PImage implements PConstants {
// STROKE CAP/JOIN/WEIGHT
/**
- *
* Sets the width of the stroke used for lines, points, and the border around
* shapes. All widths are set in units of pixels.
*
@@ -6551,7 +6442,6 @@ public class PGraphics extends PImage implements PConstants {
* setting the pixel using set() or drawing the point using either
* circle() or square().
*
- *
* @webref shape:attributes
* @webBrief Sets the width of the stroke used for lines, points, and the border
* around shapes
@@ -6565,12 +6455,10 @@ public class PGraphics extends PImage implements PConstants {
}
/**
- *
* Sets the style of the joints which connect line segments. These joints are
* either mitered, beveled, or rounded and specified with the corresponding
* parameters MITER, BEVEL, and ROUND. The default joint is MITER.
*
- *
* @webref shape:attributes
* @webBrief Sets the style of the joints which connect line segments
* @param join either MITER, BEVEL, ROUND
@@ -6583,7 +6471,6 @@ public class PGraphics extends PImage implements PConstants {
}
/**
- *
* Sets the style for rendering line endings. These ends are either squared,
* extended, or rounded, each of which specified with the corresponding
* parameters: SQUARE, PROJECT, and ROUND. The default cap is ROUND.
@@ -6611,11 +6498,9 @@ public class PGraphics extends PImage implements PConstants {
/**
- *
* Disables drawing the stroke (outline). If both noStroke() and
* noFill() are called, nothing will be drawn to the screen.
*
- *
* @webref color:setting
* @webBrief Disables drawing the stroke (outline)
* @see PGraphics#stroke(int, float)
@@ -6736,7 +6621,6 @@ public class PGraphics extends PImage implements PConstants {
* Removes the current fill value for displaying images and reverts to
* displaying images with their original hues.
*
- *
* @webref image:loading & displaying
* @webBrief Removes the current fill value for displaying images and reverts to
* displaying images with their original hues
@@ -6774,7 +6658,6 @@ public class PGraphics extends PImage implements PConstants {
* The tint() function is also used to control the coloring of textures
* in 3D.
*
- *
* @webref image:loading & displaying
* @webBrief Sets the fill value for displaying images
* @usage web_application
@@ -6854,7 +6737,6 @@ public class PGraphics extends PImage implements PConstants {
* Disables filling geometry. If both noStroke() and noFill()
* are called, nothing will be drawn to the screen.
*
- *
* @webref color:setting
* @webBrief Disables filling geometry
* @usage web_application
@@ -6889,7 +6771,6 @@ public class PGraphics extends PImage implements PConstants {
*
* To change the color of an image (or a texture), use tint().
*
- *
* @webref color:setting
* @webBrief Sets the color used to fill shapes
* @usage web_application
@@ -6977,7 +6858,6 @@ public class PGraphics extends PImage implements PConstants {
* reflect. Used in combination with emissive(), specular(),
* and shininess() in setting the material properties of shapes.
*
- *
* @webref lights_camera:material properties
* @webBrief Sets the ambient reflectance for shapes drawn to the screen
* @usage web_application
@@ -7033,7 +6913,6 @@ public class PGraphics extends PImage implements PConstants {
* with emissive(), ambient(), and shininess() in
* setting the material properties of shapes.
*
- *
* @webref lights_camera:material properties
* @webBrief Sets the specular color of the materials used for shapes drawn to the
* screen, which sets the color of highlights
@@ -7093,7 +6972,6 @@ public class PGraphics extends PImage implements PConstants {
* with ambient(), specular(), and emissive() in
* setting the material properties of shapes.
*
- *
* @webref lights_camera:material properties
* @webBrief Sets the amount of gloss in the surface of shapes
* @usage web_application
@@ -7113,7 +6991,6 @@ public class PGraphics extends PImage implements PConstants {
* specular(), and shininess() in setting the material
* properties of shapes.
*
- *
* @webref lights_camera:material properties
* @webBrief Sets the emissive color of the material used for drawing shapes drawn to
* the screen
@@ -7183,7 +7060,6 @@ public class PGraphics extends PImage implements PConstants {
* looping program will cause them to only have an effect the first time
* through the loop.
*
- *
* @webref lights_camera:lights
* @webBrief Sets the default ambient light, directional light, falloff, and specular
* values
@@ -7205,7 +7081,6 @@ public class PGraphics extends PImage implements PConstants {
* lighting so that 2D geometry (which does not require lighting) can be
* drawn after a set of lighted 3D geometry.
*
- *
* @webref lights_camera:lights
* @webBrief Disable all lighting
* @usage web_application
@@ -7226,7 +7101,6 @@ public class PGraphics extends PImage implements PConstants {
* through the loop. The v1, v2, and v3 parameters are
* interpreted as either RGB or HSB values, depending on the current color mode.
*
- *
* @webref lights_camera:lights
* @webBrief Adds an ambient light
* @usage web_application
@@ -7256,7 +7130,7 @@ public class PGraphics extends PImage implements PConstants {
/**
*
* Adds a directional light. Directional light comes from one direction and
- * is stronger when hitting a surface squarely and weaker if it hits at a a
+ * is stronger when hitting a surface squarely and weaker if it hits at a
* gentle angle. After hitting a surface, a directional lights scatters in
* all directions. Lights need to be included in the draw() to
* remain persistent in a looping program. Placing them in the
@@ -7267,7 +7141,6 @@ public class PGraphics extends PImage implements PConstants {
* direction the light is facing. For example, setting ny to -1 will
* cause the geometry to be lit from below (the light is facing directly upward).
*
- *
* @webref lights_camera:lights
* @webBrief Adds a directional light
* @usage web_application
@@ -7296,7 +7169,6 @@ public class PGraphics extends PImage implements PConstants {
* as either RGB or HSB values, depending on the current color mode. The
* x, y, and z parameters set the position of the light.
*
- *
* @webref lights_camera:lights
* @webBrief Adds a point light
* @usage web_application
@@ -7319,7 +7191,7 @@ public class PGraphics extends PImage implements PConstants {
/**
*
- * Adds a spot light. Lights need to be included in the draw() to remain
+ * Adds a spotlight. Lights need to be included in the draw() to remain
* persistent in a looping program. Placing them in the setup() of a
* looping program will cause them to only have an effect the first time through
* the loop. The v1, v2, and v3 parameters are interpreted
@@ -7331,7 +7203,7 @@ public class PGraphics extends PImage implements PConstants {
* that cone.
*
* @webref lights_camera:lights
- * @webBrief Adds a spot light
+ * @webBrief Adds a spotlight
* @usage web_application
* @param v1 red or hue value (depending on current color mode)
* @param v2 green or saturation value (depending on current color
@@ -7341,9 +7213,9 @@ public class PGraphics extends PImage implements PConstants {
* @param x x-coordinate of the light
* @param y y-coordinate of the light
* @param z z-coordinate of the light
- * @param nx direction along the x axis
- * @param ny direction along the y axis
- * @param nz direction along the z axis
+ * @param nx direction along the x-axis
+ * @param ny direction along the y-axis
+ * @param nz direction along the z-axis
* @param angle angle of the spotlight cone
* @param concentration exponent determining the center bias of the cone
* @see PGraphics#lights()
@@ -7360,7 +7232,7 @@ public class PGraphics extends PImage implements PConstants {
/**
*
- * Sets the falloff rates for point lights, spot lights, and ambient lights.
+ * Sets the falloff rates for point lights, spotlights, and ambient lights.
* Like fill(), it affects only the elements which are created after it
* in the code. The default value is lightFalloff(1.0, 0.0, 0.0), and the
* parameters are used to calculate the falloff with the following
@@ -7375,9 +7247,8 @@ public class PGraphics extends PImage implements PConstants {
* location and falloff. You can think of it as a point light that doesn't care
* which direction a surface is facing.
*
- *
* @webref lights_camera:lights
- * @webBrief Sets the falloff rates for point lights, spot lights, and ambient
+ * @webBrief Sets the falloff rates for point lights, spotlights, and ambient
* lights
* @usage web_application
* @param constant constant value or determining falloff
@@ -7404,7 +7275,6 @@ public class PGraphics extends PImage implements PConstants {
* specular material qualities set through the specular() and
* shininess() functions.
*
- *
* @webref lights_camera:lights
* @webBrief Sets the specular color for lights
* @usage web_application
@@ -7447,7 +7317,6 @@ public class PGraphics extends PImage implements PConstants {
* background colors on the main drawing surface. It can only be used along with
* a PGraphics object and createGraphics().
*
- *
* Advanced
*
* Clear the background with a color that includes an alpha value. This can only
@@ -7555,7 +7424,7 @@ public class PGraphics extends PImage implements PConstants {
* function. Unlike the main graphics context (the display window),
* pixels in additional graphics areas created with createGraphics()
* can be entirely or partially transparent. This function clears
- * everything in a PGraphics object to make all of the pixels
+ * everything in a PGraphics object to make all the pixels
* 100% transparent.
*
* @webref color:setting
@@ -7663,7 +7532,6 @@ public class PGraphics extends PImage implements PConstants {
* instance, instead of colorMode(RGB), write colorMode(RGB, 255, 255,
* 255).
*
- *
* @webref color:setting
* @webBrief Changes the way Processing interprets color data
* @usage web_application
@@ -7744,7 +7612,7 @@ public class PGraphics extends PImage implements PConstants {
* (the alpha for 0xAA000000) is set, and if not, whether the color value
* that follows is less than colorModeX (first param passed to colorMode).
*
- * This auto-detect would break in the following situation:
+ * This auto-detection would break in the following situation:
*
size(256, 256);
* for (int i = 0; i < 256; i++) {
* color c = color(0, 0, 0, i);
@@ -7872,7 +7740,7 @@ public class PGraphics extends PImage implements PConstants {
* Strangely the old version of this code ignored the alpha
* value. not sure if that was a bug or what.
*
- * Note, no need for a bounds check for 'argb' since it's a 32 bit number.
+ * Note, no need for a bounds check for 'argb' since it's a 32-bit number.
* Bounds now checked on alpha, however (rev 0225).
*/
protected void colorCalcARGB(int argb, float alpha) {
@@ -7905,13 +7773,13 @@ public class PGraphics extends PImage implements PConstants {
// These functions are really slow (because they take the current colorMode
// into account), but they're easy to use. Advanced users can write their
- // own bit shifting operations to setup 'color' data types.
+ // own bit shifting operations to set up 'color' data types.
public final int color(int c) { // ignore
// if (((c & 0xff000000) == 0) && (c <= colorModeX)) {
// if (colorModeDefault) {
-// // bounds checking to make sure the numbers aren't to high or low
+// // bounds checking to make sure the numbers aren't too high or low
// if (c > 255) c = 255; else if (c < 0) c = 0;
// return 0xff000000 | (c << 16) | (c << 8) | c;
// } else {
@@ -7936,7 +7804,7 @@ public class PGraphics extends PImage implements PConstants {
*/
public final int color(int c, int alpha) { // ignore
// if (colorModeDefault) {
-// // bounds checking to make sure the numbers aren't to high or low
+// // bounds checking to make sure the numbers aren't too high or low
// if (c > 255) c = 255; else if (c < 0) c = 0;
// if (alpha > 255) alpha = 255; else if (alpha < 0) alpha = 0;
//
@@ -8190,10 +8058,8 @@ public class PGraphics extends PImage implements PConstants {
/**
- *
* Extracts the brightness value from a color.
*
- *
* @webref color:creating & reading
* @webBrief Extracts the brightness value from a color
* @usage web_application
@@ -8234,7 +8100,6 @@ public class PGraphics extends PImage implements PConstants {
* because otherwise numbers outside the range will produce strange and
* unexpected colors.
*
- *
* @webref color:creating & reading
* @webBrief Calculates a color or colors between two colors at a specific
* increment
@@ -8298,7 +8163,7 @@ public class PGraphics extends PImage implements PConstants {
* cycling through ROYGBIV.
*/
// Disabling rollover (wasn't working anyway) for 0126.
- // Otherwise it makes full spectrum scale impossible for
+ // Otherwise, it makes full spectrum scale impossible for
// those who might want it...in spite of how despicable
// a full spectrum scale might be.
// roll around when 0.9 to 0.1
@@ -8450,7 +8315,7 @@ public class PGraphics extends PImage implements PConstants {
/**
- * Show an renderer-related exception that halts the program. Currently just
+ * Show a renderer-related exception that halts the program. Currently just
* wraps the message as a RuntimeException and throws it, but might do
* something more specific might be used in the future.
*/