2005.03.15 17:56 "[Tiff] Need to write CCITT T.6 encoded TIFF file data directly to memory buffer", by Roger Watkins

2005.03.17 03:10 "Re: [Tiff] Need to write CCITT T.6 encoded TIFF filedatadirectlytomemory buffer", by Joris Van Damme

Roger,

After using TIFFClientOpen() and setting up special handler functions, will TIFFClose() work appropriately for the tiff so opened?

TIFFClose will call the 'platform/medium dependent' close procedure, a pointer to which is also a parameter of the TIFFClientOpen functions. This platform/medium dependent close procedure of your own implementation can take care of specific closing and cleaning up. This explains the following implementations of such platform/medium dependent close procedures in LibTiffDelphi.pas:

for file, just use the windows CloseHandle function on the file handle, as this is the proper equivalent of the TIFFOpen action implementation

function TIFFFileCloseProc(Fd: Cardinal): Integer; cdecl;
begin
  if CloseHandle(Fd)=True then
    Result:=0
  else
    Result:=-1;
end;

for stream, there is no opening as such, and there is also no closing equivalent:

function TIFFStreamCloseProc(Fd: Cardinal): Integer; cdecl;
begin
  Result:=0;
end;

The most common mistake when using TStream, is forgetting to reset the 'file pointer' back to 0. This is needed when having written, and next eg reading back. It may be the cause of your question. You can reset the 'file pointer' calling its Seek method with parameters (0,soFromBeginning).

Joris Van Damme
info@awaresystems.be
http://www.awaresystems.be/
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html