Fixed the rgb2hls and hls2rgb functions. But we are losing too much precision when converting the RGB components back to "VGA" 0..63... I think it's time to switch to real 256 colors ...

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@356 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues
2008-11-19 22:04:32 +00:00
parent b49cbc3acf
commit fc0bd94113
2 changed files with 90 additions and 48 deletions

View File

@@ -946,10 +946,23 @@ void Bouton_Palette(void)
{
byte h,l,s;
rgb2hl(Palette_de_travail[Fore_color].R,Palette_de_travail[Fore_color].V,Palette_de_travail[Fore_color].B,&h,&l,&s);
DEBUG("ra",Palette_de_travail[Fore_color].R);
DEBUG("ga",Palette_de_travail[Fore_color].V);
DEBUG("ba",Palette_de_travail[Fore_color].B);
rgb2hl(Palette_de_travail[Fore_color].R*4,Palette_de_travail[Fore_color].V*4,Palette_de_travail[Fore_color].B*4,&h,&l,&s);
DEBUG("h",h);
DEBUG("l",l);
DEBUG("s",s);
h=(63-Jauge_rouge->Position)*4; // Enlever le *4 quand le slider ira de 0 à 255 comme il faut
HLStoRGB(h,l,s,&Palette_de_travail[Fore_color].R,&Palette_de_travail[Fore_color].V,&Palette_de_travail[Fore_color].B);
Palette_de_travail[Fore_color].R /= 4; // On ne compte que de 0 à 63 ici
Palette_de_travail[Fore_color].V /= 4; // On ne compte que de 0 à 63 ici
Palette_de_travail[Fore_color].B /= 4; // On ne compte que de 0 à 63 ici
DEBUG("rb",Palette_de_travail[Fore_color].R);
DEBUG("gb",Palette_de_travail[Fore_color].V);
DEBUG("bb",Palette_de_travail[Fore_color].B);
Num2str((int)h>>2,Chaine,2);
}
Print_dans_fenetre(180,172,Chaine,CM_Noir,CM_Clair);