mk_gif_desc_initfunction
mk_gif_desc mk_gif_desc_init(void)Return the default GIF load descriptor.
Returns The resulting value.
#include <modkit/gif.h>14 functions · 2 structs · 1 enums · 4 typedefs · 2 macros
Optional animated GIF decoding and playback.
Animated GIF support is enabled with MODKIT_ENABLE_GIF. Disabled builds provide the same API as unsupported stubs. A GIF keeps its composited RGBA frames in CPU memory and updates one stable RGBA8 texture as it plays.
mk_gif_desc_initfunctionmk_gif_desc mk_gif_desc_init(void)Return the default GIF load descriptor.
Returns The resulting value.
mk_gif_destroyfunctionvoid mk_gif_destroy(mk_gif_t gif)Destroy the gif.
| Parameter | Type | Description |
|---|---|---|
gif | mk_gif_t | Value for gif. |
mk_gif_get_infofunctionbool mk_gif_get_info(mk_gif_t gif, mk_gif_info *info)Query playback and decoded-output information.
| Parameter | Type | Description |
|---|---|---|
gif | mk_gif_t | Value for gif. |
info | mk_gif_info * | Value for info. |
Returns True when the operation succeeds.
mk_gif_is_validfunctionbool mk_gif_is_valid(mk_gif_t gif)Test whether the gif is valid.
| Parameter | Type | Description |
|---|---|---|
gif | mk_gif_t | Value for gif. |
Returns True when the condition holds.
mk_gif_loadfunctionmk_gif_t mk_gif_load(const char *path, const mk_gif_desc *desc)Load and decode a GIF from a filesystem path.
| Parameter | Type | Description |
|---|---|---|
path | const char * | Value for path. |
desc | const mk_gif_desc * | Configuration descriptor. |
Returns The resulting handle or value.
mk_gif_load_memfunctionmk_gif_t mk_gif_load_mem(const void *data, size_t size, const mk_gif_desc *desc)Load and decode a GIF from encoded memory.
| Parameter | Type | Description |
|---|---|---|
data | const void * | Data buffer. |
size | size_t | Size in bytes. |
desc | const mk_gif_desc * | Configuration descriptor. |
Returns The resulting handle or value.
mk_gif_pausefunctionbool mk_gif_pause(mk_gif_t gif)Pause the gif.
| Parameter | Type | Description |
|---|---|---|
gif | mk_gif_t | Value for gif. |
Returns True when the operation succeeds.
mk_gif_playfunctionbool mk_gif_play(mk_gif_t gif)Play gif.
| Parameter | Type | Description |
|---|---|---|
gif | mk_gif_t | Value for gif. |
Returns True when the operation succeeds.
mk_gif_restartfunctionbool mk_gif_restart(mk_gif_t gif)Perform the gif restart operation.
| Parameter | Type | Description |
|---|---|---|
gif | mk_gif_t | Value for gif. |
Returns True when the operation succeeds.
mk_gif_seek_framefunctionbool mk_gif_seek_frame(mk_gif_t gif, uint32_t frame_index)Seek frame for the gif.
| Parameter | Type | Description |
|---|---|---|
gif | mk_gif_t | Value for gif. |
frame_index | uint32_t | Value for frame index. |
Returns True when the operation succeeds.
mk_gif_set_loop_modefunctionbool mk_gif_set_loop_mode(mk_gif_t gif, mk_gif_loop_mode_t mode)Set loop mode on the gif.
| Parameter | Type | Description |
|---|---|---|
gif | mk_gif_t | Value for gif. |
mode | mk_gif_loop_mode_t | Value for mode. |
Returns True when the operation succeeds.
mk_gif_set_speedfunctionbool mk_gif_set_speed(mk_gif_t gif, float speed)Set speed on the gif.
| Parameter | Type | Description |
|---|---|---|
gif | mk_gif_t | Value for gif. |
speed | float | Value for speed. |
Returns True when the operation succeeds.
mk_gif_texturefunctionmk_texture_t mk_gif_texture(mk_gif_t gif)Return the stable mutable texture used by this GIF.
| Parameter | Type | Description |
|---|---|---|
gif | mk_gif_t | Value for gif. |
Returns The resulting handle or value.
mk_gif_updatefunctionbool mk_gif_update(mk_gif_t gif, float delta_seconds)Advance playback by elapsed seconds.
Arbitrary positive deltas are supported; at most one texture upload is issued for the resolved frame.
| Parameter | Type | Description |
|---|---|---|
gif | mk_gif_t | Value for gif. |
delta_seconds | float | Value for delta seconds. |
Returns True when the operation succeeds.
mk_gif_descstructData for gif desc.
| Field | Type | Description |
|---|---|---|
max_decoded_bytes | uint64_t | Conservative limit for the final contiguous composited RGBA frame output. |
mk_gif_infostructData for gif info.
| Field | Type | Description |
|---|---|---|
logical_width | uint16_t | The logical width. |
logical_height | uint16_t | The logical height. |
frame_count | uint32_t | The frame count. |
current_frame | uint32_t | The current frame. |
effective_duration_seconds | double | The effective duration seconds. |
decoded_output_bytes | uint64_t | The decoded output bytes. |
source_repeat_count | int32_t | Source repeat metadata: -1 means no loop extension, 0 means infinite, and a positive value is the number of repeats after the first play. |
speed | float | The speed. |
loop_mode | mk_gif_loop_mode_t | The loop mode. |
playing | bool | The playing. |
mk_gif_loop_modeenumValues for gif loop mode.
| Value | Description |
|---|---|
MK_GIF_LOOP_SOURCE | Selects source. |
MK_GIF_LOOP_ONCE | Selects once. |
MK_GIF_LOOP_FOREVER | Selects forever. |
mk_gif_desctypedeftypedef struct mk_gif_desc mk_gif_descData for gif desc.
mk_gif_infotypedeftypedef struct mk_gif_info mk_gif_infoData for gif info.
mk_gif_loop_mode_ttypedeftypedef enum mk_gif_loop_mode mk_gif_loop_mode_tValues for gif loop mode.
mk_gif_ttypedeftypedef struct mk_gif* mk_gif_tType used for gif.
MK_GIF_DEFAULT_MAX_DECODED_BYTESdefineMK_GIF_DEFAULT_MAX_DECODED_BYTESMaximum supported gif default decoded bytes.
MK_GIF_INVALIDdefineMK_GIF_INVALIDInvalid sentinel for gif.