roentgen b75cab
.\" $Id: TIFFWriteScanline.3tiff,v 1.2 2005-11-02 11:07:18 dron Exp $
roentgen b75cab
.\"
roentgen b75cab
.\" Copyright (c) 1988-1997 Sam Leffler
roentgen b75cab
.\" Copyright (c) 1991-1997 Silicon Graphics, Inc.
roentgen b75cab
.\"
roentgen b75cab
.\" Permission to use, copy, modify, distribute, and sell this software and 
roentgen b75cab
.\" its documentation for any purpose is hereby granted without fee, provided
roentgen b75cab
.\" that (i) the above copyright notices and this permission notice appear in
roentgen b75cab
.\" all copies of the software and related documentation, and (ii) the names of
roentgen b75cab
.\" Sam Leffler and Silicon Graphics may not be used in any advertising or
roentgen b75cab
.\" publicity relating to the software without the specific, prior written
roentgen b75cab
.\" permission of Sam Leffler and Silicon Graphics.
roentgen b75cab
.\" 
roentgen b75cab
.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
roentgen b75cab
.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
roentgen b75cab
.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
roentgen b75cab
.\" 
roentgen b75cab
.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
roentgen b75cab
.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
roentgen b75cab
.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
roentgen b75cab
.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
roentgen b75cab
.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
roentgen b75cab
.\" OF THIS SOFTWARE.
roentgen b75cab
.\"
roentgen b75cab
.if n .po 0
roentgen b75cab
.TH TIFFWriteScanline 3TIFF "December 16, 1991" "libtiff"
roentgen b75cab
.SH NAME
roentgen b75cab
TIFFWriteScanline \- write a scanline to an open
roentgen b75cab
.SM TIFF
roentgen b75cab
file
roentgen b75cab
.SH SYNOPSIS
roentgen b75cab
.B "#include <tiffio.h>"</tiffio.h>
roentgen b75cab
.sp
roentgen b75cab
.BI "int TIFFWriteScanline(TIFF *" tif ", tdata_t " buf ", uint32 " row ", tsample_t " sample ")"
roentgen b75cab
.SH DESCRIPTION
roentgen b75cab
Write data to a file at the specified row. The
roentgen b75cab
.I sample
roentgen b75cab
parameter is used only if data are organized in separate planes (\c
roentgen b75cab
.IR PlanarConfiguration =2).
roentgen b75cab
The data are assumed to be uncompressed and in the native bit- and byte-order
roentgen b75cab
of the host machine. The data written to the file is compressed according to
roentgen b75cab
the compression scheme of the current
roentgen b75cab
.SM TIFF
roentgen b75cab
directory (see further below). If the current scanline is past the end of the
roentgen b75cab
current subfile, the
roentgen b75cab
.I ImageLength
roentgen b75cab
field is automatically increased to include the scanline (except
roentgen b75cab
for
roentgen b75cab
.IR PlanarConfiguration =2,
roentgen b75cab
where the
roentgen b75cab
.I ImageLength
roentgen b75cab
cannot be changed once the first data are written). If the
roentgen b75cab
.I ImageLength
roentgen b75cab
is increased, the
roentgen b75cab
.I StripOffsets
roentgen b75cab
and
roentgen b75cab
.I StripByteCounts
roentgen b75cab
fields are similarly enlarged to reflect data written past the previous end of
roentgen b75cab
image.
roentgen b75cab
.SH NOTES
roentgen b75cab
The library writes encoded data using the native machine byte order. Correctly
roentgen b75cab
implemented
roentgen b75cab
.SM TIFF
roentgen b75cab
readers are expected to do any necessary byte-swapping to correctly process
roentgen b75cab
image data with BitsPerSample greater than 8. The library attempts to hide
roentgen b75cab
bit-ordering differences between the image and the native machine by
roentgen b75cab
converting data from the native machine order.
roentgen b75cab
.PP
roentgen b75cab
In C++ the
roentgen b75cab
.I sample
roentgen b75cab
parameter defaults to 0.
roentgen b75cab
.PP
roentgen b75cab
Once data are written to a file for the current directory, the values of
roentgen b75cab
certain tags may not be altered; see
roentgen b75cab
.IR TIFFSetField (3TIFF)
roentgen b75cab
for more information.
roentgen b75cab
.PP
roentgen b75cab
It is not possible to write scanlines to a file that uses a tiled
roentgen b75cab
organization.  The routine
roentgen b75cab
.IR TIFFIsTiled
roentgen b75cab
can be used to determine if the file is organized as tiles or strips.
roentgen b75cab
.SH "RETURN VALUES"
roentgen b75cab
.IR TIFFWriteScanline
roentgen b75cab
returns \-1 if it immediately detects an error and 1 for a successful write.
roentgen b75cab
.SH DIAGNOSTICS
roentgen b75cab
All error messages are directed to the
roentgen b75cab
.IR TIFFError (3TIFF)
roentgen b75cab
routine.
roentgen b75cab
.PP
roentgen b75cab
.BR "%s: File not open for writing .
roentgen b75cab
The file was opened for reading, not writing.
roentgen b75cab
.PP
roentgen b75cab
.BR "Can not write scanlines to a tiled image" .
roentgen b75cab
An attempt was made to write a scanline to a tiled image. The image is assumed
roentgen b75cab
to be organized in tiles because the
roentgen b75cab
.I TileWidth
roentgen b75cab
and
roentgen b75cab
.I TileLength
roentgen b75cab
tags have been set with
roentgen b75cab
.IR TIFFSetField (3TIFF).
roentgen b75cab
.PP
roentgen b75cab
.BR "Compression algorithm does not support random access" .
roentgen b75cab
Data was written in a non-sequential order to a file that uses a compression
roentgen b75cab
algorithm and that has
roentgen b75cab
.I RowsPerStrip
roentgen b75cab
greater than one. That is, data in the image is to be stored in a compressed
roentgen b75cab
form, and with multiple rows packed into a strip. In this case, the library
roentgen b75cab
does not support random access to the data. The data should either be written
roentgen b75cab
as entire strips, sequentially by rows, or the value of
roentgen b75cab
.I RowsPerStrip
roentgen b75cab
should be set to one.
roentgen b75cab
.PP
roentgen b75cab
\fB%s: Must set "ImageWidth" before writing data\fP.
roentgen b75cab
The image's width has not be set before the first write.
roentgen b75cab
See
roentgen b75cab
.BR TIFFSetField (3TIFF)
roentgen b75cab
for information on how to do this.
roentgen b75cab
.PP
roentgen b75cab
\fB%s: Must set "PlanarConfiguration" before writing data\fP.
roentgen b75cab
The organization of data has not be defined before the first write.
roentgen b75cab
See
roentgen b75cab
.BR TIFFSetField (3TIFF)
roentgen b75cab
for information on how to do this.
roentgen b75cab
.PP
roentgen b75cab
\fBCan not change "ImageLength" when using separate planes\fP. Separate image
roentgen b75cab
planes are being used (\c
roentgen b75cab
.IR PlanarConfiguration =2),
roentgen b75cab
but the number of rows has not been specified before the first write. The
roentgen b75cab
library supports the dynamic growth of an image only when data are organized
roentgen b75cab
in a contiguous manner (\c
roentgen b75cab
.IR PlanarConfiguration =1).
roentgen b75cab
.PP
roentgen b75cab
.BR "%d: Sample out of range, max %d" .
roentgen b75cab
The
roentgen b75cab
.I sample
roentgen b75cab
parameter was greater than the value of the SamplesPerPixel tag.
roentgen b75cab
.PP
roentgen b75cab
.BR "%s: No space for strip arrays .
roentgen b75cab
There was not enough space for the arrays that hold strip offsets and byte
roentgen b75cab
counts.
roentgen b75cab
.SH BUGS
roentgen b75cab
Writing subsampled YCbCR data does not work correctly because, for 
roentgen b75cab
.IR PlanarConfiguration =2
roentgen b75cab
the size of a scanline is not calculated on a per-sample basis, and for
roentgen b75cab
.IR PlanarConfiguration =1
roentgen b75cab
the library does not pack the block-interleaved samples.
roentgen b75cab
.SH "SEE ALSO"
roentgen b75cab
.BR TIFFOpen (3TIFF),
roentgen b75cab
.BR TIFFWriteEncodedStrip (3TIFF),
roentgen b75cab
.BR TIFFWriteRawStrip (3TIFF),
roentgen b75cab
.BR libtiff (3TIFF)
roentgen b75cab
.PP
roentgen b75cab
Libtiff library home page:
roentgen b75cab
.BR http://www.remotesensing.org/libtiff/