Image File Helper

Helper functions/type for easily loading/managing image files, including animated gif files.

#include <graphics/image-file.h>
struct gs_image_file

Image file structure

typedef gs_texture_t *gs_image_file.texture


typedef struct gs_image_file gs_image_file_t

Image file type

void gs_image_file_init(gs_image_file_t *image, const char *file)

Loads an initializes an image file helper. Does not initialize the texture; call gs_image_file_init_texture() to initialize the texture.

  • image – Image file helper to initialize

  • file – Path to the image file to load

void gs_image_file_free(gs_image_file_t *image)

Frees an image file helper

  • image – Image file helper

void gs_image_file_init_texture(gs_image_file_t *image)

Initializes the texture of an image file helper. This is separate from gs_image_file_init() because it allows deferring the graphics initialization if needed.

  • image – Image file helper

bool gs_image_file_tick(gs_image_file_t *image, uint64_t elapsed_time_ns)

Performs a tick operation on the image file helper (used primarily for animated file). Does not update the texture until gs_image_file_update_texture() is called.

  • image – Image file helper

  • elapsed_time_ns – Elapsed time in nanoseconds

void gs_image_file_update_texture(gs_image_file_t *image)

Updates the texture (used primarily for animated files)

  • image – Image file helper