diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index 51a246234..6254811f3 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -6509,6 +6509,8 @@ public class PApplet extends Applet /** * As of 0116 this also takes color(#FF8800, alpha) + * + * @param gray number specifying value between white and black */ public final int color(int gray, int alpha) { if (g == null) { @@ -6573,7 +6575,18 @@ public class PApplet extends Applet return g.color(x, y, z, a); } - + /** + * Creates colors for storing in variables of the color datatype. The parameters are interpreted as RGB or HSB values depending on the current colorMode(). The default mode is RGB values from 0 to 255 and therefore, the function call color(255, 204, 0) will return a bright yellow color. More about how colors are stored can be found in the reference for the color datatype. + * + * @webref color:creating_reading + * @param x red or hue values relative to the current color range + * @param y green or saturation values relative to the current color range + * @param z blue or brightness values relative to the current color range + * @param a alpha relative to current color range + * + * @see PApplet#colorMode(int) + * @ref color_datatype + */ public final int color(float x, float y, float z, float a) { if (g == null) { if (a > 255) a = 255; else if (a < 0) a = 0; @@ -8648,47 +8661,132 @@ public class PApplet extends Applet 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);
float r2 = myColor >> 16 & 0xFF;
+ * + * @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.

The green() 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 = green(myColor);
float r2 = myColor >> 8 & 0xFF;
+ * + * @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.

The blue() 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 a bit mask to remove the other color components. For example, the following two lines of code are equivalent:
float r1 = blue(myColor);
float r2 = myColor & 0xFF;
+ * + * @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); } - + static public int lerpColor(int c1, int c2, float amt, int mode) { return PGraphics.lerpColor(c1, c2, amt, mode); } @@ -8781,7 +8879,17 @@ public class PApplet extends Applet g.copy(src, sx, sy, sw, sh, dx, dy, dw, dh); } - + /** + * Blends two color values together based on the blending mode given as the MODE parameter. The possible modes are described in the reference for the blend() function. + * + * @webref color:creating_reading + * @param c1 the first color to blend + * @param c2 the second color to blend + * @param mode Either BLEND, ADD, SUBTRACT, DARKEST, LIGHTEST, DIFFERENCE, EXCLUSION, MULTIPLY, SCREEN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, or BURN + * + * @see PApplet#blend(int, int, int, int, int, int, int, int, int) + * @see PApplet#color(float) + */ static public int blendColor(int c1, int c2, int mode) { return PGraphics.blendColor(c1, c2, mode); }