home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / NETWORK / netpbm_src.lzh / NETPBM / LIBTIFF / tiffio.h < prev    next >
Text File  |  1996-11-18  |  8KB  |  195 lines

  1. /* $Header: /usr/people/sam/tiff/libtiff/RCS/tiffio.h,v 1.73 93/08/26 14:59:03 sam Exp $ */
  2.  
  3. /*
  4.  * Copyright (c) 1988, 1989, 1990, 1991, 1992 Sam Leffler
  5.  * Copyright (c) 1991, 1992 Silicon Graphics, Inc.
  6.  *
  7.  * Permission to use, copy, modify, distribute, and sell this software and 
  8.  * its documentation for any purpose is hereby granted without fee, provided
  9.  * that (i) the above copyright notices and this permission notice appear in
  10.  * all copies of the software and related documentation, and (ii) the names of
  11.  * Sam Leffler and Silicon Graphics may not be used in any advertising or
  12.  * publicity relating to the software without the specific, prior written
  13.  * permission of Sam Leffler and Silicon Graphics.
  14.  * 
  15.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  16.  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  17.  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
  18.  * 
  19.  * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
  20.  * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
  21.  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  22.  * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
  23.  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
  24.  * OF THIS SOFTWARE.
  25.  */
  26.  
  27. #ifndef _TIFFIO_
  28. #define    _TIFFIO_
  29.  
  30. /*
  31.  * TIFF I/O Library Definitions.
  32.  */
  33. #include "tiff.h"
  34.  
  35. /*
  36.  * TIFF is defined as an incomplete type to hide the
  37.  * library's internal data structures from clients.
  38.  */
  39. typedef    struct tiff TIFF;
  40.  
  41. /*
  42.  * The following typedefs define the intrinsic size of
  43.  * data types used in the *exported* interfaces.  These
  44.  * definitions depend on the proper definition of types
  45.  * in tiff.h.  Note also that the varargs interface used
  46.  * pass tag types and values uses the types defined in
  47.  * tiff.h directly.
  48.  *
  49.  * NB: ttag_t is unsigned int and not unsigned short because
  50.  *     ANSI C requires that the type before the ellipsis be a
  51.  *     promoted type (i.e. one of int, unsigned int, pointer,
  52.  *     or double).
  53.  * NB: tsize_t is int32 and not uint32 because some functions
  54.  *     return -1.
  55.  * NB: toff_t is not off_t for many reasons; TIFFs max out at
  56.  *     32-bit file offsets being the most important
  57.  */
  58. typedef    unsigned int ttag_t;    /* directory tag */
  59. typedef    uint16 tdir_t;        /* directory index */
  60. typedef    uint16 tsample_t;    /* sample number */
  61. typedef    uint32 tstrip_t;    /* strip number */
  62. typedef uint32 ttile_t;        /* tile number */
  63. typedef    int32 tsize_t;        /* i/o size in bytes */
  64. typedef    void* tdata_t;        /* image data ref */
  65. typedef    void* thandle_t;    /* client data handle */
  66. typedef    int32 toff_t;        /* file offset */
  67.  
  68. #ifndef NULL
  69. #define    NULL    0
  70. #endif
  71.  
  72. /*
  73.  * Flags to pass to TIFFPrintDirectory to control
  74.  * printing of data structures that are potentially
  75.  * very large.   Bit-or these flags to enable printing
  76.  * multiple items.
  77.  */
  78. #define    TIFFPRINT_NONE        0x0        /* no extra info */
  79. #define    TIFFPRINT_STRIPS    0x1        /* strips/tiles info */
  80. #define    TIFFPRINT_CURVES    0x2        /* color/gray response curves */
  81. #define    TIFFPRINT_COLORMAP    0x4        /* colormap */
  82. #define    TIFFPRINT_JPEGQTABLES    0x100        /* JPEG Q matrices */
  83. #define    TIFFPRINT_JPEGACTABLES    0x200        /* JPEG AC tables */
  84. #define    TIFFPRINT_JPEGDCTABLES    0x200        /* JPEG DC tables */
  85.  
  86. /*
  87.  * Macros for extracting components from the
  88.  * packed ABGR form returned by TIFFReadRGBAImage.
  89.  */
  90. #define    TIFFGetR(abgr)    ((abgr) & 0xff)
  91. #define    TIFFGetG(abgr)    (((abgr) >> 8) & 0xff)
  92. #define    TIFFGetB(abgr)    (((abgr) >> 16) & 0xff)
  93. #define    TIFFGetA(abgr)    (((abgr) >> 24) & 0xff)
  94.  
  95. #include <stdio.h>
  96. #include <stdarg.h>
  97.  
  98. #if defined(__cplusplus)
  99. extern "C" {
  100. #endif
  101. typedef    void (*TIFFErrorHandler)(const char* module, const char* fmt, va_list);
  102. typedef    tsize_t (*TIFFReadWriteProc)(thandle_t, tdata_t, tsize_t);
  103. typedef    toff_t (*TIFFSeekProc)(thandle_t, toff_t, int);
  104. typedef    int (*TIFFCloseProc)(thandle_t);
  105. typedef    toff_t (*TIFFSizeProc)(thandle_t);
  106. typedef    int (*TIFFMapFileProc)(thandle_t, tdata_t*, toff_t*);
  107. typedef    void (*TIFFUnmapFileProc)(thandle_t, tdata_t, toff_t);
  108.  
  109. extern    const char* TIFFGetVersion(void);
  110.  
  111. extern    void TIFFClose(TIFF*);
  112. extern    int TIFFFlush(TIFF*);
  113. extern    int TIFFFlushData(TIFF*);
  114. extern    int TIFFGetField(TIFF*, ttag_t, ...);
  115. extern    int TIFFVGetField(TIFF*, ttag_t, va_list);
  116. extern    int TIFFGetFieldDefaulted(TIFF*, ttag_t, ...);
  117. extern    int TIFFVGetFieldDefaulted(TIFF*, ttag_t, va_list);
  118. extern    int TIFFReadDirectory(TIFF*);
  119. extern    tsize_t TIFFScanlineSize(TIFF*);
  120. extern    tsize_t TIFFStripSize(TIFF*);
  121. extern    tsize_t TIFFVStripSize(TIFF*, uint32);
  122. extern    tsize_t TIFFTileRowSize(TIFF*);
  123. extern    tsize_t TIFFTileSize(TIFF*);
  124. extern    tsize_t TIFFVTileSize(TIFF*, uint32);
  125. extern    int TIFFFileno(TIFF*);
  126. extern    int TIFFGetMode(TIFF*);
  127. extern    int TIFFIsTiled(TIFF*);
  128. extern    int TIFFIsByteSwapped(TIFF*);
  129. extern    uint32 TIFFCurrentRow(TIFF*);
  130. extern    tdir_t TIFFCurrentDirectory(TIFF*);
  131. extern    tstrip_t TIFFCurrentStrip(TIFF*);
  132. extern    ttile_t TIFFCurrentTile(TIFF*);
  133. extern    int TIFFReadBufferSetup(TIFF*, tdata_t, tsize_t);
  134. extern    int TIFFLastDirectory(TIFF*);
  135. extern    int TIFFSetDirectory(TIFF*, tdir_t);
  136. extern    int TIFFSetField(TIFF*, ttag_t, ...);
  137. extern    int TIFFVSetField(TIFF*, ttag_t, va_list);
  138. extern    int TIFFWriteDirectory(TIFF *);
  139. #if defined(c_plusplus) || defined(__cplusplus)
  140. extern    void TIFFPrintDirectory(TIFF*, FILE*, long = 0);
  141. extern    int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t = 0);
  142. extern    int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t = 0);
  143. extern    int TIFFReadRGBAImage(TIFF*,
  144.         unsigned long, unsigned long, unsigned long*, int stop = 0);
  145. #else
  146. extern    void TIFFPrintDirectory(TIFF*, FILE*, long);
  147. extern    int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t);
  148. extern    int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t);
  149. extern    int TIFFReadRGBAImage(TIFF*,
  150.         unsigned long, unsigned long, unsigned long*, int stop);
  151. #endif
  152. extern    TIFF* TIFFOpen(const char*, const char*);
  153. extern    TIFF* TIFFFdOpen(int, const char*, const char*);
  154. extern    TIFF* TIFFClientOpen(const char* name, const char* mode,
  155.         thandle_t clientdata,
  156.         TIFFReadWriteProc readproc, TIFFReadWriteProc writeproc,
  157.         TIFFSeekProc seekproc, TIFFCloseProc closeproc,
  158.         TIFFSizeProc sizeproc,
  159.         TIFFMapFileProc mapproc, TIFFUnmapFileProc unmapproc);
  160. extern    const char* TIFFFileName(TIFF*);
  161. extern    void TIFFError(const char*, const char*, ...);
  162. extern    void TIFFWarning(const char*, const char*, ...);
  163. extern    TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler handler);
  164. extern    TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler handler);
  165. extern    ttile_t TIFFComputeTile(TIFF*, uint32, uint32, uint32, tsample_t);
  166. extern    int TIFFCheckTile(TIFF*, uint32, uint32, uint32, tsample_t);
  167. extern    ttile_t TIFFNumberOfTiles(TIFF*);
  168. extern    tsize_t TIFFReadTile(TIFF*,
  169.         tdata_t, uint32, uint32, uint32, tsample_t);
  170. extern    tsize_t TIFFWriteTile(TIFF*,
  171.         tdata_t, uint32, uint32, uint32, tsample_t);
  172. extern    tstrip_t TIFFComputeStrip(TIFF*, uint32, tsample_t);
  173. extern    tstrip_t TIFFNumberOfStrips(TIFF*);
  174. extern    tsize_t TIFFReadEncodedStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
  175. extern    tsize_t TIFFReadRawStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
  176. extern    tsize_t TIFFReadEncodedTile(TIFF*, ttile_t, tdata_t, tsize_t);
  177. extern    tsize_t TIFFReadRawTile(TIFF*, ttile_t, tdata_t, tsize_t);
  178. extern    tsize_t TIFFWriteEncodedStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
  179. extern    tsize_t TIFFWriteRawStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
  180. extern    tsize_t TIFFWriteEncodedTile(TIFF*, ttile_t, tdata_t, tsize_t);
  181. extern    tsize_t TIFFWriteRawTile(TIFF*, ttile_t, tdata_t, tsize_t);
  182. extern    void TIFFSetWriteOffset(TIFF*, toff_t);
  183. extern    void TIFFSwabShort(uint16 *);
  184. extern    void TIFFSwabLong(uint32 *);
  185. extern    void TIFFSwabArrayOfShort(uint16 *, unsigned long);
  186. extern    void TIFFSwabArrayOfLong(uint32 *, unsigned long);
  187. extern    void TIFFReverseBits(unsigned char *, unsigned long);
  188. extern    const unsigned char* TIFFGetBitRevTable(int);
  189.  
  190. extern    void TIFFModeCCITTFax3(TIFF* tif, int isClassF);    /* XXX */
  191. #if defined(__cplusplus)
  192. }
  193. #endif
  194. #endif /* _TIFFIO_ */
  195.