home *** CD-ROM | disk | FTP | other *** search
- Copyright 1990 by John Wiley & Sons, Inc.
- All Rights Reserved.
-
- TIFF Library Functions
-
- DESCRIPTION
-
- This file format is suitable for archiving multi-color and
- monochromatic image data. Directory information may be in either
- little- or big-endian byte order. Byte swapping is automatically
- done by the library. Data may not have more than four samples per
- pixel. Finally, the library does not support files in which the
- BitsPerSample, Compression, MinSampleValue or MaxSampleValue
- fields are defined differently on a per-sample basis (in Rev. 5.0
- the Compression tag is not defined on a per-sample basis, so this
- is immaterial).
-
- Function Summary
-
- This section gives a brief summary of the functions included
- in the library. For more detail see the code.
-
- TIFF *TIFFOpen(filename, mode)
-
- Open a TIFF file whose name is filename and return a handle
- to be used in subsequent calls to functions in libtiff (if the
- operation fails, then a null handle is returned). The mode
- parameter specifies if the file is to be opened for reading "r"
- or writing "w". If an existing file is opened for writing, all
- previous data is overwritten.
-
- If a file is opened for reading, the first TIFF directory in
- the file is automatically read (also see below for reading
- directories other than the first). If a file is opened for
- writing, a default directory is automatically created for writing
- subsequent data. This directory has all the default values
- specified in TIFF Revision 5.0:
-
- a. BitsPerSample =1,
- b. ThreshHolding "=bilevel art scan,"
- c. FillOrder =1 (most significant bit of the byte are
- filled first),
- d. Orientation =1 (the 0th row represents the visual top
- of the image, and the 0th column represents the visual
- left hand side),
- e. SamplesPerPixel =1,
- f. RowsPerStrip =infinity,
- g. GrayResponseUnit =2 (hundredths of a unit),
- h. ColorResponseUnit =2 (hundredths of a unit),
- i. ResolutionUnit =2 (inches), and
- j. Compression =1 (no compression).
-
- To alter these values, or to define values for additional fields,
- the "TIFFSetField" function must be used.
-
- void TIFFClose(tif)
-
- Close a file previously opened with "TIFFOpen". Any buffered
- data is flushed to the file, including the contents of the
- current directory (if modified) and all resources are reclaimed.
-
- CompletionCode TIFFSetField(tif, tag, va_alist)
-
- Set the value of a field in the current directory associated
- with tif. The field is identified by tag, one of the values
- defined in the include file "tiff.h". The actual value is
- specified using a variable argument list, as prescribed by the
- varargs interface. TRUE is returned if the operation was
- successful, FALSE if an error was detected.
-
- CompletionCode TIFFGetField(tif, tag, va_alist)
-
- Return the value of the field in the current directory
- associated with tif. If the field is not recognized, or is not
- defined, then a FALSE is returned. Otherwise, TRUE is returned
- and the value associated with the field is returned in data
- area(s) supplied in the variable argument list.
-
- CompletionCode TIFFReadDirectory(tif)
-
- Read the next directory in the specified file and make it
- the current directory. If the current directory has been
- modified, and the file is opened for writing, first the current
- directory is written out. "TIFFReadDirectory" returns TRUE if the
- next directory was successfully read. Otherwise, FALSE is
- returned if an error was encountered, or if there are no more
- directories to be read. Applications only need to call
- "TIFFReadDirectory" to read multiple subfiles in a single TIFF
- file. Normally the first directory in a file is automatically
- read when "TIFFOpen" is called.
-
- CompletionCode TIFFWriteDirectory(tif)
-
- Write the contents of the current directory to the file and
- setup to create a new subfile in the same file. Applications only
- need to call "TIFFWriteDirectory" when writing multiple subfiles
- to a single TIFF file. "TIFFWriteDirectory" is automatically
- called by "TIFFClose" to write a modified directory if the file
- is open for writing.
-
- CompletionCode TIFFSetDirectory(tif, dirnum)
-
- Seek to a specific directory in file and read the
- directory's contents with "TIFFReadDirectory". The parameter
- dirnum specifies the subfile/directory as an integer number, with
- the first directory numbered zero.
-
- CompletionCode TIFFScanlineSize(tif)
-
- Return the size (in bytes) of a row of data that would be
- returned in a call to "TIFFReadScanline", or that would be
- expected in a call to "TIFFWriteScanline". This size is typically
- used when dynamically allocating I/O buffers.
-
- CompletionCode TIFFReadScanline(tif, buf, row, sample)
-
- Return the data for the specified row in the data buffer
- buf. The data is returned decompressed but otherwise packed. The
- buffer must be large enough to hold an entire scanline of data.
- Applications should call the function "TIFFScanlineSize" to find
- out the size (in bytes) of a scanline buffer. The row parameter
- is always used by "TIFFReadScanline". The sample parameter is
- used only if data is organized in separate planes
- (PlanarConfiguration =2). "TIFFReadScanline" returns FALSE if it
- detects an error; otherwise TRUE is returned.
-
- CompletionCode TIFFWriteScanline(tif, buf, row, sample)
-
- Write data to a file at the specified row. The sample
- parameter is used only if data is organized in separate planes
- (PlanarConfiguration = 2). The data is compressed according to
- the compression scheme of the current TIFF directory.
- TIFFWriteScanline returns FALSE if it detects an error and TRUE
- for a successful write. If the current scanline is past the end
- of the current subfile, the ImageLength field is automatically
- increased to include the scanline (except for PlanarConfiguration
- = 2, where the ImageLength can not be changed once the first data
- is written). If the ImageLength is increased, the StripOffsets
- and StripByteCounts fields are similarly enlarged to reflect data
- written past the previous end of image.
-
- CompletionCode TIFFFlush(tif)
-
- Flush any pending writes for the specified file (including
- writes for the current directory). FALSE is returned if an error
- is encountered, otherwise TRUE. In normal operation this call is
- never needed the library automatically does any flushing
- required.
-
- CompletionCode TIFFFlushData(tif)
-
- Flush any pending data writes for the specified file. FALSE
- is returned if an error is encountered, otherwise TRUE. In normal
- operation this call is never needed the library automatically
- does any flushing required.
-
- void TIFFError(module, fmt, arguments)
-
- Write an error message to stderr. The fmt parameter is a
- printf format string, and any number of arguments can be
- supplied. The module parameter is interpreted as a string that,
- if non-zero, should be printed before the message; it typically
- is used to identify the software module in which an error is
- detected.
-
- void TIFFWarning(module, fmt, arguments)
-
- Write an warning message to the stderr. The parameters are
- treated as described above under "TIFFError".
-
-
-