libwebsockets
Lightweight C library for HTML5 websockets
lws-upng.h
Go to the documentation of this file.
1 /*
2  * uPNG -- derived from LodePNG version 20100808
3  *
4  * Copyright (c) 2005-2010 Lode Vandevenne
5  * Copyright (c) 2010 Sean Middleditch
6  * Copyright (c) 2021-2022 Andy Green <andy@warmcat.com>
7  *
8  * This software is provided 'as-is', without any express or implied
9  * warranty. In no event will the authors be held liable for any damages
10  * arising from the use of this software.
11 
12  * Permission is granted to anyone to use this software for any purpose,
13  * including commercial applications, and to alter it and redistribute it
14  * freely, subject to the following restrictions:
15  *
16  * 1. The origin of this software must not be misrepresented; you must not
17  * claim that you wrote the original software. If you use this software
18  * in a product, an acknowledgment in the product documentation would be
19  * appreciated but is not required.
20  *
21  * 2. Altered source versions must be plainly marked as such, and must not be
22  * misrepresented as being the original software.
23  *
24  * 3. This notice may not be removed or altered from any source
25  * distribution.
26  *
27  * The above notice is the ZLIB license, libpng also uses it.
28  *
29  * This version is based on upng project's fork of lodepng and rewritten for
30  * lws, changing the whole approach to decode on demand to issue a line of
31  * output at a time, statefully.
32  */
33 
34 typedef enum lws_upng_format_t {
49 
50 struct inflator_ctx;
51 typedef struct lws_upng_t lws_upng_t;
52 
61 
71 
102  const uint8_t **buf, size_t *size,
103  char hold_at_metadata);
104 
105 LWS_VISIBLE LWS_EXTERN unsigned int
107 LWS_VISIBLE LWS_EXTERN unsigned int
109 LWS_VISIBLE LWS_EXTERN unsigned int
111 LWS_VISIBLE LWS_EXTERN unsigned int
113 LWS_VISIBLE LWS_EXTERN unsigned int
115 LWS_VISIBLE LWS_EXTERN unsigned int
119 
130 LWS_VISIBLE LWS_EXTERN struct inflator_ctx *
131 lws_upng_inflator_create(const uint8_t **outring, size_t *outringlen,
132  size_t **opl, size_t **cl);
133 
150 lws_upng_inflate_data(struct inflator_ctx *inf, const void *buf, size_t len);
151 
160 lws_upng_inflator_destroy(struct inflator_ctx **inf);
#define LWS_EXTERN
unsigned char uint8_t
lws_stateful_ret_t
#define LWS_VISIBLE
LWS_VISIBLE LWS_EXTERN struct inflator_ctx * lws_upng_inflator_create(const uint8_t **outring, size_t *outringlen, size_t **opl, size_t **cl)
LWS_VISIBLE LWS_EXTERN lws_upng_format_t lws_upng_get_format(const lws_upng_t *upng)
LWS_VISIBLE LWS_EXTERN unsigned int lws_upng_get_width(const lws_upng_t *upng)
LWS_VISIBLE LWS_EXTERN unsigned int lws_upng_get_height(const lws_upng_t *upng)
LWS_VISIBLE LWS_EXTERN unsigned int lws_upng_get_pixelsize(const lws_upng_t *upng)
LWS_VISIBLE LWS_EXTERN unsigned int lws_upng_get_bitdepth(const lws_upng_t *upng)
lws_upng_format_t
Definition: lws-upng.h:34
@ LWS_UPNG_LUMINANCE8
Definition: lws-upng.h:43
@ LWS_UPNG_RGBA16
Definition: lws-upng.h:39
@ LWS_UPNG_RGBA8
Definition: lws-upng.h:38
@ LWS_UPNG_LUMINANCE2
Definition: lws-upng.h:41
@ LWS_UPNG_RGB16
Definition: lws-upng.h:37
@ LWS_UPNG_LUMINANCE4
Definition: lws-upng.h:42
@ LWS_UPNG_LUMINANCE_ALPHA8
Definition: lws-upng.h:47
@ LWS_UPNG_LUMINANCE_ALPHA4
Definition: lws-upng.h:46
@ LWS_UPNG_RGB8
Definition: lws-upng.h:36
@ LWS_UPNG_LUMINANCE1
Definition: lws-upng.h:40
@ LWS_UPNG_BADFORMAT
Definition: lws-upng.h:35
@ LWS_UPNG_LUMINANCE_ALPHA1
Definition: lws-upng.h:44
@ LWS_UPNG_LUMINANCE_ALPHA2
Definition: lws-upng.h:45
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_upng_emit_next_line(lws_upng_t *upng, const uint8_t **ppix, const uint8_t **buf, size_t *size, char hold_at_metadata)
struct lws_upng_t lws_upng_t
Definition: lws-upng.h:51
LWS_VISIBLE LWS_EXTERN lws_upng_t * lws_upng_new(void)
LWS_VISIBLE LWS_EXTERN void lws_upng_inflator_destroy(struct inflator_ctx **inf)
LWS_VISIBLE LWS_EXTERN unsigned int lws_upng_get_components(const lws_upng_t *upng)
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_upng_inflate_data(struct inflator_ctx *inf, const void *buf, size_t len)
LWS_VISIBLE LWS_EXTERN unsigned int lws_upng_get_bpp(const lws_upng_t *upng)
LWS_VISIBLE LWS_EXTERN void lws_upng_free(lws_upng_t **upng)