From 960d2b3709b8118205b0e06198be75bb6674e449 Mon Sep 17 00:00:00 2001 From: benfry Date: Thu, 9 Dec 2004 23:10:57 +0000 Subject: [PATCH] continuing... --- core/PApplet.java | 5 ++++ core/PGraphics.java | 60 +++++++++++++++++++++++++++++++++++++++++---- core/PMethods.java | 2 ++ 3 files changed, 62 insertions(+), 5 deletions(-) diff --git a/core/PApplet.java b/core/PApplet.java index df92111b5..95aea6173 100644 --- a/core/PApplet.java +++ b/core/PApplet.java @@ -4433,6 +4433,11 @@ public class PApplet extends Applet } + public void circle(float x, float y, float radius) { + g.circle(x, y, radius); + } + + public float bezierPoint(float a, float b, float c, float d, float t) { return g.bezierPoint(a, b, c, d, t); diff --git a/core/PGraphics.java b/core/PGraphics.java index 2bb46c6f7..d4b12264d 100644 --- a/core/PGraphics.java +++ b/core/PGraphics.java @@ -2696,29 +2696,43 @@ public class PGraphics extends PImage implements PMethods, PConstants { break; } - if (depth) { - if (fill) ellipse3_fill(x, y, hradius, vradius); - if (stroke) ellipse3_stroke(x, y, hradius, vradius); + if (depth || !optimize2) { + ellipse3(x, y, hradius, vradius); } else { - if (fill) ellipse2_fill(x, y, hradius, vradius); - if (stroke) ellipse2_stroke(x, y, hradius, vradius); + ellipse2(x, y, hradius, vradius); } } + public void ellipse3(float x, float y, float hradius, float vradius) { + if (fill) ellipse3_fill(x, y, hradius, vradius); + if (stroke) ellipse3_stroke(x, y, hradius, vradius); + } + + protected void ellipse3_fill(float x, float y, float h, float v) { } + protected void ellipse3_stroke(float x, float y, float h, float v) { } + + public void ellipse2(float x, float y, float hradius, float vradius) { + if (fill) ellipse2_fill(x, y, hradius, vradius); + if (stroke) ellipse2_stroke(x, y, hradius, vradius); + } + + protected void ellipse2_fill(float x, float y, float h, float v) { } + protected void ellipse2_stroke(float x, float y, float h, float v) { } + /* protected void ellipse_mess(float x, float y, float hradius, float vradius) { @@ -2839,6 +2853,7 @@ public class PGraphics extends PImage implements PMethods, PConstants { } while (y > 0); } + private final void ellipse0_rough_internal(int centerX, int centerY, int ellipseX, int ellipseY, boolean filling) { @@ -2859,6 +2874,41 @@ public class PGraphics extends PImage implements PMethods, PConstants { } + ////////////////////////////////////////////////////////////// + + + public void circle(float x, float y, float radius) { + switch (ellipseMode) { + case CENTER_RADIUS: + break; + case CENTER: + radius /= 2f; radius /= 2f; + break; + case CORNER: + radius /= 2f; radius /= 2f; + x += radius; y += radius; + break; + case CORNERS: + radius = (radius - x) / 2f; + radius = (radius - y) / 2f; + x += radius; + y += radius; + break; + } + + if (depth || !optimize2) { + ellipse3(x, y, radius, radius); + + } else { + circle2(x, y, radius); + } + } + + + public void circle2(float x, float y, float radius) { + } + + /* private void flat_circle(int centerX, int centerY, int radius) { // FIXME diff --git a/core/PMethods.java b/core/PMethods.java index 240690ba5..70623802e 100755 --- a/core/PMethods.java +++ b/core/PMethods.java @@ -129,6 +129,8 @@ public interface PMethods { public void ellipse(float x, float y, float hradius, float vradius); + public void circle(float x, float y, float radius); + public float bezierPoint(float a, float b, float c, float d, float t);