This commit is contained in:
Tonton Th 2020-07-02 16:55:45 +02:00
parent a81d218fc8
commit ed864ea45a
2 changed files with 29 additions and 3 deletions

View File

@ -14,7 +14,7 @@
int fimg_test_pattern(FloatImg *fimg, int type, double dval)
{
int nio;
int x, y;
int x, y, k;
float fr, fg, fb, val;
#if DEBUG_LEVEL
@ -46,6 +46,14 @@ for (x=0; x<fimg->width; x++) {
fimg_plot_rgb(fimg, x, y, fr, fg, fb);
}
k = fimg->height/4;
for (x=0; x<fimg->width; x++) {
val = ((double)x / (double)fimg->width) * dval;
for (y=0; y<20; y++) {
fimg_plot_rgb(fimg, x, k+y, val, val, val);
fimg_plot_rgb(fimg, x, k+y+20, 1-val, 1-val, 1-val);
}
}
return 0;

View File

@ -307,6 +307,20 @@ printf("%-10s %d\n\n", fname, foo);
return 0;
}
/* --------------------------------------------------------------------- */
int essai_mire(char *outname, int notused)
{
FloatImg fimg;
int re;
fimg_create(&fimg, 1280, 960, FIMG_TYPE_RGB);
re = fimg_test_pattern(&fimg, 9, 1.0);
fimg_save_as_pnm(&fimg, "mire.pnm", 0);
return -1;
}
/* --------------------------------------------------------------------- */
int essai_rampes(void)
{
FloatImg fimg;
@ -351,7 +365,7 @@ fprintf(stderr, "save as png -> %d\n", foo);
return 0;
}
/* --------------------------------------------------------------------- */
enum nCmd { Equalize=1, Rotate, Sfx0, F3x3 };
enum nCmd { Equalize=1, Rotate, Sfx0, F3x3, MIRE };
typedef struct {
char *name;
int Cmd;
@ -362,6 +376,7 @@ Command commands[] = {
{ "rotate", Rotate },
{ "sfx0", Sfx0 },
{ "f3x3", F3x3 },
{ "mire", MIRE },
{ NULL, 0 }
} ;
@ -383,7 +398,7 @@ void help(int k)
{
Command *pcmd;
fprintf(stderr, "usage:\n\t./t command in-filename\n");
fprintf(stderr, "usage:\n\t./t command filename\n");
fprintf(stderr, "commands:\n");
pcmd = commands;
@ -440,6 +455,9 @@ switch(opt) {
case F3x3:
foo = essai_filtrage_3x3(filename); break;
case MIRE:
foo = essai_mire(filename, 0);
break;
default:
fprintf(stderr, "%s : bad command\n", command);