SapLut.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #ifndef _SAPLUT_H_
  2. #define _SAPLUT_H_
  3. // SapLut.h : header file
  4. //
  5. #include "SapClassBasicDef.h"
  6. //
  7. // SapLut class declaration
  8. //
  9. class SAPCLASSBASIC_CLASS SapLut : public SapManager
  10. {
  11. public:
  12. // Arithmetic operations
  13. enum ArithmeticOp
  14. {
  15. Add,
  16. ASub,
  17. Max,
  18. Min,
  19. Scale,
  20. Sub
  21. };
  22. // Boolean operations
  23. enum BooleanOp
  24. {
  25. And,
  26. Or,
  27. Xor
  28. };
  29. public:
  30. // Constructor/Destructor
  31. SapLut(int numEntries = SapDefLutEntries, SapFormat format = SapFormatUint8, SapLocation loc = SapLocation::ServerSystem);
  32. SapLut(const char *filename, SapLocation loc = SapLocation::ServerSystem);
  33. SapLut(const SapLut &lut);
  34. virtual ~SapLut();
  35. SapLut &operator= (const SapLut &lut);
  36. // Module create/destroy
  37. virtual BOOL Create();
  38. virtual BOOL Destroy();
  39. // Access to implementation
  40. CORHANDLE GetHandle() const { return m_hLut; }
  41. SapLocation GetLocation() const { return m_Location; }
  42. int GetNumEntries() const { return m_NumEntries; }
  43. SapFormat GetFormat() const { return m_Format; }
  44. int GetElementSize() const { return m_DataSize; }
  45. int GetNumPages() const { return m_NumPages; }
  46. BOOL IsSigned() const { return m_IsSigned; }
  47. int GetTotalSize() const { return m_TotalSize; }
  48. BOOL SetLocation(SapLocation location);
  49. virtual BOOL SetNumEntries(int numEntries);
  50. virtual BOOL SetFormat(SapFormat format);
  51. virtual BOOL GetParameter(int param, void *pValue);
  52. virtual BOOL SetParameter(int param, int value);
  53. virtual BOOL SetParameter(int param, void *pValue);
  54. // LUT manipulation
  55. virtual BOOL Copy(SapLut *pSrc);
  56. virtual BOOL Load(const char *filename);
  57. virtual BOOL Save(const char *filename);
  58. virtual BOOL Read(int lutIndex, SapData *pValue);
  59. virtual BOOL Read(int offset, void *pData, int size);
  60. virtual BOOL Write(int lutIndex, SapData value);
  61. virtual BOOL Write(int offset, void *pData, int size);
  62. // Data generation methods
  63. virtual BOOL Arithmetic(ArithmeticOp operation, SapData value);
  64. virtual BOOL BinaryPattern(int bitNumber, SapData newValue);
  65. virtual BOOL Boolean(BooleanOp operation, SapData value);
  66. virtual BOOL Gamma(float factor);
  67. virtual BOOL Normal();
  68. virtual BOOL Reverse();
  69. virtual BOOL Roll(int numEntries);
  70. virtual BOOL Shift(int numBits);
  71. virtual BOOL Slope(int startIndex, int endIndex, SapData minValue, SapData maxValue, BOOL clipOutside = FALSE);
  72. virtual BOOL Threshold(SapData threshValue);
  73. virtual BOOL Threshold(SapData lowValue, SapData highValue);
  74. protected:
  75. // Utility methods
  76. void Construct(SapLocation loc, int numEntries, SapFormat format, const char *filename);
  77. protected:
  78. SapLocation m_Location;
  79. CORLUT m_hLut;
  80. char m_Filename[MAX_PATH]; // Used when creating LUT from an existing file
  81. // Parameters
  82. int m_NumEntries; // Number of entries
  83. SapFormat m_Format; // Data format
  84. int m_DataSize; // Number of bytes for one LUT element
  85. int m_NumPages; // Number of color pages
  86. BOOL m_IsSigned; // TRUE if LUT data is signed
  87. int m_TotalSize; // Total number of data bytes
  88. };
  89. #endif // _SAPBUFFER_H_