if hyieutils.IsKnownFormat(AFilename) then
ShowMessage('ok, I can load it.');
For Opening and Saving add a TOpenPictureDialog or a TSavePictureDialog to the form then call:
procedure TForm1.FormCreate(Sender: TObject);
{ FormCreate. }
begin
hyieutils.IERegisterFormats;
OpenPictureDialog1.Filter := GraphicFilter(TGraphic);
SavePictureDialog1.Filter := GraphicFilter(TGraphic);
end;
procedure TForm1.FormDestroy(Sender: TObject);
{ FormDestroy. }
begin
hyieutils.IEUnRegisterFormats;
end;
The dialogs filter will include supported image formats.
Also by using ImageEn Helper functions you can create this:
function IsKnownOpenFormat(AFilename: string): boolean;
{ Return True if opening AFilename is supported by ImageEnIO, false if not. }
var
iSupportedExtensions: string;
begin
iSupportedExtensions := GetAllSupportedFileExtensions(True, False, False);
result := IEFilenameInExtensions(AFilename, iSupportedExtensions);
end;
function IsKnownSaveFormat(AFilename: string): boolean;
{ Return True if saving AFilename is supported by ImageEnIO, false if not. }
var
iSupportedExtensions: string;
begin
iSupportedExtensions := GetAllSupportedFileExtensions(False, True, False);
result := IEFilenameInExtensions(AFilename, iSupportedExtensions);
end;
William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html