tinyimg 1.0.0
Lightweight image manipulation library for Cloudflare Workers
Loading...
Searching...
No Matches
tinyimg.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <stddef.h>
14#include <stdint.h>
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20#pragma region version
21
25#define TINYIMG_VERSION_MAJOR 1
26
30#define TINYIMG_VERSION_MINOR 0
31
35#define TINYIMG_VERSION_PATCH 0
36
41#define TINYIMG_VERSION \
42 ((TINYIMG_VERSION_MAJOR << 16) | (TINYIMG_VERSION_MINOR << 8) | \
43 TINYIMG_VERSION_PATCH)
44
52#define TINYIMG_ABI_VERSION 1
53
60#if defined(__wasm__)
61 #define TINYIMG_EXPORT(name) __attribute__((export_name(name)))
62#else
63 #define TINYIMG_EXPORT(name)
64#endif
65
74void tiny_init(void);
75
81uint32_t tiny_version(void);
82
88uint32_t tiny_abi_version(void);
89
98uint32_t tiny_features(void);
99
107{
108 TINYIMG_FEATURE_SIMD = 1 << 0,
109 TINYIMG_FEATURE_PNG = 1 << 1,
110 TINYIMG_FEATURE_JPEG = 1 << 2,
111 TINYIMG_FEATURE_BMP = 1 << 3,
112 TINYIMG_FEATURE_GIF = 1 << 4,
113 TINYIMG_FEATURE_TIFF = 1 << 5,
114 TINYIMG_FEATURE_WEBP = 1 << 6,
115 TINYIMG_FEATURE_AVIF = 1 << 7,
116 TINYIMG_FEATURE_TEXT = 1 << 8,
117 TINYIMG_FEATURE_DETECT = 1 << 9,
118 TINYIMG_FEATURE_ICC = 1 << 10,
120
121#pragma endregion
122
123#pragma region error codes
124
205
216const char* tiny_error_name(int error);
217
218#pragma endregion
219
220#ifdef __cplusplus
221}
222#endif
TinyImageError
Result of a tinyimg call.
Definition tinyimg.h:132
@ TINYIMG_ERR_RANGE
An argument was outside its documented range.
Definition tinyimg.h:144
@ TINYIMG_ERR_CORRUPT
The bitstream is malformed, truncated or internally inconsistent.
Definition tinyimg.h:173
@ TINYIMG_ERR_TOO_LARGE
The image exceeds TINYIMG_MAX_PIXELS or TINYIMG_MAX_IMAGE_BYTES.
Definition tinyimg.h:160
@ TINYIMG_ERR_BOUNDS
Coordinates or a rectangle fell outside the image.
Definition tinyimg.h:148
@ TINYIMG_ERR_NO_CHANNEL
The image has no channel the operation needs, such as an alpha channel for an opacity change.
Definition tinyimg.h:194
@ TINYIMG_OK
The call succeeded.
Definition tinyimg.h:136
@ TINYIMG_ERR_UNSUPPORTED_CODEC
The format was recognized but this build cannot decode or encode it. AVIF and HEIF always report this...
Definition tinyimg.h:169
@ TINYIMG_ERR_BUFFER_TOO_SMALL
The output buffer was too small. The required size is reported through the call's size out-parameter.
Definition tinyimg.h:184
@ TINYIMG_ERR_PLAN
The transform plan is full or holds an operation that cannot be combined with the others in it.
Definition tinyimg.h:203
@ TINYIMG_ERR_NULL
A required pointer argument was NULL.
Definition tinyimg.h:140
@ TINYIMG_ERR_UNSUPPORTED_VARIANT
The format is recognized and supported, but this particular variant of it is not (a 12-bit JPEG,...
Definition tinyimg.h:179
@ TINYIMG_ERR_NOT_FOUND
The requested key or metadata entry does not exist.
Definition tinyimg.h:198
@ TINYIMG_ERR_BLOB_MISSING
The operation needs a blob that has not been loaded, such as a font or a detection cascade.
Definition tinyimg.h:189
@ TINYIMG_ERR_UNKNOWN_FORMAT
The buffer did not match any format tinyimg recognizes.
Definition tinyimg.h:164
@ TINYIMG_ERR_MEMORY
The allocator could not satisfy a request.
Definition tinyimg.h:152
uint32_t tiny_abi_version(void)
Retrieves the ABI version of the compiled module.
uint32_t tiny_version(void)
Retrieves the packed library version.
void tiny_init(void)
Builds the tables the library derives at runtime and installs the default heap.
TinyImageFeature
Optional features a build may or may not contain.
Definition tinyimg.h:107
const char * tiny_error_name(int error)
Retrieves a short, stable name for an error code.
uint32_t tiny_features(void)
Reports which optional features were compiled in.