Well, maybe the pixels array will probably be filled with 0xffcccccc values
to start with. As you add these together, the first time, you get an
increasing amount of values which are almost like an l-system, really.
ffcccccc+ffcccccc => ff999998
ffcccccc+ff999998 => ff666664
ffcccccc+ff666664 => ff333330
ff999998+ff999998 => ff333330
The lowest byte will wrap around fastest (making a quick blue<->yellow change), then green, then red, then alpha.
I just tried to put a
background(0x01010101); in the setup method. That's kind of cool (but slow to build).
This is what I was using to examine it:
static HashSet h=new HashSet();
void setup(){
size(800,800);
// background(0x01010101);
// background(0x08080808);
// background(0x10101010);
// background(0x20202020);
// background(0x80808080);
}
void draw(){
loadPixels();
for(int i=1;i<width*height-1;i+=random(1000)) {
final int a=pixels[i-1];
final int b=pixels[i+1];
final long st = a<b ? (((long)a)<<32) | (b&0xffffffffL) : (((long)b)<<32) | (a&0xffffffffL);
if (!h.contains(st)) {
System.out.println(Integer.toHexString((int)(st>>32)) + " + "+Integer.toHexString((int)b)+" => "+Integer.toHexString(a+b));
h.add(st);
}
pixels[i]=a+b;
}
updatePixels();
}
ffcccccc+ffcccccc => ff999998
ffcccccc+ff999998 => ff666664
ffcccccc+ff666664 => ff333330
ff999998+ff999998 => ff333330
The lowest byte will wrap around fastest (making a quick blue<->yellow change), then green, then red, then alpha.
I just tried to put a
background(0x01010101); in the setup method. That's kind of cool (but slow to build).
This is what I was using to examine it:
static HashSet h=new HashSet();
void setup(){
size(800,800);
// background(0x01010101);
// background(0x08080808);
// background(0x10101010);
// background(0x20202020);
// background(0x80808080);
}
void draw(){
loadPixels();
for(int i=1;i<width*height-1;i+=random(1000)) {
final int a=pixels[i-1];
final int b=pixels[i+1];
final long st = a<b ? (((long)a)<<32) | (b&0xffffffffL) : (((long)b)<<32) | (a&0xffffffffL);
if (!h.contains(st)) {
System.out.println(Integer.toHexString((int)(st>>32)) + " + "+Integer.toHexString((int)b)+" => "+Integer.toHexString(a+b));
h.add(st);
}
pixels[i]=a+b;
}
updatePixels();
}



