added a (slow) function
This commit is contained in:
parent
7b0384a3b7
commit
d09291bd4e
28
Lib/image.c
28
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; y<img->height; y++) {
|
||||
for (x=0; x<img->width; 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.
|
||||
|
Loading…
Reference in New Issue
Block a user