diff options
author | tgl <tgl> | 2012-07-29 15:45:29 +0000 |
---|---|---|
committer | tgl <tgl> | 2012-07-29 15:45:29 +0000 |
commit | a72cc4a4e23feb36614b423c4b545fcd881087fa (patch) | |
tree | bb8b9656c9f261b3a110268b414236c8f30aeee4 | |
parent | ca8d7a84ca0cb8201fa0d53ad21cb1d8b6ae6163 (diff) | |
download | libtiff-a72cc4a4e23feb36614b423c4b545fcd881087fa.tar.gz |
Add accessor functions for the opaque type TIFFField.
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | configure.com | 14 | ||||
-rw-r--r-- | libtiff/libtiff.def | 6 | ||||
-rw-r--r-- | libtiff/tif_dirinfo.c | 38 | ||||
-rw-r--r-- | libtiff/tiffio.h | 9 | ||||
-rw-r--r-- | man/Makefile.am | 6 | ||||
-rw-r--r-- | man/TIFFFieldDataType.3tiff | 53 | ||||
-rw-r--r-- | man/TIFFFieldName.3tiff | 52 | ||||
-rw-r--r-- | man/TIFFFieldPassCount.3tiff | 73 | ||||
-rw-r--r-- | man/TIFFFieldReadCount.3tiff | 77 | ||||
-rw-r--r-- | man/TIFFFieldTag.3tiff | 56 | ||||
-rw-r--r-- | man/TIFFFieldWriteCount.3tiff | 88 | ||||
-rw-r--r-- | man/libtiff.3tiff | 11 | ||||
-rw-r--r-- | tools/tiffset.c | 65 |
14 files changed, 521 insertions, 37 deletions
@@ -1,3 +1,13 @@ +2012-07-26 Tom Lane <tgl@sss.pgh.pa.us> + + * libtiff/{tiffio.h, tif_dirinfo.c, libtiff.def}: Add six new + functions TIFFFieldTag(), TIFFFieldName(), TIFFFieldDataType(), + TIFFFieldPassCount(), TIFFFieldReadCount(), TIFFFieldWriteCount() + as external accessors for the opaque type TIFFField. + + * tools/tiffset.c: Make tiffset use the above functions instead of + relying on library private headers. + 2012-07-19 Tom Lane <tgl@sss.pgh.pa.us> * tools/tiff2pdf.c: Fix two places where t2p_error didn't get set diff --git a/configure.com b/configure.com index 9572cc3d..22675172 100644 --- a/configure.com +++ b/configure.com @@ -1,4 +1,4 @@ -$! $Id: configure.com,v 1.2 2007-11-23 10:01:34 dron Exp $ +$! $Id: configure.com,v 1.3 2012-07-29 15:45:29 tgl Exp $ $! $! OpenVMS configure procedure for libtiff $! (c) Alexey Chupahin 22-NOV-2007 @@ -503,6 +503,12 @@ TIFFFindFieldInfo=PROCEDURE,- TIFFFindFieldInfoByName=PROCEDURE,- TIFFFieldWithName=PROCEDURE,- TIFFFieldWithTag=PROCEDURE,- +TIFFFieldTag=PROCEDURE,- +TIFFFieldName=PROCEDURE,- +TIFFFieldDataType=PROCEDURE,- +TIFFFieldPassCount=PROCEDURE,- +TIFFFieldReadCount=PROCEDURE,- +TIFFFieldWriteCount=PROCEDURE,- TIFFCurrentDirOffset=PROCEDURE,- TIFFWriteCheck=PROCEDURE,- TIFFRGBAImageOK=PROCEDURE,- @@ -648,6 +654,12 @@ UNIVERSAL=TIFFFindFieldInfo UNIVERSAL=TIFFFindFieldInfoByName UNIVERSAL=TIFFFieldWithName UNIVERSAL=TIFFFieldWithTag +UNIVERSAL=TIFFFieldTag +UNIVERSAL=TIFFFieldName +UNIVERSAL=TIFFFieldDataType +UNIVERSAL=TIFFFieldPassCount +UNIVERSAL=TIFFFieldReadCount +UNIVERSAL=TIFFFieldWriteCount UNIVERSAL=TIFFCurrentDirOffset UNIVERSAL=TIFFWriteCheck UNIVERSAL=TIFFRGBAImageOK diff --git a/libtiff/libtiff.def b/libtiff/libtiff.def index b62fdd08..892ad23e 100644 --- a/libtiff/libtiff.def +++ b/libtiff/libtiff.def @@ -119,6 +119,12 @@ EXPORTS TIFFOpen TIFFSetTagExtender TIFFFieldWithName TIFFFieldWithTag + TIFFFieldTag + TIFFFieldName + TIFFFieldDataType + TIFFFieldPassCount + TIFFFieldReadCount + TIFFFieldWriteCount TIFFCurrentDirOffset TIFFWriteCheck TIFFRGBAImageOK diff --git a/libtiff/tif_dirinfo.c b/libtiff/tif_dirinfo.c index f9506bb2..6baa27fc 100644 --- a/libtiff/tif_dirinfo.c +++ b/libtiff/tif_dirinfo.c @@ -1,4 +1,4 @@ -/* $Id: tif_dirinfo.c,v 1.115 2012-07-06 19:18:31 bfriesen Exp $ */ +/* $Id: tif_dirinfo.c,v 1.116 2012-07-29 15:45:29 tgl Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -556,6 +556,42 @@ TIFFFieldWithName(TIFF* tif, const char *field_name) return (fip); } +uint32 +TIFFFieldTag(const TIFFField* fip) +{ + return fip->field_tag; +} + +const char * +TIFFFieldName(const TIFFField* fip) +{ + return fip->field_name; +} + +TIFFDataType +TIFFFieldDataType(const TIFFField* fip) +{ + return fip->field_type; +} + +int +TIFFFieldPassCount(const TIFFField* fip) +{ + return fip->field_passcount; +} + +int +TIFFFieldReadCount(const TIFFField* fip) +{ + return fip->field_readcount; +} + +int +TIFFFieldWriteCount(const TIFFField* fip) +{ + return fip->field_writecount; +} + const TIFFField* _TIFFFindOrRegisterField(TIFF *tif, uint32 tag, TIFFDataType dt) diff --git a/libtiff/tiffio.h b/libtiff/tiffio.h index c88ca190..038b6701 100644 --- a/libtiff/tiffio.h +++ b/libtiff/tiffio.h @@ -1,4 +1,4 @@ -/* $Id: tiffio.h,v 1.90 2012-06-06 04:58:00 fwarmerdam Exp $ */ +/* $Id: tiffio.h,v 1.91 2012-07-29 15:45:29 tgl Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -319,6 +319,13 @@ extern const TIFFField* TIFFFindField(TIFF *, uint32, TIFFDataType); extern const TIFFField* TIFFFieldWithTag(TIFF*, uint32); extern const TIFFField* TIFFFieldWithName(TIFF*, const char *); +extern uint32 TIFFFieldTag(const TIFFField*); +extern const char* TIFFFieldName(const TIFFField*); +extern TIFFDataType TIFFFieldDataType(const TIFFField*); +extern int TIFFFieldPassCount(const TIFFField*); +extern int TIFFFieldReadCount(const TIFFField*); +extern int TIFFFieldWriteCount(const TIFFField*); + typedef int (*TIFFVSetMethod)(TIFF*, uint32, va_list); typedef int (*TIFFVGetMethod)(TIFF*, uint32, va_list); typedef void (*TIFFPrintMethod)(TIFF*, FILE*, long); diff --git a/man/Makefile.am b/man/Makefile.am index 745912bf..bcad9ba7 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -59,6 +59,12 @@ dist_man3_MANS = \ TIFFcolor.3tiff \ TIFFDataWidth.3tiff \ TIFFError.3tiff \ + TIFFFieldDataType.3tiff \ + TIFFFieldName.3tiff \ + TIFFFieldPassCount.3tiff \ + TIFFFieldReadCount.3tiff \ + TIFFFieldTag.3tiff \ + TIFFFieldWriteCount.3tiff \ TIFFFlush.3tiff \ TIFFGetField.3tiff \ TIFFmemory.3tiff \ diff --git a/man/TIFFFieldDataType.3tiff b/man/TIFFFieldDataType.3tiff new file mode 100644 index 00000000..3efe6974 --- /dev/null +++ b/man/TIFFFieldDataType.3tiff @@ -0,0 +1,53 @@ +.\" $Id: TIFFFieldDataType.3tiff,v 1.1 2012-07-29 15:45:29 tgl Exp $ +.\" +.\" Copyright (c) 2012, Tom Lane <tgl@sss.pgh.pa.us> +.\" +.\" Permission to use, copy, modify, distribute, and sell this software and +.\" its documentation for any purpose is hereby granted without fee, provided +.\" that (i) the above copyright notices and this permission notice appear in +.\" all copies of the software and related documentation, and (ii) the names of +.\" Sam Leffler and Silicon Graphics may not be used in any advertising or +.\" publicity relating to the software without the specific, prior written +.\" permission of Sam Leffler and Silicon Graphics. +.\" +.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +.\" +.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +.\" OF THIS SOFTWARE. +.\" +.if n .po 0 +.TH TIFFFieldDataType 3TIFF "July 26, 2012" "libtiff" +.SH NAME +TIFFFieldDataType \- Get TIFF data type from field information +.SH SYNOPSIS +.B "#include <tiffio.h>" +.sp +.BI "TIFFDataType TIFFFieldDataType(const TIFFField* " fip ")" +.SH DESCRIPTION +.BR TIFFFieldDataType +returns the data type stored in a TIFF field. +.P +.I fip +is a field information pointer previously returned by +.BR TIFFFindField , +.BR TIFFFieldWithTag , +or +.BR TIFFFieldWithName . +.br +.SH "RETURN VALUES" +.br +.BR TIFFFieldDataType +returns a member of the enum type +.BR TIFFDataType . +.br +.SH "SEE ALSO" +.BR libtiff (3TIFF), +.PP +Libtiff library home page: +.BR http://www.remotesensing.org/libtiff/ diff --git a/man/TIFFFieldName.3tiff b/man/TIFFFieldName.3tiff new file mode 100644 index 00000000..2755d181 --- /dev/null +++ b/man/TIFFFieldName.3tiff @@ -0,0 +1,52 @@ +.\" $Id: TIFFFieldName.3tiff,v 1.1 2012-07-29 15:45:29 tgl Exp $ +.\" +.\" Copyright (c) 2012, Tom Lane <tgl@sss.pgh.pa.us> +.\" +.\" Permission to use, copy, modify, distribute, and sell this software and +.\" its documentation for any purpose is hereby granted without fee, provided +.\" that (i) the above copyright notices and this permission notice appear in +.\" all copies of the software and related documentation, and (ii) the names of +.\" Sam Leffler and Silicon Graphics may not be used in any advertising or +.\" publicity relating to the software without the specific, prior written +.\" permission of Sam Leffler and Silicon Graphics. +.\" +.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +.\" +.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +.\" OF THIS SOFTWARE. +.\" +.if n .po 0 +.TH TIFFFieldName 3TIFF "July 26, 2012" "libtiff" +.SH NAME +TIFFFieldName \- Get TIFF field name from field information +.SH SYNOPSIS +.B "#include <tiffio.h>" +.sp +.BI "const char* TIFFFieldName(const TIFFField* " fip ")" +.SH DESCRIPTION +.BR TIFFFieldName +returns the textual name for a TIFF field. +.P +.I fip +is a field information pointer previously returned by +.BR TIFFFindField , +.BR TIFFFieldWithTag , +or +.BR TIFFFieldWithName . +.br +.SH "RETURN VALUES" +.br +.BR TIFFFieldName +returns a constant C string. +.br +.SH "SEE ALSO" +.BR libtiff (3TIFF), +.PP +Libtiff library home page: +.BR http://www.remotesensing.org/libtiff/ diff --git a/man/TIFFFieldPassCount.3tiff b/man/TIFFFieldPassCount.3tiff new file mode 100644 index 00000000..8f3c5d0d --- /dev/null +++ b/man/TIFFFieldPassCount.3tiff @@ -0,0 +1,73 @@ +.\" $Id: TIFFFieldPassCount.3tiff,v 1.1 2012-07-29 15:45:29 tgl Exp $ +.\" +.\" Copyright (c) 2012, Tom Lane <tgl@sss.pgh.pa.us> +.\" +.\" Permission to use, copy, modify, distribute, and sell this software and +.\" its documentation for any purpose is hereby granted without fee, provided +.\" that (i) the above copyright notices and this permission notice appear in +.\" all copies of the software and related documentation, and (ii) the names of +.\" Sam Leffler and Silicon Graphics may not be used in any advertising or +.\" publicity relating to the software without the specific, prior written +.\" permission of Sam Leffler and Silicon Graphics. +.\" +.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +.\" +.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +.\" OF THIS SOFTWARE. +.\" +.if n .po 0 +.TH TIFFFieldPassCount 3TIFF "July 26, 2012" "libtiff" +.SH NAME +TIFFFieldPassCount \- Get whether to pass a count to TIFFGet/SetField +.SH SYNOPSIS +.B "#include <tiffio.h>" +.sp +.BI "int TIFFFieldPassCount(const TIFFField* " fip ")" +.SH DESCRIPTION +.BR TIFFFieldPassCount +returns true (nonzero) if +.BR TIFFGetField +and +.BR TIFFSetField +expect a +.I count +value to be passed before the actual data pointer. +.P +.I fip +is a field information pointer previously returned by +.BR TIFFFindField , +.BR TIFFFieldWithTag , +or +.BR TIFFFieldWithName . +.P +When a +.I count +is required, it will be of type +.BR uint32 +when +.BR TIFFFieldReadCount +reports +.BR TIFF_VARIABLE2 , +and of type +.BR uint16 +otherwise. (This distinction is critical for use of +.BR TIFFGetField , +but normally not so for use of +.BR TIFFSetField .) +.br +.SH "RETURN VALUES" +.br +.BR TIFFFieldPassCount +returns an integer that is always 1 (true) or 0 (false). +.br +.SH "SEE ALSO" +.BR libtiff (3TIFF), +.PP +Libtiff library home page: +.BR http://www.remotesensing.org/libtiff/ diff --git a/man/TIFFFieldReadCount.3tiff b/man/TIFFFieldReadCount.3tiff new file mode 100644 index 00000000..cdb5858a --- /dev/null +++ b/man/TIFFFieldReadCount.3tiff @@ -0,0 +1,77 @@ +.\" $Id: TIFFFieldReadCount.3tiff,v 1.1 2012-07-29 15:45:30 tgl Exp $ +.\" +.\" Copyright (c) 2012, Tom Lane <tgl@sss.pgh.pa.us> +.\" +.\" Permission to use, copy, modify, distribute, and sell this software and +.\" its documentation for any purpose is hereby granted without fee, provided +.\" that (i) the above copyright notices and this permission notice appear in +.\" all copies of the software and related documentation, and (ii) the names of +.\" Sam Leffler and Silicon Graphics may not be used in any advertising or +.\" publicity relating to the software without the specific, prior written +.\" permission of Sam Leffler and Silicon Graphics. +.\" +.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +.\" +.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +.\" OF THIS SOFTWARE. +.\" +.if n .po 0 +.TH TIFFFieldReadCount 3TIFF "July 26, 2012" "libtiff" +.SH NAME +TIFFFieldReadCount \- Get number of values to be read from field +.SH SYNOPSIS +.B "#include <tiffio.h>" +.sp +.BI "int TIFFFieldReadCount(const TIFFField* " fip ")" +.SH DESCRIPTION +.BR TIFFFieldReadCount +returns the number of values available to be read from the specified +TIFF field; that is, the number of arguments that should be supplied to +.BR TIFFGetField . +For most field types this is a small positive integer, typically 1 or 2, +but there are some special values: +.br +.BR TIFF_VARIABLE +indicates that a variable number of values is possible; then, a +.BR uint16 +.I count +argument and a pointer +.I data +argument must be supplied to +.BR TIFFGetField . +.br +.BR TIFF_VARIABLE2 +is the same as +.BR TIFF_VARIABLE +except that the +.I count +argument must have type +.BR uint32 . +.br +.BR TIFF_SPP +indicates that the number of arguments is equal to the image's +number of samples per pixel. +.P +.I fip +is a field information pointer previously returned by +.BR TIFFFindField , +.BR TIFFFieldWithTag , +or +.BR TIFFFieldWithName . +.br +.SH "RETURN VALUES" +.br +.BR TIFFFieldReadCount +returns an integer. +.br +.SH "SEE ALSO" +.BR libtiff (3TIFF), +.PP +Libtiff library home page: +.BR http://www.remotesensing.org/libtiff/ diff --git a/man/TIFFFieldTag.3tiff b/man/TIFFFieldTag.3tiff new file mode 100644 index 00000000..bf8174e2 --- /dev/null +++ b/man/TIFFFieldTag.3tiff @@ -0,0 +1,56 @@ +.\" $Id: TIFFFieldTag.3tiff,v 1.1 2012-07-29 15:45:30 tgl Exp $ +.\" +.\" Copyright (c) 2012, Tom Lane <tgl@sss.pgh.pa.us> +.\" +.\" Permission to use, copy, modify, distribute, and sell this software and +.\" its documentation for any purpose is hereby granted without fee, provided +.\" that (i) the above copyright notices and this permission notice appear in +.\" all copies of the software and related documentation, and (ii) the names of +.\" Sam Leffler and Silicon Graphics may not be used in any advertising or +.\" publicity relating to the software without the specific, prior written +.\" permission of Sam Leffler and Silicon Graphics. +.\" +.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +.\" +.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +.\" OF THIS SOFTWARE. +.\" +.if n .po 0 +.TH TIFFFieldTag 3TIFF "July 26, 2012" "libtiff" +.SH NAME +TIFFFieldTag \- Get TIFF field tag value from field information +.SH SYNOPSIS +.B "#include <tiffio.h>" +.sp +.BI "uint32 TIFFFieldTag(const TIFFField* " fip ")" +.SH DESCRIPTION +.BR TIFFFieldTag +returns the numeric tag value for a TIFF field. +This can be compared to various constants exported by the +.BR libtiff +header files, such as +.BR TIFFTAG_IMAGEWIDTH . +.P +.I fip +is a field information pointer previously returned by +.BR TIFFFindField , +.BR TIFFFieldWithTag , +or +.BR TIFFFieldWithName . +.br +.SH "RETURN VALUES" +.br +.BR TIFFFieldTag +returns an integer tag value. +.br +.SH "SEE ALSO" +.BR libtiff (3TIFF), +.PP +Libtiff library home page: +.BR http://www.remotesensing.org/libtiff/ diff --git a/man/TIFFFieldWriteCount.3tiff b/man/TIFFFieldWriteCount.3tiff new file mode 100644 index 00000000..63305320 --- /dev/null +++ b/man/TIFFFieldWriteCount.3tiff @@ -0,0 +1,88 @@ +.\" $Id: TIFFFieldWriteCount.3tiff,v 1.1 2012-07-29 15:45:30 tgl Exp $ +.\" +.\" Copyright (c) 2012, Tom Lane <tgl@sss.pgh.pa.us> +.\" +.\" Permission to use, copy, modify, distribute, and sell this software and +.\" its documentation for any purpose is hereby granted without fee, provided +.\" that (i) the above copyright notices and this permission notice appear in +.\" all copies of the software and related documentation, and (ii) the names of +.\" Sam Leffler and Silicon Graphics may not be used in any advertising or +.\" publicity relating to the software without the specific, prior written +.\" permission of Sam Leffler and Silicon Graphics. +.\" +.\" THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +.\" EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +.\" WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +.\" +.\" IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +.\" ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +.\" OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +.\" WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +.\" LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +.\" OF THIS SOFTWARE. +.\" +.if n .po 0 +.TH TIFFFieldWriteCount 3TIFF "July 26, 2012" "libtiff" +.SH NAME +TIFFFieldWriteCount \- Get number of values to be written to field +.SH SYNOPSIS +.B "#include <tiffio.h>" +.sp +.BI "int TIFFFieldWriteCount(const TIFFField* " fip ")" +.SH DESCRIPTION +.BR TIFFFieldWriteCount +returns the number of values to be written into the specified +TIFF field; that is, the number of arguments that should be supplied to +.BR TIFFSetField . +For most field types this is a small positive integer, typically 1 or 2, +but there are some special values: +.br +.BR TIFF_VARIABLE +indicates that a variable number of values is possible; then, a +.BR uint16 +.I count +argument and a pointer +.I data +argument must be supplied to +.BR TIFFSetField . +.br +.BR TIFF_VARIABLE2 +is the same as +.BR TIFF_VARIABLE +except that the +.I count +argument must have type +.BR uint32 . +(On most modern machines, this makes no practical difference, and the +.I count +argument can simply be an +.BR int +in either case.) +.br +.BR TIFF_SPP +indicates that the number of arguments must be equal to the image's +number of samples per pixel. +.P +.I fip +is a field information pointer previously returned by +.BR TIFFFindField , +.BR TIFFFieldWithTag , +or +.BR TIFFFieldWithName . +.P +For most field types, +.BR TIFFFieldWriteCount +returns the same value as +.BR TIFFFieldReadCount , +but there are some exceptions. +.br +.SH "RETURN VALUES" +.br +.BR TIFFFieldWriteCount +returns an integer. +.br +.SH "SEE ALSO" +.BR libtiff (3TIFF), +.PP +Libtiff library home page: +.BR http://www.remotesensing.org/libtiff/ diff --git a/man/libtiff.3tiff b/man/libtiff.3tiff index 710f9085..59895d62 100644 --- a/man/libtiff.3tiff +++ b/man/libtiff.3tiff @@ -1,4 +1,4 @@ -.\" $Id: libtiff.3tiff,v 1.3 2005-11-02 11:07:19 dron Exp $ +.\" $Id: libtiff.3tiff,v 1.4 2012-07-29 15:45:30 tgl Exp $ .\" .\" Copyright (c) 1988-1997 Sam Leffler .\" Copyright (c) 1991-1997 Silicon Graphics, Inc. @@ -163,9 +163,18 @@ TIFFCurrentTile return index of current tile TIFFDataWidth return the size of TIFF data types TIFFError library error handler TIFFFdOpen open a file for reading or writing +TIFFFieldDataType get data type from field information +TIFFFieldName get field name from field information +TIFFFieldPassCount get whether to pass a value count to Get/SetField +TIFFFieldReadCount get number of values to be read from field +TIFFFieldTag get tag value from field information +TIFFFieldWithName get field information given field name +TIFFFieldWithTag get field information given tag +TIFFFieldWriteCount get number of values to be written to field TIFFFileName return name of open file TIFFFileno return open file descriptor TIFFFindCODEC find standard codec for the specific scheme +TIFFFindField get field information given tag and data type TIFFFlush flush all pending writes TIFFFlushData flush pending data writes TIFFGetBitRevTable return bit reversal table diff --git a/tools/tiffset.c b/tools/tiffset.c index b9e58364..3b4b9f0e 100644 --- a/tools/tiffset.c +++ b/tools/tiffset.c @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: tiffset.c,v 1.16 2011-03-26 12:07:20 fwarmerdam Exp $ + * $Id: tiffset.c,v 1.17 2012-07-29 15:45:30 tgl Exp $ * * Project: libtiff tools * Purpose: Mainline for setting metadata in existing TIFF files. @@ -35,7 +35,6 @@ #include <stdlib.h> #include "tiffio.h" -#include "tif_dir.h" static char* usageMsg[] = { "usage: tiffset [options] filename", @@ -118,25 +117,25 @@ main(int argc, char* argv[]) return 3; arg_index++; - if (fip->field_type == TIFF_ASCII) { - if (TIFFSetField(tiff, fip->field_tag, argv[arg_index]) != 1) + if (TIFFFieldDataType(fip) == TIFF_ASCII) { + if (TIFFSetField(tiff, TIFFFieldTag(fip), argv[arg_index]) != 1) fprintf( stderr, "Failed to set %s=%s\n", - fip->field_name, argv[arg_index] ); - } else if (fip->field_writecount > 0 - || fip->field_writecount == TIFF_VARIABLE) { + TIFFFieldName(fip), argv[arg_index] ); + } else if (TIFFFieldWriteCount(fip) > 0 + || TIFFFieldWriteCount(fip) == TIFF_VARIABLE) { int ret = 1; short wc; - if (fip->field_writecount == TIFF_VARIABLE) + if (TIFFFieldWriteCount(fip) == TIFF_VARIABLE) wc = atoi(argv[arg_index++]); else - wc = fip->field_writecount; + wc = TIFFFieldWriteCount(fip); if (argc - arg_index < wc) { fprintf( stderr, "Number of tag values is not enough. " "Expected %d values for %s tag, got %d\n", - wc, fip->field_name, argc - arg_index); + wc, TIFFFieldName(fip), argc - arg_index); return 4; } @@ -144,7 +143,7 @@ main(int argc, char* argv[]) int i, size; void *array; - switch (fip->field_type) { + switch (TIFFFieldDataType(fip)) { /* * XXX: We can't use TIFFDataWidth() * to determine the space needed to store @@ -186,7 +185,7 @@ main(int argc, char* argv[]) return 4; } - switch (fip->field_type) { + switch (TIFFFieldDataType(fip)) { case TIFF_BYTE: for (i = 0; i < wc; i++) ((uint8 *)array)[i] = atoi(argv[arg_index+i]); @@ -226,49 +225,49 @@ main(int argc, char* argv[]) break; } - if (fip->field_passcount) { - ret = TIFFSetField(tiff, fip->field_tag, + if (TIFFFieldPassCount(fip)) { + ret = TIFFSetField(tiff, TIFFFieldTag(fip), wc, array); - } else if (fip->field_tag == TIFFTAG_PAGENUMBER - || fip->field_tag == TIFFTAG_HALFTONEHINTS - || fip->field_tag == TIFFTAG_YCBCRSUBSAMPLING - || fip->field_tag == TIFFTAG_DOTRANGE) { - if (fip->field_type == TIFF_BYTE) { - ret = TIFFSetField(tiff, fip->field_tag, + } else if (TIFFFieldTag(fip) == TIFFTAG_PAGENUMBER + || TIFFFieldTag(fip) == TIFFTAG_HALFTONEHINTS + || TIFFFieldTag(fip) == TIFFTAG_YCBCRSUBSAMPLING + || TIFFFieldTag(fip) == TIFFTAG_DOTRANGE) { + if (TIFFFieldDataType(fip) == TIFF_BYTE) { + ret = TIFFSetField(tiff, TIFFFieldTag(fip), ((uint8 *)array)[0], ((uint8 *)array)[1]); - } else if (fip->field_type == TIFF_SHORT) { - ret = TIFFSetField(tiff, fip->field_tag, + } else if (TIFFFieldDataType(fip) == TIFF_SHORT) { + ret = TIFFSetField(tiff, TIFFFieldTag(fip), ((uint16 *)array)[0], ((uint16 *)array)[1]); } } else { - ret = TIFFSetField(tiff, fip->field_tag, + ret = TIFFSetField(tiff, TIFFFieldTag(fip), array); } _TIFFfree(array); } else { - switch (fip->field_type) { + switch (TIFFFieldDataType(fip)) { case TIFF_BYTE: case TIFF_SHORT: case TIFF_SBYTE: case TIFF_SSHORT: - ret = TIFFSetField(tiff, fip->field_tag, + ret = TIFFSetField(tiff, TIFFFieldTag(fip), atoi(argv[arg_index++])); break; case TIFF_LONG: case TIFF_SLONG: case TIFF_IFD: - ret = TIFFSetField(tiff, fip->field_tag, + ret = TIFFSetField(tiff, TIFFFieldTag(fip), atol(argv[arg_index++])); break; case TIFF_DOUBLE: - ret = TIFFSetField(tiff, fip->field_tag, + ret = TIFFSetField(tiff, TIFFFieldTag(fip), atof(argv[arg_index++])); break; case TIFF_RATIONAL: case TIFF_SRATIONAL: case TIFF_FLOAT: - ret = TIFFSetField(tiff, fip->field_tag, + ret = TIFFSetField(tiff, TIFFFieldTag(fip), (float)atof(argv[arg_index++])); break; default: @@ -277,7 +276,7 @@ main(int argc, char* argv[]) } if (ret != 1) - fprintf(stderr, "Failed to set %s\n", fip->field_name); + fprintf(stderr, "Failed to set %s\n", TIFFFieldName(fip)); arg_index += wc; } } else if (strcmp(argv[arg_index],"-sf") == 0 && arg_index < argc-3) { @@ -292,10 +291,10 @@ main(int argc, char* argv[]) if (!fip) return 3; - if (fip->field_type != TIFF_ASCII) { + if (TIFFFieldDataType(fip) != TIFF_ASCII) { fprintf( stderr, "Only ASCII tags can be set from file. " - "%s is not ASCII tag.\n", fip->field_name ); + "%s is not ASCII tag.\n", TIFFFieldName(fip) ); return 5; } @@ -312,9 +311,9 @@ main(int argc, char* argv[]) fclose( fp ); - if(TIFFSetField( tiff, fip->field_tag, text ) != 1) { + if(TIFFSetField( tiff, TIFFFieldTag(fip), text ) != 1) { fprintf(stderr, "Failed to set %s from file %s\n", - fip->field_name, argv[arg_index]); + TIFFFieldName(fip), argv[arg_index]); } _TIFFfree( text ); |