libwebsockets
Lightweight C library for HTML5 websockets
Loading...
Searching...
No Matches
lws-gif.h
Go to the documentation of this file.
1/*
2 * lws gif
3 *
4 * Written in 2026 by Andy Green <andy@warmcat.com>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 * IN THE SOFTWARE.
23 *
24 * Stateful, linewise GIF decoder for the first frame. Compressed input is
25 * consumed from arbitrarily-sized chunks and complete raster rows are issued
26 * one at a time into a row buffer shared between every live gif object, so
27 * heap use does not scale with anything about the gif except its logical
28 * screen width (one row) and the fixed 12-bit LZW code tables.
29 *
30 * Rows are issued in logical screen coordinates as single bytes that index
31 * the active colour table: every screen row is issued exactly once, with
32 * areas the image rectangle does not cover filled with the background
33 * index, and parts of the image rectangle falling outside the logical
34 * screen clipped. For interlaced images, rows are issued in gif interlace
35 * order with their true y available at \p py, bookended by the background
36 * rows above and below the image rectangle; linearizing interlaced rows
37 * needs a whole framebuffer, so consumers that need strict top-down order
38 * must re-decode from retained input, as the dlo integration does.
39 *
40 * Only the first image is decoded; any further images are walked structurally
41 * to the trailer and their pixel data discarded.
42 */
43
44typedef struct lws_gif lws_gif_t;
45
54
65
77
115lws_gif_emit_next_line(lws_gif_t *gif, const uint8_t **ppix, int *py,
116 const uint8_t **buf, size_t *len, char hold_at_metadata);
117
126LWS_VISIBLE LWS_EXTERN unsigned int
128
136LWS_VISIBLE LWS_EXTERN unsigned int
138
150
162
171LWS_VISIBLE LWS_EXTERN unsigned int
173
185
186/* indices are one byte each; provided for symmetry with the other decoders */
187
188LWS_VISIBLE LWS_EXTERN unsigned int
190LWS_VISIBLE LWS_EXTERN unsigned int
192LWS_VISIBLE LWS_EXTERN unsigned int
194LWS_VISIBLE LWS_EXTERN unsigned int
#define LWS_EXTERN
unsigned char uint8_t
lws_stateful_ret_t
#define LWS_VISIBLE
LWS_VISIBLE LWS_EXTERN unsigned int lws_gif_get_bitdepth(const lws_gif_t *gif)
LWS_VISIBLE LWS_EXTERN unsigned int lws_gif_get_pixelsize(const lws_gif_t *gif)
LWS_VISIBLE LWS_EXTERN char lws_gif_get_interlaced(const lws_gif_t *gif)
LWS_VISIBLE LWS_EXTERN unsigned int lws_gif_get_components(const lws_gif_t *gif)
LWS_VISIBLE LWS_EXTERN const uint8_t * lws_gif_get_palette(const lws_gif_t *gif)
LWS_VISIBLE LWS_EXTERN unsigned int lws_gif_get_bpp(const lws_gif_t *gif)
LWS_VISIBLE LWS_EXTERN lws_gif_t * lws_gif_new(void)
struct lws_gif lws_gif_t
Definition lws-gif.h:44
LWS_VISIBLE LWS_EXTERN void lws_gif_free(lws_gif_t **gif)
LWS_VISIBLE LWS_EXTERN unsigned int lws_gif_get_height(const lws_gif_t *gif)
LWS_VISIBLE LWS_EXTERN unsigned int lws_gif_get_palette_count(const lws_gif_t *gif)
LWS_VISIBLE LWS_EXTERN unsigned int lws_gif_get_width(const lws_gif_t *gif)
LWS_VISIBLE LWS_EXTERN int lws_gif_get_transparent_index(const lws_gif_t *gif)
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_gif_emit_next_line(lws_gif_t *gif, const uint8_t **ppix, int *py, const uint8_t **buf, size_t *len, char hold_at_metadata)
LWS_VISIBLE LWS_EXTERN void lws_gif_restart(lws_gif_t *gif)