forked from tTh/FloatImg
rien ne marche, on verra un autre jour...
This commit is contained in:
parent
8b4603fa21
commit
607a37c901
24
funcs/hsv.c
24
funcs/hsv.c
@ -1,6 +1,11 @@
|
||||
/*
|
||||
* FloatImg library
|
||||
* HUE - SATURATION - VALUE
|
||||
|
||||
+---------------------------------------------+
|
||||
| ce code ne fonctionne vraiment PAS ! |
|
||||
+---------------------------------------------+
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -111,9 +116,12 @@ return 0;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
/*
|
||||
* expect garbage !
|
||||
*/
|
||||
int fimg_essai_hsv(char *fname)
|
||||
{
|
||||
float colors[3], values[3];
|
||||
float colors[3], values[3], newcols[3];
|
||||
int foo, r, g, b;
|
||||
|
||||
#define INC 16
|
||||
@ -121,19 +129,29 @@ for (r=0; r<255; r+=INC) {
|
||||
for (g=0; g<255; g+=INC) {
|
||||
for (b=0; b<255; b+=INC) {
|
||||
|
||||
printf("%4d %4d %4d ", r, g, b);
|
||||
printf("%4d %4d %4d ", r, g, b);
|
||||
|
||||
colors[0] = (float)r;
|
||||
colors[1] = (float)g;
|
||||
colors[2] = (float)b;
|
||||
foo = fimg_rgb2hsv(colors, values, 255.0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s: err %d in rgv->hsv\n", __func__, foo);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
printf(" %9.5f %9.5f %9.5f\n",
|
||||
printf(" %8.4f %8.4f %8.4f ",
|
||||
values[0], values[1], values[2]);
|
||||
|
||||
foo = fimg_hsv2rgb(values, newcols, 255.0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s: err %d in hsv->rgb\n", __func__, foo);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
printf(" %8.4f %8.4f %8.4f\n",
|
||||
newcols[0], newcols[1], newcols[2]);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user