eLynx SDK
v3.3.0 C++ image processing API reference |
00001 //============================================================================ 00002 // ImageFileManager.h Image.Component package 00003 //============================================================================ 00004 // Usage : definition of tool class to manage image file format via plugins 00005 //---------------------------------------------------------------------------- 00006 // Inheritance : 00007 // ImageFileManager 00008 //---------------------------------------------------------------------------- 00009 // Copyright (C) 2006 by eLynx project 00010 // 00011 // This library is free software; you can redistribute it and/or 00012 // modify it under the terms of the GNU Library General Public 00013 // License as published by the Free Software Foundation; either 00014 // version 2 of the License, or (at your option) any later version. 00015 // 00016 // This library is distributed in the hope that it will be useful, 00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00019 // See the GNU Library General Public License for more details. 00020 //---------------------------------------------------------------------------- 00021 #ifndef __ImageFileManager_h__ 00022 #define __ImageFileManager_h__ 00023 00024 #include <elx/core/PluginManager.h> 00025 #include "ImageLib.h" 00026 #include "IImageFilePlugin.h" 00027 #include <vector> 00028 #include <map> 00029 #include <string> 00030 00031 namespace eLynx { 00032 namespace Image { 00033 00034 class IImageFilePlugin; 00035 class AbstractImageFileFormat; 00036 class ImageVariant; 00037 00040 class ExportedByImage ImageFileManager 00041 { 00042 public: 00046 ImageFileManager(); 00047 00050 virtual ~ImageFileManager(); 00051 00054 00057 bool IsEmpty() const; 00058 00063 bool Register(const char * iprPath); 00064 00067 void Unregister(); 00068 00071 void Unregister(const IPluginPackage& iPackage); 00072 00075 void Unregister(const IImageFilePlugin& iPlugin); 00076 00079 void UnregisterPackage(const char * iprFilename); 00080 00083 void UnregisterPackage(const UUID& iUUID); 00084 00087 void UnregisterPlugin(const char * iprName); 00088 00091 void UnregisterPlugin(const UUID& iUUID); 00092 00096 bool UnregisterExt(const char * iprExt); 00097 00102 bool UnregisterInExt(const char * iprExt); 00103 00108 bool UnregisterOutExt(const char * iprExt); 00109 00112 size_t GetInputExtCount() const; 00113 00116 size_t GetOutputExtCount() const; 00117 00121 size_t GetPluginCount() const; 00122 00126 IImageFilePlugin * GetPlugin(const char * iprName); 00127 00128 IImageFilePlugin * GetPlugin(size_t iIndex) const; 00130 00131 const char * GetInputFileFormatList(bool ibAllInOne = true); 00132 const char * GetOutputFileFormatList(bool ibAllInOne = false); 00133 const char * GetSupportedOutputFileFormatList(const ImageVariant& iImage, bool ibAllInOne = false); 00134 00137 00138 const char * GetDescription(size_t iPlugin) const; 00139 00147 bool CanImport( 00148 const char * iprFilename, 00149 ImageFileInfo * oprInfo=NULL, 00150 bool ibPreview=false); 00151 00157 bool GeneratePreview( 00158 const char * iprFilenameIn, 00159 const char * iprFilenameOut, 00160 ProgressNotifier& iNotifier=ProgressNotifier_NULL); 00161 00168 bool Import( 00169 ImageVariant& oImage, 00170 const char * iprFilename, 00171 ImageFileInfo * oprInfo=NULL, 00172 ProgressNotifier& iNotifier=ProgressNotifier_NULL); 00173 00180 bool CanExport( 00181 const ImageVariant& iImage, 00182 const char * iprFilename, 00183 const ImageFileOptions * iprOptions=NULL); 00184 00191 bool Export( 00192 const ImageVariant& iImage, 00193 const char * iprFilename, 00194 ProgressNotifier& iNotifier, 00195 const ImageFileOptions * iprOptions=NULL); 00197 00198 protected: 00199 size_t GetPackageCount() const; 00200 IImageFilePlugin * GetPlugin(const UUID& iClass); 00201 IImageFilePlugin * GetInPlugin(const char * iprFilename); 00202 IImageFilePlugin * GetOutPlugin(const char * iprFilename); 00203 void Register(IImageFilePlugin& iPlugin); 00204 00205 protected: 00206 PluginManager _manager; 00207 size_t _nInputFileFormat; 00208 size_t _nOutputFileFormat; 00209 00210 // list of available input/output extension with associated plugin 00211 typedef std::map<std::string, IImageFilePlugin *> MapExt; 00212 MapExt _inExts; 00213 MapExt _outExts; 00214 00215 std::string _inFormatList; 00216 std::string _outFormatList; 00217 }; 00218 00219 extern ExportedByImage ImageFileManager the_ImageFileManager; 00220 00221 } // namespace Image 00222 } // namespace eLynx 00223 00224 #endif // __ImageFileManager_h__