il_exr.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. //-----------------------------------------------------------------------------
  2. //
  3. // ImageLib Sources
  4. // Copyright (C) 2000-2008 by Denton Woods
  5. // Last modified: 08/29/2008
  6. //
  7. // Filename: src-IL/include/il_exr.h
  8. //
  9. // Description: Reads from an OpenEXR (.exr) file.
  10. //
  11. //-----------------------------------------------------------------------------
  12. #ifndef EXR_H
  13. #define EXR_H
  14. #include "il_internal.h"
  15. #include <ImfIO.h>
  16. //using namespace Imf; // Using this leads to errors with Microsoft's IStream.
  17. // So it is better to just specify the namespace explicitly.
  18. typedef struct EXRHEAD
  19. {
  20. ILuint MagicNumber; // File signature (0x76, 0x2f, 0x31, 0x01)
  21. ILuint Version; // Treated as two bitfields
  22. } IL_PACKSTRUCT EXRHEAD;
  23. //@TODO: Should I just do these as enums?
  24. #define EXR_UINT 0
  25. #define EXR_HALF 1
  26. #define EXR_FLOAT 2
  27. #define EXR_NO_COMPRESSION 0
  28. #define EXR_RLE_COMPRESSION 1
  29. #define EXR_ZIPS_COMPRESSION 2
  30. #define EXR_ZIP_COMPRESSION 3
  31. #define EXR_PIZ_COMPRESSION 4
  32. #define EXR_PXR24_COMPRESSION 5
  33. #define EXR_B44_COMPRESSION 6
  34. #define EXR_B44A_COMPRESSION 7
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38. ILboolean iIsValidExr();
  39. ILboolean iCheckExr(EXRHEAD *Header);
  40. ILboolean iLoadExrInternal();
  41. ILboolean iSaveExrInternal();
  42. #ifdef __cplusplus
  43. }
  44. #endif
  45. class ilIStream : public Imf::IStream
  46. {
  47. public:
  48. ilIStream(/*ILHANDLE Handle*/);
  49. virtual bool read (char c[/*n*/], int n);
  50. // I don't think I need this one, since we are taking care of the file handles ourselves.
  51. //virtual char * readMemoryMapped (int n);
  52. virtual Imf::Int64 tellg ();
  53. virtual void seekg (Imf::Int64 Pos);
  54. virtual void clear ();
  55. protected:
  56. private:
  57. };
  58. class ilOStream : public Imf::OStream
  59. {
  60. public:
  61. ilOStream(/*ILHANDLE Handle*/);
  62. virtual void write (const char c[/*n*/], int n);
  63. // I don't think I need this one, since we are taking care of the file handles ourselves.
  64. //virtual char * readMemoryMapped (int n);
  65. virtual Imf::Int64 tellp ();
  66. virtual void seekp (Imf::Int64 Pos);
  67. protected:
  68. private:
  69. };
  70. #endif//EXR_H