1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
double wavelength, x, y, z, r, g, b;
printf("Wavelength x y z R G B\n");
printf("----------- ------ ------ ------ ----- ----- -----\n");
for (wave = 380; wave <= 780; wave += 5)
{
double wave;
spectrum_to_xyz(wave, &x, &y, &z);
xyz_to_rgb(cs, x, y, z, &r, &g, &b);
printf(" %5.0f nm %.4f %.4f %.4f ", wave, x, y, z);
if (constrain_rgb(&r, &g, &b)) {
norm_rgb(&r, &g, &b);
printf("%.3f %.3f %.3f (Approximation)\n", r, g, b);
} else {
norm_rgb(&r, &g, &b);
printf("%.3f %.3f %.3f\n", r, g, b);
}
}
return 0;
|