mirror of
https://github.com/dyne/FreeJ.git
synced 2026-02-05 12:39:15 +01:00
processing-js 0.4 has been merged in some relevant parts basic and topic scripts added for test color handling fixed, more scripts show up now
36 lines
584 B
Plaintext
36 lines
584 B
Plaintext
size(200, 200);
|
|
noStroke();
|
|
background(0);
|
|
|
|
// Load an image from the data directory
|
|
PImage c;
|
|
c = loadImage("data/cait.jpg", null, function(){
|
|
|
|
int xoff = 0;
|
|
int yoff = 0;
|
|
int p = 2;
|
|
int pix = p*3;
|
|
|
|
|
|
for(int i = 0; i < c.width*c.height; i += 1)
|
|
{
|
|
int here = c.pixels[i];
|
|
|
|
fill(red(here), 0, 0);
|
|
rect(xoff, yoff, p, pix);
|
|
|
|
fill(0, green(here), 0);
|
|
rect(xoff+p, yoff, p, pix);
|
|
|
|
fill(0, 0, blue(here));
|
|
rect(xoff+p*2, yoff, p, pix);
|
|
|
|
xoff+=pix;
|
|
if(xoff >= width-pix) {
|
|
xoff = 0;
|
|
yoff += pix;
|
|
}
|
|
}
|
|
|
|
});
|