OSDLImage.h

Go to the documentation of this file.
00001 #ifndef OSDL_IMAGE_H_
00002 #define OSDL_IMAGE_H_
00003 
00004 
00005 #include "OSDLPixel.h"           // for Pixels::ColorElement
00006 #include "OSDLVideoTypes.h"      // for VideoException
00007 
00008 #include "Ceylan.h"
00009 
00010 
00011 #include <string>
00012 
00013 
00014 
00015 namespace OSDL
00016 {
00017 
00018     namespace Video
00019     {
00020 
00021 
00022         // Images are loaded into surfaces.
00023         class Surface ;
00024 
00025 
00026         namespace TwoDimensional
00027         {
00028             
00029             
00031             class OSDL_DLL ImageException : public OSDL::Video::VideoException 
00032             { 
00033                 public: 
00034                 
00035                     ImageException( const std::string & reason ) throw() ; 
00036                     virtual ~ImageException() throw() ; 
00037             } ;
00038                 
00039                 
00040                 
00072             class OSDL_DLL Image : public Ceylan::TextDisplayable
00073             {
00074                 
00075                 
00076                 public:
00077                     
00078                     
00086                     explicit Image( const std::string & filename ) 
00087                         throw( ImageException ) ;
00088                     
00089                                         
00095                     virtual ~Image() throw() ;
00096                     
00097                     
00098                     
00099                     // Static section.
00100                     
00101                     
00119                     static Surface & LoadIcon( const std::string & filename, 
00120                         Pixels::ColorElement ** mask ) throw( ImageException ) ;
00121                 
00122                                 
00123                             
00124                                         
00125                     // Load image section.          
00126                     
00127                                             
00128                     
00170                     static void Load( Surface & targetSurface, 
00171                             const std::string & filename,
00172                             bool blitOnly = false,
00173                             bool convertToDisplay = true,
00174                             bool convertWithAlpha = true  ) 
00175                         throw( ImageException ) ;   
00176                     
00177                         
00178                         
00222                     static void LoadJPG( Surface & targetSurface, 
00223                             const std::string & filename,
00224                             bool blitOnly = false,
00225                             bool convertToDisplay = true,
00226                             bool convertWithAlpha = true  ) 
00227                         throw( ImageException ) ;   
00228 
00229 
00230 
00274                     static void LoadPNG( Surface & targetSurface, 
00275                             const std::string & filename,
00276                             bool blitOnly = false,
00277                             bool convertToDisplay = true,
00278                             bool convertWithAlpha = true  ) 
00279                         throw( ImageException ) ;   
00280 
00281 
00282 
00326                     static void LoadBMP( Surface & targetSurface, 
00327                             const std::string & filename,
00328                             bool blitOnly = false,
00329                             bool convertToDisplay = true,
00330                             bool convertWithAlpha = true  ) 
00331                         throw( ImageException ) ;   
00332 
00333 
00334 
00378                     static void LoadGIF( Surface & targetSurface, 
00379                             const std::string & filename,
00380                             bool blitOnly = false,
00381                             bool convertToDisplay = true,
00382                             bool convertWithAlpha = true  ) 
00383                         throw( ImageException ) ;   
00384 
00385 
00386 
00430                     static void LoadLBM( Surface & targetSurface, 
00431                             const std::string & filename,
00432                             bool blitOnly = false,
00433                             bool convertToDisplay = true,
00434                             bool convertWithAlpha = true  ) 
00435                         throw( ImageException ) ;   
00436 
00437 
00438 
00482                     static void LoadPCX( Surface & targetSurface, 
00483                             const std::string & filename,
00484                             bool blitOnly = false,
00485                             bool convertToDisplay = true,
00486                         bool convertWithAlpha = true  ) 
00487                         throw( ImageException ) ;   
00488 
00489 
00490 
00534                     static void LoadPNM( Surface & targetSurface, 
00535                             const std::string & filename,
00536                             bool blitOnly = false,
00537                             bool convertToDisplay = true,
00538                             bool convertWithAlpha = true  ) 
00539                         throw( ImageException ) ;   
00540 
00541 
00542 
00586                     static void LoadTGA( Surface & targetSurface, 
00587                             const std::string & filename,
00588                             bool blitOnly = false,
00589                             bool convertToDisplay = true,
00590                             bool convertWithAlpha = true  ) 
00591                         throw( ImageException ) ;   
00592 
00593 
00594 
00638                     static void LoadXPM( Surface & targetSurface, 
00639                             const std::string & filename,
00640                             bool blitOnly = false,
00641                             bool convertToDisplay = true,
00642                             bool convertWithAlpha = true  ) 
00643                         throw( ImageException ) ;  
00644                     
00645                     
00646                     
00647                     
00648                     
00649                     // Save image section.          
00650                     
00651                     
00652                                             
00680                     static void SavePNG( Surface & targetSurface, 
00681                             const std::string & filename, 
00682                             bool overwrite = true ) 
00683                         throw( ImageException ) ;   
00684                         
00685                                         
00686                                             
00712                     static void SaveBMP( Surface & targetSurface, 
00713                             const std::string & filename,
00714                             bool overwrite = true ) 
00715                         throw( ImageException ) ;   
00716 
00717 
00718                         
00731                     virtual const std::string toString( 
00732                             Ceylan::VerbosityLevels level = Ceylan::high ) 
00733                         const throw() ;
00734                     
00735                     
00736                         
00737                 protected:
00738                 
00739                 
00741                     std::string _filename ;
00742                         
00743                         
00744                         
00745                 private:
00746             
00747             
00756                     explicit Image( const Image & source ) throw() ;
00757             
00758             
00767                     Image & operator = ( const Image & source ) throw() ;
00768                 
00769                 
00774                     static const std::string JPGTag ;
00775                     
00776                     
00781                     static const std::string PNGTag ;
00782         
00783         
00784         
00790                     static const std::string BMPTag ;
00791                     
00792                     
00798                     static const std::string GIFTag ;
00799         
00800         
00806                     static const std::string LBMTag ;
00807         
00808         
00814                     static const std::string PCXTag ;
00815         
00816         
00822                     static const std::string PNMTag ;
00823         
00824         
00830                     static const std::string TGATag ;
00831         
00832         
00838                     static const std::string XPMTag ;
00839         
00840                 
00841             } ;
00842         }       
00843     }
00844 }       
00845 
00846 
00847 #endif // OSDL_IMAGE_H_
00848 

Generated on Fri Mar 30 14:46:59 2007 for OSDL by  doxygen 1.5.1