123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340 |
- #ifndef _TIFFDIR_
- #define _TIFFDIR_
- #include "tiff.h"
- #include "tiffio.h"
- typedef struct
- {
- const TIFFField *info;
- int count;
- void *value;
- } TIFFTagValue;
- typedef struct
- {
- uint16_t tdir_tag;
- uint16_t tdir_type;
- uint64_t tdir_count;
- union
- {
- uint16_t toff_short;
- uint32_t toff_long;
- uint64_t toff_long8;
- } tdir_offset;
- uint8_t tdir_ignore;
- } TIFFDirEntry;
- typedef struct
- {
- #define FIELDSET_ITEMS 4
-
- uint32_t td_fieldsset[FIELDSET_ITEMS];
- uint32_t td_imagewidth, td_imagelength, td_imagedepth;
- uint32_t td_tilewidth, td_tilelength, td_tiledepth;
- uint32_t td_subfiletype;
- uint16_t td_bitspersample;
- uint16_t td_sampleformat;
- uint16_t td_compression;
- uint16_t td_photometric;
- uint16_t td_threshholding;
- uint16_t td_fillorder;
- uint16_t td_orientation;
- uint16_t td_samplesperpixel;
- uint32_t td_rowsperstrip;
- uint16_t td_minsamplevalue, td_maxsamplevalue;
- double *td_sminsamplevalue;
- double *td_smaxsamplevalue;
- float td_xresolution, td_yresolution;
- uint16_t td_resolutionunit;
- uint16_t td_planarconfig;
- float td_xposition, td_yposition;
- uint16_t td_pagenumber[2];
- uint16_t *td_colormap[3];
- uint16_t td_halftonehints[2];
- uint16_t td_extrasamples;
- uint16_t *td_sampleinfo;
-
- uint32_t td_stripsperimage;
- uint32_t td_nstrips;
- uint64_t
- *td_stripoffset_p;
- uint64_t *td_stripbytecount_p;
- uint32_t
- td_stripoffsetbyteallocsize;
- #ifdef STRIPBYTECOUNTSORTED_UNUSED
- int td_stripbytecountsorted;
- #endif
- TIFFDirEntry td_stripoffset_entry;
- TIFFDirEntry td_stripbytecount_entry;
- uint16_t td_nsubifd;
- uint64_t *td_subifd;
-
- uint16_t td_ycbcrsubsampling[2];
- uint16_t td_ycbcrpositioning;
-
- uint16_t *td_transferfunction[3];
- float *td_refblackwhite;
-
- int td_inknameslen;
- char *td_inknames;
- uint16_t td_numberofinks;
- int td_customValueCount;
- TIFFTagValue *td_customValues;
- unsigned char
- td_deferstrilearraywriting;
- } TIFFDirectory;
- #define FIELD_IGNORE 0
- #define FIELD_IMAGEDIMENSIONS 1
- #define FIELD_TILEDIMENSIONS 2
- #define FIELD_RESOLUTION 3
- #define FIELD_POSITION 4
- #define FIELD_SUBFILETYPE 5
- #define FIELD_BITSPERSAMPLE 6
- #define FIELD_COMPRESSION 7
- #define FIELD_PHOTOMETRIC 8
- #define FIELD_THRESHHOLDING 9
- #define FIELD_FILLORDER 10
- #define FIELD_ORIENTATION 15
- #define FIELD_SAMPLESPERPIXEL 16
- #define FIELD_ROWSPERSTRIP 17
- #define FIELD_MINSAMPLEVALUE 18
- #define FIELD_MAXSAMPLEVALUE 19
- #define FIELD_PLANARCONFIG 20
- #define FIELD_RESOLUTIONUNIT 22
- #define FIELD_PAGENUMBER 23
- #define FIELD_STRIPBYTECOUNTS 24
- #define FIELD_STRIPOFFSETS 25
- #define FIELD_COLORMAP 26
- #define FIELD_EXTRASAMPLES 31
- #define FIELD_SAMPLEFORMAT 32
- #define FIELD_SMINSAMPLEVALUE 33
- #define FIELD_SMAXSAMPLEVALUE 34
- #define FIELD_IMAGEDEPTH 35
- #define FIELD_TILEDEPTH 36
- #define FIELD_HALFTONEHINTS 37
- #define FIELD_YCBCRSUBSAMPLING 39
- #define FIELD_YCBCRPOSITIONING 40
- #define FIELD_REFBLACKWHITE 41
- #define FIELD_TRANSFERFUNCTION 44
- #define FIELD_INKNAMES 46
- #define FIELD_SUBIFD 49
- #define FIELD_NUMBEROFINKS 50
- #define FIELD_CODEC 66
- #define FIELD_PSEUDO 0
- #define FIELD_LAST (32 * FIELDSET_ITEMS - 1)
- #define BITn(n) (((uint32_t)1L) << ((n)&0x1f))
- #define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
- #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
- #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
- #define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
- #define FieldSet(fields, f) (fields[(f) / 32] & BITn(f))
- #define ResetFieldBit(fields, f) (fields[(f) / 32] &= ~BITn(f))
- typedef enum
- {
- TIFF_SETGET_UNDEFINED = 0,
- TIFF_SETGET_ASCII = 1,
- TIFF_SETGET_UINT8 = 2,
- TIFF_SETGET_SINT8 = 3,
- TIFF_SETGET_UINT16 = 4,
- TIFF_SETGET_SINT16 = 5,
- TIFF_SETGET_UINT32 = 6,
- TIFF_SETGET_SINT32 = 7,
- TIFF_SETGET_UINT64 = 8,
- TIFF_SETGET_SINT64 = 9,
- TIFF_SETGET_FLOAT = 10,
- TIFF_SETGET_DOUBLE = 11,
- TIFF_SETGET_IFD8 = 12,
- TIFF_SETGET_INT = 13,
- TIFF_SETGET_UINT16_PAIR = 14,
- TIFF_SETGET_C0_ASCII = 15,
- TIFF_SETGET_C0_UINT8 = 16,
- TIFF_SETGET_C0_SINT8 = 17,
- TIFF_SETGET_C0_UINT16 = 18,
- TIFF_SETGET_C0_SINT16 = 19,
- TIFF_SETGET_C0_UINT32 = 20,
- TIFF_SETGET_C0_SINT32 = 21,
- TIFF_SETGET_C0_UINT64 = 22,
- TIFF_SETGET_C0_SINT64 = 23,
- TIFF_SETGET_C0_FLOAT = 24,
- TIFF_SETGET_C0_DOUBLE = 25,
- TIFF_SETGET_C0_IFD8 = 26,
- TIFF_SETGET_C16_ASCII = 27,
- TIFF_SETGET_C16_UINT8 = 28,
- TIFF_SETGET_C16_SINT8 = 29,
- TIFF_SETGET_C16_UINT16 = 30,
- TIFF_SETGET_C16_SINT16 = 31,
- TIFF_SETGET_C16_UINT32 = 32,
- TIFF_SETGET_C16_SINT32 = 33,
- TIFF_SETGET_C16_UINT64 = 34,
- TIFF_SETGET_C16_SINT64 = 35,
- TIFF_SETGET_C16_FLOAT = 36,
- TIFF_SETGET_C16_DOUBLE = 37,
- TIFF_SETGET_C16_IFD8 = 38,
- TIFF_SETGET_C32_ASCII = 39,
- TIFF_SETGET_C32_UINT8 = 40,
- TIFF_SETGET_C32_SINT8 = 41,
- TIFF_SETGET_C32_UINT16 = 42,
- TIFF_SETGET_C32_SINT16 = 43,
- TIFF_SETGET_C32_UINT32 = 44,
- TIFF_SETGET_C32_SINT32 = 45,
- TIFF_SETGET_C32_UINT64 = 46,
- TIFF_SETGET_C32_SINT64 = 47,
- TIFF_SETGET_C32_FLOAT = 48,
- TIFF_SETGET_C32_DOUBLE = 49,
- TIFF_SETGET_C32_IFD8 = 50,
- TIFF_SETGET_OTHER = 51
- } TIFFSetGetFieldType;
- #if defined(__cplusplus)
- extern "C"
- {
- #endif
- extern const TIFFFieldArray *_TIFFGetFields(void);
- extern const TIFFFieldArray *_TIFFGetExifFields(void);
- extern const TIFFFieldArray *_TIFFGetGpsFields(void);
- extern void _TIFFSetupFields(TIFF *tif, const TIFFFieldArray *infoarray);
- extern void _TIFFPrintFieldInfo(TIFF *, FILE *);
- extern int _TIFFFillStriles(TIFF *);
- typedef enum
- {
- tfiatImage,
- tfiatExif,
- tfiatGps,
- tfiatOther
- } TIFFFieldArrayType;
- struct _TIFFFieldArray
- {
- TIFFFieldArrayType type;
- uint32_t allocated_size;
- uint32_t count;
- TIFFField *fields;
- };
- struct _TIFFField
- {
- uint32_t field_tag;
- short field_readcount;
- short field_writecount;
- TIFFDataType field_type;
- uint32_t
- field_anonymous;
- TIFFSetGetFieldType
- set_field_type;
- TIFFSetGetFieldType
- get_field_type;
- unsigned short field_bit;
- unsigned char field_oktochange;
- unsigned char field_passcount;
- char *field_name;
- TIFFFieldArray *field_subfields;
- };
- extern int _TIFFMergeFields(TIFF *, const TIFFField[], uint32_t);
- extern const TIFFField *_TIFFFindOrRegisterField(TIFF *, uint32_t,
- TIFFDataType);
- extern TIFFField *_TIFFCreateAnonField(TIFF *, uint32_t, TIFFDataType);
- extern int _TIFFCheckFieldIsValidForCodec(TIFF *tif, ttag_t tag);
- extern int _TIFFCheckDirNumberAndOffset(TIFF *tif, tdir_t dirn,
- uint64_t diroff);
- extern int _TIFFGetDirNumberFromOffset(TIFF *tif, uint64_t diroff,
- tdir_t *dirn);
- extern int _TIFFGetOffsetFromDirNumber(TIFF *tif, tdir_t dirn,
- uint64_t *diroff);
- extern int _TIFFRemoveEntryFromDirectoryListByOffset(TIFF *tif,
- uint64_t diroff);
- #if defined(__cplusplus)
- }
- #endif
- #endif
|