added tag ignore API for Bruce Cameron <cameron@petris.com>
This commit is contained in:
parent
8deaff17c2
commit
ba9f0c9cca
@ -1,4 +1,4 @@
|
||||
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dir.c,v 1.1 1999-07-27 21:50:27 mike Exp $ */
|
||||
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dir.c,v 1.2 1999-09-08 12:21:13 warmerda Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
@ -1129,3 +1129,54 @@ TIFFUnlinkDirectory(TIFF* tif, tdir_t dirn)
|
||||
tif->tif_curstrip = (tstrip_t) -1;
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* [BFC]
|
||||
*
|
||||
* Author: Bruce Cameron <cameron@petris.com>
|
||||
*
|
||||
* Set a table of tags that are to be replaced during directory process by the
|
||||
* 'IGNORE' state - or return TRUE/FALSE for the requested tag such that
|
||||
* 'ReadDirectory' can use the stored information.
|
||||
*/
|
||||
int
|
||||
TIFFReassignTagToIgnore (enum TIFFIgnoreSense task, int TIFFtagID)
|
||||
{
|
||||
static int TIFFignoretags [FIELD_LAST];
|
||||
static int tagcount = 0 ;
|
||||
int i; /* Loop index */
|
||||
int j; /* Loop index */
|
||||
|
||||
switch (task)
|
||||
{
|
||||
case TIS_STORE:
|
||||
if ( tagcount < (FIELD_LAST - 1) )
|
||||
{
|
||||
for ( j = 0 ; j < tagcount ; ++j )
|
||||
{ /* Do not add duplicate tag */
|
||||
if ( TIFFignoretags [j] == TIFFtagID )
|
||||
return (TRUE) ;
|
||||
}
|
||||
TIFFignoretags [tagcount++] = TIFFtagID ;
|
||||
return (TRUE) ;
|
||||
}
|
||||
break ;
|
||||
|
||||
case TIS_EXTRACT:
|
||||
for ( i = 0 ; i < tagcount ; ++i )
|
||||
{
|
||||
if ( TIFFignoretags [i] == TIFFtagID )
|
||||
return (TRUE) ;
|
||||
}
|
||||
break;
|
||||
|
||||
case TIS_EMPTY:
|
||||
tagcount = 0 ; /* Clear the list */
|
||||
return (TRUE) ;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return (FALSE);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dirread.c,v 1.1 1999-07-27 21:50:27 mike Exp $ */
|
||||
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dirread.c,v 1.2 1999-09-08 12:21:13 warmerda Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
@ -210,11 +210,17 @@ TIFFReadDirectory(TIFF* tif)
|
||||
*/
|
||||
fix = 0;
|
||||
for (dp = dir, n = dircount; n > 0; n--, dp++) {
|
||||
/*
|
||||
* Find the field information entry for this tag.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Find the field information entry for this tag.
|
||||
* Added check for tags to ignore ... [BFC]
|
||||
*/
|
||||
if( TIFFReassignTagToIgnore(TIS_EXTRACT, dp->tdir_tag) )
|
||||
dp->tdir_tag = IGNORE;
|
||||
|
||||
if (dp->tdir_tag == IGNORE)
|
||||
continue;
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Silicon Beach (at least) writes unordered
|
||||
* directory tags (violating the spec). Handle
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tiff.h,v 1.1 1999-07-27 21:50:27 mike Exp $ */
|
||||
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tiff.h,v 1.2 1999-09-08 12:21:13 warmerda Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
@ -69,6 +69,14 @@ typedef unsigned long uint32; /* sizeof (uint32) must == 4 */
|
||||
#endif
|
||||
#endif /* _TIFF_DATA_TYPEDEFS_ */
|
||||
|
||||
/* For TIFFReassignTagToIgnore */
|
||||
enum TIFFIgnoreSense /* IGNORE tag table */
|
||||
{
|
||||
TIS_STORE,
|
||||
TIS_EXTRACT,
|
||||
TIS_EMPTY
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
uint16 tiff_magic; /* magic number (defines byte order) */
|
||||
uint16 tiff_version; /* TIFF version number */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tiffio.h,v 1.2 1999-08-16 17:43:03 warmerda Exp $ */
|
||||
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tiffio.h,v 1.3 1999-09-08 12:21:13 warmerda Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
@ -258,6 +258,8 @@ extern int TIFFUnlinkDirectory(TIFF*, tdir_t);
|
||||
extern int TIFFSetField(TIFF*, ttag_t, ...);
|
||||
extern int TIFFVSetField(TIFF*, ttag_t, va_list);
|
||||
extern int TIFFWriteDirectory(TIFF *);
|
||||
extern int TIFFReassignTagToIgnore(enum TIFFIgnoreSense, int);
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
extern void TIFFPrintDirectory(TIFF*, FILE*, long = 0);
|
||||
extern int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t = 0);
|
||||
|
Loading…
Reference in New Issue
Block a user