|
|
1.1 root 1: #include <stdio.h>
2: #include <math.h>
3: main()
4: {
5: /* generates table for -mf option in view2d */
6: /* all spectral colors: blue to green to red */
7: int nc=64; /* number of colors (-c64 option) */
8: int maxi=nc-1; /* max color index */
9: int i, max1;
10: double r, g, b;
11: max1=maxi/2;
12: /* sqrt's here are for gamma correction of monitor */
13: for(i=0; i<=max1; i++){
14: r=sqrt(0.);
15: g=sqrt(((double)i)/max1);
16: b=sqrt(1-((double)i)/max1);
17: printf("%d %d %d\n",(int)(255.499*r), (int)(255.499*g), (int)(255.499*b));
18: }
19: for(i=max1+1; i<=maxi; i++){
20: r=sqrt(((double)i-max1)/(maxi-max1));
21: g=sqrt(1-((double)i-max1)/(maxi-max1));
22: b=sqrt(0.);
23: printf("%d %d %d\n",(int)(255.499*r), (int)(255.499*g), (int)(255.499*b));
24: }
25: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.