Home

Struct lib2d_image

References a bitmap that can be rendered by a lib2d_drawable.

Methods

int lib2d_image_load(const char* path, lib2d_image* image, lib2d_image_info* info)

Load a bitmap image from the filesystem. Returns 0 on success.

Examples

lib2d_image_info info;
lib2d_image im;
if (lib2d_image_load("bitmap.png", &im, &info) != 0) {
    fprintf(stderr, "%s\n", lib2d_get_error());
}
lib2d_drawable d = {.w=info.w, .h=info.h, .image=im, .color=0xffffffff};

void lib2d_image_delete(lib2d_image image)

Deletes resources associated with an image. Do not use an image after it's been deleted.