adding the copy_data funcs
This commit is contained in:
@@ -76,7 +76,7 @@ return 0;
|
||||
}
|
||||
/* ---------------------------------------------------------------- */
|
||||
/*
|
||||
*
|
||||
* values for the parameter 't' are defined in 'floatimg.h'
|
||||
*/
|
||||
int fimg_create(FloatImg *fimg, int w, int h, int t)
|
||||
{
|
||||
@@ -142,7 +142,7 @@ if ( ! fimg_type_is_valid(fimg->type) ) {
|
||||
return -2;
|
||||
}
|
||||
if (NULL == fimg->R) {
|
||||
fprintf(stderr, "%s : %p already freed\n", __func__, fimg);
|
||||
fprintf(stderr, "%s : %p already freed ?\n", __func__, fimg);
|
||||
return -3;
|
||||
}
|
||||
free(fimg->R);
|
||||
@@ -177,6 +177,27 @@ if (flags & 0x01) {
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
int fimg_copy_data(FloatImg *from, FloatImg *to)
|
||||
{
|
||||
int size;
|
||||
int foo;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %-25s ( %p %p )\n", __func__, from, to);
|
||||
#endif
|
||||
|
||||
foo = fimg_images_compatible(from, to);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s: pics not compatible (%d)\n", __func__, foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
size = from->width * from->height * from->type * sizeof(float);
|
||||
memcpy(to->R, from->R, size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
@@ -202,8 +223,10 @@ int fimg_rgb_constant(FloatImg *head, float r, float g, float b)
|
||||
{
|
||||
int idx, size;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %-25s ( %p %f %f %f )\n", __func__, head,
|
||||
r, g, b);
|
||||
#endif
|
||||
|
||||
if (head->type != FIMG_TYPE_RGB) {
|
||||
return -21;
|
||||
|
||||
Reference in New Issue
Block a user