Pillow/src/libImaging/TiffDecode.h
Oliver Tonnhofer 2af4026201 Improve encoding of TIFF tags (#3861)
* Improve encoding of TIFF tags

- Pass tagtype from v2 directory to libtiff encoder, instead of
autodetecting type.
- Use explicit types. E.g. uint32_t for TIFF_LONG to fix issues on
platforms with 64bit longs.
- Add support for multiple values (arrays). Requires type in v2
directory and values must be passed as a tuple.
- Add support for signed types (e.g. TIFFTypes.TIFF_SIGNED_SHORT).

Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
2019-06-30 21:48:19 +03:00

65 lines
1.4 KiB
C

/*
* The Python Imaging Library.
* $Id: //modules/pil/libImaging/Tiff.h#1 $
*
* declarations for the LibTiff-based Group3 and Group4 decoder
*
*/
#ifndef _TIFFIO_
#include <tiffio.h>
#endif
#ifndef _TIFF_
#include <tiff.h>
#endif
/* UNDONE -- what are we using from this? */
/*#ifndef _UNISTD_H
# include <unistd.h>
# endif
*/
#ifndef min
#define min(x,y) (( x > y ) ? y : x )
#define max(x,y) (( x < y ) ? y : x )
#endif
#ifndef _PIL_LIBTIFF_
#define _PIL_LIBTIFF_
typedef struct {
tdata_t data; /* tdata_t == void* */
toff_t loc; /* toff_t == uint32 */
tsize_t size; /* tsize_t == int32 */
int fp;
uint32 ifd; /* offset of the ifd, used for multipage
* Should be uint32 for libtiff 3.9.x
* uint64 for libtiff 4.0.x
*/
TIFF *tiff; /* Used in write */
toff_t eof;
int flrealloc;/* may we realloc */
} TIFFSTATE;
extern int ImagingLibTiffInit(ImagingCodecState state, int fp, uint32 offset);
extern int ImagingLibTiffEncodeInit(ImagingCodecState state, char *filename, int fp);
extern int ImagingLibTiffMergeFieldInfo(ImagingCodecState state, TIFFDataType field_type, int key, int is_var_length);
extern int ImagingLibTiffSetField(ImagingCodecState state, ttag_t tag, ...);
/*
Trace debugging
legacy, don't enable for Python 3.x, unicode issues.
*/
/*
#define VA_ARGS(...) __VA_ARGS__
#define TRACE(args) fprintf(stderr, VA_ARGS args)
*/
#define TRACE(args)
#endif