BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TOpenPictureDialog and Large Images

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics
View previous topic :: View next topic  
Author Message
Pete
Guest





PostPosted: Tue Jun 01, 2004 4:08 pm    Post subject: TOpenPictureDialog and Large Images Reply with quote




I am trying to avoid the problem where TOpenPictureDialog fails on files
with large images, because of the well-known GDI limitations. At the same
time, I am adding support for additional file formats (e.g. JPG, PNG),
using a 3rd-party image library.

I'm doing this by loading image files into a DIB, creating a thumbnail
TBitmap of a "safe" size, then Assigning that to the TPicture being
displayed. Calls to RegisterFileFormat tie it all together.

This all works fine, even with images needing more than 100MB of memory,
but I could use some help with loose ends:

1. How do I disable Delphi's built-in support for .BMP (and other) files,
so that I can replace them with the above technique?

2. How do I get TOpenPictureDialog to display the pixel size of the
original image, rather than the size of the thumbnail I'm actually
displaying?

3. How can I make my changes only apply to TOpenPictureDialog, and not to
other TPictures (where the use of a thumbnail may not be appropriate)?

4. How can I change the TOpenPictureDialog's cursor to crHourglass when
loading large files?

5. How can I speed things up with very large files? They take for ever!

TIA

Pete
Back to top
Nils Haeck
Guest





PostPosted: Tue Jun 01, 2004 10:37 pm    Post subject: Re: TOpenPictureDialog and Large Images Reply with quote



Answer to all questions:

Create your own dialog, "TMyOpenPictureDialog".

Nils

"Pete" <nobody (AT) nowhere (DOT) com> wrote

Quote:

I am trying to avoid the problem where TOpenPictureDialog fails on files
with large images, because of the well-known GDI limitations. At the same
time, I am adding support for additional file formats (e.g. JPG, PNG),
using a 3rd-party image library.

I'm doing this by loading image files into a DIB, creating a thumbnail
TBitmap of a "safe" size, then Assigning that to the TPicture being
displayed. Calls to RegisterFileFormat tie it all together.

This all works fine, even with images needing more than 100MB of memory,
but I could use some help with loose ends:

1. How do I disable Delphi's built-in support for .BMP (and other) files,
so that I can replace them with the above technique?

2. How do I get TOpenPictureDialog to display the pixel size of the
original image, rather than the size of the thumbnail I'm actually
displaying?

3. How can I make my changes only apply to TOpenPictureDialog, and not to
other TPictures (where the use of a thumbnail may not be appropriate)?

4. How can I change the TOpenPictureDialog's cursor to crHourglass when
loading large files?

5. How can I speed things up with very large files? They take for ever!

TIA

Pete



Back to top
Pete
Guest





PostPosted: Wed Jun 02, 2004 12:31 am    Post subject: Re: TOpenPictureDialog and Large Images Reply with quote



On Wed, 2 Jun 2004 00:37:39 +0200, Nils Haeck wrote:

Quote:
Answer to all questions:

Create your own dialog, "TMyOpenPictureDialog".

Nils

I was afraid you'd say that! If I limit myself to #1, is there an easier
answer? i.e.:

1. How do I disable Delphi's built-in support for .BMP (and other) files,
so that I can replace them with the above technique?

Back to top
Nils Haeck
Guest





PostPosted: Wed Jun 02, 2004 1:22 am    Post subject: Re: TOpenPictureDialog and Large Images Reply with quote

Yes, it was a bit mean to say that was it :)

Well, I think you can disable support for a format by calling
TPicture.UnregisterGraphicsClass(). Then after that you can register it to
your own handler of BMP, using TPicture.RegisterFileFormat().

However, you must do this *after* the graphics unit has registered it, so
observe the unit loading sequence.

Kind regards,

Nils Haeck
www.simdesign.nl

"Pete" wrote in message news:10g0l0lbun24m$.vjbftu85a6i2.dlg (AT) 40tude (DOT) net...

Quote:
I was afraid you'd say that! If I limit myself to #1, is there an easier
answer? i.e.:

1. How do I disable Delphi's built-in support for .BMP (and other) files,
so that I can replace them with the above technique?



Back to top
willem van Deursen
Guest





PostPosted: Wed Jun 02, 2004 6:32 am    Post subject: Re: TOpenPictureDialog and Large Images Reply with quote

The sourcecode of the OpenPictureDiolog is available in the delphi
source folder. This code gives enough information to derive your own
preview dialog, with dedicated support such as pixel size etc. Also,
once inside this code, you can use standard techniques to display PNG
etc. JPEG should be automatically supported once you add JPEG to the
uses clause.

PBPreviewDialog (available though www.torry.net and many others) offers
a generic way of creating your own preview mechanisms, so might be worth
exploring....

Willem

Pete wrote:

Quote:
I am trying to avoid the problem where TOpenPictureDialog fails on files
with large images, because of the well-known GDI limitations. At the same
time, I am adding support for additional file formats (e.g. JPG, PNG),
using a 3rd-party image library.

I'm doing this by loading image files into a DIB, creating a thumbnail
TBitmap of a "safe" size, then Assigning that to the TPicture being
displayed. Calls to RegisterFileFormat tie it all together.

This all works fine, even with images needing more than 100MB of memory,
but I could use some help with loose ends:

1. How do I disable Delphi's built-in support for .BMP (and other) files,
so that I can replace them with the above technique?

2. How do I get TOpenPictureDialog to display the pixel size of the
original image, rather than the size of the thumbnail I'm actually
displaying?

3. How can I make my changes only apply to TOpenPictureDialog, and not to
other TPictures (where the use of a thumbnail may not be appropriate)?

4. How can I change the TOpenPictureDialog's cursor to crHourglass when
loading large files?

5. How can I speed things up with very large files? They take for ever!

TIA

Pete

--
Willem van Deursen, The Netherlands
[email]wvandeursen_nospam (AT) nospam_carthago (DOT) nl[/email]
replace _nospam@nospam_ for @ to get a valid email address
www.carthago.nl


Back to top
Pete
Guest





PostPosted: Wed Jun 02, 2004 8:15 pm    Post subject: Re: TOpenPictureDialog and Large Images Reply with quote

On Wed, 2 Jun 2004 03:22:11 +0200, Nils Haeck wrote:

Quote:
Well, I think you can disable support for a format by calling
TPicture.UnregisterGraphicsClass(). Then after that you can register it to
your own handler of BMP, using TPicture.RegisterFileFormat().

However, you must do this *after* the graphics unit has registered it, so
observe the unit loading sequence.

Thanks for the tip Nils, especially the "however...".

You persuaded me to bite the bullet and write my own TOpenPictureDialogEx.
All issues in my OP were easily resolved.

Pete

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.