How would i go about making a palette generator..
i need an array of a definable size which stores each color in an image. For that i made this:
Code:
int pSize = 16;
PImage pal = new PImage(pSize,pSize);
color[] colors = new color[pSize*pSize];
void setup()
{
size(100,100);
setPal();
}
void draw()
{
copy(pal,0,0,pal.width,pal.height,0,0,w,h);
}
void setPal()
{
for (int i = 0; i < 64; i++)
{
colors[i] = color(i << 2,255 - ((i << 2)+1),0);
colors[i+64] = color(255,(i << 2) + 1,0);
colors[i+128] = color(255 - ((i << 2) + 1),255 - ((i << 2) + 1),0);
colors[i+192] = color(0,(i << 2) + 1,0);
pal.pixels[i] = colors[i];
pal.pixels[i+64] = colors[i+64];
pal.pixels[i+128] = colors[i+128];
pal.pixels[i+192] = colors[i+192];
}
}
Now, does anybody have an idea on how i could make a palette with random colors, rather than the same colors each time.. and it has to be fading in and out of each color, like in the code i have..
thanks in advance for any ideas
-seltar