91abe1665f35a9144c4299b78dbab02f3215d279
[occt.git] / src / Image / Image_SupportedFormats.hxx
1 // Copyright (c) 2020 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14 #ifndef _Image_SupportedFormats_HeaderFile
15 #define _Image_SupportedFormats_HeaderFile
16
17 #include <Image_CompressedFormat.hxx>
18 #include <NCollection_Array1.hxx>
19 #include <Standard_Type.hxx>
20
21 //! Structure holding information about supported texture formats.
22 class Image_SupportedFormats : public Standard_Transient
23 {
24   DEFINE_STANDARD_RTTIEXT(Image_SupportedFormats, Standard_Transient)
25 public:
26
27   //! Empty constructor.
28   Standard_EXPORT Image_SupportedFormats();
29
30   //! Return TRUE if image format is supported.
31   bool IsSupported (Image_Format theFormat) const { return myFormats.Value (theFormat); }
32
33   //! Set if image format is supported or not.
34   void Add (Image_Format theFormat) { myFormats.SetValue (theFormat, true); }
35
36   //! Return TRUE if there are compressed image formats supported.
37   bool HasCompressed() const { return myHasCompressed; }
38
39   //! Return TRUE if compressed image format is supported.
40   bool IsSupported (Image_CompressedFormat theFormat) const { return myFormats.Value (theFormat); }
41
42   //! Set if compressed image format is supported or not.
43   void Add (Image_CompressedFormat theFormat)
44   {
45     myFormats.SetValue (theFormat, true);
46     myHasCompressed = true;
47   }
48
49   //! Reset flags.
50   void Clear()
51   {
52     myFormats.Init (false);
53     myHasCompressed = false;
54   }
55
56 protected:
57
58   NCollection_Array1<bool> myFormats; //!< list of supported formats
59   Standard_Boolean   myHasCompressed; //!< flag indicating that some compressed image formats are supported
60
61 };
62
63 #endif // _Image_SupportedFormats_HeaderFile