The manual
ginnOS
The reference: libc, the libraries and the kernel
Toggle main menu visibility
Loading...
Searching...
No Matches
image.h
Go to the documentation of this file.
1
#pragma once
2
3
/**
4
* @file image.h
5
* @brief load PNG, JPEG and BMP files into libgfx buffers.
6
*
7
* the decoder is stb_image (public domain, src/lib/stb). the result is a
8
* gfx_buffer_t of premultiplied ARGB; an image without alpha is opaque.
9
*/
10
11
#include <
gfx.h
>
12
13
// images larger than this on either side are refused
14
#define IMAGE_MAX_SIDE 8192
15
16
/**
17
* load an image file.
18
* @param error receives a short reason on failure (may be NULL).
19
* @return a new buffer (free it with gfx_buffer_free), or NULL.
20
*/
21
gfx_buffer_t
*
image_load
(
const
char
*path,
const
char
**
error
);
22
23
/**
24
* decode an image from memory.
25
*/
26
gfx_buffer_t
*
image_decode
(
const
uint8_t
*data,
size_t
size,
const
char
**
error
);
27
28
/**
29
* decompress zlib data (RFC 1950) into a buffer of known size.
30
* @return the bytes written, or -1 (bad data, or out does not hold it).
31
*/
32
int32_t
image_inflate
(
const
uint8_t
*in,
size_t
in_size,
uint8_t
*out,
size_t
out_size);
gfx.h
libgfx: drawing into pixel buffers in memory.
image_inflate
int32_t image_inflate(const uint8_t *in, size_t in_size, uint8_t *out, size_t out_size)
decompress zlib data (RFC 1950) into a buffer of known size.
Definition
image.c:122
image_decode
gfx_buffer_t * image_decode(const uint8_t *data, size_t size, const char **error)
decode an image from memory.
Definition
image.c:46
image_load
gfx_buffer_t * image_load(const char *path, const char **error)
load an image file.
Definition
image.c:81
error
uint32_t error
Definition
isr.h:3
uint8_t
unsigned char uint8_t
Definition
fb.h:18
int32_t
int int32_t
Definition
stdint.h:14
gfx_buffer_t
Definition
gfx.h:41
src
lib
image
include
image.h
Generated by
1.18.0