diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2022-02-26 16:24:33 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2022-02-26 17:39:49 +0000 |
commit | 7ee51c0f6025238640cfa55faa36cd73e12489c7 (patch) | |
tree | 36c69272b8afd5df95371d896b9563c9d062e02d /README.md | |
parent | a0025eda79e5f6b7f0ae23e7a85fd947dc847726 (diff) | |
download | libnsgif-7ee51c0f6025238640cfa55faa36cd73e12489c7.tar.gz libnsgif-7ee51c0f6025238640cfa55faa36cd73e12489c7.tar.bz2 |
Docs: Rename readme to have markdown extension.
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..498ee46 --- /dev/null +++ b/README.md @@ -0,0 +1,36 @@ +libnsgif - Decoding GIF files +============================= + +The functions provided by this library allow for efficient progressive +GIF decoding. Whilst the initialisation does not ensure that there is +sufficient image data to complete the entire frame, it does ensure +that the information provided is valid. Any subsequent attempts to +decode an initialised GIF are guaranteed to succeed, and any bytes of +the image not present are assumed to be totally transparent. + +To begin decoding a GIF, the 'gif' structure must be initialised with +the 'gif_data' and 'buffer_size' set to their initial values. The +'buffer_position' should initially be 0, and will be internally +updated as the decoding commences. The caller should then repeatedly +call gif_initialise() with the structure until the function returns 1, +or no more data is avaliable. + +Once the initialisation has begun, the decoder completes the variables +'frame_count' and 'frame_count_partial'. The former being the total +number of frames that have been successfully initialised, and the +latter being the number of frames that a partial amount of data is +available for. This assists the caller in managing the animation +whilst decoding is continuing. + +To decode a frame, the caller must use gif_decode_frame() which +updates the current 'frame_image' to reflect the desired frame. The +required 'disposal_method' is also updated to reflect how the frame +should be plotted. The caller must not assume that the current +'frame_image' will be valid between calls if initialisation is still +occuring, and should either always request that the frame is decoded +(no processing will occur if the 'decoded_frame' has not been +invalidated by initialisation) or perform the check itself. + +It should be noted that gif_finalise() should always be called, even +if no frames were initialised. Additionally, it is the responsibility +of the caller to free 'gif_data'. |