forked from tTh/FloatImg
add a new function
This commit is contained in:
parent
252d5c62e0
commit
4945bb1c53
@ -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…
Reference in New Issue
Block a user