Skip to content

Instantly share code, notes, and snippets.

@memish
Created February 1, 2019 01:30
Show Gist options
  • Save memish/956480d4faccbc7dbb843dd30729c673 to your computer and use it in GitHub Desktop.
Save memish/956480d4faccbc7dbb843dd30729c673 to your computer and use it in GitHub Desktop.
int[] pr ={255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,80,80,80,235,235,5,235,255,255,255,255,255,255,255,255,80,235,80,235,235,235,5,235,235,235,255,255,255,255,255,255,80,235,80,80,235,235,235,5,235,235,235,255,255,255,255,255,255,80,235,235,235,235,5,5,5,5,255,255,255,255,255,255,255,255,235,235,235,235,235,235,255,255,255,255,255,255,255,255,255,255,255,0,255,255,0,255,255,255,255,255,255,255,255,255,255,255,255,0,255,255,0,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,0,255,0,0,255,0,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,0,0,0,255,255,0,0,0,255,255,255,255,255,255,255,100,100,100,255,255,255,255,100,100,100,255,255,255,255,255,100,100,100,100,255,255,255,255,100,100,100,100,255,255};
int[] pg ={255,255,255,255,255,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,10,10,10,220,220,0,220,255,255,255,255,255,255,255,255,10,220,10,220,220,220,0,220,220,220,255,255,255,255,255,255,10,220,10,10,220,220,220,0,220,220,220,255,255,255,255,255,255,10,220,220,220,220,0,0,0,0,255,255,255,255,255,255,255,255,220,220,220,220,220,220,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,225,225,0,0,255,0,0,255,0,0,225,225,255,255,255,255,225,225,225,0,0,0,0,0,0,225,225,225,255,255,255,255,225,225,0,0,0,0,0,0,0,0,225,225,255,255,255,255,255,255,0,0,0,255,255,0,0,0,255,255,255,255,255,255,255,55,55,55,255,255,255,255,55,55,55,255,255,255,255,255,55,55,55,55,255,255,255,255,55,55,55,55,255,255};
int[] pb ={255,255,255,255,255,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,5,5,5,0,0,0,0,255,255,255,255,255,255,255,255,5,0,5,0,0,0,0,0,0,0,255,255,255,255,255,255,5,0,5,5,0,0,0,0,0,0,0,255,255,255,255,255,255,5,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,0,0,255,0,0,255,0,0,255,255,255,255,255,255,255,0,0,0,255,0,0,255,0,0,0,255,255,255,255,255,0,0,0,0,255,255,255,255,0,0,0,0,255,255,255,255,0,0,0,255,0,255,255,0,255,0,0,0,255,255,255,255,0,0,0,255,255,255,255,255,255,0,0,0,255,255,255,255,0,0,255,255,255,255,255,255,255,255,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,255,0,0,0,255,255,255,255,255,0,0,0,0,255,255,255,255,0,0,0,0,255,255};
PImage myImg=null;
int gridSize = 16;
void setup() {
size(600, 300);
myImg = createImage(16, 16, RGB);
}
void draw() {
image(myImg, 0, 0);
}
void mousePressed(){
changeImg();
}
void changeImg(){
myImg.loadPixels();
for (int i = 0; i < gridSize*gridSize; i++) {
myImg.pixels[i] = color(pr[i], pg[i], pb[i]);
}
myImg.updatePixels();
myImg.resize(0,200);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment