AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2005.06.21 09:17 "[Tiff] Tiff-Tags and Delphi7 / X and Y RESOLUTION / PHOTOMETRIC", by Matthias Lach
2005.06.21 11:30 "Re: [Tiff] Tiff-Tags and Delphi7 / X and Y RESOLUTION / PHOTOMETRIC", by Joris
2005.07.21 03:16 "Re: [Tiff] Tiff-Tags and Delphi7 / X and Y RESOLUTION / PHOTOMETRIC", by Joris
2005.07.06 10:18 "[Tiff] question of understanding / D7 and Var-Types", by Matthias Lach
2005.07.21 03:16 "Re: [Tiff] question of understanding / D7 and Var-Types", by Joris
2005.07.21 14:09 "Re: [Tiff] question of understanding / D7 and Var-Types", by Frank Warmerdam
2005.07.21 14:21 "Re: [Tiff] question of understanding / D7 and Var-Types", by Chris Losinger
2005.07.21 16:13 "Re: [Tiff] question of understanding / D7 and Var-Types", by Joris
2005.07.21 16:38 "Re: [Tiff] question of understanding / D7 and Var-Types", by Chris Losinger
2005.07.21 16:47 "Re: [Tiff] question of understanding / D7 and Var-Types", by Frank Warmerdam

2005.07.21 14:09 "Re: [Tiff] question of understanding / D7 and Var-Types", by Frank Warmerdam

On 7/20/05, Joris <joris.at.lebbeke@skynet.be> wrote:

Matthias his problem got solved when we remembered

http://www.asmail.be/msg0055048683.html

Seems that we need Single to read the resolution tags with TIFFGetField, and a variable of type Double (as opposed to a direct value, or a variable of other type) to write with TIFFSetField. So the problem is solved on a trial-and-error basis. It's strange though, the TIFFSetField man page says TIFFSetField expects a float for setting the resolution tags, and this is equivalent to a Delphi Single, not a Double. And it's also weird that a direct value doesn't work. If someone has a more thorough understanding of why exactly, we would appreciate more insight.

Joris,

This is a pecularity of C. When floating point (single) values are passed to a function that lacks a prototype (or uses varargs "..." as in this case) they are automatically promoted to double. So internally libtiff has to pull a double off the stack instead of a float even though it considers the field to be float. Because it considers the field to be a float, when you request the value you have to pass a float*, not a double*.

Developers in C don't see this issue since the compiler converts the type automatically.

Best regards,
--

---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent