change binary() to use a fixed size like hex()

This commit is contained in:
benfry
2011-06-20 20:36:50 +00:00
parent 595fdfc0ef
commit c072824a06
5 changed files with 28 additions and 32 deletions
@@ -6292,16 +6292,12 @@ public class PApplet extends Activity implements PConstants, Runnable {
}
/**
* Returns a String that contains the binary value of an int.
* The length depends on the size of the number itself.
* An int can be up to 32 binary digits, but that seems like
* overkill for almost any situation, so this function just
* auto-size. If you want a specific number of digits (like all 32)
* use binary(int what, int digits) to specify how many digits.
* Returns a String that contains the binary value of an int. The length
* depends on the size of the number itself. If you want a specific number
* of digits use binary(int what, int digits) to specify how many.
*/
static final public String binary(int what) {
return Integer.toBinaryString(what);
//return binary(what, 32);
return binary(what, 32);
}
/**
@@ -668,6 +668,7 @@ public class PShape implements PConstants {
return parent;
}
public int getChildCount() {
return childCount;
}
+4 -8
View File
@@ -6963,16 +6963,12 @@ public class PApplet extends Applet
}
/**
* Returns a String that contains the binary value of an int.
* The length depends on the size of the number itself.
* An int can be up to 32 binary digits, but that seems like
* overkill for almost any situation, so this function just
* auto-size. If you want a specific number of digits (like all 32)
* use binary(int what, int digits) to specify how many digits.
* Returns a String that contains the binary value of an int. The length
* depends on the size of the number itself. If you want a specific number
* of digits use binary(int what, int digits) to specify how many.
*/
static final public String binary(int what) {
return Integer.toBinaryString(what);
//return binary(what, 32);
return binary(what, 32);
}
/**
+1 -1
View File
@@ -1824,7 +1824,7 @@ public class PShapeSVG extends PShape {
* beneath them can be used here.
* <PRE>
* // This code grabs "Layer 3" and the shapes beneath it.
* PShape layer3 = svg.getChild("Layer 3");
* PShape layer3 = svg.getShape("Layer 3");
* </PRE>
*/
public PShape getChild(String name) {
+18 -15
View File
@@ -258,13 +258,14 @@ o http://dev.processing.org/bugs/show_bug.cgi?id=964
decisions
o call reapplySettings() when using beginRecord()?
X nope, won't work for many fonts, can't get the background
_ should beginRecord inherit settings from its parent renderer?
_ textFont() is null on beginRecord
_ same would be the case for strokeWeight, background, etc.
_ http://dev.processing.org/bugs/show_bug.cgi?id=346
_ add note to begin/endRecord, that settings are not inherited
_ http://dev.processing.org/bugs/show_bug.cgi?id=346
_ or actually inherit the settings
X should beginRecord inherit settings from its parent renderer?
X textFont() is null on beginRecord
X same would be the case for strokeWeight, background, etc.
X add note to begin/endRecord, that settings are not inherited
X http://dev.processing.org/bugs/show_bug.cgi?id=346
o or actually inherit the settings
X decision: too many minor glitches possible, just note in the ref
X i.e. some fonts don't work with PDF, or bg color can't be re-set
X clean up filter stuff?
X filter(GRAY) -> to push things to luminosity-based gray
X already implemented this way
@@ -280,7 +281,9 @@ o http://en.wikipedia.org/wiki/Clip_Mapping
o http://www.cubic.org/docs/3dclip.htm
o perspective() applied after camera()... problems?
o make sure that filter, blend, copy, etc say that no loadPixels necessary
_ add java.io.Reader (and Writer?) to imports
o add java.io.Reader (and Writer?) to imports
X binary() auto-sizes, hex() does not
X decision: remove auto-sizing from binary
xml changes
o see if write() is necessary inside PNodeXML
@@ -360,6 +363,7 @@ _ figure out why font naming not working correctly
_ add blendMode() to reference, remove blend()
_ need documentation for quadraticVertex()
_ docs for rect(x, y, w, h, r) and rect(x, y, w, h, tl, tr, br, bl)
_ svg examples should use getShape(name) not getChild(name)
2.0
_ toArray(), toArray(float[]), toVectorArray(), toVectorArray(PVector[])
@@ -381,13 +385,6 @@ _ http://dvcs.w3.org/hg/webevents/raw-file/tip/touchevents.html
_ http://www.html5rocks.com/en/mobile/touch.html
_ decision: go with what looks like javascript/ios
_ touchEvent(), gestureEvent()?
_ binary() auto-sizes, hex() does not
_ decision: remove auto-sizing from binary
_ in PShape, getChild(name) refers to a <blah id="name">
_ however in an XML file, that's <name ...>, meaning the name of the tag
_ change it to getShape(name)? also for fonts getShape(char c)
_ decision: use getShape() (maybe add getShapeCount and getShape(int))
_ and remove getChild() from PShape
_ load/save methods.. is it save("blah.svg") or saveSVG("blah.svg")
_ also works that way with tables
_ decision: useExtension() or something like that
@@ -523,6 +520,12 @@ _ http://code.google.com/p/processing/issues/detail?id=246
_ path for selectXxxxx() functions
_ http://code.google.com/p/processing/issues/detail?id=233
_ provide a way to clear the PGraphics with plain alpha
_ in PShape, getChild(name) refers to a <blah id="name">
_ however in an XML file, that's <name ...>, meaning the name of the tag
_ change it to getShape(name)? also for fonts getShape(char c)
_ decision: use getShape() (maybe add getShapeCount and getShape(int))
_ and remove getChild() from PShape
_ oops: getParent() is in there, as is getChildren() and others...
stop() mess
_ notes