libwebsockets
Lightweight C library for HTML5 websockets
Toggle main menu visibility
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
44
typedef
struct
lws_gif
lws_gif_t
;
45
52
LWS_VISIBLE
LWS_EXTERN
lws_gif_t
*
53
lws_gif_new
(
void
);
54
63
LWS_VISIBLE
LWS_EXTERN
void
64
lws_gif_free
(
lws_gif_t
**gif);
65
75
LWS_VISIBLE
LWS_EXTERN
void
76
lws_gif_restart
(
lws_gif_t
*gif);
77
114
LWS_VISIBLE
LWS_EXTERN
lws_stateful_ret_t
115
lws_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
126
LWS_VISIBLE
LWS_EXTERN
unsigned
int
127
lws_gif_get_width
(
const
lws_gif_t
*gif);
128
136
LWS_VISIBLE
LWS_EXTERN
unsigned
int
137
lws_gif_get_height
(
const
lws_gif_t
*gif);
138
148
LWS_VISIBLE
LWS_EXTERN
char
149
lws_gif_get_interlaced
(
const
lws_gif_t
*gif);
150
160
LWS_VISIBLE
LWS_EXTERN
const
uint8_t
*
161
lws_gif_get_palette
(
const
lws_gif_t
*gif);
162
171
LWS_VISIBLE
LWS_EXTERN
unsigned
int
172
lws_gif_get_palette_count
(
const
lws_gif_t
*gif);
173
183
LWS_VISIBLE
LWS_EXTERN
int
184
lws_gif_get_transparent_index
(
const
lws_gif_t
*gif);
185
186
/* indices are one byte each; provided for symmetry with the other decoders */
187
188
LWS_VISIBLE
LWS_EXTERN
unsigned
int
189
lws_gif_get_bpp
(
const
lws_gif_t
*gif);
190
LWS_VISIBLE
LWS_EXTERN
unsigned
int
191
lws_gif_get_bitdepth
(
const
lws_gif_t
*gif);
192
LWS_VISIBLE
LWS_EXTERN
unsigned
int
193
lws_gif_get_components
(
const
lws_gif_t
*gif);
194
LWS_VISIBLE
LWS_EXTERN
unsigned
int
195
lws_gif_get_pixelsize
(
const
lws_gif_t
*gif);
LWS_EXTERN
#define LWS_EXTERN
Definition
libwebsockets.h:327
uint8_t
unsigned char uint8_t
Definition
libwebsockets.h:746
lws_stateful_ret_t
lws_stateful_ret_t
Definition
libwebsockets.h:802
LWS_VISIBLE
#define LWS_VISIBLE
Definition
libwebsockets.h:322
lws_gif_get_bitdepth
LWS_VISIBLE LWS_EXTERN unsigned int lws_gif_get_bitdepth(const lws_gif_t *gif)
lws_gif_get_pixelsize
LWS_VISIBLE LWS_EXTERN unsigned int lws_gif_get_pixelsize(const lws_gif_t *gif)
lws_gif_get_interlaced
LWS_VISIBLE LWS_EXTERN char lws_gif_get_interlaced(const lws_gif_t *gif)
lws_gif_get_components
LWS_VISIBLE LWS_EXTERN unsigned int lws_gif_get_components(const lws_gif_t *gif)
lws_gif_get_palette
LWS_VISIBLE LWS_EXTERN const uint8_t * lws_gif_get_palette(const lws_gif_t *gif)
lws_gif_get_bpp
LWS_VISIBLE LWS_EXTERN unsigned int lws_gif_get_bpp(const lws_gif_t *gif)
lws_gif_new
LWS_VISIBLE LWS_EXTERN lws_gif_t * lws_gif_new(void)
lws_gif_t
struct lws_gif lws_gif_t
Definition
lws-gif.h:44
lws_gif_free
LWS_VISIBLE LWS_EXTERN void lws_gif_free(lws_gif_t **gif)
lws_gif_get_height
LWS_VISIBLE LWS_EXTERN unsigned int lws_gif_get_height(const lws_gif_t *gif)
lws_gif_get_palette_count
LWS_VISIBLE LWS_EXTERN unsigned int lws_gif_get_palette_count(const lws_gif_t *gif)
lws_gif_get_width
LWS_VISIBLE LWS_EXTERN unsigned int lws_gif_get_width(const lws_gif_t *gif)
lws_gif_get_transparent_index
LWS_VISIBLE LWS_EXTERN int lws_gif_get_transparent_index(const lws_gif_t *gif)
lws_gif_emit_next_line
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_gif_restart
LWS_VISIBLE LWS_EXTERN void lws_gif_restart(lws_gif_t *gif)
include
libwebsockets
lws-gif.h
Generated on
for libwebsockets by
1.18.0