Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-18 09:20:53

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_CompressedPixMap_HeaderFile
0015 #define _Image_CompressedPixMap_HeaderFile
0016 
0017 #include <Image_Format.hxx>
0018 #include <Image_CompressedFormat.hxx>
0019 #include <NCollection_Array1.hxx>
0020 #include <NCollection_Buffer.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 //! Compressed pixmap data definition.
0024 //! It is defined independently from Image_PixMap, which defines only uncompressed formats.
0025 class Image_CompressedPixMap : public Standard_Transient
0026 {
0027   DEFINE_STANDARD_RTTIEXT(Image_CompressedPixMap, Standard_Transient)
0028 public:
0029   //! Return base (uncompressed) pixel format.
0030   Image_Format BaseFormat() const { return myBaseFormat; }
0031 
0032   //! Set base (uncompressed) pixel format.
0033   void SetBaseFormat(Image_Format theFormat) { myBaseFormat = theFormat; }
0034 
0035   //! Return compressed format.
0036   Image_CompressedFormat CompressedFormat() const { return myFormat; }
0037 
0038   //! Set compressed format.
0039   void SetCompressedFormat(Image_CompressedFormat theFormat) { myFormat = theFormat; }
0040 
0041   //! Return raw (compressed) data.
0042   const occ::handle<NCollection_Buffer>& FaceData() const { return myFaceData; }
0043 
0044   //! Set raw (compressed) data.
0045   void SetFaceData(const occ::handle<NCollection_Buffer>& theBuffer) { myFaceData = theBuffer; }
0046 
0047   //! Return Array of mipmap sizes, including base level.
0048   const NCollection_Array1<int>& MipMaps() const { return myMipMaps; }
0049 
0050   //! Return Array of mipmap sizes, including base level.
0051   NCollection_Array1<int>& ChangeMipMaps() { return myMipMaps; }
0052 
0053   //! Return TRUE if complete mip map level set (up to 1x1 resolution).
0054   bool IsCompleteMipMapSet() const { return myIsCompleteMips; }
0055 
0056   //! Set if complete mip map level set (up to 1x1 resolution).
0057   void SetCompleteMipMapSet(bool theIsComplete) { myIsCompleteMips = theIsComplete; }
0058 
0059   //! Return surface length in bytes.
0060   size_t FaceBytes() const { return myFaceBytes; }
0061 
0062   //! Set surface length in bytes.
0063   void SetFaceBytes(size_t theSize) { myFaceBytes = theSize; }
0064 
0065   //! Return surface width.
0066   int SizeX() const { return mySizeX; }
0067 
0068   //! Return surface height.
0069   int SizeY() const { return mySizeY; }
0070 
0071   //! Set surface width x height.
0072   void SetSize(int theSizeX, int theSizeY)
0073   {
0074     mySizeX = theSizeX;
0075     mySizeY = theSizeY;
0076   }
0077 
0078   //! Return TRUE if image layout is top-down (always true).
0079   bool IsTopDown() const { return true; }
0080 
0081   //! Return number of faces in the file; should be 6 for cubemap.
0082   int NbFaces() const { return myNbFaces; }
0083 
0084   //! Set number of faces in the file.
0085   void SetNbFaces(int theSize) { myNbFaces = theSize; }
0086 
0087 public:
0088   //! Empty constructor.
0089   Image_CompressedPixMap()
0090       : myFaceBytes(0),
0091         myNbFaces(0),
0092         mySizeX(0),
0093         mySizeY(0),
0094         myBaseFormat(Image_Format_UNKNOWN),
0095         myFormat(Image_CompressedFormat_UNKNOWN),
0096         myIsCompleteMips(false)
0097   {
0098   }
0099 
0100 protected:
0101   NCollection_Array1<int>         myMipMaps;    //!< Array of mipmap sizes, including base level
0102   occ::handle<NCollection_Buffer> myFaceData;   //!< raw compressed data
0103   size_t                          myFaceBytes;  //!< surface length in bytes
0104   int                             myNbFaces;    //!< number of faces in the file
0105   int                             mySizeX;      //!< surface width
0106   int                             mySizeY;      //!< surface height
0107   Image_Format                    myBaseFormat; //!< base (uncompressed) pixel format
0108   Image_CompressedFormat          myFormat;     //!< compressed format
0109   // clang-format off
0110   bool           myIsCompleteMips;    //!< flag indicating complete mip map level set (up to 1x1 resolution)
0111   // clang-format on
0112 };
0113 
0114 #endif // _Image_CompressedPixMap_HeaderFile