From d09291bd4e52282fccceb1f657dd255194cf91ce Mon Sep 17 00:00:00 2001 From: tTh Date: Mon, 25 Sep 2023 13:28:13 +0200 Subject: [PATCH] added a (slow) function --- Lib/image.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Lib/image.c b/Lib/image.c index 9e68584..6017ee4 100644 --- a/Lib/image.c +++ b/Lib/image.c @@ -289,6 +289,34 @@ fprintf(stderr, "%s : invalid image type %d : %s\n", __func__, return IMAGE_BAD_TYPE; } /*::------------------------------------------------------------------::*/ +/* new: Sat Sep 23 19:07:03 UTC 2023 + * + */ +int Image_set_rgb(Image_Desc *img, RGBA *rgba) +{ +int x, y; + +#if DEBUG_LEVEL +fprintf(stderr, ">>> %s ( %p %p ) %d %d %d\n", __func__, img, + rgba, rgba->r, rgba->g, rgba->b); +#endif + +if (IMAGE_RGB != img->type) { + fprintf(stderr, "%s : invalid image type %d : %s\n", __func__, + img->type, Image_type2str(img->type)); + return IMAGE_BAD_TYPE; + } + +for (y=0; yheight; y++) { + for (x=0; xwidth; x++) { + (img->Rpix[y])[x] = rgba->r; + (img->Gpix[y])[x] = rgba->g; + (img->Bpix[y])[x] = rgba->b; + } + } +return FUNC_IS_BETA; +} +/*::------------------------------------------------------------------::*/ /* * every image in memory have a comment field, who is writen * in TGA and PNM file when image is saved.