Added bitmap_fill

This commit is contained in:
Justin Ethier 2016-04-19 22:37:13 -04:00
parent da7baa0fbf
commit f0e45111e4
2 changed files with 13 additions and 0 deletions

View file

@ -96,6 +96,18 @@ int bitmap_set(RGBBitmap *img, int x, int y, int r, int g, int b)
return 0; return 0;
} }
void bitmap_fill(RGBBitmap *img, int r, int g, int b)
{
int x, y;
// TODO: could use pointers directly or even memcpy
// to make this faster
for (y = 0; y < img->height; y++) {
for (x = 0; x < img->height; x++) {
bitmap_set(img, x, y, r, g, b);
}
}
}
//int main() //int main()
//{ //{
// const char path[] = "test.png"; // const char path[] = "test.png";

View file

@ -32,5 +32,6 @@ typedef struct _RGBBitmap {
int bitmap_init(RGBBitmap *img, int width, int height); int bitmap_init(RGBBitmap *img, int width, int height);
int bitmap_set(RGBBitmap *img, int x, int y, int r, int g, int b); int bitmap_set(RGBBitmap *img, int x, int y, int r, int g, int b);
int bitmap_save_to_png(RGBBitmap *bitmap, const char *path); int bitmap_save_to_png(RGBBitmap *bitmap, const char *path);
void bitmap_fill(RGBBitmap *img, int r, int g, int b);
#endif /* WRITE_PNG_H */ #endif /* WRITE_PNG_H */