added "abs" func to fimgfx

This commit is contained in:
tth
2021-11-02 16:01:11 +01:00
parent 2a1d74a83f
commit 8c514ffe99
3 changed files with 26 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
/*
* fimg-core.c
* fimg-math.c
*
*
*/
@@ -295,6 +295,22 @@ fimg_mul_cste(fi, coef);
return 0;
}
/* ---------------------------------------------------------------- */
int fimg_absolute(FloatImg *fi)
{
int surface, idx;
surface = fi->width * fi->height;
for (idx=0; idx<surface; idx++) {
fi->R[idx] = fabsf(fi->R[idx]);
fi->G[idx] = fabsf(fi->G[idx]);
fi->B[idx] = fabsf(fi->B[idx]);
}
return 0;
}
/* ---------------------------------------------------------------- */
/* Warning: this function is _very_ slow */
void fimg_drand48(FloatImg *fi, float kmul)
{