|
imsz
|
#include <stdint.h>#include <stdio.h>
Go to the source code of this file.
Classes | |
| struct | ImInfo |
| The width, height and format of an image. More... | |
Macros | |
| #define | IMSZ_INIT { .width = (uint64_t)0, .height = (uint64_t)0, .format = 0 } |
Typedefs | |
| typedef enum ImError | ImError |
| Error values. More... | |
| typedef enum ImFormat | ImFormat |
| All supported image formats. | |
| typedef struct ImInfo | ImInfo |
| The width, height and format of an image. | |
Enumerations | |
| enum | ImError { IMSZ_OK = 0, IMSZ_ERR_IO = -1, IMSZ_ERR_PARSER = -2, IMSZ_ERR_UNSUPPORTED = -3 } |
| Error values. More... | |
| enum | ImFormat { IMSZ_GIF = 1u, IMSZ_PNG = 2u, IMSZ_BMP = 3u, IMSZ_JPEG = 4u, IMSZ_WEBP = 5u, IMSZ_QOI = 6u, IMSZ_PSD = 7u, IMSZ_XCF = 8u, IMSZ_ICO = 9u, IMSZ_AVIF = 10u, IMSZ_TIFF = 11u, IMSZ_OpenEXR = 12u, IMSZ_PCX = 13u, IMSZ_TGA = 14u, IMSZ_DDS = 15u, IMSZ_HEIF = 16u, IMSZ_JP2K = 17u, IMSZ_DIB = 18u, IMSZ_VTF = 19u, IMSZ_ILBM = 20u } |
| All supported image formats. More... | |
Functions | |
| int | imsz_from_path (const char *path, ImInfo *info_ptr) |
| int | imsz_from_buffer (const void *buf, size_t len, ImInfo *info_ptr) |
| int | imsz_from_fd (int fd, ImInfo *info_ptr) |
| int | imsz_from_file (FILE *stream, ImInfo *info_ptr) |
| const char * | imsz_format_name (unsigned int format) |
| int | imsz_from_pathw (const wchar_t *path, ImInfo *info_ptr) |
| int | imsz_from_handle (HANDLE hnd, ImInfo *info_ptr) |
| const wchar_t * | imsz_format_namew (unsigned int format) |
| int | imsz (const char *path, ImInfo *info_ptr) |
| Alias of imsz_from_path() More... | |
| int | imsz (const void *buf, size_t len, ImInfo *info_ptr) |
| Alias of imsz_from_buffer() More... | |
| int | imsz (int fd, ImInfo *info_ptr) |
| Alias of imsz_from_fd() More... | |
| int | imsz (FILE *file, ImInfo *info_ptr) |
| Alias of imsz_from_file() More... | |
| int | imsz (const wchar_t *path, ImInfo *info_ptr) |
| Alias of imsz_from_pathw() More... | |
| int | imsz (HANDLE hnd, ImInfo *info_ptr) |
| Alias of imsz_from_handle() More... | |
Get image width and height reading as few bytes as possible
| #define IMSZ_INIT { .width = (uint64_t)0, .height = (uint64_t)0, .format = 0 } |
Initialize an ImInfo variable with all 0 values.
NOTE: The API doesn't use enum ImFormat as a type, but unsigned int. This is so to be certain about the ABI since the library is actually implemented in Rust, which doesn't know about C enums. And C enums aren't guaranteed to be any certain integer type.
Error values.
NOTE: The API doesn't use enum ImError as a return type, but int. This is so to be certain about the ABI since the library is actually implemented in Rust, which doesn't know about C enums. And C enums aren't guaranteed to be any certain integer type.
Also a returned error value is not limited to these values, but can also be an errno value under POSIX or a Windows error code under Windows. Both, POSIX and Windows error codes are positive integers (or 0 for no error), these custom error codes are negative values.
| enum ImError |
Error values.
NOTE: The API doesn't use enum ImError as a return type, but int. This is so to be certain about the ABI since the library is actually implemented in Rust, which doesn't know about C enums. And C enums aren't guaranteed to be any certain integer type.
Also a returned error value is not limited to these values, but can also be an errno value under POSIX or a Windows error code under Windows. Both, POSIX and Windows error codes are positive integers (or 0 for no error), these custom error codes are negative values.
| Enumerator | |
|---|---|
| IMSZ_OK | No error. |
| IMSZ_ERR_IO | IO error happened, but no OS error (errno or WIndows error code) was reported. (Classic should never happen.) |
| IMSZ_ERR_PARSER | File format was detected, but there was an error parsing the file. ImInfo::format will be set to the detected file format. |
| IMSZ_ERR_UNSUPPORTED | File format is not supported. |
| enum ImFormat |
All supported image formats.
|
inline |
Alias of imsz_from_path()
Under C this is a macro using _Generic, under C++ an overloaded inline function.
|
inline |
Alias of imsz_from_buffer()
Under C this is a macro using _Generic, under C++ an overloaded inline function.
|
inline |
Alias of imsz_from_pathw()
Under C this is a macro using _Generic, under C++ an overloaded inline function.
|
inline |
Alias of imsz_from_file()
Under C this is a macro using _Generic, under C++ an overloaded inline function.
|
inline |
Alias of imsz_from_handle()
Under C this is a macro using _Generic, under C++ an overloaded inline function.
|
inline |
Alias of imsz_from_fd()
Under C this is a macro using _Generic, under C++ an overloaded inline function.
| const char* imsz_format_name | ( | unsigned int | format | ) |
Get the name of an image file format.
| format | A ImFormat value. |
"(unknown)" for an unknown value. | const wchar_t* imsz_format_namew | ( | unsigned int | format | ) |
Get the name of an image file format. (Windows-only)
| format | A ImFormat value. |
"(unknown)" for an unknown value. | int imsz_from_buffer | ( | const void * | buf, |
| size_t | len, | ||
| ImInfo * | info_ptr | ||
| ) |
Get image width and height from file loaded in buf.
| buf | Image file loaded into memory. |
| len | Size of buf in bytes. |
| info_ptr | Pointer to where to write the result. Can be NULL. |
errno value under POSIX and Windows error code under Windows. | int imsz_from_fd | ( | int | fd, |
| ImInfo * | info_ptr | ||
| ) |
Get image width and height from file descriptor fd.
| fd | A file descriptor of an image file. Must be seekable. |
| info_ptr | Pointer to where to write the result. Can be NULL. |
errno value under POSIX and Windows error code under Windows. | int imsz_from_file | ( | FILE * | stream, |
| ImInfo * | info_ptr | ||
| ) |
Get image width and height from file stream.
| stream | A file handle of an image file. Must be seekable. |
| info_ptr | Pointer to where to write the result. Can be NULL. |
errno value under POSIX and Windows error code under Windows. | int imsz_from_handle | ( | HANDLE | hnd, |
| ImInfo * | info_ptr | ||
| ) |
Get image width and height from file handle hnd. (Windows-only)
| hnd | File handle. Must be seekable. |
| info_ptr | Pointer to where to write the result. Can be NULL. |
| int imsz_from_path | ( | const char * | path, |
| ImInfo * | info_ptr | ||
| ) |
Get image width and height from file at path.
| path | Image file path. |
| info_ptr | Pointer to where to write the result. Can be NULL. |
errno value under POSIX and Windows error code under Windows.