getting polygons to work properly.. but not quite yet

This commit is contained in:
benfry
2005-02-28 00:32:38 +00:00
parent b5a7eda63f
commit 79de004742
3 changed files with 39 additions and 34 deletions

View File

@@ -255,9 +255,11 @@ public class PGraphics2 extends PGraphics {
case CONCAVE_POLYGON:
case CONVEX_POLYGON:
if (vertexCount == 1) {
//System.out.println("starting poly path " + x + " " + y);
gpath = new GeneralPath();
gpath.moveTo(x, y);
} else {
//System.out.println("continuing poly path " + x + " " + y);
gpath.lineTo(x, y);
}
break;
@@ -313,8 +315,6 @@ public class PGraphics2 extends PGraphics {
public void endShape() {
//System.out.println("endShape");
shape = 0;
switch (shape) {
case LINE_STRIP:
stroke_shape(gpath);
@@ -328,10 +328,13 @@ public class PGraphics2 extends PGraphics {
case POLYGON:
case CONCAVE_POLYGON:
case CONVEX_POLYGON:
//System.out.println("finishing polygon");
gpath.closePath();
draw_shape(gpath);
break;
}
shape = 0;
}
@@ -358,10 +361,12 @@ public class PGraphics2 extends PGraphics {
protected void draw_shape(Shape s) {
if (fill) {
//System.out.println("filling shape");
graphics.setColor(fillColorObject);
graphics.fill(s);
}
if (stroke) {
//System.out.println("stroking shape");
graphics.setColor(strokeColorObject);
graphics.draw(s);
}