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
September 2005

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

2005.09.05 16:32 "LibTIFFDelphi and Delphi OpenPictureDialog", by Stephen Billard
2005.09.05 17:45 "Re: LibTIFFDelphi and Delphi OpenPictureDialog", by Joris Van Damme

2005.09.05 17:45 "Re: LibTIFFDelphi and Delphi OpenPictureDialog", by Joris Van Damme

Stephen,

Stephen Billard wrote:
> Does anyone have an example of how to hook LibTIFFDelphi into the
> Delphi OpenPictureDialog component so that it will show TIFF images
> in the preview panel?

Please post only plain text messages to the list.

What you're asking for is quite something...

The standard OpenPictureDialog works with a TImage component. A TImage
works with a TPicture. A TPicture access the list of known TGraphic
classes to get a list of supported extensions, and build a particular
TGraphic that supports a particular file format.

Thus, for this to work, you'll have to build a TGraphicTiff sorts of
thing, that inherits from the TGraphic. This involves implementing all
virtual methods of TGraphic, and registring your descendant. Next, when
a TPicture is asked what file extensions it supports, it will include
the extensions added by the TGraphicTiff registration (or something,
this is all from the top of my head...), and when a TPicture is asked to
open a 'xxx.tif' file, it will know that it can create a TGraphicTiff
and delegate the actual opening and rendering to this TGraphicTiff.

The bad news is that this is a lot of work. The worst news, however, is
that the whole system is useless. Many TIFF files are quite large. In
the standard VCL system explained above, normally, message pump is
frozen while the complete image gets decoded and resized and rendered,
all in the main thread. This means that, if the user accesses a
directory with such large TIFFs, and riscs clicking one, he'll next have
to wait for seconds or more, before application starts responding again.
A user may very well prefer not previewing over halting his action for
seconds or more every time he clicks another file.

When the user next clicks 'open' on the dialog, its content isn't
actually destroyed (untill the OpenPictureDialog component on your
calling form is destroyed, or is used a next time). Your calling code
gets a filename only. Thus, the most likely action is that your calling
code opens again the same TIFF file, repeating all previous processing,
producing duplicate memory. This, too, adds to the whole system becoming
completely useless on anything but small sized images.

It is not impossible to work around this. In fact, I'm in the process of
building a much nicer, multi-thread TGraphic system on top of the
existing one. It's a lot of work though, and I don't expect it to become
avaibable any time sooner then 2006.

If you're nevertheless interested in using TGraphic the normal VCL way,
take a look at graphics.pas and jpeg.pas for clues on how to build your
TGraphicTiff. If you're unclear on the basics of TImage, TPicture, and
TGraphic, and how they interact,
http://www.awaresystems.be/techtalks/003_graphic_picture_image.html may
be helpful.


Kind regards,


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