AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
November 2000

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2000.11.21 00:59 "How to use the TIFFVGetField() interface", by Tobias Patton
2000.11.22 20:34 "Re: How to use the TIFFVGetField() interface", by Rick Lamont

2000.11.21 00:59 "How to use the TIFFVGetField() interface", by Tobias Patton

Hello all;

DISCLAIMER: This is my first posting to the TIFF mailing list. If that's
doesn't scare you enough, let me say this: I am very new to C/C++
programming. The little programming I've done has been in Perl. I do,
however, understand TIFFs quite well. I've written an object oriented TIFF
Library in Perl that works fairly well, even if it's stupendously ugly.
You've been warned. Read on at your own peril.

I need to write a C++ program that copies verbatim a number of tags from one
TIFF header to a newly created TIFF. It seems to me that I should be able to
do this quite simply with the TIFFVGetField() and TIFFVSetField()
subroutines. My understanding is that regardless of the number and type of
values represented in a given tag, these can all be referenced by an va_list
pointer. I should be able to step through all the tags I need copied,
TIFFVGetField() the values into a va_list pointer, and then TIFFVSetField()
into the new TIFF with the same pointer.

Unfortunately, when I try this, I get "Illegal Access" errors. I think this
mostly comes down to my complete lack of understanding of how to use
variable argument lists.  I suppose I need to initialize the va_list
pointer, but none of the obvious things seem to work.

I'm developing in Visual Studio 6.0sp4 on W2K.

Here's the code that gives the error:

int newCopyIfd (TIFF* in, TIFF* out) {
    const int TagsToCopy[] = {
                                TIFFTAG_DOCUMENTNAME,
                                TIFFTAG_IMAGEDESCRIPTION,
                   
                                ... SNIP ...
                   
                                TIFFTAG_XRESOLUTION,
                                TIFFTAG_YRESOLUTION
                            };
    const int NumTagsToCopy = 39;
    va_list ap;
    for (int i = 0; i < NumTagsToCopy; i++) {
        if (TIFFVGetField (in, TagsToCopy[i], ap)) {
            TIFFVSetField (out, TagsToCopy[i], ap);
        }
    }
    return 1;
}

Thanks.

Tobias Patton