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_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 
0030   //! Return base (uncompressed) pixel format.
0031   Image_Format BaseFormat() const { return myBaseFormat; }
0032 
0033   //! Set base (uncompressed) pixel format.
0034   void SetBaseFormat (Image_Format theFormat) { myBaseFormat = theFormat; }
0035 
0036   //! Return compressed format.
0037   Image_CompressedFormat CompressedFormat() const { return myFormat; }
0038 
0039   //! Set compressed format.
0040   void SetCompressedFormat (Image_CompressedFormat theFormat) { myFormat = theFormat; }
0041 
0042   //! Return raw (compressed) data.
0043   const Handle(NCollection_Buffer)& FaceData() const { return myFaceData; }
0044 
0045   //! Set raw (compressed) data.
0046   void SetFaceData (const Handle(NCollection_Buffer)& theBuffer) { myFaceData = theBuffer; }
0047 
0048   //! Return Array of mipmap sizes, including base level.
0049   const NCollection_Array1<Standard_Integer>& MipMaps() const { return myMipMaps; }
0050 
0051   //! Return Array of mipmap sizes, including base level.
0052   NCollection_Array1<Standard_Integer>& ChangeMipMaps() { return myMipMaps; }
0053 
0054   //! Return TRUE if complete mip map level set (up to 1x1 resolution).
0055   Standard_Boolean IsCompleteMipMapSet() const { return myIsCompleteMips; }
0056 
0057   //! Set if complete mip map level set (up to 1x1 resolution).
0058   void SetCompleteMipMapSet (Standard_Boolean theIsComplete) { myIsCompleteMips = theIsComplete; }
0059 
0060   //! Return surface length in bytes.
0061   Standard_Size FaceBytes() const { return myFaceBytes; }
0062 
0063   //! Set surface length in bytes.
0064   void SetFaceBytes (Standard_Size theSize) { myFaceBytes = theSize; }
0065 
0066   //! Return surface width.
0067   Standard_Integer SizeX() const { return mySizeX; }
0068 
0069   //! Return surface height.
0070   Standard_Integer SizeY() const { return mySizeY; }
0071 
0072   //! Set surface width x height.
0073   void SetSize (Standard_Integer theSizeX, Standard_Integer theSizeY)
0074   {
0075     mySizeX = theSizeX;
0076     mySizeY = theSizeY;
0077   }
0078 
0079   //! Return TRUE if image layout is top-down (always true).
0080   bool IsTopDown() const { return true; }
0081 
0082   //! Return number of faces in the file; should be 6 for cubemap.
0083   Standard_Integer NbFaces() const { return myNbFaces; }
0084 
0085   //! Set number of faces in the file.
0086   void SetNbFaces (Standard_Integer theSize) { myNbFaces = theSize; }
0087 
0088 public:
0089 
0090   //! Empty constructor.
0091   Image_CompressedPixMap()
0092   : myFaceBytes (0), myNbFaces (0), mySizeX (0), mySizeY (0), myBaseFormat (Image_Format_UNKNOWN), myFormat (Image_CompressedFormat_UNKNOWN), myIsCompleteMips (false)  {}
0093 
0094 protected:
0095 
0096   NCollection_Array1<Standard_Integer> myMipMaps; //!< Array of mipmap sizes, including base level
0097   Handle(NCollection_Buffer) myFaceData;          //!< raw compressed data
0098   Standard_Size              myFaceBytes;         //!< surface length in bytes
0099   Standard_Integer           myNbFaces;           //!< number of faces in the file
0100   Standard_Integer           mySizeX;             //!< surface width
0101   Standard_Integer           mySizeY;             //!< surface height
0102   Image_Format               myBaseFormat;        //!< base (uncompressed) pixel format
0103   Image_CompressedFormat     myFormat;            //!< compressed format
0104   Standard_Boolean           myIsCompleteMips;    //!< flag indicating complete mip map level set (up to 1x1 resolution)
0105 
0106 };
0107 
0108 #endif // _Image_CompressedPixMap_HeaderFile