The function grayscale() doesn't have constants, I thought I'd remind of them and suggest another functionality for grayscale().
original code:
switch(params[2]){
case 0: // RGB
c=gr_rgb(c,c,c);
break;
case 1: // R
c=gr_rgb(c,0,0);
break;
case 2: // G
c=gr_rgb(0,c,0);
break;
case 3: // B
c=gr_rgb(0,0,c);
break;
case 4: // RG
c=gr_rgb(c,c,0);
break;
case 5: // RB
c=gr_rgb(c,0,c);
break;
case 6: // GB
c=gr_rgb(0,c,c);
break;
default:
c=gr_rgb(r,g,b);
}
I suggest something like:
GS_RGB 0
GS_R 1
GS_G 2
GS_B 3
GS_RG 4
GS_RB 5
GS_GB 6
Also a few other types I suggest. Instead of 0 (in gr_rgb(c,0,0)), use the original value; so the number of types would be almost doubled:
GS_CCC 0
GS_C00 1
GS_0C0 2
GS_00C 3
GS_CC0 4
GS_C0C 5
GS_0CC 6
GS_CGB 7
GS_RCB 8
GS_RGC 9
GS_CCB 10
GS_CGC 11
GS_CGB 12
Notice that in this list is no GS_RGB, because that would be useless (c=gr_rgb(r,g,b) is the original colour). These are an addition to the first constants.
The code would be:
switch(params[2]){
case 0: // RGB
c=gr_rgb(c,c,c);
break;
case 1: // R
c=gr_rgb(c,0,0);
break;
case 2: // G
c=gr_rgb(0,c,0);
break;
case 3: // B
c=gr_rgb(0,0,c);
break;
case 4: // RG
c=gr_rgb(c,c,0);
break;
case 5: // RB
c=gr_rgb(c,0,c);
break;
case 6: // GB
c=gr_rgb(0,c,c);
break;
case 7: // R
c=gr_rgb(c,g,b);
break;
case 8: // G
c=gr_rgb(r,c,b);
break;
case 9: // B
c=gr_rgb(r,g,c);
break;
case 10: // RG
c=gr_rgb(c,c,b);
break;
case 11: // RB
c=gr_rgb(c,g,c);
break;
case 12: // GB
c=gr_rgb(r,c,c);
break;
default:
c=gr_rgb(r,g,b);
}
Thanks...