#include <gear/images.h>
#include <stb/stb_image.h>

g_image* g_image_load(const char* filename) {
    const i32 desired_channels = 4;

    i32 width, height, channels;
    stbi_set_flip_vertically_on_load(true);

    u8* pixels = stbi_load(filename, &width, &height, &channels, desired_channels);
    if(pixels == NULL) {
        return g_image_default();
    } 

    return g_image_create(pixels, width, height);
}
