diff --git a/Makefile b/Makefile index 45e5a13..7ed4873 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ essai: essai.c libfloatimg.a floatimg.h Makefile TOTAR = *.[ch] Makefile *.sh *.md \ doc/the*.tex doc/mk*.sh doc/*.txt \ funcs/*.[ch] funcs/Makefile \ - tools/*.[ch] tools/READEME.md tools/Makefile \ + tools/*.[ch] tools/README.md tools/Makefile \ v4l2/*.[ch] v4l2/Makefile \ scripts/*.sh scripts/README.md \ lib/*.[ch] lib/Makefile diff --git a/floatimg.h b/floatimg.h index f2e0c3a..3fd36b6 100644 --- a/floatimg.h +++ b/floatimg.h @@ -62,6 +62,7 @@ int fimg_describe(FloatImg *head, char *txt); char *fimg_str_type(int type); int fimg_plot_rgb (FloatImg *head, int x, int y, float r, float g, float b); int fimg_get_rgb(FloatImg *head, int x, int y, float *rgb); +int fimg_put_rgb(FloatImg *head, int x, int y, float *rgb); int fimg_clear(FloatImg *fimg); int fimg_add_rgb(FloatImg *head, int x, int y, float r, float g, float b); int fimg_rgb_constant(FloatImg *head, float r, float g, float b); diff --git a/funcs/rotate.c b/funcs/rotate.c index fd47b6b..ec190b8 100644 --- a/funcs/rotate.c +++ b/funcs/rotate.c @@ -31,7 +31,9 @@ if (src->type != FIMG_TYPE_RGB) { /* check if dst pic is not allocated */ if ( 0 == (dst->type | dst->width | dst->height) ) { +#if DEBUG_LEVEL fprintf(stderr, "in %s, %p is empty\n", __func__, dst); +#endif /* OK allocate a new fpic */ foo = fimg_create(dst, src->height, src->width, src->type); if (foo) { @@ -54,7 +56,7 @@ if ( (src->type != dst->type) || for (y=0; yheight; y++) { for (x=0; xwidth; x++) { fimg_get_rgb(src, x, y, rgb); - fimg_plot_rgb(dst, y, x, rgb[0], rgb[1], rgb[2]); + fimg_put_rgb(dst, y, x, rgb); } } diff --git a/lib/fimg-core.c b/lib/fimg-core.c index 6a51bbc..3896ced 100644 --- a/lib/fimg-core.c +++ b/lib/fimg-core.c @@ -314,3 +314,24 @@ prgb[2] = head->B[offset]; return 0; } /* --------------------------------------------------------------------- */ +/* nouveau 24 mars 2020 - coronacoding */ +int fimg_put_rgb(FloatImg *head, int x, int y, float *prgb) +{ +int offset; + +if (head->type != FIMG_TYPE_RGB) { +#if DEBUG_LEVEL > 1 + fprintf(stderr, "%s : type %d is bad.\n", __func__, head->type); +#endif + return -1; + } + +offset = x + (y * head->width); +head->R[offset] = prgb[0]; +head->G[offset] = prgb[1]; +head->B[offset] = prgb[2]; + +return 0; +} +/* --------------------------------------------------------------------- */ +