Image.inl

Go to the documentation of this file.
00001 /**<!-------------------------------------------------------------------->
00002    @file   Image.inl
00003    @author Travis Fischer (fisch0920@gmail.com)
00004    @author Matthew Jacobs (jacobs.mh@gmail.com)
00005    @date   Fall 2008
00006    
00007    @brief
00008      Abstract image class supporting a standard 32-bit Rgba pixel format, as 
00009    well as an extended, 128- or 256-bit floating-point RgbaHDR pixel format 
00010    for high dynamic range images
00011    
00012    @note
00013       In addition to Qt's normal image loading / saving, represented by the 
00014    following table, this class also supports loading / saving of images in 
00015    HDR, OpenEXR, and PFM image formats.
00016    
00017    Default/built-in image formats supported by Qt:
00018    
00019     Format                 Description                     Qt Support
00020     ------  -------------------------------------------  --------------
00021       BMP   Windows Bitmap                               Read / Write
00022       GIF   Graphic Interchange Format (optional)        Read
00023       JPG   Joint Photographic Experts Group             Read / Write
00024       JPEG  Joint Photographic Experts Group             Read / Write
00025       PNG   Portable Network Graphics                    Read / Write
00026       PBM   Portable Bitmap                              Read
00027       PGM   Portable Graymap                             Read
00028       PPM   Portable Pixmap                              Read / Write
00029       TIFF  Tagged Image File Format                     Read / Write
00030       XBM   X11 Bitmap                                   Read / Write
00031       XPM   X11 Pixmap                                   Read / Write
00032    
00033    Extra High Dynamic Range image formats supported by Milton:
00034    
00035     Format                 Description                      Support
00036     ------  -------------------------------------------   ----------- 
00037       HDR   Also known as RGBE (Radiance, by Greg Ward)  Read / Write
00038       EXR   ILM's OpenEXR Format                         Read / Write*
00039       PFM   Portable Float Map Format                    Read / Write
00040    
00041    @note
00042       * OpenEXR is only supported on platforms / builds with ILM's OpenEXR 
00043    libraries which do not come bundled with Milton.
00044    <!-------------------------------------------------------------------->**/
00045 
00046 #ifndef MILTON_IMAGE_INL_
00047 #define MILTON_IMAGE_INL_
00048 
00049 inline Image::Image(unsigned width, unsigned height)
00050    : m_width(width), m_height(height), m_size(width * height)
00051 { }
00052 
00053 template <typename T>
00054 inline T Image::getPixel(unsigned row, unsigned col) const {
00055    ASSERT(row < m_height && col < m_width);
00056    
00057    if (sizeof(T) == sizeof(Rgba32))
00058       return _getPixelRgba32(row, col);
00059    
00060    return _getPixelRgbaHDR(row, col);
00061 }
00062 
00063 template <typename T>
00064 inline void Image::setPixel(unsigned row, unsigned col, const T &val) {
00065    ASSERT(row < m_height && col < m_width);
00066    
00067    _setPixel(row, col, val);
00068 }
00069 
00070 inline unsigned Image::getWidth() const {
00071    return m_width;
00072 }
00073 
00074 inline unsigned Image::getHeight() const {
00075    return m_height;
00076 }
00077 
00078 inline unsigned Image::getSize() const {
00079    return m_size;
00080 }
00081 
00082 template <typename T>
00083 inline void Image::setData(const T *data) {
00084    _setData(data);
00085 }
00086 
00087 template <typename T>
00088 inline void Image::setData(const T *data, unsigned width, unsigned height) {
00089    setSize(width, height);
00090    
00091    _setData(data);
00092 }
00093 
00094 #endif // MILTON_IMAGE_INL_
00095 

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6