File indexing completed on 2025-01-18 10:04:16
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef MeshVS_TwoColors_HeaderFile
0017 #define MeshVS_TwoColors_HeaderFile
0018
0019 #include <Quantity_Color.hxx>
0020
0021 struct MeshVS_TwoColors
0022 {
0023 unsigned int r1 : 8;
0024 unsigned int g1 : 8;
0025 unsigned int b1 : 8;
0026 unsigned int r2 : 8;
0027 unsigned int g2 : 8;
0028 unsigned int b2 : 8;
0029
0030 bool operator==(const MeshVS_TwoColors& TwoColors) const
0031 {
0032 return (((r1 * 256 + g1) * 256 + b1) ==
0033 ((TwoColors.r1 * 256 + TwoColors.g1) * 256 + TwoColors.b1) &&
0034 ((r2 * 256 + g2) * 256 + b2) ==
0035 ((TwoColors.r2 * 256 + TwoColors.g2) * 256 + TwoColors.b2));
0036 }
0037 };
0038
0039 namespace std
0040 {
0041 template<>
0042 struct hash<MeshVS_TwoColors>
0043 {
0044 size_t operator()(const MeshVS_TwoColors& TwoColors) const noexcept
0045 {
0046 unsigned int aHash = 0;
0047 meshprsHashByte(aHash, TwoColors.r1);
0048 meshprsHashByte(aHash, TwoColors.g1);
0049 meshprsHashByte(aHash, TwoColors.b1);
0050 meshprsHashByte(aHash, TwoColors.r2);
0051 meshprsHashByte(aHash, TwoColors.g2);
0052 meshprsHashByte(aHash, TwoColors.b2);
0053 return std::hash<unsigned int>{}(aHash);
0054 }
0055 private:
0056 void meshprsHashByte(unsigned int& theHash, const unsigned int theValues) const noexcept
0057 {
0058 theHash += (theValues);
0059 theHash += (theHash << 10);
0060 theHash ^= (theHash >> 6);
0061 }
0062
0063 };
0064 }
0065
0066 Standard_EXPORT MeshVS_TwoColors BindTwoColors ( const Quantity_Color&, const Quantity_Color& );
0067 Standard_EXPORT Quantity_Color ExtractColor ( MeshVS_TwoColors&, const Standard_Integer );
0068 Standard_EXPORT void ExtractColors ( MeshVS_TwoColors&, Quantity_Color&, Quantity_Color& );
0069
0070 #endif