Make RichTIFFIPTC, Photoshop and ICCProfile tags custom.

This commit is contained in:
Andrey Kiselev 2005-12-21 14:24:41 +00:00
parent f182ef17da
commit 50d7105ee6
3 changed files with 27 additions and 61 deletions

View File

@ -1,4 +1,4 @@
/* $Id: tif_dir.c,v 1.61 2005-12-21 12:23:13 joris Exp $ */
/* $Id: tif_dir.c,v 1.62 2005-12-21 14:24:41 dron Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -394,22 +394,6 @@ _TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
case TIFFTAG_NUMBEROFINKS:
td->td_ninks = (uint16) va_arg(ap, int);
break;
case TIFFTAG_ICCPROFILE:
td->td_profileLength = (uint32) va_arg(ap, uint32);
_TIFFsetByteArray(&td->td_profileData, va_arg(ap, void*),
td->td_profileLength);
break;
case TIFFTAG_PHOTOSHOP:
td->td_photoshopLength = (uint32) va_arg(ap, uint32);
_TIFFsetByteArray (&td->td_photoshopData, va_arg(ap, void*),
td->td_photoshopLength);
break;
case TIFFTAG_RICHTIFFIPTC:
td->td_richtiffiptcLength = (uint32) va_arg(ap, uint32);
_TIFFsetLongArray ((uint32**)&td->td_richtiffiptcData,
va_arg(ap, uint32*),
td->td_richtiffiptcLength);
break;
default: {
const TIFFFieldInfo* fip = _TIFFFindFieldInfo(tif, tag, TIFF_ANY);
TIFFTagValue *tv;
@ -838,18 +822,6 @@ _TIFFVGetField(TIFF* tif, ttag_t tag, va_list ap)
case TIFFTAG_NUMBEROFINKS:
*va_arg(ap, uint16*) = td->td_ninks;
break;
case TIFFTAG_ICCPROFILE:
*va_arg(ap, uint32*) = td->td_profileLength;
*va_arg(ap, void**) = td->td_profileData;
break;
case TIFFTAG_PHOTOSHOP:
*va_arg(ap, uint32*) = td->td_photoshopLength;
*va_arg(ap, void**) = td->td_photoshopData;
break;
case TIFFTAG_RICHTIFFIPTC:
*va_arg(ap, uint32*) = td->td_richtiffiptcLength;
*va_arg(ap, void**) = td->td_richtiffiptcData;
break;
default:
{
@ -1015,9 +987,6 @@ TIFFFreeDirectory(TIFF* tif)
CleanupField(td_transferfunction[0]);
CleanupField(td_transferfunction[1]);
CleanupField(td_transferfunction[2]);
CleanupField(td_profileData);
CleanupField(td_photoshopData);
CleanupField(td_richtiffiptcData);
CleanupField(td_stripoffset);
CleanupField(td_stripbytecount);
@ -1275,7 +1244,8 @@ TIFFUnlinkDirectory(TIFF* tif, tdir_t dirn)
tdir_t n;
if (tif->tif_mode == O_RDONLY) {
TIFFErrorExit(tif->tif_clientdata, module, "Can not unlink directory in read-only file");
TIFFErrorExit(tif->tif_clientdata, module,
"Can not unlink directory in read-only file");
return (0);
}
/*

View File

@ -1,4 +1,4 @@
/* $Id: tif_dir.h,v 1.23 2005-12-12 16:13:18 dron Exp $ */
/* $Id: tif_dir.h,v 1.24 2005-12-21 14:24:41 dron Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -81,15 +81,6 @@ typedef struct {
uint16 td_dotrange[2];
int td_inknameslen;
char* td_inknames;
/* ICC parameters */
uint32 td_profileLength;
void *td_profileData;
/* Adobe Photoshop tag handling */
uint32 td_photoshopLength;
void *td_photoshopData;
/* IPTC parameters */
uint32 td_richtiffiptcLength;
void *td_richtiffiptcData;
int td_customValueCount;
TIFFTagValue *td_customValues;
} TIFFDirectory;
@ -163,9 +154,6 @@ typedef struct {
/* unused - was FIELD_TARGETPRINTER 48 */
#define FIELD_SUBIFD 49
#define FIELD_NUMBEROFINKS 50
#define FIELD_ICCPROFILE 51
#define FIELD_PHOTOSHOP 52
#define FIELD_RICHTIFFIPTC 53
#define FIELD_STONITS 54
/* FIELD_CUSTOM (see tiffio.h) 65 */
/* end of support for well-known tags; codec-private tags follow */
@ -408,13 +396,13 @@ static const TIFFFieldInfo tiffFieldInfo[] = {
{ TIFFTAG_COPYRIGHT, -1, -1, TIFF_ASCII, FIELD_CUSTOM,
1, 0, "Copyright" },
/* end Pixar tags */
{ TIFFTAG_RICHTIFFIPTC, -1, -3, TIFF_LONG, FIELD_RICHTIFFIPTC,
{ TIFFTAG_RICHTIFFIPTC, -1, -3, TIFF_LONG, FIELD_CUSTOM,
0, 1, "RichTIFFIPTC" },
{ TIFFTAG_PHOTOSHOP, -1, -3, TIFF_BYTE, FIELD_PHOTOSHOP,
{ TIFFTAG_PHOTOSHOP, -1, -3, TIFF_BYTE, FIELD_CUSTOM,
0, 1, "Photoshop" },
{ TIFFTAG_EXIFIFD, 1, 1, TIFF_LONG, FIELD_CUSTOM,
0, 0, "EXIFIFDOffset" },
{ TIFFTAG_ICCPROFILE, -1, -3, TIFF_UNDEFINED, FIELD_ICCPROFILE,
{ TIFFTAG_ICCPROFILE, -1, -3, TIFF_UNDEFINED, FIELD_CUSTOM,
0, 1, "ICC Profile" },
{ TIFFTAG_GPSIFD, 1, 1, TIFF_LONG, FIELD_CUSTOM,
0, 0, "GPSIFDOffset" },

View File

@ -1,4 +1,4 @@
/* $Id: tif_print.c,v 1.30 2005-12-09 17:52:40 dron Exp $ */
/* $Id: tif_print.c,v 1.31 2005-12-21 14:24:41 dron Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -128,8 +128,8 @@ _TIFFPrettyPrintField(TIFF* tif, FILE* fd, ttag_t tag,
fprintf(fd, " %2d: %5g %5g\n", i,
((float *)raw_data)[2*i+0],
((float *)raw_data)[2*i+1]);
}
return 1;
}
case TIFFTAG_XMLPACKET:
{
uint32 i;
@ -138,7 +138,24 @@ _TIFFPrettyPrintField(TIFF* tif, FILE* fd, ttag_t tag,
for(i = 0; i < value_count; i++)
fputc(((char *)raw_data)[i], fd);
fprintf( fd, "\n" );
return 1;
}
case TIFFTAG_RICHTIFFIPTC:
/*
* XXX: for some weird reason RichTIFFIPTC tag
* defined as array of LONG values.
*/
fprintf(fd,
" RichTIFFIPTC Data: <present>, %lu bytes\n",
(unsigned long) value_count * 4);
return 1;
case TIFFTAG_PHOTOSHOP:
fprintf(fd, " Photoshop Data: <present>, %lu bytes\n",
(unsigned long) value_count);
return 1;
case TIFFTAG_ICCPROFILE:
fprintf(fd, " ICC Profile: <present>, %lu bytes\n",
(unsigned long) value_count);
return 1;
}
@ -473,15 +490,6 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
} else
fprintf(fd, "(present)\n");
}
if (TIFFFieldSet(tif,FIELD_ICCPROFILE))
fprintf(fd, " ICC Profile: <present>, %lu bytes\n",
(unsigned long) td->td_profileLength);
if (TIFFFieldSet(tif,FIELD_PHOTOSHOP))
fprintf(fd, " Photoshop Data: <present>, %lu bytes\n",
(unsigned long) td->td_photoshopLength);
if (TIFFFieldSet(tif,FIELD_RICHTIFFIPTC))
fprintf(fd, " RichTIFFIPTC Data: <present>, %lu bytes\n",
(unsigned long) td->td_richtiffiptcLength);
if (TIFFFieldSet(tif, FIELD_SUBIFD)) {
fprintf(fd, " SubIFD Offsets:");
for (i = 0; i < td->td_nsubifd; i++)