Skip to content

Commit cb8434c

Browse files
committed
change binary() to use a fixed size like hex()
1 parent 8595bef commit cb8434c

File tree

5 files changed

+28
-32
lines changed

5 files changed

+28
-32
lines changed

android/core/src/processing/core/PApplet.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6292,16 +6292,12 @@ static final public String binary(char what) {
62926292
}
62936293

62946294
/**
6295-
* Returns a String that contains the binary value of an int.
6296-
* The length depends on the size of the number itself.
6297-
* An int can be up to 32 binary digits, but that seems like
6298-
* overkill for almost any situation, so this function just
6299-
* auto-size. If you want a specific number of digits (like all 32)
6300-
* use binary(int what, int digits) to specify how many digits.
6295+
* Returns a String that contains the binary value of an int. The length
6296+
* depends on the size of the number itself. If you want a specific number
6297+
* of digits use binary(int what, int digits) to specify how many.
63016298
*/
63026299
static final public String binary(int what) {
6303-
return Integer.toBinaryString(what);
6304-
//return binary(what, 32);
6300+
return binary(what, 32);
63056301
}
63066302

63076303
/**

android/core/src/processing/core/PShape.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,7 @@ public PShape getParent() {
668668
return parent;
669669
}
670670

671+
671672
public int getChildCount() {
672673
return childCount;
673674
}

core/src/processing/core/PApplet.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6963,16 +6963,12 @@ static final public String binary(char what) {
69636963
}
69646964

69656965
/**
6966-
* Returns a String that contains the binary value of an int.
6967-
* The length depends on the size of the number itself.
6968-
* An int can be up to 32 binary digits, but that seems like
6969-
* overkill for almost any situation, so this function just
6970-
* auto-size. If you want a specific number of digits (like all 32)
6971-
* use binary(int what, int digits) to specify how many digits.
6966+
* Returns a String that contains the binary value of an int. The length
6967+
* depends on the size of the number itself. If you want a specific number
6968+
* of digits use binary(int what, int digits) to specify how many.
69726969
*/
69736970
static final public String binary(int what) {
6974-
return Integer.toBinaryString(what);
6975-
//return binary(what, 32);
6971+
return binary(what, 32);
69766972
}
69776973

69786974
/**

core/src/processing/core/PShapeSVG.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1824,7 +1824,7 @@ protected boolean isLegit() { // TODO need a better way to handle this...
18241824
* beneath them can be used here.
18251825
* <PRE>
18261826
* // This code grabs "Layer 3" and the shapes beneath it.
1827-
* PShape layer3 = svg.getChild("Layer 3");
1827+
* PShape layer3 = svg.getShape("Layer 3");
18281828
* </PRE>
18291829
*/
18301830
public PShape getChild(String name) {

core/todo.txt

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,14 @@ o http://dev.processing.org/bugs/show_bug.cgi?id=964
258258
decisions
259259
o call reapplySettings() when using beginRecord()?
260260
X nope, won't work for many fonts, can't get the background
261-
_ should beginRecord inherit settings from its parent renderer?
262-
_ textFont() is null on beginRecord
263-
_ same would be the case for strokeWeight, background, etc.
264-
_ http://dev.processing.org/bugs/show_bug.cgi?id=346
265-
_ add note to begin/endRecord, that settings are not inherited
266-
_ http://dev.processing.org/bugs/show_bug.cgi?id=346
267-
_ or actually inherit the settings
261+
X should beginRecord inherit settings from its parent renderer?
262+
X textFont() is null on beginRecord
263+
X same would be the case for strokeWeight, background, etc.
264+
X add note to begin/endRecord, that settings are not inherited
265+
X http://dev.processing.org/bugs/show_bug.cgi?id=346
266+
o or actually inherit the settings
267+
X decision: too many minor glitches possible, just note in the ref
268+
X i.e. some fonts don't work with PDF, or bg color can't be re-set
268269
X clean up filter stuff?
269270
X filter(GRAY) -> to push things to luminosity-based gray
270271
X already implemented this way
@@ -280,7 +281,9 @@ o http://en.wikipedia.org/wiki/Clip_Mapping
280281
o http://www.cubic.org/docs/3dclip.htm
281282
o perspective() applied after camera()... problems?
282283
o make sure that filter, blend, copy, etc say that no loadPixels necessary
283-
_ add java.io.Reader (and Writer?) to imports
284+
o add java.io.Reader (and Writer?) to imports
285+
X binary() auto-sizes, hex() does not
286+
X decision: remove auto-sizing from binary
284287

285288
xml changes
286289
o see if write() is necessary inside PNodeXML
@@ -360,6 +363,7 @@ _ figure out why font naming not working correctly
360363
_ add blendMode() to reference, remove blend()
361364
_ need documentation for quadraticVertex()
362365
_ docs for rect(x, y, w, h, r) and rect(x, y, w, h, tl, tr, br, bl)
366+
_ svg examples should use getShape(name) not getChild(name)
363367

364368
2.0
365369
_ toArray(), toArray(float[]), toVectorArray(), toVectorArray(PVector[])
@@ -381,13 +385,6 @@ _ http://dvcs.w3.org/hg/webevents/raw-file/tip/touchevents.html
381385
_ http://www.html5rocks.com/en/mobile/touch.html
382386
_ decision: go with what looks like javascript/ios
383387
_ touchEvent(), gestureEvent()?
384-
_ binary() auto-sizes, hex() does not
385-
_ decision: remove auto-sizing from binary
386-
_ in PShape, getChild(name) refers to a <blah id="name">
387-
_ however in an XML file, that's <name ...>, meaning the name of the tag
388-
_ change it to getShape(name)? also for fonts getShape(char c)
389-
_ decision: use getShape() (maybe add getShapeCount and getShape(int))
390-
_ and remove getChild() from PShape
391388
_ load/save methods.. is it save("blah.svg") or saveSVG("blah.svg")
392389
_ also works that way with tables
393390
_ decision: useExtension() or something like that
@@ -523,6 +520,12 @@ _ http://code.google.com/p/processing/issues/detail?id=246
523520
_ path for selectXxxxx() functions
524521
_ http://code.google.com/p/processing/issues/detail?id=233
525522
_ provide a way to clear the PGraphics with plain alpha
523+
_ in PShape, getChild(name) refers to a <blah id="name">
524+
_ however in an XML file, that's <name ...>, meaning the name of the tag
525+
_ change it to getShape(name)? also for fonts getShape(char c)
526+
_ decision: use getShape() (maybe add getShapeCount and getShape(int))
527+
_ and remove getChild() from PShape
528+
_ oops: getParent() is in there, as is getChildren() and others...
526529

527530
stop() mess
528531
_ notes

0 commit comments

Comments
 (0)