Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OSGImageFileType.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *             Copyright (C) 2000-2002 by the OpenSG Forum                   *
00006  *                                                                           *
00007  *                            www.opensg.org                                 *
00008  *                                                                           *
00009  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00010  *                                                                           *
00011 \*---------------------------------------------------------------------------*/
00012 /*---------------------------------------------------------------------------*\
00013  *                                License                                    *
00014  *                                                                           *
00015  * This library is free software; you can redistribute it and/or modify it   *
00016  * under the terms of the GNU Library General Public License as published    *
00017  * by the Free Software Foundation, version 2.                               *
00018  *                                                                           *
00019  * This library is distributed in the hope that it will be useful, but       *
00020  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00022  * Library General Public License for more details.                          *
00023  *                                                                           *
00024  * You should have received a copy of the GNU Library General Public         *
00025  * License along with this library; if not, write to the Free Software       *
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00027  *                                                                           *
00028 \*---------------------------------------------------------------------------*/
00029 /*---------------------------------------------------------------------------*\
00030  *                                Changes                                    *
00031  *                                                                           *
00032  *                                                                           *
00033  *                                                                           *
00034  *                                                                           *
00035  *                                                                           *
00036  *                                                                           *
00037 \*---------------------------------------------------------------------------*/
00038 
00039 #ifndef OSGIMAGEFILETYPE_CLASS_DECLARATION
00040 #define OSGIMAGEFILETYPE_CLASS_DECLARATION
00041 
00042 #include <list>
00043 
00044 #include <OSGBaseTypes.h>
00045 #include <OSGIDString.h>
00046 #include <OSGImage.h>
00047 
00048 OSG_BEGIN_NAMESPACE
00049 
00054 class OSG_SYSTEMLIB_DLLMAPPING ImageFileType {
00055 
00056 
00057   /*==========================  PUBLIC  =================================*/
00058 
00059   public:
00060 
00061     /*---------------------------------------------------------------------*/
00065     enum
00066     {
00067         OSG_READ_SUPPORTED = 1,
00068         OSG_WRITE_SUPPORTED = 2
00069     };
00070     
00072     /*---------------------------------------------------------------------*/
00076     virtual ~ImageFileType (void);
00077 
00079     /*---------------------------------------------------------------------*/
00083     const Char8  *getMimeType (void) const;
00084 
00085     const std::list<IDString> &getSuffixList(void) const;
00086     
00087     virtual UInt32 getFlags(void) const;
00088 
00090     /*---------------------------------------------------------------------*/
00094     virtual bool read  (ImagePtr &image, const Char8 *fileName )       = 0;
00095 
00096     virtual bool write (const ImagePtr &image, const Char8 *fileName ) = 0;
00097 
00098     virtual bool validateHeader( const Char8 *fileName, bool &implemented );
00099 
00101     /*---------------------------------------------------------------------*/
00105     static  UInt64 restore       ( ImagePtr &image, const UChar8 *buffer,
00106                                    Int32 memSize = -1 );
00107 
00108     static  UInt64 store         ( const ImagePtr &image,
00109                                    const char *mimeType,
00110                                    UChar8 *buffer, Int32 memSize = -1 );
00111 
00112     UInt64 store                 ( const ImagePtr &image, UChar8 *buffer,
00113                                    Int32 memSize = -1 );
00114     
00115     virtual UInt64 maxBufferSize ( const ImagePtr &image );
00116 
00118     /*---------------------------------------------------------------------*/
00122     virtual UInt64 restoreData ( ImagePtr &image, const UChar8 *buffer,
00123                                  Int32 memSize = -1 );
00124 
00125     virtual UInt64 storeData   ( const ImagePtr &image, UChar8 *buffer,
00126                                  Int32 memSize = -1 );
00127 
00128 
00130     /*---------------------------------------------------------------------*/
00134     void dump(void);
00135 
00138     /*=========================  PROTECTED  ===============================*/
00139   protected:
00140 
00141     /*---------------------------------------------------------------------*/
00145     struct Head {
00146       Char8          mimeType[8];
00147       unsigned short pixelFormat;
00148       unsigned short width;
00149       unsigned short height;
00150       unsigned short depth;
00151       unsigned short mipmapCount;
00152       unsigned short frameCount;
00153       unsigned short frameDelay;
00154       unsigned short sideCount;
00155       unsigned short dataType;
00156       unsigned short _reserved3;
00157       unsigned short _reserved4;
00158       unsigned short attachmentSize;
00159 
00160       bool netToHost (void);
00161       bool hostToNet (void);
00162 
00163     };
00164 
00167     /*---------------------------------------------------------------------*/
00171     ImageFileType ( const Char8  *mimeType,
00172                     const Char8  *suffixArray[], 
00173                           UInt16  suffixByteCount,
00174                           UInt32  flags = OSG_READ_SUPPORTED );
00175 
00177     /*---------------------------------------------------------------------*/
00181     ImageFileType ( const ImageFileType &obj);
00182 
00185     /*==========================  PRIVATE  ================================*/
00186   private:
00187 
00188     std::list<IDString> _suffixList;
00189 
00190     IDString _mimeType;
00191 
00192     UInt32              _flags;
00193 };
00194 
00195 typedef ImageFileType* ImageFileTypeP;
00196 
00197 OSG_END_NAMESPACE
00198 
00199 #endif // OSGIMAGEFILETYPE_CLASS_DECLARATION

Generated on Thu Aug 25 04:06:20 2005 for OpenSG by  doxygen 1.4.3