fix variable naming, cleaning up constants

This commit is contained in:
benfry
2012-04-03 22:21:19 +00:00
parent acaca34812
commit 003b57e66f
7 changed files with 360 additions and 365 deletions
-7
View File
@@ -9995,13 +9995,6 @@ public class PApplet extends Applet
}
/** This feature is in testing, do not use or rely upon its implementation */
public void breakShape() {
if (recorder != null) recorder.breakShape();
g.breakShape();
}
public void beginContour() {
if (recorder != null) recorder.beginContour();
g.beginContour();
+26 -32
View File
@@ -273,7 +273,7 @@ public interface PConstants {
static final int ARGB = 2; // image
static final int HSB = 3; // color
static final int ALPHA = 4; // image
static final int CMYK = 5; // image & color (someday)
// static final int CMYK = 5; // image & color (someday)
// image file types
@@ -347,39 +347,38 @@ public interface PConstants {
// the low four bits set the variety,
// higher bits set the specific shape type
//static final int GROUP = (1 << 2);
static final int GROUP = 1; // createShape()
static final int POINT = 2; // shared with light (!)
static final int POINTS = 2;
static final int POINT = 2; // primitive
static final int POINTS = 3; // vertices
static final int LINE = 4;
static final int LINES = 4;
static final int LINE = 4; // primitive
static final int LINES = 5; // beginShape(), createShape()
static final int LINE_STRIP = 50; // beginShape()
static final int LINE_LOOP = 51;
static final int TRIANGLE = 8;
static final int TRIANGLES = 9;
static final int TRIANGLE_STRIP = 10;
static final int TRIANGLE_FAN = 11;
static final int TRIANGLE = 8; // primitive
static final int TRIANGLES = 9; // vertices
static final int TRIANGLE_STRIP = 10; // vertices
static final int TRIANGLE_FAN = 11; // vertices
static final int QUAD = 16;
static final int QUADS = 16;
static final int QUAD_STRIP = 17;
static final int QUAD = 16; // primitive
static final int QUADS = 17; // vertices
static final int QUAD_STRIP = 18; // vertices
static final int POLYGON = 20;
static final int PATH = 21;
static final int POLYGON = 20; // in the end, probably cannot
static final int PATH = 21; // separate these two
static final int RECT = 30;
static final int ELLIPSE = 31;
static final int ARC = 32;
static final int RECT = 30; // primitive
static final int ELLIPSE = 31; // primitive
static final int ARC = 32; // primitive
static final int SPHERE = 40;
static final int BOX = 41;
static final int SPHERE = 40; // primitive
static final int BOX = 41; // primitive
static public final int LINE_STRIP = 50;
static public final int LINE_LOOP = 51;
static public final int POINT_SPRITES = 52;
static public final int NON_STROKED_SHAPE = 60;
static public final int STROKED_SHAPE = 61;
// static public final int POINT_SPRITES = 52;
// static public final int NON_STROKED_SHAPE = 60;
// static public final int STROKED_SHAPE = 61;
// shape closing modes
@@ -396,8 +395,6 @@ public interface PConstants {
static final int CORNERS = 1;
/** Draw mode from the center, and using the radius */
static final int RADIUS = 2;
/** @deprecated Use RADIUS instead. */
static final int CENTER_RADIUS = 2;
/**
* Draw from the center, using second pair of values as the diameter.
* Formerly called CENTER_DIAMETER in alpha releases.
@@ -408,8 +405,6 @@ public interface PConstants {
* using second pair of values as the diameter.
*/
static final int DIAMETER = 3;
/** @deprecated Use DIAMETER instead. */
static final int CENTER_DIAMETER = 3;
// vertically alignment modes for text
@@ -426,8 +421,6 @@ public interface PConstants {
/** texture coordinates in 0..1 range */
static final int NORMAL = 1;
/** @deprecated use NORMAL instead */
static final int NORMALIZED = 1;
/** texture coordinates based on image width/height */
static final int IMAGE = 2;
@@ -479,6 +472,7 @@ public interface PConstants {
public static final int LINEAR = 0;
public static final int QUADRATIC = 1;
// PShape3D
/** Static usage mode for PShape3D (vertices won't be updated after creation). */
+65 -76
View File
@@ -1384,11 +1384,11 @@ public class PGraphics extends PImage implements PConstants {
}
/** This feature is in testing, do not use or rely upon its implementation */
public void breakShape() {
showWarning("This renderer cannot currently handle concave shapes, " +
"or shapes with holes.");
}
// /** This feature is in testing, do not use or rely upon its implementation */
// public void breakShape() {
// showWarning("This renderer cannot currently handle concave shapes, " +
// "or shapes with holes.");
// }
public void beginContour() {
@@ -5711,6 +5711,7 @@ public class PGraphics extends PImage implements PConstants {
strokeFromCalc();
}
/**
* @param alpha opacity of the stroke
*/
@@ -5728,24 +5729,27 @@ public class PGraphics extends PImage implements PConstants {
strokeFromCalc();
}
public void stroke(float gray, float alpha) {
colorCalc(gray, alpha);
strokeFromCalc();
}
/**
* @param x red or hue value (depending on current color mode)
* @param y green or saturation value (depending on current color mode)
* @param z blue or brightness value (depending on current color mode)
* @param v1 red or hue value (depending on current color mode)
* @param v2 green or saturation value (depending on current color mode)
* @param v3 blue or brightness value (depending on current color mode)
* @webref color:setting
*/
public void stroke(float x, float y, float z) {
colorCalc(x, y, z);
public void stroke(float v1, float v2, float v3) {
colorCalc(v1, v2, v3);
strokeFromCalc();
}
public void stroke(float x, float y, float z, float alpha) {
colorCalc(x, y, z, alpha);
public void stroke(float v1, float v2, float v3, float alpha) {
colorCalc(v1, v2, v3, alpha);
strokeFromCalc();
}
@@ -5854,21 +5858,21 @@ public class PGraphics extends PImage implements PConstants {
}
/**
* @param x red or hue value (depending on current color mode)
* @param y green or saturation value (depending on current color mode)
* @param z blue or brightness value (depending on current color mode)
* @param v1 red or hue value (depending on current color mode)
* @param v2 green or saturation value (depending on current color mode)
* @param v3 blue or brightness value (depending on current color mode)
*/
public void tint(float x, float y, float z) {
colorCalc(x, y, z);
public void tint(float v1, float v2, float v3) {
colorCalc(v1, v2, v3);
tintFromCalc();
}
/**
* @param z opacity of the image
* @param v3 opacity of the image
*/
public void tint(float x, float y, float z, float a) {
colorCalc(x, y, z, a);
public void tint(float v1, float v2, float v3, float a) {
colorCalc(v1, v2, v3, a);
tintFromCalc();
}
@@ -5974,13 +5978,13 @@ public class PGraphics extends PImage implements PConstants {
}
/**
* @param x red or hue value (depending on current color mode)
* @param y green or saturation value (depending on current color mode)
* @param z blue or brightness value (depending on current color mode)
* @param v1 red or hue value (depending on current color mode)
* @param v2 green or saturation value (depending on current color mode)
* @param v3 blue or brightness value (depending on current color mode)
*/
public void fill(float x, float y, float z) {
colorCalc(x, y, z);
public void fill(float v1, float v2, float v3) {
colorCalc(v1, v2, v3);
fillFromCalc();
}
@@ -5988,8 +5992,8 @@ public class PGraphics extends PImage implements PConstants {
/**
* @param a opacity of the fill
*/
public void fill(float x, float y, float z, float a) {
colorCalc(x, y, z, a);
public void fill(float v1, float v2, float v3, float a) {
colorCalc(v1, v2, v3, a);
fillFromCalc();
}
@@ -6453,16 +6457,16 @@ public class PGraphics extends PImage implements PConstants {
*
* @webref lights_camera:lights
* @usage web_application
* @param x red or hue value (depending on current color mode)
* @param y green or saturation value (depending on current color mode)
* @param z blue or brightness value (depending on current color mode)
* @param v1 red or hue value (depending on current color mode)
* @param v2 green or saturation value (depending on current color mode)
* @param v3 blue or brightness value (depending on current color mode)
* @see PGraphics#specular(float, float, float)
* @see PGraphics#lights()
* @see PGraphics#ambientLight(float, float, float, float, float, float)
* @see PGraphics#pointLight(float, float, float, float, float, float)
* @see PGraphics#spotLight(float, float, float, float, float, float, float, float, float, float, float)
*/
public void lightSpecular(float x, float y, float z) {
public void lightSpecular(float v1, float v2, float v3) {
showMethodWarning("lightSpecular");
}
@@ -6572,12 +6576,12 @@ public class PGraphics extends PImage implements PConstants {
/**
* @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)
* @param v1 red or hue value (depending on the current color mode)
* @param v2 green or saturation value (depending on the current color mode)
* @param v3 blue or brightness value (depending on the current color mode)
*/
public void background(float x, float y, float z) {
colorCalc(x, y, z);
public void background(float v1, float v2, float v3) {
colorCalc(v1, v2, v3);
backgroundFromCalc();
// backgroundImpl();
}
@@ -6586,7 +6590,7 @@ public class PGraphics extends PImage implements PConstants {
/**
* @param a opacity of the background
*/
public void background(float x, float y, float z, float a) {
public void background(float v1, float v2, float v3, float a) {
// if (format == RGB) {
// background(x, y, z); // don't allow people to set alpha
//
@@ -6595,7 +6599,7 @@ public class PGraphics extends PImage implements PConstants {
// backgroundFromCalc();
// backgroundImpl();
// }
colorCalc(x, y, z, a);
colorCalc(v1, v2, v3, a);
backgroundFromCalc();
}
@@ -6723,6 +6727,7 @@ public class PGraphics extends PImage implements PConstants {
colorMode(mode, colorModeX, colorModeY, colorModeZ, colorModeA);
}
/**
* @param max range for all color elements
*/
@@ -6732,29 +6737,30 @@ public class PGraphics extends PImage implements PConstants {
/**
* @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 max1 range for the red or hue depending on the current color mode
* @param max2 range for the green or saturation depending on the current color mode
* @param max3 range for the blue or brightness depending on the current color mode
*/
public void colorMode(int mode, float maxX, float maxY, float maxZ) {
colorMode(mode, maxX, maxY, maxZ, colorModeA);
public void colorMode(int mode, float max1, float max2, float max3) {
colorMode(mode, max1, max2, max3, colorModeA);
}
/**
* @param maxA range for the alpha
*/
/**
* @param maxA range for the alpha
*/
public void colorMode(int mode,
float maxX, float maxY, float maxZ, float maxA) {
float max1, float max2, float max3, float maxA) {
colorMode = mode;
colorModeX = maxX; // still needs to be set for hsb
colorModeY = maxY;
colorModeZ = maxZ;
colorModeX = max1; // still needs to be set for hsb
colorModeY = max2;
colorModeZ = max3;
colorModeA = maxA;
// if color max values are all 1, then no need to scale
colorModeScale =
((maxA != 1) || (maxX != maxY) || (maxY != maxZ) || (maxZ != maxA));
((maxA != 1) || (max1 != max2) || (max2 != max3) || (max3 != maxA));
// if color is rgb/0..255 this will make it easier for the
// red() green() etc functions
@@ -7009,43 +7015,26 @@ public class PGraphics extends PImage implements PConstants {
}
public final int color(int x, int y, int z) { // ignore
// if (colorModeDefault) {
// // bounds checking to make sure the numbers aren't to high or low
// if (x > 255) x = 255; else if (x < 0) x = 0;
// if (y > 255) y = 255; else if (y < 0) y = 0;
// if (z > 255) z = 255; else if (z < 0) z = 0;
//
// return 0xff000000 | (x << 16) | (y << 8) | z;
// }
colorCalc(x, y, z);
public final int color(int v1, int v2, int v3) { // ignore
colorCalc(v1, v2, v3);
return calcColor;
}
public final int color(float x, float y, float z) { // ignore
colorCalc(x, y, z);
public final int color(float v1, float v2, float v3) { // ignore
colorCalc(v1, v2, v3);
return calcColor;
}
public final int color(int x, int y, int z, int a) { // ignore
// if (colorModeDefault) {
// // bounds checking to make sure the numbers aren't to high or low
// if (a > 255) a = 255; else if (a < 0) a = 0;
// if (x > 255) x = 255; else if (x < 0) x = 0;
// if (y > 255) y = 255; else if (y < 0) y = 0;
// if (z > 255) z = 255; else if (z < 0) z = 0;
//
// return (a << 24) | (x << 16) | (y << 8) | z;
// }
colorCalc(x, y, z, a);
public final int color(int v1, int v2, int v3, int a) { // ignore
colorCalc(v1, v2, v3, a);
return calcColor;
}
public final int color(float x, float y, float z, float a) { // ignore
colorCalc(x, y, z, a);
public final int color(float v1, float v2, float v3, float a) { // ignore
colorCalc(v1, v2, v3, a);
return calcColor;
}
@@ -391,11 +391,16 @@ public class PGraphicsJava2D extends PGraphics /*PGraphics2D*/ {
}
public void breakShape() {
public void beginContour() {
breakShape = true;
}
public void endContour() {
// does nothing, just need the break in beginContour()
}
public void endShape(int mode) {
if (gpath != null) { // make sure something has been drawn
if (shape == POLYGON) {
+19 -19
View File
@@ -589,31 +589,31 @@ public class PImage implements PConstants, Cloneable {
* @webref pimage:method
* @brief Changes the size of an image to a new width and height
* @usage web_application
* @param wide the resized image width
* @param high the resized image height
* @param w the resized image width
* @param h the resized image height
* @see PImage#get(int, int, int, int)
*/
public void resize(int wide, int high) { // ignore
public void resize(int w, int h) { // ignore
// Make sure that the pixels[] array is valid
loadPixels();
if (wide <= 0 && high <= 0) {
if (w <= 0 && h <= 0) {
width = 0; // Gimme a break, don't waste my time
height = 0;
pixels = new int[0];
} else {
if (wide == 0) { // Use height to determine relative size
float diff = (float) high / (float) height;
wide = (int) (width * diff);
} else if (high == 0) { // Use the width to determine relative size
float diff = (float) wide / (float) width;
high = (int) (height * diff);
if (w == 0) { // Use height to determine relative size
float diff = (float) h / (float) height;
w = (int) (width * diff);
} else if (h == 0) { // Use the width to determine relative size
float diff = (float) w / (float) width;
h = (int) (height * diff);
}
PImage temp = new PImage(wide, high, this.format);
temp.copy(this, 0, 0, width, height, 0, 0, wide, high);
this.width = wide;
this.height = high;
PImage temp = new PImage(w, h, this.format);
temp.copy(this, 0, 0, width, height, 0, 0, w, h);
this.width = w;
this.height = h;
this.pixels = temp.pixels;
}
// Mark the pixels array as altered
@@ -796,13 +796,13 @@ public class PImage implements PConstants, Cloneable {
* No variations are employed, meaning that any scale, tint, or imageMode
* settings will be ignored.
*
* @param src image to draw on screen
* @param image image to draw on screen
*/
public void set(int x, int y, PImage src) {
public void set(int x, int y, PImage image) {
int sx = 0;
int sy = 0;
int sw = src.width;
int sh = src.height;
int sw = image.width;
int sh = image.height;
// if (imageMode == CENTER) {
// x -= src.width/2;
@@ -828,7 +828,7 @@ public class PImage implements PConstants, Cloneable {
// this could be nonexistant
if ((sw <= 0) || (sh <= 0)) return;
setImpl(x, y, sx, sy, sw, sh, src);
setImpl(x, y, sx, sy, sw, sh, image);
}
+242 -230
View File
@@ -29,18 +29,18 @@ import processing.core.PApplet;
/**
* ( begin auto-generated from PShape.xml )
*
* Datatype for storing shapes. Processing can currently load and display
* SVG (Scalable Vector Graphics) shapes. Before a shape is used, it must
* be loaded with the <b>loadShape()</b> function. The <b>shape()</b>
* function is used to draw the shape to the display window. The
* <b>PShape</b> object contain a group of methods, linked below, that can
* operate on the shape data.
*
* Datatype for storing shapes. Processing can currently load and display
* SVG (Scalable Vector Graphics) shapes. Before a shape is used, it must
* be loaded with the <b>loadShape()</b> function. The <b>shape()</b>
* function is used to draw the shape to the display window. The
* <b>PShape</b> object contain a group of methods, linked below, that can
* operate on the shape data.
* <br /><br />
* The <b>loadShape()</b> function supports SVG files created with Inkscape
* and Adobe Illustrator. It is not a full SVG implementation, but offers
* The <b>loadShape()</b> function supports SVG files created with Inkscape
* and Adobe Illustrator. It is not a full SVG implementation, but offers
* some straightforward support for handling vector data.
*
*
* ( end auto-generated )
* <h3>Advanced</h3>
*
@@ -80,7 +80,7 @@ public class PShape implements PConstants {
protected String name;
protected HashMap<String,PShape> nameTable;
/** Generic, only draws its child objects. */
static public final int GROUP = 0;
/** A line, ellipse, arc, image, etc. */
@@ -107,9 +107,9 @@ public class PShape implements PConstants {
//protected float height;
/**
* ( begin auto-generated from PShape_width.xml )
*
*
* The width of the PShape document.
*
*
* ( end auto-generated )
* @webref pshape:field
* @usage web_application
@@ -118,16 +118,16 @@ public class PShape implements PConstants {
public float width;
/**
* ( begin auto-generated from PShape_height.xml )
*
*
* The height of the PShape document.
*
*
* ( end auto-generated )
* @webref pshape:field
* @usage web_application
* @brief Shape document height
*/
public float height;
public float depth;
// set to false if the object is hidden in the layers palette
@@ -143,13 +143,13 @@ public class PShape implements PConstants {
protected int fillColor;
protected boolean tint;
protected int tintColor;
protected int ambientColor;
protected int specularColor;
protected int tintColor;
protected int ambientColor;
protected int specularColor;
protected int emissiveColor;
protected float shininess;
protected float shininess;
/** Temporary toggle for whether styles should be honored. */
protected boolean style = true;
@@ -163,11 +163,11 @@ public class PShape implements PConstants {
* two variables.
*/
protected float[][] vertices;
protected PShape parent;
protected int childCount;
protected PShape[] children;
protected PShape[] children;
/** Array of VERTEX, BEZIER_VERTEX, and CURVE_VERTEX calls. */
protected int vertexCodeCount;
@@ -175,14 +175,14 @@ public class PShape implements PConstants {
/** True if this is a closed path. */
protected boolean close;
// ........................................................
// internal color for setting/calculating
protected float calcR, calcG, calcB, calcA;
protected int calcRi, calcGi, calcBi, calcAi;
protected int calcColor;
protected boolean calcAlpha;
protected boolean calcAlpha;
/** The current colorMode */
public int colorMode; // = RGB;
@@ -204,10 +204,10 @@ public class PShape implements PConstants {
/** True if colorMode(RGB, 255) */
boolean colorModeDefault; // = true;
/** To mark the shape dirty upon changes in its geometry **/
public boolean modified;
// should this be called vertices (consistent with PGraphics internals)
// or does that hurt flexibility?
@@ -242,7 +242,7 @@ public class PShape implements PConstants {
// pivot point for transformations
// public float px;
// public float py;
public PShape() {
this.family = GROUP;
}
@@ -266,14 +266,14 @@ public class PShape implements PConstants {
/**
* ( begin auto-generated from PShape_isVisible.xml )
*
* Returns a boolean value "true" if the image is set to be visible,
*
* Returns a boolean value "true" if the image is set to be visible,
* "false" if not. This is modified with the <b>setVisible()</b> parameter.
* <br/> <br/>
* The visibility of a shape is usually controlled by whatever program
* created the SVG file. For instance, this parameter is controlled by
* The visibility of a shape is usually controlled by whatever program
* created the SVG file. For instance, this parameter is controlled by
* showing or hiding the shape in the layers palette in Adobe Illustrator.
*
*
* ( end auto-generated )
* @webref pshape:method
* @usage web_application
@@ -283,17 +283,17 @@ public class PShape implements PConstants {
return visible;
}
/**
* ( begin auto-generated from PShape_setVisible.xml )
*
* Sets the shape to be visible or invisible. This is determined by the
*
* Sets the shape to be visible or invisible. This is determined by the
* value of the <b>visible</b> parameter.
* <br/> <br/>
* The visibility of a shape is usually controlled by whatever program
* created the SVG file. For instance, this parameter is controlled by
* The visibility of a shape is usually controlled by whatever program
* created the SVG file. For instance, this parameter is controlled by
* showing or hiding the shape in the layers palette in Adobe Illustrator.
*
*
* ( end auto-generated )
* @webref pshape:mathod
* @usage web_application
@@ -307,11 +307,11 @@ public class PShape implements PConstants {
/**
* ( begin auto-generated from PShape_disableStyle.xml )
*
* Disables the shape's style data and uses Processing's current styles.
* Styles include attributes such as colors, stroke weight, and stroke
* joints.
*
*
* Disables the shape's style data and uses Processing's current styles.
* Styles include attributes such as colors, stroke weight, and stroke
* joints.
*
* ( end auto-generated )
* <h3>Advanced</h3>
* Overrides this shape's style information and uses PGraphics styles and
@@ -332,13 +332,13 @@ public class PShape implements PConstants {
/**
* ( begin auto-generated from PShape_enableStyle.xml )
*
* Enables the shape's style data and ignores Processing's current styles.
* Styles include attributes such as colors, stroke weight, and stroke
* joints.
*
*
* Enables the shape's style data and ignores Processing's current styles.
* Styles include attributes such as colors, stroke weight, and stroke
* joints.
*
* ( end auto-generated )
*
*
* @webref pshape:method
* @usage web_application
* @brief Enables the shape's style data and ignores the Processing styles
@@ -398,55 +398,55 @@ public class PShape implements PConstants {
public boolean is3D() {
return false;
}
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
//
// Drawing methods
// Drawing methods
public void texture(PImage tex) {
}
public void noTexture() {
}
public void solid(boolean solid) {
}
public void beginContour() {
}
public void endContour() {
}
public void vertex(float x, float y) {
}
public void vertex(float x, float y, float u, float v) {
public void solid(boolean solid) {
}
public void beginContour() {
}
public void endContour() {
}
public void vertex(float x, float y) {
}
public void vertex(float x, float y, float u, float v) {
}
public void vertex(float x, float y, float z) {
}
public void vertex(float x, float y, float z, float u, float v) {
}
}
public void normal(float nx, float ny, float nz) {
}
public void end() {
}
}
public void end(int mode) {
}
public void end(int mode) {
}
//////////////////////////////////////////////////////////////
// STROKE CAP/JOIN/WEIGHT
public void strokeWeight(float weight) {
}
@@ -454,8 +454,8 @@ public class PShape implements PConstants {
}
public void strokeCap(int cap) {
}
}
//////////////////////////////////////////////////////////////
// FILL COLOR
@@ -479,107 +479,107 @@ public class PShape implements PConstants {
}
public void fill(float x, float y, float z, float a) {
}
}
//////////////////////////////////////////////////////////////
// STROKE COLOR
// STROKE COLOR
public void noStroke() {
}
}
public void stroke(int rgb) {
}
}
public void stroke(int rgb, float alpha) {
}
public void stroke(float gray) {
}
public void stroke(float gray, float alpha) {
}
public void stroke(float x, float y, float z) {
}
public void stroke(float x, float y, float z, float alpha) {
}
//////////////////////////////////////////////////////////////
// TINT COLOR
// TINT COLOR
public void noTint() {
}
}
public void tint(int rgb) {
}
}
public void tint(int rgb, float alpha) {
}
public void tint(float gray) {
}
public void tint(float gray, float alpha) {
}
public void tint(float x, float y, float z) {
}
public void tint(float x, float y, float z, float alpha) {
}
///////////////////////////////////////////////////////////
public void tint(float x, float y, float z, float alpha) {
}
///////////////////////////////////////////////////////////
//
// Bezier curves
// Bezier curves
public void bezierDetail(int detail) {
}
}
public void bezierVertex(float x2, float y2,
float x3, float y3,
float x4, float y4) {
}
public void bezierVertex(float x2, float y2, float z2,
float x3, float y3, float z3,
float x4, float y4, float z4) {
}
public void quadraticVertex(float cx, float cy,
float x3, float y3) {
}
}
public void quadraticVertex(float cx, float cy, float cz,
float x3, float y3, float z3) {
}
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
//
// Catmull-Rom curves
public void curveDetail(int detail) {
}
public void curveTightness(float tightness) {
}
}
public void curveVertex(float x, float y) {
}
}
public void curveVertex(float x, float y, float z) {
}
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
@@ -771,8 +771,8 @@ public class PShape implements PConstants {
protected void drawGeometry(PGraphics g) {
// get cache object using g.
g.beginShape(kind);
if (style) {
for (int i = 0; i < vertexCount; i++) {
@@ -852,6 +852,7 @@ public class PShape implements PConstants {
// http://dev.processing.org/bugs/show_bug.cgi?id=982
if (vertices == null) return;
boolean insideContour = false;
g.beginShape();
if (vertexCodeCount == 0) { // each point is a simple vertex
@@ -908,7 +909,11 @@ public class PShape implements PConstants {
index++;
case BREAK:
g.breakShape();
if (insideContour) {
g.endContour();
}
g.beginContour();
insideContour = true;
}
}
} else { // drawing a 3D path
@@ -942,11 +947,18 @@ public class PShape implements PConstants {
index++;
case BREAK:
g.breakShape();
if (insideContour) {
g.endContour();
}
g.beginContour();
insideContour = true;
}
}
}
}
if (insideContour) {
g.endContour();
}
g.endShape(close ? CLOSE : OPEN);
}
@@ -969,11 +981,11 @@ public class PShape implements PConstants {
/**
* ( begin auto-generated from PShape_getChild.xml )
*
* Extracts a child shape from a parent shape. Specify the name of the
* shape with the <b>target</b> parameter. The shape is returned as a
*
* Extracts a child shape from a parent shape. Specify the name of the
* shape with the <b>target</b> parameter. The shape is returned as a
* <b>PShape</b> object, or <b>null</b> is returned if there is an error.
*
*
* ( end auto-generated )
* @webref pshape:method
* @usage web_application
@@ -1104,19 +1116,19 @@ public class PShape implements PConstants {
}
return -1;
}
public void updateRoot(PShape root) {
public void updateRoot(PShape root) {
}
protected void modified() {
modified = true;
if (parent != null) {
parent.modified();
}
}
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
@@ -1149,20 +1161,20 @@ public class PShape implements PConstants {
public float getParam(int index) {
return params[index];
}
public void setParams(float[] source) {
if (params == null) {
params = new float[source.length];
}
params = new float[source.length];
}
if (source.length != params.length) {
PGraphics.showWarning("Wrong number of parameters");
return;
}
PApplet.arrayCopy(source, params);
}
}
public int getVertexCount() {
return vertexCount;
}
@@ -1253,30 +1265,30 @@ public class PShape implements PConstants {
// these each call matrix.translate, etc
// if matrix is null when one is called,
// it is created and set to identity
public void center(float cx, float cy) {
}
public void center(float cx, float cy, float cz) {
}
/**
* ( begin auto-generated from PShape_translate.xml )
*
* Specifies an amount to displace the shape. The <b>x</b> parameter
* specifies left/right translation, the <b>y</b> parameter specifies
* up/down translation, and the <b>z</b> parameter specifies translations
* toward/away from the screen. Subsequent calls to the method accumulates
* the effect. For example, calling <b>translate(50, 0)</b> and then
* <b>translate(20, 0)</b> is the same as <b>translate(70, 0)</b>. This
* transformation is applied directly to the shape, it's not refreshed each
* time <b>draw()</b> is run.
*
* Specifies an amount to displace the shape. The <b>x</b> parameter
* specifies left/right translation, the <b>y</b> parameter specifies
* up/down translation, and the <b>z</b> parameter specifies translations
* toward/away from the screen. Subsequent calls to the method accumulates
* the effect. For example, calling <b>translate(50, 0)</b> and then
* <b>translate(20, 0)</b> is the same as <b>translate(70, 0)</b>. This
* transformation is applied directly to the shape, it's not refreshed each
* time <b>draw()</b> is run.
* <br /><br />
* Using this method with the <b>z</b> parameter requires using the P3D
* parameter in combination with size.
*
* Using this method with the <b>z</b> parameter requires using the P3D
* parameter in combination with size.
*
* ( end auto-generated )
* @webref pshape:method
* @usage web_application
@@ -1299,21 +1311,21 @@ public class PShape implements PConstants {
/**
* ( begin auto-generated from PShape_rotateX.xml )
*
* Rotates a shape around the x-axis the amount specified by the
* <b>angle</b> parameter. Angles should be specified in radians (values
*
* Rotates a shape around the x-axis the amount specified by the
* <b>angle</b> parameter. Angles should be specified in radians (values
* from 0 to TWO_PI) or converted to radians with the <b>radians()</b> method.
* <br /><br />
* Shapes are always rotated around the upper-left corner of their bounding
* box. Positive numbers rotate objects in a clockwise direction.
* Subsequent calls to the method accumulates the effect. For example,
* calling <b>rotateX(HALF_PI)</b> and then <b>rotateX(HALF_PI)</b> is the
* same as <b>rotateX(PI)</b>. This transformation is applied directly to
* the shape, it's not refreshed each time <b>draw()</b> is run.
* Shapes are always rotated around the upper-left corner of their bounding
* box. Positive numbers rotate objects in a clockwise direction.
* Subsequent calls to the method accumulates the effect. For example,
* calling <b>rotateX(HALF_PI)</b> and then <b>rotateX(HALF_PI)</b> is the
* same as <b>rotateX(PI)</b>. This transformation is applied directly to
* the shape, it's not refreshed each time <b>draw()</b> is run.
* <br /><br />
* This method requires a 3D renderer. You need to use P3D as a third
* This method requires a 3D renderer. You need to use P3D as a third
* parameter for the <b>size()</b> function as shown in the example above.
*
*
* ( end auto-generated )
* @webref pshape:method
* @usage web_application
@@ -1326,23 +1338,23 @@ public class PShape implements PConstants {
/**
* ( begin auto-generated from PShape_rotateY.xml )
*
* Rotates a shape around the y-axis the amount specified by the
* <b>angle</b> parameter. Angles should be specified in radians (values
*
* Rotates a shape around the y-axis the amount specified by the
* <b>angle</b> parameter. Angles should be specified in radians (values
* from 0 to TWO_PI) or converted to radians with the <b>radians()</b> method.
* <br /><br />
* Shapes are always rotated around the upper-left corner of their bounding
* box. Positive numbers rotate objects in a clockwise direction.
* Subsequent calls to the method accumulates the effect. For example,
* calling <b>rotateY(HALF_PI)</b> and then <b>rotateY(HALF_PI)</b> is the
* same as <b>rotateY(PI)</b>. This transformation is applied directly to
* the shape, it's not refreshed each time <b>draw()</b> is run.
* Shapes are always rotated around the upper-left corner of their bounding
* box. Positive numbers rotate objects in a clockwise direction.
* Subsequent calls to the method accumulates the effect. For example,
* calling <b>rotateY(HALF_PI)</b> and then <b>rotateY(HALF_PI)</b> is the
* same as <b>rotateY(PI)</b>. This transformation is applied directly to
* the shape, it's not refreshed each time <b>draw()</b> is run.
* <br /><br />
* This method requires a 3D renderer. You need to use P3D as a third
* This method requires a 3D renderer. You need to use P3D as a third
* parameter for the <b>size()</b> function as shown in the example above.
*
*
* ( end auto-generated )
*
*
* @webref pshape:method
* @usage web_application
* @brief Rotates the shape around the y-axis
@@ -1358,21 +1370,21 @@ public class PShape implements PConstants {
/**
* ( begin auto-generated from PShape_rotateZ.xml )
*
* Rotates a shape around the z-axis the amount specified by the
* <b>angle</b> parameter. Angles should be specified in radians (values
*
* Rotates a shape around the z-axis the amount specified by the
* <b>angle</b> parameter. Angles should be specified in radians (values
* from 0 to TWO_PI) or converted to radians with the <b>radians()</b> method.
* <br /><br />
* Shapes are always rotated around the upper-left corner of their bounding
* box. Positive numbers rotate objects in a clockwise direction.
* Subsequent calls to the method accumulates the effect. For example,
* calling <b>rotateZ(HALF_PI)</b> and then <b>rotateZ(HALF_PI)</b> is the
* same as <b>rotateZ(PI)</b>. This transformation is applied directly to
* the shape, it's not refreshed each time <b>draw()</b> is run.
* Shapes are always rotated around the upper-left corner of their bounding
* box. Positive numbers rotate objects in a clockwise direction.
* Subsequent calls to the method accumulates the effect. For example,
* calling <b>rotateZ(HALF_PI)</b> and then <b>rotateZ(HALF_PI)</b> is the
* same as <b>rotateZ(PI)</b>. This transformation is applied directly to
* the shape, it's not refreshed each time <b>draw()</b> is run.
* <br /><br />
* This method requires a 3D renderer. You need to use P3D as a third
* This method requires a 3D renderer. You need to use P3D as a third
* parameter for the <b>size()</b> function as shown in the example above.
*
*
* ( end auto-generated )
* @webref pshape:method
* @usage web_application
@@ -1385,19 +1397,19 @@ public class PShape implements PConstants {
/**
* ( begin auto-generated from PShape_rotate.xml )
*
* Rotates a shape the amount specified by the <b>angle</b> parameter.
* Angles should be specified in radians (values from 0 to TWO_PI) or
*
* Rotates a shape the amount specified by the <b>angle</b> parameter.
* Angles should be specified in radians (values from 0 to TWO_PI) or
* converted to radians with the <b>radians()</b> method.
* <br /><br />
* Shapes are always rotated around the upper-left corner of their bounding
* box. Positive numbers rotate objects in a clockwise direction.
* Transformations apply to everything that happens after and subsequent
* calls to the method accumulates the effect. For example, calling
* <b>rotate(HALF_PI)</b> and then <b>rotate(HALF_PI)</b> is the same as
* <b>rotate(PI)</b>. This transformation is applied directly to the shape,
* it's not refreshed each time <b>draw()</b> is run.
*
* Shapes are always rotated around the upper-left corner of their bounding
* box. Positive numbers rotate objects in a clockwise direction.
* Transformations apply to everything that happens after and subsequent
* calls to the method accumulates the effect. For example, calling
* <b>rotate(HALF_PI)</b> and then <b>rotate(HALF_PI)</b> is the same as
* <b>rotate(PI)</b>. This transformation is applied directly to the shape,
* it's not refreshed each time <b>draw()</b> is run.
*
* ( end auto-generated )
* @webref pshape:method
* @usage web_application
@@ -1422,19 +1434,19 @@ public class PShape implements PConstants {
/**
* ( begin auto-generated from PShape_scale.xml )
*
* Increases or decreases the size of a shape by expanding and contracting
* vertices. Shapes always scale from the relative origin of their bounding
* box. Scale values are specified as decimal percentages. For example, the
* method call <b>scale(2.0)</b> increases the dimension of a shape by
* 200%. Subsequent calls to the method multiply the effect. For example,
* calling <b>scale(2.0)</b> and then <b>scale(1.5)</b> is the same as
* <b>scale(3.0)</b>. This transformation is applied directly to the shape,
* it's not refreshed each time <b>draw()</b> is run.
*
* Increases or decreases the size of a shape by expanding and contracting
* vertices. Shapes always scale from the relative origin of their bounding
* box. Scale values are specified as decimal percentages. For example, the
* method call <b>scale(2.0)</b> increases the dimension of a shape by
* 200%. Subsequent calls to the method multiply the effect. For example,
* calling <b>scale(2.0)</b> and then <b>scale(1.5)</b> is the same as
* <b>scale(3.0)</b>. This transformation is applied directly to the shape,
* it's not refreshed each time <b>draw()</b> is run.
* <br /><br />
* Using this method with the <b>z</b> parameter requires using the P3D
* parameter in combination with size.
*
* Using this method with the <b>z</b> parameter requires using the P3D
* parameter in combination with size.
*
* ( end auto-generated )
* @webref pshape:method
* @usage web_application
@@ -1467,10 +1479,10 @@ public class PShape implements PConstants {
/**
* ( begin auto-generated from PShape_resetMatrix.xml )
*
* Replaces the current matrix of a shape with the identity matrix. The
* equivalent function in OpenGL is glLoadIdentity().
*
*
* Replaces the current matrix of a shape with the identity matrix. The
* equivalent function in OpenGL is glLoadIdentity().
*
* ( end auto-generated )
* @webref pshape:method
* @brief Replaces the current matrix of a shape with the identity matrix
@@ -1576,7 +1588,7 @@ public class PShape implements PConstants {
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
public void colorMode(int mode) {
colorMode(mode, colorModeX, colorModeY, colorModeZ, colorModeA);
}
@@ -1620,8 +1632,8 @@ public class PShape implements PConstants {
(colorModeA == 255) && (colorModeX == 255) &&
(colorModeY == 255) && (colorModeZ == 255);
}
protected void colorCalc(int rgb) {
if (((rgb & 0xff000000) == 0) && (rgb <= colorModeX)) {
colorCalc((float) rgb);
@@ -1746,5 +1758,5 @@ public class PShape implements PConstants {
calcB = calcBi / 255.0f;
calcAlpha = (calcAi != 255);
}
}
+2
View File
@@ -16,6 +16,8 @@ _ docs: P2D and P3D are now OpenGL variations
X add createGraphics() with no renderer param to point to JAVA2D
X also added to Android
_ add to docs
X CENTER_RADIUS, CENTER_DIAMETER, NORMALIZED have been removed
_ update changes Wiki
andres
A polygon shapes without fill slowdown render progressively