bring back width/height in PShape

This commit is contained in:
benfry
2008-11-22 23:53:46 +00:00
parent f1c3f30664
commit 48c6642a92
3 changed files with 37 additions and 22 deletions

View File

@@ -77,10 +77,12 @@ public class PShape implements PConstants {
protected PImage image;
// boundary box of this shape
protected float x;
protected float y;
protected float width;
protected float height;
//protected float x;
//protected float y;
//protected float width;
//protected float height;
public float width;
public float height;
// set to false if the object is hidden in the layers palette
protected boolean visible = true;
@@ -216,23 +218,29 @@ public class PShape implements PConstants {
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
protected void checkBounds() {
if (width == 0 || height == 0) {
// calculate bounds here (also take kids into account)
width = 1;
height = 1;
}
}
// protected void checkBounds() {
// if (width == 0 || height == 0) {
// // calculate bounds here (also take kids into account)
// width = 1;
// height = 1;
// }
// }
/**
* Get the width of the drawing area (not necessarily the shape boundary).
*/
public float getWidth() {
checkBounds();
//checkBounds();
return width;
}
/**
* Get the height of the drawing area (not necessarily the shape boundary).
*/
public float getHeight() {
checkBounds();
//checkBounds();
return height;
}
@@ -521,7 +529,7 @@ public class PShape implements PConstants {
} else { // coded set of vertices
int index = 0;
if (vertices[0].length == 2) { // drawing a 2D path
for (int j = 0; j < vertexCodeCount; j++) {
switch (vertexCodes[j]) {

View File

@@ -1519,8 +1519,8 @@ public class PShapeSVG extends PShape {
}
// Set bounding box based on the parent bounding box
if (found != null) {
found.x = this.x;
found.y = this.y;
// found.x = this.x;
// found.y = this.y;
found.width = this.width;
found.height = this.height;
}

View File

@@ -24,20 +24,27 @@ X Bring back CENTER_RADIUS but deprecate it
X http://dev.processing.org/bugs/show_bug.cgi?id=1035
X enable smoothing by default in opengl
X change hints to instead only be able to DISABLE 2X or 4X
_ change reference re: smoothing in opengl
_ hint(), smooth(), and size()
X bring back .width and .height fields for PShape
o need to update the examples to reflect
X no examples to update
X change reference re: smoothing in opengl
X hint(), smooth(), and size()
_ rev the version number
_ OPENGL sketches flicker w/ Vista when background() is not used inside draw()
_ http://dev.processing.org/bugs/show_bug.cgi?id=930
_ Disabling Aero scheme prevents the problem (maybe?)
_ do we need to do glEnable for multisample with gl?
_ Present mode and OPENGL not working in 0156 with Windows Vista
_ http://dev.processing.org/bugs/show_bug.cgi?id=1009
_ Seems to be limited to Java 6u10 (but verify)
_ -Dsun.java2d.d3d=false seems to fix the problem
_ can probably add that to PApplet.main()
_ OPENGL sketches flicker w/ Vista when background() is not used inside draw()
_ http://dev.processing.org/bugs/show_bug.cgi?id=930
_ Disabling Aero scheme sometimes prevents the problem
_ Updating graphics drivers may prevent the problem
_ No textures render with hint(ENABLE_ACCURATE_TEXTURES)
_ http://dev.processing.org/bugs/show_bug.cgi?id=985
_ need to remove the hint from the reference