![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
Data Structures | |
| struct | N_TIFF |
| The first directory of a TIFF structured buffer. More... | |
| struct | N_TIFF_ENTRY |
| One directory entry. More... | |
Macros | |
| #define | N_TIFF_MAGIC 42 |
| The magic of a plain TIFF file. | |
| #define | N_TIFF_MAGIC_DCP 0x4352 |
| The magic of an Adobe DCP camera profile, "RC" read little endian. | |
Functions | |
| size_t | n_tiff_count (const N_TIFF *tiff, uint16_t tag) |
| How many values a tag has. | |
| const N_TIFF_ENTRY * | n_tiff_find (const N_TIFF *tiff, uint16_t tag) |
| Find an entry by tag. | |
| void | n_tiff_free (N_TIFF **tiff) |
| Release a parse, and set the pointer to NULL. | |
| int | n_tiff_get_ascii (const N_TIFF *tiff, uint16_t tag, char *out, size_t out_len) |
| Read an ASCII tag. | |
| size_t | n_tiff_get_doubles (const N_TIFF *tiff, uint16_t tag, double *out, size_t max) |
| Read a numeric tag as doubles. | |
| N_TIFF * | n_tiff_parse (const unsigned char *data, size_t len) |
| Parse the first directory of a TIFF structured buffer. | |
| struct N_TIFF |
The first directory of a TIFF structured buffer.
| Data Fields | ||
|---|---|---|
| int | big_endian | 1 for "MM" (Motorola, big endian), 0 for "II" |
| size_t | count | how many |
| const unsigned char * | data | the buffer, borrowed |
| N_TIFF_ENTRY * | entries | the entries whose values lie inside the buffer, in file order |
| size_t | len | its length |
| uint16_t | magic | the 16 bit value after the byte order mark |
| struct N_TIFF_ENTRY |
| #define N_TIFF_MAGIC_DCP 0x4352 |
The magic of an Adobe DCP camera profile, "RC" read little endian.
Definition at line 63 of file n_tiff.h.
Referenced by build(), and test_order().
| size_t n_tiff_count | ( | const N_TIFF * | tiff, |
| uint16_t | tag ) |
How many values a tag has.
| tiff | the parse |
| tag | the tag number |
Definition at line 178 of file n_tiff.c.
References N_TIFF_ENTRY::count, and n_tiff_find().
Referenced by test_order().
| const N_TIFF_ENTRY * n_tiff_find | ( | const N_TIFF * | tiff, |
| uint16_t | tag ) |
Find an entry by tag.
| tiff | the parse |
| tag | the tag number |
Definition at line 167 of file n_tiff.c.
References __n_assert, N_TIFF::count, N_TIFF::entries, and N_TIFF_ENTRY::tag.
Referenced by _from_tiff(), n_tiff_count(), n_tiff_get_ascii(), n_tiff_get_doubles(), and test_order().
| void n_tiff_free | ( | N_TIFF ** | tiff | ) |
Release a parse, and set the pointer to NULL.
The buffer is not touched.
| tiff | address of the N_TIFF pointer, may point to NULL |
Definition at line 160 of file n_tiff.c.
References Free, and FreeNoLog.
Referenced by _from_tiff(), list_file(), and test_order().
| int n_tiff_get_ascii | ( | const N_TIFF * | tiff, |
| uint16_t | tag, | ||
| char * | out, | ||
| size_t | out_len ) |
Read an ASCII tag.
The string is cut to the first NUL and to out_len - 1 bytes, and always terminated.
| tiff | the parse |
| tag | the tag number |
| out | receives the string |
| out_len | size of out, at least 1 |
Definition at line 254 of file n_tiff.c.
References __n_assert, N_TIFF_ENTRY::count, N_TIFF::data, n_tiff_find(), N_TIFF_ENTRY::offset, and N_TIFF_ENTRY::type.
Referenced by test_order().
| size_t n_tiff_get_doubles | ( | const N_TIFF * | tiff, |
| uint16_t | tag, | ||
| double * | out, | ||
| size_t | max ) |
Read a numeric tag as doubles.
BYTE, SHORT, LONG, RATIONAL and their signed forms, FLOAT and DOUBLE are converted; a rational with a zero denominator reads as 0.
| tiff | the parse |
| tag | the tag number |
| out | receives up to max values |
| max | room in out |
Definition at line 184 of file n_tiff.c.
References __n_assert, _n_tiff_type_size(), _n_tiff_u16(), _n_tiff_u32(), _n_tiff_u64(), N_TIFF_ENTRY::count, N_TIFF::data, n_tiff_find(), N_TIFF_ENTRY::offset, and N_TIFF_ENTRY::type.
Referenced by test_order().
| N_TIFF * n_tiff_parse | ( | const unsigned char * | data, |
| size_t | len ) |
Parse the first directory of a TIFF structured buffer.
Entries of an unknown type or whose values lie outside the buffer are skipped.
| data | the buffer, borrowed: it must outlive the result |
| len | its length in bytes |
Definition at line 94 of file n_tiff.c.
References __n_assert, _n_tiff_type_size(), _n_tiff_u16(), _n_tiff_u32(), N_TIFF::big_endian, N_TIFF::count, N_TIFF_ENTRY::count, N_TIFF::data, N_TIFF::entries, Free, N_TIFF::len, N_TIFF::magic, Malloc, N_TIFF_MAX_ENTRIES, N_TIFF_ENTRY::offset, N_TIFF_ENTRY::tag, and N_TIFF_ENTRY::type.
Referenced by _from_tiff(), list_file(), test_broken(), and test_order().