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