Compare commits

..

2 Commits

Author SHA1 Message Date
tth
2b62730f47 Merge branch 'master' of ssh://tetalab.org/tTh/FloatImg
krkrkr
2020-06-22 17:04:32 +02:00
tth
81c1d98ffc a new useless sfx 2020-06-22 12:15:01 +02:00
2 changed files with 31 additions and 0 deletions

View File

@ -98,6 +98,7 @@ int fimg_filter_3x3(FloatImg *s, FloatImg *d, FimgFilter3x3 *filtr);
/* 'sfx0' module */ /* 'sfx0' module */
int fimg_killcolors_a(FloatImg *fimg, float fval); int fimg_killcolors_a(FloatImg *fimg, float fval);
int fimg_killcolors_b(FloatImg *fimg, float fval); int fimg_killcolors_b(FloatImg *fimg, float fval);
int fimg_colors_mixer_a(FloatImg *fimg, float fval);
/* funcs/rotate.c module */ /* funcs/rotate.c module */
/* #coronamaison */ /* #coronamaison */

View File

@ -54,3 +54,33 @@ for (foo=0; foo<nbpix; foo++) {
return 0; return 0;
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
int fimg_colors_mixer_a(FloatImg *fimg, float fval)
{
int nbpix, foo;
float R, G, B;
if (FIMG_TYPE_RGB != fimg->type) {
fprintf(stderr, "%s: bad src type %d on %p\n", __func__,
fimg->type, fimg);
#if MUST_ABORT
abort();
#endif
return -8;
}
nbpix = fimg->width * fimg->height;
for (foo=0; foo<nbpix; foo++) {
R = (fimg->G[foo] + fimg->B[foo]) / fval;
G = (fimg->R[foo] + fimg->B[foo]) / fval;
B = (fimg->R[foo] + fimg->G[foo]) / fval;
fimg->R[foo] = R;
fimg->G[foo] = G;
fimg->B[foo] = B;
}
return 0;
}
/* --------------------------------------------------------------------- */