Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-13 09:16:54

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   //! Load the face from DDS file.
0027   //! @param[in] theSupported  list of supported image formats
0028   //! @param[in] theFile       file path
0029   //! @param[in] theFaceIndex  face index, within [0, Image_CompressedPixMap::NbFaces()) range;
0030   //!                          use -1 to skip reading the face data
0031   //! @param[in] theFileOffset  offset to the DDS data
0032   //! @return loaded face or NULL if file cannot be read or not valid DDS file
0033   Standard_EXPORT static occ::handle<Image_CompressedPixMap> Load(
0034     const occ::handle<Image_SupportedFormats>& theSupported,
0035     const TCollection_AsciiString&             theFile,
0036     const int                                  theFaceIndex,
0037     const int64_t                              theFileOffset = 0);
0038 
0039   //! Load the face from DDS file.
0040   //! @param[in] theSupported  list of supported image formats
0041   //! @param[in] theBuffer     pre-loaded file data, should be at least of 128 bytes long defining
0042   //! DDS header.
0043   //! @param[in] theFaceIndex  face index, within [0, Image_CompressedPixMap::NbFaces()) range;
0044   //!                          use -1 to skip reading the face data
0045   //! @return loaded face or NULL if file cannot be read or not valid DDS file
0046   Standard_EXPORT static occ::handle<Image_CompressedPixMap> Load(
0047     const occ::handle<Image_SupportedFormats>& theSupported,
0048     const occ::handle<NCollection_Buffer>&     theBuffer,
0049     const int                                  theFaceIndex);
0050 
0051 private:
0052   struct DDSPixelFormat;
0053   struct DDSFileHeader;
0054 
0055 private:
0056   //! Parse DDS header.
0057   static occ::handle<Image_CompressedPixMap> parseHeader(const DDSFileHeader& theHeader);
0058 };
0059 
0060 #endif // _Image_DDSParser_HeaderFile