1
0
Fork 0
tsgames/build/assets/lib/image_data.c

21 lines
447 B
C

#include <stdlib.h>
#include <image_data.h>
image_data_t create_image(uint16_t width, uint16_t height) {
image_data_t data;
data.width = width;
data.height = height;
size_t length = width * height * sizeof(image_pixel_t);
data.pixels = (image_pixel_t*)malloc(length);
memset(data.pixels, 255, length);
return data;
}
void free_image(image_data_t image) {
if (image.pixels) {
free(image.pixels);
}
}