HDRImage.h
Go to the documentation of this file.00001 /**<!--------------------------------------------------------------------> 00002 @class HDRImage 00003 @author Travis Fischer (fisch0920@gmail.com) 00004 @date January 2008 00005 00006 @brief 00007 HDR image class supporting a 128- or 256-bit RgbaHDR pixel format 00008 <!-------------------------------------------------------------------->**/ 00009 00010 #ifndef MILTON_HDR_IMAGE_H_ 00011 #define MILTON_HDR_IMAGE_H_ 00012 00013 #include <common/image/Image.h> 00014 00015 class HDRImage : public Image { 00016 public: 00017 ///@name Constructors 00018 //@{----------------------------------------------------------------- 00019 00020 inline HDRImage(unsigned width = 640, unsigned height = 480); 00021 virtual ~HDRImage(); 00022 00023 00024 //@}----------------------------------------------------------------- 00025 ///@name Data Accessors / Mutators 00026 ///@note 00027 /// You can extract a particular pixel via [][]. 00028 /// For example:<br /> 00029 /// HDRImage image;<br /> 00030 /// image[2][0] = RgbaHDR(0.0, 1.0, 0.0);<br /> 00031 /// This example sets the pixel in the third row, first column to green. 00032 //@{----------------------------------------------------------------- 00033 00034 /** 00035 * @returns whether or not the underlying data for this image is stored 00036 * in a floating-point HDR format 00037 * 00038 * @note that some operations will be more of less efficient when 00039 * performed on an HDR image versus a standard 32-bit Rgba image, 00040 * and knowing whether or not an image is in HDR format can 00041 * facilitate efficient usage (cutting down on the number of 00042 * implicit conversions between HDR and non-HDR pixel formats that 00043 * must be performed) 00044 * 00045 * @note returns true for HDRImage 00046 */ 00047 virtual bool isHDR() const; 00048 00049 /// @returns the underlying data in the given row index 00050 inline RgbaHDR *operator[](unsigned index); 00051 00052 /// @returns the underlying data in the given row index 00053 inline const RgbaHDR *operator[](unsigned index) const; 00054 00055 /// @returns the underlying data in row major order 00056 inline RgbaHDR *getData(); 00057 00058 /// @returns the underlying data in row major order 00059 inline const RgbaHDR *getData() const; 00060 00061 /** 00062 * @returns the luminance of the pixel at the given row and column which 00063 * is guaranteed to lie in [0, 1] 00064 */ 00065 virtual real_t getLuminance(unsigned row, unsigned col) const; 00066 00067 00068 //@}----------------------------------------------------------------- 00069 ///@name Mutators 00070 //@{----------------------------------------------------------------- 00071 00072 /** 00073 * @brief 00074 * Sets the dimensions of this image, most likely allocating a new 00075 * underlying buffer and erasing its previous contents 00076 */ 00077 virtual void setSize(unsigned width, unsigned height); 00078 00079 00080 //@}----------------------------------------------------------------- 00081 ///@name Miscellaneous 00082 //@{----------------------------------------------------------------- 00083 00084 /** 00085 * @returns a copy of this Image and its underlying data 00086 */ 00087 virtual Image *clone() const; 00088 00089 /** 00090 * @brief 00091 * Overwrites this image's data with the given image which is assumed 00092 * to have the same dimensions as this image (and may have been created 00093 * from this image by, for example, the clone function) 00094 */ 00095 virtual void copyData(const Image *image); 00096 00097 00098 //@}----------------------------------------------------------------- 00099 00100 protected: 00101 virtual Rgba32 _getPixelRgba32 (unsigned row, unsigned col) const; 00102 virtual RgbaHDR _getPixelRgbaHDR(unsigned row, unsigned col) const; 00103 00104 virtual void _setPixel(unsigned row, unsigned col, const Rgba32 &val); 00105 virtual void _setPixel(unsigned row, unsigned col, const RgbaHDR &val); 00106 00107 virtual void _setData(const Rgba32 *data); 00108 virtual void _setData(const RgbaHDR *data); 00109 00110 protected: 00111 RgbaHDR *m_data; 00112 }; 00113 00114 // include inline definitions 00115 #include <common/image/HDRImage.inl> 00116 00117 #endif // MILTON_HDR_IMAGE_H_ 00118
Generated on 28 Feb 2009 for Milton by
1.5.6