better support of gray level

This commit is contained in:
2019-08-26 02:35:17 +02:00
parent 20d122890b
commit fe0f90af64
3 changed files with 82 additions and 30 deletions

View File

@@ -13,7 +13,7 @@ extern int verbosity; /* must be declared around main() */
/* --------------------------------------------------------------------- */
/*
* floating img MUST be allocated.
* floating imgs MUST be allocated before calling this func.
*/
int fimg_mk_gray_from(FloatImg *src, FloatImg*dst, int k)
{
@@ -40,14 +40,13 @@ if (FIMG_TYPE_GRAY != dst->type) {
nbb = src->width * src->height;
for (foo=0; foo<nbb; foo++) {
dst->R[foo] = ( (src->R[foo] * kr) +
(src->G[foo] * kg) +
(src->B[foo] * kb) ) /
kdiv;
}
return -1;
return 0;
}
/* --------------------------------------------------------------------- */