Browse Source

add a new function

master
tth 3 years ago
parent
commit
4945bb1c53
  1. 22
      lib/fimg-core.c

22
lib/fimg-core.c

@ -164,6 +164,28 @@ if ( ! fimg_type_is_valid(fimg->type) ) { @@ -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;
}
/* --------------------------------------------------------------------- */

Loading…
Cancel
Save