ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 How to find a list of supported formats?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Mason Wheeler

3 Posts

Posted - Jan 28 2014 :  18:25:16  Show Profile  Reply
Is there any way to programatically find a list of all file formats supported by ImageEn? I'd like to be able to fill in a Open File dialog box's list of filters this way. For that, I'd need a list of all formats, with both a user-friendly name and an extension. (ie. "PNG Image, *.png")

Does ImageEn have any functionality that can be used to query for a list like this? It would need to include custom formats that have been registered, since we're using that functionality.

w2m

USA
1990 Posts

Posted - Jan 28 2014 :  19:02:04  Show Profile  Reply
uses hyieutils;

procedure TForm1.FormCreate(Sender: TObject);
begin
  {Register graphic file formats }
  IERegisterFormats;
  { Set the dialog filters to match TGraphic filters }
  OpenPictureDialog1.Filter := GraphicFilter(TGraphic);
  SavePictureDialog1.Filter := GraphicFilter(TGraphic);
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  {UnRegister graphic file formats }
  IEUnRegisterFormats;
end;

procedure TForm1.SavePictureDialog1TypeChange(Sender: TObject);
{ Change the File Extension when the FileType changes. }
var
  FilePath: string;
  FileName: string;
  FileExt: string;
begin
  FilePath := SavePictureDialog1.FileName;
  FileExt := ExtractFileExt(FilePath);
  FileName := ExtractFileName(FilePath);
end;

You can also use:
imageenio.IEExtToFileFormat
imageenio.IEFileFormatGetInfo
imageenio.IEFileFormatGetInfo2
imageenio.GetAllSupportedFileExtensions

But I find the simplest way is to handle the dialogs as I outlined.


William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Go to Top of Page

Mason Wheeler

3 Posts

Posted - Jan 28 2014 :  19:05:20  Show Profile  Reply
That looks very helpful, but the dialog in question is of class TFileOpenDialog, which has a FileTypes property rather than a Filter property.

Do you have anything that supports that? If not, I can probably work from what you've posted so far.
Go to Top of Page

w2m

USA
1990 Posts

Posted - Jan 28 2014 :  19:11:38  Show Profile  Reply
TFileOpenDialogs are very complicated to deal with. Lots of com and somewhat unusual programming. Why not use TOpen/SavePicture dialogs... they are very similar with Win 7 and 8.

William Miller
Go to Top of Page

Mason Wheeler

3 Posts

Posted - Jan 28 2014 :  19:21:07  Show Profile  Reply
Because of the COM stuff, actually. TFileOpenDialog gives access to IFileDialogCustomize, which is an OS-supported way to add custom functionality to a dialog box that is guaranteed to continue to still look right when Windows 9 comes out. (This is all part of a project to replace a bunch of custom file dialogs that were built during the XP era and look very out of place on a Win7 system.)
Go to Top of Page

w2m

USA
1990 Posts

Posted - Jan 28 2014 :  19:51:12  Show Profile  Reply
Well... it is not perfect but I spent quite a bit of time making a FileDialog that looks similar to the imageen dialogs with image information in labels with a image preview.

The file info stuff works very well... but I am sure it could be improved some. If you send me your email address I'll send it to you.
I am not that good at com so this was quite difficult for me. Maybe you can improve it where needed and we will both benefit.




William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: