|
ginnOS
The reference: libc, the libraries and the kernel
|
load images into libgfx buffers, through stb_image. More...
#include "image.h"#include <fcntl.h>#include <stdlib.h>#include <string.h>#include <sys/stat.h>#include <unistd.h>#include "../stb/stb_image.h"Macros | |
| #define | STBI_ONLY_PNG |
| #define | STBI_ONLY_JPEG |
| #define | STBI_ONLY_BMP |
| #define | STBI_NO_STDIO |
| #define | STBI_NO_HDR |
| #define | STBI_NO_SIMD |
| #define | STBI_NO_THREAD_LOCALS |
| #define | STBI_ASSERT(x) |
| #define | STBI_MAX_DIMENSIONS IMAGE_MAX_SIDE |
| #define | STB_IMAGE_IMPLEMENTATION |
| #define | FILE_MAX_SIZE (64u * 1024 * 1024) |
Functions | |
| gfx_buffer_t * | image_decode (const uint8_t *data, size_t size, const char **error) |
| decode an image from memory. | |
| gfx_buffer_t * | image_load (const char *path, const char **error) |
| load an image file. | |
| 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. | |
load images into libgfx buffers, through stb_image.
stb_image is built here with only what ginnOS needs: PNG, JPEG and BMP from memory, no file access of its own (the file is read here), no SIMD, no thread-local storage, and no HDR. (STBI_NO_LINEAR is not set: in v2.30 it leaves a helper the PNG decoder needs undefined.)
| #define STBI_ONLY_PNG |
| #define STBI_ONLY_JPEG |
| #define STBI_ONLY_BMP |
| #define STBI_NO_STDIO |
| #define STBI_NO_HDR |
| #define STBI_NO_SIMD |
| #define STBI_NO_THREAD_LOCALS |
| #define STBI_ASSERT | ( | x | ) |
| #define STBI_MAX_DIMENSIONS IMAGE_MAX_SIDE |
| #define STB_IMAGE_IMPLEMENTATION |
| #define FILE_MAX_SIZE (64u * 1024 * 1024) |
| gfx_buffer_t * image_decode | ( | const uint8_t * | data, |
| size_t | size, | ||
| const char ** | error ) |
decode an image from memory.
| gfx_buffer_t * image_load | ( | const char * | path, |
| const char ** | error ) |
load an image file.
| error | receives a short reason on failure (may be NULL). |