mkfimg got tpat0

This commit is contained in:
Tonton Th 2020-02-29 21:34:29 +01:00
parent e1938dfaeb
commit f9467dacee
2 changed files with 15 additions and 26 deletions

View File

@ -15,7 +15,7 @@ int fimg_test_pattern(FloatImg *fimg, int type, double dval)
{
int nio;
int x, y;
float fr, fg, fb;
float fr, fg, fb, val;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %d %g )\n", __func__, fimg, type, dval);
@ -27,39 +27,26 @@ if (fimg->type != FIMG_TYPE_RGB) {
}
/* rampe de primaires dans le quart du haut */
val = (float)dval;
for (x=0; x<fimg->width; x++) {
nio = x / (fimg->width / 8);
switch(nio) {
case 0:
fr = 0.0, fg = 0.0, fb = 0.0; break;
case 1:
fr = 1.0, fg = 0.0, fb = 0.0; break;
case 2:
fr = 0.0, fg = 1.0, fb = 0.0; break;
case 3:
fr = 1.0, fg = 1.0, fb = 0.0; break;
case 4:
fr = 0.0, fg = 0.0, fb = 1.0; break;
case 5:
fr = 1.0, fg = 0.0, fb = 1.0; break;
case 6:
fr = 0.0, fg = 1.0, fb = 1.0; break;
case 7:
fr = 1.0, fg = 1.0, fb = 1.0; break;
case 0: fr = 0.0, fg = 0.0, fb = 0.0; break;
case 1: fr = val, fg = 0.0, fb = 0.0; break;
case 2: fr = 0.0, fg = val, fb = 0.0; break;
case 3: fr = val, fg = val, fb = 0.0; break;
case 4: fr = 0.0, fg = 0.0, fb = val; break;
case 5: fr = val, fg = 0.0, fb = val; break;
case 6: fr = 0.0, fg = val, fb = val; break;
case 7: fr = val, fg = val, fb = val; break;
default:
// abort();
break;
abort(); break;
}
for (y=0; y<fimg->height/4; y++)
fimg_plot_rgb(fimg, x, y, fr, fg, fb);
}
return -1;
return 0;
}
/* --------------------------------------------------------------------- */
int fimg_draw_something(FloatImg *fimg)

View File

@ -14,6 +14,7 @@ int verbosity;
#define T_GRAY 3
#define T_HDEG_A 4
#define T_VDEG_A 5
#define T_TPAT0 6
typedef struct {
int code;
@ -27,7 +28,7 @@ Type types[] = {
{ T_GRAY, "grey" },
{ T_HDEG_A, "hdeg" },
{ T_VDEG_A, "vdeg" },
{ T_TPAT0, "tpat0" },
{ 0, NULL }
};
@ -128,6 +129,7 @@ switch(type) {
break;
case T_HDEG_A: fimg_hdeg_a(&fimg, 1.0); break;
case T_VDEG_A: fimg_vdeg_a(&fimg, 1.0); break;
case T_TPAT0: fimg_test_pattern(&fimg, 0, fvalue); break;
}
foo = fimg_dump_to_file(&fimg, fname, 0);