add a new function

This commit is contained in:
tth 2019-09-28 23:54:14 +02:00
parent 252d5c62e0
commit 4945bb1c53
1 changed files with 22 additions and 0 deletions

View File

@ -164,6 +164,28 @@ if ( ! fimg_type_is_valid(fimg->type) ) {
size = fimg->width * fimg->height * fimg->type * sizeof(float);
memset(fimg->R, 0, size);
return 0;
}
/* --------------------------------------------------------------------- */
int fimg_rgb_constant(FloatImg *head, float r, float g, float b)
{
int idx, size;
fprintf(stderr, ">>> %-25s ( %p %f %f %f )\n", __func__, head,
r, g, b);
if (head->type != FIMG_TYPE_RGB) {
return -21;
}
size = head->width * head->height;
for (idx=0; idx<size; idx++) {
head->R[idx] = r;
head->G[idx] = g;
head->B[idx] = b;
}
return 0;
}
/* --------------------------------------------------------------------- */