clamp me hardly, say the pixel

This commit is contained in:
2020-02-29 20:01:11 +01:00
parent 3b7b4f234c
commit f451a8c8fe
2 changed files with 36 additions and 1 deletions

View File

@@ -144,6 +144,31 @@ for (idx=0; idx<nbre; idx++) {
if (fi->R[idx] < 0.0) count++;
}
return count;
}
/* ---------------------------------------------------------------- */
/* nouveau 29 fevrier 2020 */
int fimg_clamp_negativ(FloatImg *fi)
{
int nbre, idx;
int count;
if (fi->type != FIMG_TYPE_RGB) {
fprintf(stderr, "%s : type %d invalide\n",
__func__, fi->type);
return -1;
}
nbre = fi->width * fi->height * fi->type;
count = 0;
for (idx=0; idx<nbre; idx++) {
if (fi->R[idx] < 0.0) {
fi->R[idx] = 0.0;
count++;
}
}
return count;
}
/* ---------------------------------------------------------------- */