diff --git a/core/PGraphics.java b/core/PGraphics.java index 776b23a46..9847cdb3e 100644 --- a/core/PGraphics.java +++ b/core/PGraphics.java @@ -180,7 +180,6 @@ public class PGraphics extends PImage implements PConstants { * zero if no shape is currently being drawn. */ protected int shape; - //int shape_index; // vertices static final int DEFAULT_VERTICES = 512; @@ -190,8 +189,8 @@ public class PGraphics extends PImage implements PConstants { // ........................................................ - protected boolean bezier_inited = false; - protected int bezier_detail = 20; //BEZIER_DETAIL; + protected boolean bezierInited = false; + public int bezierDetail = 20; // msjvm complained when bezier_basis was final protected float bezier_basis[][] = { { -1, 3, -3, 1}, @@ -212,9 +211,9 @@ public class PGraphics extends PImage implements PConstants { // ........................................................ protected boolean curve_inited = false; - protected int curve_detail = 20; + protected int curveDetail = 20; // catmull-rom basis matrix, perhaps with optional s parameter - protected float curve_tightness = 0; + public float curveTightness = 0; protected float curve_basis[][]; // = new float[4][4]; protected float curve_forward[][]; // = new float[4][4]; protected float curve_draw[][]; @@ -1239,7 +1238,7 @@ public class PGraphics extends PImage implements PConstants { protected void bezier_init() { - bezierDetail(bezier_detail); + bezierDetail(bezierDetail); } @@ -1248,8 +1247,8 @@ public class PGraphics extends PImage implements PConstants { bezier_forward = new float[4][4]; bezier_draw = new float[4][4]; } - bezier_detail = detail; - bezier_inited = true; + bezierDetail = detail; + bezierInited = true; // setup matrix for forward differencing to speed up drawing setup_spline_forward(detail, bezier_forward); @@ -1333,17 +1332,17 @@ public class PGraphics extends PImage implements PConstants { public void curveDetail(int detail) { - curve_mode(detail, curve_tightness); + curve_mode(detail, curveTightness); } public void curveTightness(float tightness) { - curve_mode(curve_detail, tightness); + curve_mode(curveDetail, tightness); } protected void curve_init() { - curve_mode(curve_detail, curve_tightness); + curve_mode(curveDetail, curveTightness); } @@ -1359,9 +1358,7 @@ public class PGraphics extends PImage implements PConstants { * code more readable) */ protected void curve_mode(int segments, float s) { - curve_detail = segments; - //curve_mode = ((curve_tightness != 0) || - // (curve_segments != CURVE_DETAIL)); + curveDetail = segments; if (curve_basis == null) { // allocate these when used, to save startup time @@ -1656,6 +1653,11 @@ public class PGraphics extends PImage implements PConstants { } + /** + * Returns the ascent of the current font at the current size. + * This is a method, rather than a variable inside the PGraphics object + * because it requires calculation. + */ public float textAscent() { if (textFont == null) { throw new RuntimeException("use textFont() before textAscent()"); @@ -1665,6 +1667,11 @@ public class PGraphics extends PImage implements PConstants { } + /** + * Returns the descent of the current font at the current size. + * This is a method, rather than a variable inside the PGraphics object + * because it requires calculation. + */ public float textDescent() { if (textFont != null) { return textFont.descent() * textSize; diff --git a/core/PGraphics2.java b/core/PGraphics2.java index c89d338b3..efa039224 100644 --- a/core/PGraphics2.java +++ b/core/PGraphics2.java @@ -713,9 +713,9 @@ public class PGraphics2 extends PGraphics { boolean savedSmooth = smooth; if (textFont.smooth != savedSmooth) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, - textFont.smooth ? - RenderingHints.VALUE_ANTIALIAS_ON : - RenderingHints.VALUE_ANTIALIAS_OFF); + textFont.smooth ? + RenderingHints.VALUE_ANTIALIAS_ON : + RenderingHints.VALUE_ANTIALIAS_OFF); } g2.setColor(fillColorObject); diff --git a/core/PGraphics3.java b/core/PGraphics3.java index b025ed44f..3bffa4711 100644 --- a/core/PGraphics3.java +++ b/core/PGraphics3.java @@ -745,18 +745,18 @@ public class PGraphics3 extends PGraphics { if (splineVertexCount > 3) { if (bezier) { if ((splineVertexCount % 4) == 0) { - if (!bezier_inited) bezier_init(); + if (!bezierInited) bezier_init(); spline3_segment(splineVertexCount-4, splineVertexCount-4, bezier_draw, - bezier_detail); + bezierDetail); } } else { // catmull-rom curve (!bezier) if (!curve_inited) curve_init(); spline3_segment(splineVertexCount-4, splineVertexCount-3, curve_draw, - curve_detail); + curveDetail); } } } @@ -3114,7 +3114,9 @@ public class PGraphics3 extends PGraphics { * called always dominates. On resize, the default projection is always * established, which has perspective. *
- * This behavior is pretty much familiar from OpenGL. + * This behavior is pretty much familiar from OpenGL, except where + * functions replace matrices, rather than multiplying against the + * previous. *
*/ public void perspective() { diff --git a/core/todo.txt b/core/todo.txt index 53ca3684f..01a9096e3 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -4,6 +4,10 @@ X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action X http://192.18.37.44/forums/index.php?topic=1596.msg79680#msg79680 X faster blur code contributed by toxi X filter(ERODE) and filter(DILATE) contributed by toxi +o textAscent() should probably be g.textAscent instead +o more like textLeading() etc +X nope, because it requires grabbing a font metrics object and other calculations +X bezierDetail, curveDetail made public nixed or fixed in previous releases X textMode(SCREEN) having issues on Mac OS X