00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00020 #ifndef SHIMAGE_HPP
00021 #define SHIMAGE_HPP
00022
00023 #include <string>
00024 #include "ShDllExport.hpp"
00025 #include "ShRefCount.hpp"
00026 #include "ShMemory.hpp"
00027
00028 namespace SH {
00029
00035 class
00036 SH_DLLEXPORT ShImage : public ShRefCountable {
00037 public:
00038 ShImage();
00039 ShImage(int width, int height, int depth);
00040
00041 ShImage(const ShImage& other);
00042
00043 ~ShImage();
00044
00045 ShImage& operator=(const ShImage& other);
00046
00047
00048 int width() const;
00049 int height() const;
00050 int elements() const;
00051
00052
00053 float operator()(int x, int y, int i) const;
00054
00055
00056 float& operator()(int x, int y, int i);
00057
00058
00059
00065 void load_PNG(const std::string& filename) { loadPng(filename); }
00066 void loadPng(const std::string& filename);
00067
00068
00069 void savePng(const std::string& filename, int inverse_alpha=0);
00070
00071
00072 void savePng16(const std::string& filename, int inverse_alpha=0);
00073
00074 ShImage getNormalImage();
00075
00076 const float* data() const;
00077 float* data();
00078
00079 void dirty();
00080 ShMemoryPtr memory();
00081 ShPointer<const ShMemory> memory() const;
00082
00083 private:
00084 int m_width, m_height;
00085 int m_elements;
00086 ShHostMemoryPtr m_memory;
00087 };
00088
00089 }
00090
00091 #endif