change how TRIANGLE_FAN is handled (issue #1137)

This commit is contained in:
benfry
2012-09-07 15:13:44 +00:00
parent 553a6b23ff
commit 327e448cdd
4 changed files with 26 additions and 35 deletions
@@ -369,20 +369,12 @@ public class PGraphicsAndroid2D extends PGraphics {
break;
case TRIANGLE_FAN:
if (vertexCount == 3) {
triangle(vertices[0][X], vertices[0][Y],
vertices[1][X], vertices[1][Y],
if (vertexCount >= 3) {
triangle(vertices[0][X],
vertices[0][Y],
vertices[vertexCount - 2][X],
vertices[vertexCount - 2][Y],
x, y);
} else if (vertexCount > 3) {
path.reset();
// when vertexCount > 3, draw an un-closed triangle
// for indices 0 (center), previous, current
path.moveTo(vertices[0][X],
vertices[0][Y]);
path.lineTo(vertices[vertexCount - 2][X],
vertices[vertexCount - 2][Y]);
path.lineTo(x, y);
drawPath();
}
break;
+3 -1
View File
@@ -1,6 +1,8 @@
0210 android
X lots of example updates from Andres
_ PMotionEvent is being used internal to PApplet, need to re-wrap
_ should be able to fire MotionEvents
_ modify MotionEvent code to use TouchEvent class, even if basic version
_ internally, PApplet might subclass it for the pointers
_ but queueing needs to work
+13 -19
View File
@@ -371,26 +371,20 @@ public class PGraphicsJava2D extends PGraphics /*PGraphics2D*/ {
break;
case TRIANGLE_FAN:
if (vertexCount == 3) {
triangle(vertices[0][X], vertices[0][Y],
vertices[1][X], vertices[1][Y],
if (vertexCount >= 3) {
// This is an unfortunate implementation because the stroke for an
// adjacent triangle will be repeated. However, if the stroke is not
// redrawn, it will replace the adjacent line (when it lines up
// perfectly) or show a faint line (when off by a small amount).
// The alternative would be to wait, then draw the shape as a
// polygon fill, followed by a series of vertices. But that's a
// poor method when used with PDF, DXF, or other recording objects,
// since discrete triangles would likely be preferred.
triangle(vertices[0][X],
vertices[0][Y],
vertices[vertexCount - 2][X],
vertices[vertexCount - 2][Y],
x, y);
} else if (vertexCount > 3) {
gpath = new GeneralPath();
// when vertexCount > 3, draw an un-closed triangle
// for indices 0 (center), previous, current
gpath.moveTo(vertices[0][X],
vertices[0][Y]);
gpath.lineTo(vertices[vertexCount - 2][X],
vertices[vertexCount - 2][Y]);
gpath.lineTo(x, y);
// gpath.moveTo(vertices[vertexCount - 2][X],
// vertices[vertexCount - 2][Y]);
// gpath.lineTo(x, y);
// gpath.lineTo(vertices[0][X],
// vertices[0][Y]);
gpath.closePath();
drawShape(gpath);
}
break;
+5 -2
View File
@@ -1,14 +1,16 @@
0210 core
X fix problem with key events breaking with libraries
X added hint(ENABLE_STROKE_PURE) to deal with Java 2D grossness
_ double check that new key and mouse events are being addressed correctly
X fix stroke on TRIANGLE_FAN
X http://code.google.com/p/processing/issues/detail?id=1137
andres
A POINTS mode vertices are huge
A http://code.google.com/p/processing/issues/detail?id=1037
A potentially insufficient ellipse detail with P3D/OPENGL when scale()'d
A http://code.google.com/p/processing/issues/detail?id=87
A Using ortho() breaks stroke rendering
A http://code.google.com/p/processing/issues/detail?id=1207
earlier
A Implement support for complex shapes when using the OpenGL renderer
@@ -18,6 +20,7 @@ A this way we can also implement breakShape() for opengl
A http://code.google.com/p/processing/issues/detail?id=122
_ double check that new key and mouse events are being addressed correctly
hint(OPENGL_ERRORS) should be the opposite to enable the reporting, no?