Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:05

0001 // Copyright (c) 2020 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 #ifndef _Image_DDSParser_HeaderFile
0015 #define _Image_DDSParser_HeaderFile
0016 
0017 #include <Image_CompressedPixMap.hxx>
0018 #include <NCollection_Buffer.hxx>
0019 
0020 class Image_SupportedFormats;
0021 
0022 //! Auxiliary tool for parsing DDS file structure (without decoding).
0023 class Image_DDSParser
0024 {
0025 public:
0026 
0027   //! Load the face from DDS file.
0028   //! @param theSupported [in] list of supported image formats
0029   //! @param theFile      [in] file path
0030   //! @param theFaceIndex [in] face index, within [0, Image_CompressedPixMap::NbFaces()) range;
0031   //!                          use -1 to skip reading the face data
0032   //! @param theFileOffset [in] offset to the DDS data
0033   //! @return loaded face or NULL if file cannot be read or not valid DDS file
0034   Standard_EXPORT static Handle(Image_CompressedPixMap) Load (const Handle(Image_SupportedFormats)& theSupported,
0035                                                               const TCollection_AsciiString& theFile,
0036                                                               const Standard_Integer theFaceIndex,
0037                                                               const int64_t theFileOffset = 0);
0038 
0039   //! Load the face from DDS file.
0040   //! @param theSupported [in] list of supported image formats
0041   //! @param theBuffer    [in] pre-loaded file data, should be at least of 128 bytes long defining DDS header.
0042   //! @param theFaceIndex [in] face index, within [0, Image_CompressedPixMap::NbFaces()) range;
0043   //!                          use -1 to skip reading the face data
0044   //! @return loaded face or NULL if file cannot be read or not valid DDS file
0045   Standard_EXPORT static Handle(Image_CompressedPixMap) Load (const Handle(Image_SupportedFormats)& theSupported,
0046                                                               const Handle(NCollection_Buffer)& theBuffer,
0047                                                               const Standard_Integer theFaceIndex);
0048 
0049   
0050 private:
0051 
0052   struct DDSPixelFormat;
0053   struct DDSFileHeader;
0054 
0055 private:
0056 
0057   //! Parse DDS header.
0058   static Handle(Image_CompressedPixMap) parseHeader (const DDSFileHeader& theHeader);
0059 
0060 };
0061 
0062 #endif // _Image_DDSParser_HeaderFile