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_ex
Image file structure
-
typedef gs_texture_t *gs_image_file_ex.texture
Texture
-
typedef struct gs_image_file_ex gs_image_file_ex_t
Image file type
-
void gs_image_file_ex_init(gs_image_file_ex_t *image, const char *file, enum gs_image_alpha_mode alpha_mode)
Loads an initializes an image file helper. Does not initialize the texture; call
gs_image_file_ex_init_texture()to initialize the texture.- Parameters:
image – Image file helper to initialize
file – Path to the image file to load
-
void gs_image_file_ex_free(gs_image_file_ex_t *image)
Frees an image file helper
- Parameters:
image – Image file helper
-
void gs_image_file_ex_init_texture(gs_image_file_ex_t *image)
Initializes the texture of an image file helper. This is separate from
gs_image_file_ex_init()because it allows deferring the graphics initialization if needed.- Parameters:
image – Image file helper
-
bool gs_image_file_ex_tick(gs_image_file_ex_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_ex_update_texture()is called.- Parameters:
image – Image file helper
elapsed_time_ns – Elapsed time in nanoseconds
-
void gs_image_file_ex_update_texture(gs_image_file_ex_t *image)
Updates the texture (used primarily for animated files)
- Parameters:
image – Image file helper