mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
fixing parseXxxx() for 1.0
This commit is contained in:
@@ -5404,27 +5404,46 @@ public class PApplet extends Applet
|
||||
// CASTING FUNCTIONS, INSERTED BY PREPROC
|
||||
|
||||
|
||||
/**
|
||||
* Convert a char to a boolean. 'T', 't', and '1' will become the
|
||||
* boolean value true, while 'F', 'f', or '0' will become false.
|
||||
*/
|
||||
/*
|
||||
static final public boolean parseBoolean(char what) {
|
||||
return ((what == 't') || (what == 'T') || (what == '1'));
|
||||
}
|
||||
*/
|
||||
|
||||
static final public boolean parseBoolean(int what) { // this will cover byte
|
||||
/**
|
||||
* <p>Convert an integer to a boolean. Because of how Java handles upgrading
|
||||
* numbers, this will also cover byte and char (as they will upgrade to
|
||||
* an int without any sort of explicit cast).</p>
|
||||
* <p>The preprocessor will convert boolean(what) to parseBoolean(what).</p>
|
||||
* @return false if 0, true if any other number
|
||||
*/
|
||||
static final public boolean parseBoolean(int what) {
|
||||
return (what != 0);
|
||||
}
|
||||
|
||||
/*
|
||||
// removed because this makes no useful sense
|
||||
static final public boolean parseBoolean(float what) {
|
||||
return (what != 0);
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Convert the string "true" or "false" to a boolean.
|
||||
* @return true if 'what' is "true" or "TRUE", false otherwise
|
||||
*/
|
||||
static final public boolean parseBoolean(String what) {
|
||||
return new Boolean(what).booleanValue();
|
||||
}
|
||||
|
||||
//
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
/*
|
||||
// removed, no need to introduce strange syntax from other languages
|
||||
static final public boolean[] parseBoolean(char what[]) {
|
||||
boolean outgoing[] = new boolean[what.length];
|
||||
for (int i = 0; i < what.length; i++) {
|
||||
@@ -5433,7 +5452,14 @@ public class PApplet extends Applet
|
||||
}
|
||||
return outgoing;
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Convert a byte array to a boolean array. Each element will be
|
||||
* evaluated identical to the integer case, where a byte equal
|
||||
* to zero will return false, and any other value will return true.
|
||||
* @return array of boolean elements
|
||||
*/
|
||||
static final public boolean[] parseBoolean(byte what[]) {
|
||||
boolean outgoing[] = new boolean[what.length];
|
||||
for (int i = 0; i < what.length; i++) {
|
||||
@@ -5442,6 +5468,21 @@ public class PApplet extends Applet
|
||||
return outgoing;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert an int array to a boolean array. An int equal
|
||||
* to zero will return false, and any other value will return true.
|
||||
* @return array of boolean elements
|
||||
*/
|
||||
static final public boolean[] parseBoolean(int what[]) {
|
||||
boolean outgoing[] = new boolean[what.length];
|
||||
for (int i = 0; i < what.length; i++) {
|
||||
outgoing[i] = (what[i] != 0);
|
||||
}
|
||||
return outgoing;
|
||||
}
|
||||
|
||||
/*
|
||||
// removed, not necessary... if necessary, convert to int array first
|
||||
static final public boolean[] parseBoolean(float what[]) {
|
||||
boolean outgoing[] = new boolean[what.length];
|
||||
for (int i = 0; i < what.length; i++) {
|
||||
@@ -5459,13 +5500,11 @@ public class PApplet extends Applet
|
||||
return outgoing;
|
||||
}
|
||||
|
||||
//
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
/*
|
||||
static final public byte parseByte(boolean what) {
|
||||
return what ? (byte)1 : 0;
|
||||
}
|
||||
*/
|
||||
|
||||
static final public byte parseByte(char what) {
|
||||
return (byte) what;
|
||||
@@ -5475,19 +5514,19 @@ public class PApplet extends Applet
|
||||
return (byte) what;
|
||||
}
|
||||
|
||||
/*
|
||||
static final public byte parseByte(float what) { // nonsensical
|
||||
static final public byte parseByte(float what) {
|
||||
return (byte) what;
|
||||
}
|
||||
|
||||
/*
|
||||
// nixed, no precedent
|
||||
static final public byte[] parseByte(String what) { // note: array[]
|
||||
return what.getBytes();
|
||||
}
|
||||
*/
|
||||
|
||||
//
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
/*
|
||||
static final public byte[] parseByte(boolean what[]) {
|
||||
byte outgoing[] = new byte[what.length];
|
||||
for (int i = 0; i < what.length; i++) {
|
||||
@@ -5495,7 +5534,6 @@ public class PApplet extends Applet
|
||||
}
|
||||
return outgoing;
|
||||
}
|
||||
*/
|
||||
|
||||
static final public byte[] parseByte(char what[]) {
|
||||
byte outgoing[] = new byte[what.length];
|
||||
@@ -5513,8 +5551,7 @@ public class PApplet extends Applet
|
||||
return outgoing;
|
||||
}
|
||||
|
||||
/*
|
||||
static final public byte[] parseByte(float what[]) { // nonsensical
|
||||
static final public byte[] parseByte(float what[]) {
|
||||
byte outgoing[] = new byte[what.length];
|
||||
for (int i = 0; i < what.length; i++) {
|
||||
outgoing[i] = (byte) what[i];
|
||||
@@ -5522,6 +5559,7 @@ public class PApplet extends Applet
|
||||
return outgoing;
|
||||
}
|
||||
|
||||
/*
|
||||
static final public byte[][] parseByte(String what[]) { // note: array[][]
|
||||
byte outgoing[][] = new byte[what.length][];
|
||||
for (int i = 0; i < what.length; i++) {
|
||||
@@ -5531,7 +5569,7 @@ public class PApplet extends Applet
|
||||
}
|
||||
*/
|
||||
|
||||
//
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
/*
|
||||
static final public char parseChar(boolean what) { // 0/1 or T/F ?
|
||||
@@ -5557,7 +5595,7 @@ public class PApplet extends Applet
|
||||
}
|
||||
*/
|
||||
|
||||
//
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
/*
|
||||
static final public char[] parseChar(boolean what[]) { // 0/1 or T/F ?
|
||||
@@ -5569,14 +5607,6 @@ public class PApplet extends Applet
|
||||
}
|
||||
*/
|
||||
|
||||
static final public char[] parseChar(int what[]) {
|
||||
char outgoing[] = new char[what.length];
|
||||
for (int i = 0; i < what.length; i++) {
|
||||
outgoing[i] = (char) what[i];
|
||||
}
|
||||
return outgoing;
|
||||
}
|
||||
|
||||
static final public char[] parseChar(byte what[]) {
|
||||
char outgoing[] = new char[what.length];
|
||||
for (int i = 0; i < what.length; i++) {
|
||||
@@ -5585,6 +5615,14 @@ public class PApplet extends Applet
|
||||
return outgoing;
|
||||
}
|
||||
|
||||
static final public char[] parseChar(int what[]) {
|
||||
char outgoing[] = new char[what.length];
|
||||
for (int i = 0; i < what.length; i++) {
|
||||
outgoing[i] = (char) what[i];
|
||||
}
|
||||
return outgoing;
|
||||
}
|
||||
|
||||
/*
|
||||
static final public char[] parseChar(float what[]) { // nonsensical
|
||||
char outgoing[] = new char[what.length];
|
||||
@@ -5603,13 +5641,11 @@ public class PApplet extends Applet
|
||||
}
|
||||
*/
|
||||
|
||||
//
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
/*
|
||||
static final public int parseInt(boolean what) {
|
||||
return what ? 1 : 0;
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Note that parseInt() will un-sign a signed byte value.
|
||||
@@ -5657,9 +5693,8 @@ public class PApplet extends Applet
|
||||
return otherwise;
|
||||
}
|
||||
|
||||
//
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
/*
|
||||
static final public int[] parseInt(boolean what[]) {
|
||||
int list[] = new int[what.length];
|
||||
for (int i = 0; i < what.length; i++) {
|
||||
@@ -5667,7 +5702,6 @@ public class PApplet extends Applet
|
||||
}
|
||||
return list;
|
||||
}
|
||||
*/
|
||||
|
||||
static final public int[] parseInt(byte what[]) { // note this unsigns
|
||||
int list[] = new int[what.length];
|
||||
@@ -5728,7 +5762,7 @@ public class PApplet extends Applet
|
||||
return output;
|
||||
}
|
||||
|
||||
//
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
/*
|
||||
static final public float parseFloat(boolean what) {
|
||||
@@ -5736,7 +5770,11 @@ public class PApplet extends Applet
|
||||
}
|
||||
*/
|
||||
|
||||
static final public float parseFloat(int what) {
|
||||
/**
|
||||
* Convert an int to a float value. Also handles bytes because of
|
||||
* Java's rules for upgrading values.
|
||||
*/
|
||||
static final public float parseFloat(int what) { // also handles byte
|
||||
return (float)what;
|
||||
}
|
||||
|
||||
@@ -5752,7 +5790,7 @@ public class PApplet extends Applet
|
||||
return otherwise;
|
||||
}
|
||||
|
||||
//
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
/*
|
||||
static final public float[] parseFloat(boolean what[]) {
|
||||
@@ -5772,6 +5810,14 @@ public class PApplet extends Applet
|
||||
}
|
||||
*/
|
||||
|
||||
static final public float[] parseByte(byte what[]) {
|
||||
float floaties[] = new float[what.length];
|
||||
for (int i = 0; i < what.length; i++) {
|
||||
floaties[i] = what[i];
|
||||
}
|
||||
return floaties;
|
||||
}
|
||||
|
||||
static final public float[] parseFloat(int what[]) {
|
||||
float floaties[] = new float[what.length];
|
||||
for (int i = 0; i < what.length; i++) {
|
||||
@@ -5796,18 +5842,29 @@ public class PApplet extends Applet
|
||||
return output;
|
||||
}
|
||||
|
||||
//
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
static final public String str(boolean x) { return String.valueOf(x); }
|
||||
static final public String str(byte x) { return String.valueOf(x); }
|
||||
static final public String str(char x) { return String.valueOf(x); }
|
||||
static final public String str(short x) { return String.valueOf(x); }
|
||||
static final public String str(int x) { return String.valueOf(x); }
|
||||
static final public String str(float x) { return String.valueOf(x); }
|
||||
static final public String str(long x) { return String.valueOf(x); }
|
||||
static final public String str(double x) { return String.valueOf(x); }
|
||||
static final public String str(boolean x) {
|
||||
return String.valueOf(x);
|
||||
}
|
||||
|
||||
//
|
||||
static final public String str(byte x) {
|
||||
return String.valueOf(x);
|
||||
}
|
||||
|
||||
static final public String str(char x) {
|
||||
return String.valueOf(x);
|
||||
}
|
||||
|
||||
static final public String str(int x) {
|
||||
return String.valueOf(x);
|
||||
}
|
||||
|
||||
static final public String str(float x) {
|
||||
return String.valueOf(x);
|
||||
}
|
||||
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
static final public String[] str(boolean x[]) {
|
||||
String s[] = new String[x.length];
|
||||
@@ -5827,12 +5884,6 @@ public class PApplet extends Applet
|
||||
return s;
|
||||
}
|
||||
|
||||
static final public String[] str(short x[]) {
|
||||
String s[] = new String[x.length];
|
||||
for (int i = 0; i < x.length; i++) s[i] = String.valueOf(x);
|
||||
return s;
|
||||
}
|
||||
|
||||
static final public String[] str(int x[]) {
|
||||
String s[] = new String[x.length];
|
||||
for (int i = 0; i < x.length; i++) s[i] = String.valueOf(x);
|
||||
@@ -5845,19 +5896,6 @@ public class PApplet extends Applet
|
||||
return s;
|
||||
}
|
||||
|
||||
static final public String[] str(long x[]) {
|
||||
String s[] = new String[x.length];
|
||||
for (int i = 0; i < x.length; i++) s[i] = String.valueOf(x);
|
||||
return s;
|
||||
}
|
||||
|
||||
static final public String[] str(double x[]) {
|
||||
String s[] = new String[x.length];
|
||||
for (int i = 0; i < x.length; i++) s[i] = String.valueOf(x);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
+54
-45
@@ -1,4 +1,7 @@
|
||||
0124 core
|
||||
X ironed out more of the preproc parseXxxx() functions
|
||||
_ update the reference to cover these decisions
|
||||
_ also add notes about parseInt/Float(blah, otherwise)
|
||||
|
||||
|
||||
out of our control, just waiting
|
||||
@@ -21,6 +24,54 @@ _ is the image actually a BufferedImage so PixelGrabber is a waste?
|
||||
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
blend modes [1.0]
|
||||
_ more blend() modes (the five listed on the thread below?)
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=132
|
||||
_ figure out what the modes should actually be:
|
||||
_ photoshop: normal, dissolve; darken, multiply, color burn,
|
||||
_ linear burn; lighten, screen, color dodge, linear
|
||||
_ dodge; overlay, soft light, hard light, vivid light,
|
||||
_ linear light, pin light, hard mix; difference,
|
||||
_ exclusion; hue, saturation, color, luminosity
|
||||
_ illustrator: normal; darken, multiply, color burn; lighten,
|
||||
_ screen, color dodge; overlay, soft light, hard light;
|
||||
_ difference, exclusion; hue, sat, color, luminosity
|
||||
_ director: Copy, Transparent, Reverse, Ghost, Not copy,
|
||||
_ Not transparent, Not reverse, Not ghost, Matte, Mask;
|
||||
_ (below seems more useful:
|
||||
_ Blend, Add pin, Add, Subtract pin, Background transparent,
|
||||
_ Lightest, Subtract, Darkest, Lighten, Darken
|
||||
_ flash:
|
||||
_ DIFFERENCE: C = abs(A-B);
|
||||
_ MULTIPLY: C = (A * B ) / 255
|
||||
_ SCREEN: C= 255 - ( (255-A) * (255-B) / 255 )
|
||||
_ OVERLAY: C = B < 128 ? (2*A*B/255) : 255-2*(255-A)*(255-B)/255
|
||||
_ HARD_LIGHT: C = A < 128 ? (2*A*B/255) : 255-2*(255-A)*(255-B)/255
|
||||
_ SOFT_LIGHT: C = B < 128 ? 2*((A>>1)+64)*B/255 : 255-(2*(255-((A>>1)+64))*(255-B)/255)
|
||||
|
||||
X begin/endPixels.. change has been made
|
||||
_ on PImage, sets a flag that marks it to be updated on next render
|
||||
_ for PImage, begin after an end is ignored, no pixels are re-loaded
|
||||
_ the "changed" bit gets turned off when the PImage is rendered
|
||||
_ for subclasses of PGraphics, the reload bit needs to be set on endFrame
|
||||
_ filter() checks to see if inside begin/endPixels, if so doesn't call
|
||||
o if line() is called inside beginpixels, call updatepixels?
|
||||
_ when NPE on line with pixels[], suggest user includes beginPixels
|
||||
_ need to test/straighten out load/update pixels
|
||||
_ loadPixels() and updatePixels() only need to be used when
|
||||
_ touching pixels[]. All other functions including get(), set(),
|
||||
_ filter(), etc shouldn't need them.
|
||||
_ fjen says blend() doens't work in JAVA2D
|
||||
_ the functions are fairly well separated now in PMethods
|
||||
_ just go through all the stuff to make sure it's setting properly
|
||||
_ don't do a loadPixels unless an updatePixels has completed
|
||||
_ tho this won't affect anything, since either it's an image buffer
|
||||
_ or it's the PGraphics object, which does an updatePixels() immediately
|
||||
_ if (modified) don't loadPixels again, just ignore it
|
||||
_ make a note that updatePixels() only sets a flag in PImage
|
||||
_ (but not PGraphics, which does it immediately)
|
||||
|
||||
|
||||
gledgeflag [1.0]
|
||||
_ when turning smoothing on, internal lines of shapes are visible
|
||||
_ need to turn off smoothing for the interior of shapes
|
||||
@@ -121,6 +172,9 @@ _ (i.e. will it be the uncompressed or compressed size of the data?)
|
||||
_ modelX/Y/Z still having trouble
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=486
|
||||
|
||||
_ Use getContextClassLoader() instead of Class.forName()
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=514
|
||||
|
||||
_ problems with depth buffer and createGraphics with P3D
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=482
|
||||
_ ARGB problems with createGraphics
|
||||
@@ -212,28 +266,6 @@ _ or textAlign(LEFT, MIDDLE); -> this one seems best
|
||||
|
||||
_ AIOOBE on PLine 757.. halts renderer
|
||||
|
||||
X begin/endPixels.. change has been made
|
||||
_ on PImage, sets a flag that marks it to be updated on next render
|
||||
_ for PImage, begin after an end is ignored, no pixels are re-loaded
|
||||
_ the "changed" bit gets turned off when the PImage is rendered
|
||||
_ for subclasses of PGraphics, the reload bit needs to be set on endFrame
|
||||
_ filter() checks to see if inside begin/endPixels, if so doesn't call
|
||||
o if line() is called inside beginpixels, call updatepixels?
|
||||
_ when NPE on line with pixels[], suggest user includes beginPixels
|
||||
_ need to test/straighten out load/update pixels
|
||||
_ loadPixels() and updatePixels() only need to be used when
|
||||
_ touching pixels[]. All other functions including get(), set(),
|
||||
_ filter(), etc shouldn't need them.
|
||||
_ fjen says blend() doens't work in JAVA2D
|
||||
_ the functions are fairly well separated now in PMethods
|
||||
_ just go through all the stuff to make sure it's setting properly
|
||||
_ don't do a loadPixels unless an updatePixels has completed
|
||||
_ tho this won't affect anything, since either it's an image buffer
|
||||
_ or it's the PGraphics object, which does an updatePixels() immediately
|
||||
_ if (modified) don't loadPixels again, just ignore it
|
||||
_ make a note that updatePixels() only sets a flag in PImage
|
||||
_ (but not PGraphics, which does it immediately)
|
||||
|
||||
_ add notes about fixing serial on the mac to the faq (and link to bug)
|
||||
|
||||
_ beginFrame()/beginDraw() and defaults()
|
||||
@@ -574,29 +606,6 @@ _ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bu
|
||||
_ ellipses are just plain ugly
|
||||
_ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1073409011;start=0
|
||||
_ toxi ellipses don't adapt properly with transformations
|
||||
_ more blend() modes (the five listed on the thread below?)
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=132
|
||||
_ figure out what the modes should actually be:
|
||||
_ photoshop: normal, dissolve; darken, multiply, color burn,
|
||||
_ linear burn; lighten, screen, color dodge, linear
|
||||
_ dodge; overlay, soft light, hard light, vivid light,
|
||||
_ linear light, pin light, hard mix; difference,
|
||||
_ exclusion; hue, saturation, color, luminosity
|
||||
_ illustrator: normal; darken, multiply, color burn; lighten,
|
||||
_ screen, color dodge; overlay, soft light, hard light;
|
||||
_ difference, exclusion; hue, sat, color, luminosity
|
||||
_ director: Copy, Transparent, Reverse, Ghost, Not copy,
|
||||
_ Not transparent, Not reverse, Not ghost, Matte, Mask;
|
||||
_ (below seems more useful:
|
||||
_ Blend, Add pin, Add, Subtract pin, Background transparent,
|
||||
_ Lightest, Subtract, Darkest, Lighten, Darken
|
||||
_ flash:
|
||||
_ DIFFERENCE: C = abs(A-B);
|
||||
_ MULTIPLY: C = (A * B ) / 255
|
||||
_ SCREEN: C= 255 - ( (255-A) * (255-B) / 255 )
|
||||
_ OVERLAY: C = B < 128 ? (2*A*B/255) : 255-2*(255-A)*(255-B)/255
|
||||
_ HARD_LIGHT: C = A < 128 ? (2*A*B/255) : 255-2*(255-A)*(255-B)/255
|
||||
_ SOFT_LIGHT: C = B < 128 ? 2*((A>>1)+64)*B/255 : 255-(2*(255-((A>>1)+64))*(255-B)/255)
|
||||
_ clipping planes
|
||||
_ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1058491568;start=0
|
||||
_ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1052313604;start=0
|
||||
|
||||
Reference in New Issue
Block a user