![]() |
tinyimg 1.0.0
Lightweight image manipulation library for Cloudflare Workers
|
Umbrella header, version and error codes. More...
#include <stddef.h>#include <stdint.h>Go to the source code of this file.
Macros | |
| #define | TINYIMG_VERSION_MAJOR 1 |
| Major version of the library. | |
| #define | TINYIMG_VERSION_MINOR 0 |
| Minor version of the library. | |
| #define | TINYIMG_VERSION_PATCH 0 |
| Patch version of the library. | |
| #define | TINYIMG_VERSION |
| The version packed into a single integer as (major << 16) | (minor << 8) | patch. | |
| #define | TINYIMG_ABI_VERSION 1 |
| Version of the contract between the wasm module and its host wrapper. | |
| #define | TINYIMG_EXPORT(name) |
| Marks a function as exported from the wasm module. | |
Typedefs | |
| typedef enum TinyImageFeature | TinyImageFeature |
| Optional features a build may or may not contain. | |
| typedef enum TinyImageError | TinyImageError |
| Result of a tinyimg call. | |
Enumerations | |
| enum | TinyImageFeature { TINYIMG_FEATURE_SIMD = 1 << 0 , TINYIMG_FEATURE_PNG = 1 << 1 , TINYIMG_FEATURE_JPEG = 1 << 2 , TINYIMG_FEATURE_BMP = 1 << 3 , TINYIMG_FEATURE_GIF = 1 << 4 , TINYIMG_FEATURE_TIFF = 1 << 5 , TINYIMG_FEATURE_WEBP = 1 << 6 , TINYIMG_FEATURE_AVIF = 1 << 7 , TINYIMG_FEATURE_TEXT = 1 << 8 , TINYIMG_FEATURE_DETECT = 1 << 9 , TINYIMG_FEATURE_ICC = 1 << 10 } |
| Optional features a build may or may not contain. More... | |
| enum | TinyImageError { TINYIMG_OK = 0 , TINYIMG_ERR_NULL = -1 , TINYIMG_ERR_RANGE = -2 , TINYIMG_ERR_BOUNDS = -3 , TINYIMG_ERR_MEMORY = -4 , TINYIMG_ERR_TOO_LARGE = -5 , TINYIMG_ERR_UNKNOWN_FORMAT = -6 , TINYIMG_ERR_UNSUPPORTED_CODEC = -7 , TINYIMG_ERR_CORRUPT = -8 , TINYIMG_ERR_UNSUPPORTED_VARIANT = -9 , TINYIMG_ERR_BUFFER_TOO_SMALL = -10 , TINYIMG_ERR_BLOB_MISSING = -11 , TINYIMG_ERR_NO_CHANNEL = -12 , TINYIMG_ERR_NOT_FOUND = -13 , TINYIMG_ERR_PLAN = -14 } |
| Result of a tinyimg call. More... | |
Functions | |
| void | tiny_init (void) |
| Builds the tables the library derives at runtime and installs the default heap. | |
| uint32_t | tiny_version (void) |
| Retrieves the packed library version. | |
| uint32_t | tiny_abi_version (void) |
| Retrieves the ABI version of the compiled module. | |
| uint32_t | tiny_features (void) |
| Reports which optional features were compiled in. | |
| const char * | tiny_error_name (int error) |
| Retrieves a short, stable name for an error code. | |
Umbrella header, version and error codes.
| #define TINYIMG_ABI_VERSION 1 |
Version of the contract between the wasm module and its host wrapper.
Bumped whenever an exported signature, a struct layout or an error code changes. The TypeScript loader refuses a module whose ABI it does not know, which turns a silent misread of a struct into a startup failure.
| #define TINYIMG_EXPORT | ( | name | ) |
Marks a function as exported from the wasm module.
Exporting by attribute rather than by linker flag means --gc-sections keeps exactly the public surface and its dependencies, and drops everything else.
| #define TINYIMG_VERSION |
The version packed into a single integer as (major << 16) | (minor << 8) | patch.
| typedef enum TinyImageError TinyImageError |
Result of a tinyimg call.
Every function that can fail returns one of these. Zero is success and every failure is negative, so if (result < 0) is the only check a caller needs.
| typedef enum TinyImageFeature TinyImageFeature |
Optional features a build may or may not contain.
Every codec can be compiled out, so a caller that only ever handles PNG can link a module with nothing else in it.
| enum TinyImageError |
Result of a tinyimg call.
Every function that can fail returns one of these. Zero is success and every failure is negative, so if (result < 0) is the only check a caller needs.
| enum TinyImageFeature |
Optional features a build may or may not contain.
Every codec can be compiled out, so a caller that only ever handles PNG can link a module with nothing else in it.
| uint32_t tiny_abi_version | ( | void | ) |
Retrieves the ABI version of the compiled module.
| const char * tiny_error_name | ( | int | error | ) |
Retrieves a short, stable name for an error code.
Intended for logs and for the message the host wrapper throws; the text is not localized and is not meant to be shown to an end user.
| error | The error code to describe. |
| uint32_t tiny_features | ( | void | ) |
Reports which optional features were compiled in.
The host wrapper reads this to decide whether to offer a codec at all, rather than calling it and handling a failure.
| void tiny_init | ( | void | ) |
Builds the tables the library derives at runtime and installs the default heap.
Idempotent, and every entry point that needs it calls it, so nothing breaks if a host never calls it. A host that would rather pay the cost at startup than on the first request calls it once after instantiating the module.
| uint32_t tiny_version | ( | void | ) |
Retrieves the packed library version.