enhanced mkfimg: do_stripe take a maxlevel parameter

This commit is contained in:
tTh 2023-10-08 07:10:02 +02:00
parent 1f1398f9f2
commit 9e9535221f
3 changed files with 20 additions and 15 deletions

View File

@ -20,7 +20,7 @@
* https://git.tetalab.org/tTh/FloatImg
*/
#define FIMG_VERSION (227)
#define FIMG_VERSION (229)
#define RELEASE_NAME ("noname")
#define PATCH_LEVEL ("aaaa")
@ -269,7 +269,7 @@ int fimg_displacement_0(FloatImg *psrc, FloatImg *pdst, int flags);
/* module funcs/rampes.c */
int fimg_hdeg_a(FloatImg *img, double dcoef);
int fimg_vdeg_a(FloatImg *img, double dcoef);
int fimg_do_stripes(FloatImg *img, int mode);
int fimg_do_stripes(FloatImg *img, float fmax, int mode);
/* FIMG native file module */
int fimg_fileinfos(char *fname, int *datas);

View File

@ -62,15 +62,18 @@ for (x=0; x<img->width; x++) {
return 0;
}
/* --------------------------------------------------------------------- */
/* nouveau 19 septembre 2022 */
/* nouveau 19 septembre 2022
*
* 6 octobre 2023 : rajout du parametre 'fmax'
*/
int fimg_do_stripes(FloatImg *img, int mode)
int fimg_do_stripes(FloatImg *img, float fmax, int mode)
{
int x, y, quad;
float *ligne;
float fr, fg, fb;
fprintf(stderr, ">>> %s ( %p %d )\n", __func__, img, mode);
fprintf(stderr, ">>> %s ( %p %f %d )\n", __func__, img, fmax, mode);
/*
* allocate and fill a lookup table
@ -79,8 +82,10 @@ if (NULL==(ligne=malloc(img->width*sizeof(float)))) {
fprintf(stderr, "%s: malloc fail\n", __func__);
exit(1);
}
for (x=0; x<img->width; x++)
for (x=0; x<img->width; x++) {
ligne[x] = (float)x / (float)img->width;
ligne[x] *= fmax;
}
/*
* build the pixels

View File

@ -174,16 +174,16 @@ if (foo) {
switch(type) {
default:
case T_BLACK: fimg_clear(&fimg); break;
case T_DRAND48: fimg_drand48(&fimg, fvalue); break;
case T_BLACK: fimg_clear(&fimg); break;
case T_DRAND48: fimg_drand48(&fimg, fvalue); break;
case T_GRAY: fimg_rgb_constant(&fimg, fvalue, fvalue, fvalue);
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;
case T_MIRCOL1: fimg_mircol_1(&fimg, fvalue); break;
case T_BLOUP: fimg_draw_something(&fimg); break;
case T_STRIPES: fimg_do_stripes(&fimg, 0); break;
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;
case T_MIRCOL1: fimg_mircol_1(&fimg, fvalue); break;
case T_BLOUP: fimg_draw_something(&fimg); break;
case T_STRIPES: fimg_do_stripes(&fimg, fvalue, 0); break;
case -1: exit(1);
}