quadVertex() becomes quadraticVertex(), and a better copy() for 2D

This commit is contained in:
benfry
2011-06-20 20:03:19 +00:00
parent 4d6cbb9360
commit 6f15d9b13c
8 changed files with 47 additions and 47 deletions
@@ -1183,11 +1183,11 @@ public class PGraphics extends PImage implements PConstants {
protected void bezierVertexCheck() {
if (shape == 0 || shape != POLYGON) {
throw new RuntimeException("beginShape() or beginShape(POLYGON) " +
"must be used before bezierVertex() or quadVertex()");
"must be used before bezierVertex() or quadraticVertex()");
}
if (vertexCount == 0) {
throw new RuntimeException("vertex() must be used at least once" +
"before bezierVertex() or quadVertex()");
"before bezierVertex() or quadraticVertex()");
}
}
@@ -1252,8 +1252,8 @@ public class PGraphics extends PImage implements PConstants {
}
public void quadVertex(float cx, float cy,
float x3, float y3) {
public void quadraticVertex(float cx, float cy,
float x3, float y3) {
bezierVertexCheck();
float[] prev = vertices[vertexCount-1];
float x1 = prev[X];
@@ -1265,8 +1265,8 @@ public class PGraphics extends PImage implements PConstants {
}
public void quadVertex(float cx, float cy, float cz,
float x3, float y3, float z3) {
public void quadraticVertex(float cx, float cy, float cz,
float x3, float y3, float z3) {
bezierVertexCheck();
float[] prev = vertices[vertexCount-1];
float x1 = prev[X];
@@ -489,14 +489,14 @@ public class PGraphicsAndroid2D extends PGraphics {
// QUADRATIC BEZIER VERTICES
public void quadVertex(float ctrlX, float ctrlY,
public void quadraticVertex(float ctrlX, float ctrlY,
float endX, float endY) {
bezierVertexCheck();
path.quadTo(ctrlX, ctrlY, endX, endY);
}
public void quadVertex(float x2, float y2, float z2,
public void quadraticVertex(float x2, float y2, float z2,
float x4, float y4, float z4) {
showDepthWarningXYZ("quadVertex");
}
+2 -2
View File
@@ -590,7 +590,7 @@ public class PShape implements PConstants {
break;
case QUAD_BEZIER_VERTEX:
g.quadVertex(vertices[index+0][X], vertices[index+0][Y],
g.quadraticVertex(vertices[index+0][X], vertices[index+0][Y],
vertices[index+1][X], vertices[index+1][Y]);
// float x1 = vertices[index+0][X];
// float y1 = vertices[index+0][Y];
@@ -634,7 +634,7 @@ public class PShape implements PConstants {
break;
case QUAD_BEZIER_VERTEX:
g.quadVertex(vertices[index+0][X], vertices[index+0][Y], vertices[index+0][Z],
g.quadraticVertex(vertices[index+0][X], vertices[index+0][Y], vertices[index+0][Z],
vertices[index+1][X], vertices[index+1][Y], vertices[index+0][Z]);
index += 2;
break;
+4 -4
View File
@@ -7974,15 +7974,15 @@ public class PApplet extends Applet
public void quadVertex(float cx, float cy,
float x3, float y3) {
if (recorder != null) recorder.quadVertex(cx, cy, x3, y3);
g.quadVertex(cx, cy, x3, y3);
if (recorder != null) recorder.quadrativVertex(cx, cy, x3, y3);
g.quadrativVertex(cx, cy, x3, y3);
}
public void quadVertex(float cx, float cy, float cz,
float x3, float y3, float z3) {
if (recorder != null) recorder.quadVertex(cx, cy, cz, x3, y3, z3);
g.quadVertex(cx, cy, cz, x3, y3, z3);
if (recorder != null) recorder.quadraticVertex(cx, cy, cz, x3, y3, z3);
g.quadraticVertex(cx, cy, cz, x3, y3, z3);
}
+6 -6
View File
@@ -1256,11 +1256,11 @@ public class PGraphics extends PImage implements PConstants {
protected void bezierVertexCheck() {
if (shape == 0 || shape != POLYGON) {
throw new RuntimeException("beginShape() or beginShape(POLYGON) " +
"must be used before bezierVertex() or quadVertex()");
"must be used before bezierVertex() or quadraticVertex()");
}
if (vertexCount == 0) {
throw new RuntimeException("vertex() must be used at least once" +
"before bezierVertex() or quadVertex()");
"before bezierVertex() or quadraticVertex()");
}
}
@@ -1325,8 +1325,8 @@ public class PGraphics extends PImage implements PConstants {
}
public void quadVertex(float cx, float cy,
float x3, float y3) {
public void quadrativVertex(float cx, float cy,
float x3, float y3) {
float[] prev = vertices[vertexCount-1];
float x1 = prev[X];
float y1 = prev[Y];
@@ -1337,8 +1337,8 @@ public class PGraphics extends PImage implements PConstants {
}
public void quadVertex(float cx, float cy, float cz,
float x3, float y3, float z3) {
public void quadraticVertex(float cx, float cy, float cz,
float x3, float y3, float z3) {
float[] prev = vertices[vertexCount-1];
float x1 = prev[X];
float y1 = prev[Y];
+9 -11
View File
@@ -426,7 +426,7 @@ public class PGraphicsJava2D extends PGraphics /*PGraphics2D*/ {
// QUADRATIC BEZIER VERTICES
public void quadVertex(float ctrlX, float ctrlY,
public void quadrativVertex(float ctrlX, float ctrlY,
float endX, float endY) {
bezierVertexCheck();
Point2D cur = gpath.getCurrentPoint();
@@ -440,7 +440,7 @@ public class PGraphicsJava2D extends PGraphics /*PGraphics2D*/ {
}
public void quadVertex(float x2, float y2, float z2,
public void quadraticVertex(float x2, float y2, float z2,
float x4, float y4, float z4) {
showDepthWarningXYZ("quadVertex");
}
@@ -1878,8 +1878,8 @@ public class PGraphicsJava2D extends PGraphics /*PGraphics2D*/ {
public void copy(int sx, int sy, int sw, int sh,
int dx, int dy, int dw, int dh) {
if ((sw != dw) || (sh != dh)) {
// use slow version if changing size
copy(this, sx, sy, sw, sh, dx, dy, dw, dh);
Image img = primarySurface ? offscreen : image;
g2.drawImage(img, dx, dy, dx + dw, dy + dh, sx, sy, sx + sw, sy + sh, null);
} else {
dx = dx - sx; // java2d's "dx" is the delta, not dest
@@ -1889,13 +1889,11 @@ public class PGraphicsJava2D extends PGraphics /*PGraphics2D*/ {
}
// public void copy(PImage src,
// int sx1, int sy1, int sx2, int sy2,
// int dx1, int dy1, int dx2, int dy2) {
// loadPixels();
// super.copy(src, sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2);
// updatePixels();
// }
public void copy(PImage src,
int sx, int sy, int sw, int sh,
int dx, int dy, int dw, int dh) {
g2.drawImage(src.getImage(), dx, dy, dx + dw, dy + dh, sx, sy, sx + sw, sy + sh, null);
}
+2 -2
View File
@@ -606,7 +606,7 @@ public class PShape implements PConstants {
break;
case QUAD_BEZIER_VERTEX:
g.quadVertex(vertices[index+0][X], vertices[index+0][Y],
g.quadrativVertex(vertices[index+0][X], vertices[index+0][Y],
vertices[index+1][X], vertices[index+1][Y]);
// float x1 = vertices[index+0][X];
// float y1 = vertices[index+0][Y];
@@ -650,7 +650,7 @@ public class PShape implements PConstants {
break;
case QUAD_BEZIER_VERTEX:
g.quadVertex(vertices[index+0][X], vertices[index+0][Y], vertices[index+0][Z],
g.quadraticVertex(vertices[index+0][X], vertices[index+0][Y], vertices[index+0][Z],
vertices[index+1][X], vertices[index+1][Y], vertices[index+0][Z]);
index += 2;
break;
+16 -14
View File
@@ -53,6 +53,9 @@ A implement repeating textures
A http://code.google.com/p/processing/issues/detail?id=94
o add a limit to pushStyle() to catch unmatched sets?
X http://code.google.com/p/processing/issues/detail?id=198
X how should quadVertex() be named? bezierVertex() quadraticVertex()
X decision: quadraticVertex() to avoid confusion with quads
X more efficient version of copy() added for 2D
cleanup
o if too many errors come through during setup, app will terminate
@@ -335,18 +338,20 @@ _ http://code.google.com/p/processing/issues/detail?id=502
_ Signature issue on contributed libraries affects unrelated opengl sketches
_ http://code.google.com/p/processing/issues/detail?id=261
_ remove matrixMode(), add a projection() method
_ remove screenBlend(), textureBlend() from PGraphics et al
_ have andres take over all current GL issues in the tracker
casey
_ pdf fonts
_ rewrite documentation about pdf fonts (errors with non-native fonts)
_ figure out why font naming not working correctly
_ add blendMode() to reference, remove blend()
_ need documentation for quadraticVertex()
2.0
_ toArray(), toArray(float[]), toVectorArray(), toVectorArray(PVector[])
_ toColorArray(), toColorArray(float[])...
_ remove blend(), add blendMode()
_ have andres take over all current GL issues in the tracker
_ sort out destroy(), stop(), pause() et al
_ ColorSelector should stop/pause when not visible
_ start()/stop() perform like onPause()/onResume()
@@ -354,7 +359,15 @@ _ all of which call pause() and resume()
_ decision on registered methods
_ remove registerPre() et al
_ add register("pause", ...)
_ add PEvent
_ add PEvent
_ need to wrap mouse/key events for p5
_ need a version that works with both android and desktop
_ also need to interleave events properly (as per report)
_ touch events.. can't do MouseEvent et al with Android
_ http://dvcs.w3.org/hg/webevents/raw-file/tip/touchevents.html
_ http://www.html5rocks.com/en/mobile/touch.html
_ decision: go with what looks like javascript/ios
_ touchEvent(), gestureEvent()?
_ binary() auto-sizes, hex() does not
_ decision: remove auto-sizing from binary
_ in PShape, getChild(name) refers to a <blah id="name">
@@ -366,9 +379,6 @@ _ move to new XML library
_ add XHTML parsing or any others?
_ html parser? javax.swing.text.html.parser... has binary DTDs
_ decision: it's someone else's job
_ how should quadVertex() be named? bezierVertex() quadraticVertex()
_ need documentation for it
_ decision: quadraticVertex() to avoid confusion with quads
_ load/save methods.. is it save("blah.svg") or saveSVG("blah.svg")
_ also works that way with tables
_ decision: useExtension() or something like that
@@ -410,11 +420,6 @@ _ needs to be documented, and excise all screen.width/height references
_ add to the 'changes' document
_ PImage.save() should return a success boolean
_ and not throw an exception when it fails
_ touch events.. can't do MouseEvent et al with Android
_ http://dvcs.w3.org/hg/webevents/raw-file/tip/touchevents.html
_ http://www.html5rocks.com/en/mobile/touch.html
_ decision: go with what looks like javascript/ios
_ touchEvent(), gestureEvent()?
_ make loading images lighter, ala android
_ require loadPixels to get 2D image data from images
_ only load PImage pixels when necessary (faster for java2d)
@@ -453,9 +458,6 @@ _ 10s should be fine--no need to keep spinning (bad for android too)
_ just call interrupt() when it's time to get back to work
_ memory leak when many createGraphics(..., JAVA2D) calls are used
_ http://code.google.com/p/processing/issues/detail?id=507
_ need to wrap mouse/key events for p5
_ need a version that works with both android and desktop
_ also need to interleave events properly (as per report)
_ need to clean up the hints in the reference/source
_ Abnormal high Java CPU usage at empty sketch with draw()
_ http://code.google.com/p/processing/issues/detail?id=729