Processing remembers the values used when the user calls the fill(…) method but does not provide methods for the user to retrieve them. Since the user is responsible for calling the fill(…) method then the user will already know these values e.g. fill(255, 0, 80);
The user knows the values for the RGB channels so just store them in global variables e.g.
int r, g, b;
r = 255;
g = 0;
b = 80;
// then later on
fill(r,g,b);
The alternative is to override the fill method like I have done in this sketch
int fillR, fillG, fillB;
void setup() {
size(320, 240);
background(255);
fill(255, 0, 80);
}
void draw() {
}
// Override fill method
void fill(int r, int g, int b) {
println( fillR, fillG, fillB);
fillR = r;
fillG = g;
fillB = b;
// now call the Processing fill method
super.fill( fillR, fillG, fillB);
}
void function() {
loadPixels();
for (int i = 0; i < pixels.length; i++) {
pixels[i] = color( fillR, fillG, fillB );
}
updatePixels();
}
void keyPressed() {
if (key == 'p') {
function();
}
}