Image Class Reference
Abstract image class supporting a standard 32-bit Rgba pixel format, as well as an extended, 128- or 256-bit floating-point RgbaHDR pixel format for high dynamic range images. More...
#include <Image.h>

Saving / Loading | |
| virtual bool | save (const std::string &filename) const |
| Attempts to save this image out to the given file, inferring the desired file format by the filename's extension. | |
| static Image * | load (const std::string &filename) |
| Attempts to load an image from the given file, inferring the image file format by the filename's extension. | |
Public Member Functions | |
Constructors | |
| Image (unsigned width=640, unsigned height=480) | |
| virtual | ~Image () |
Data Accessors / Mutators | |
| virtual bool | isHDR () const =0 |
| template<typename T> | |
| T | getPixel (unsigned row, unsigned col) const |
| template<typename T> | |
| void | setPixel (unsigned row, unsigned col, const T &val) |
| Sets the pixel in the given row and column to the pixel value in the desired template format (either Rgba32 or RgbaHDR). | |
| virtual real_t | getLuminance (unsigned row, unsigned col) const =0 |
Size accessors | |
| unsigned | getWidth () const |
| unsigned | getHeight () const |
| unsigned | getSize () const |
Large Mutators | |
| virtual void | setSize (unsigned width, unsigned height)=0 |
| Sets the dimensions of this image, most likely allocating a new underlying buffer and erasing its previous contents. | |
| template<typename T> | |
| void | setData (const T *data) |
| Sets the underlying data - data should be the size of the image. | |
| template<typename T> | |
| void | setData (const T *data, unsigned width, unsigned height) |
| Sets the underlying data and image dimensions, where the given data should be preallocated to the desired size of the image. | |
Miscellaneous | |
| virtual Image * | clone () const =0 |
| virtual void | copyData (const Image *image)=0 |
| Overwrites this image's data with the given image which is assumed to have the same dimensions as this image (and may have been created from this image by, for example, the clone function). | |
Protected Member Functions | |
| virtual Rgba32 | _getPixelRgba32 (unsigned row, unsigned col) const =0 |
| virtual RgbaHDR | _getPixelRgbaHDR (unsigned row, unsigned col) const =0 |
| virtual void | _setPixel (unsigned row, unsigned col, const Rgba32 &val)=0 |
| virtual void | _setPixel (unsigned row, unsigned col, const RgbaHDR &val)=0 |
| virtual void | _setData (const Rgba32 *data)=0 |
| virtual void | _setData (const RgbaHDR *data)=0 |
Protected Attributes | |
| unsigned | m_width |
| unsigned | m_height |
| unsigned | m_size |
Detailed Description
Abstract image class supporting a standard 32-bit Rgba pixel format, as well as an extended, 128- or 256-bit floating-point RgbaHDR pixel format for high dynamic range images.
- Date:
- Fall 2008
- Note:
- In addition to Qt's normal image loading / saving, represented by the following table, this class also supports loading / saving of images in HDR, OpenEXR, and PFM image formats.
Format Description Qt Support ------ ------------------------------------------- -------------- BMP Windows Bitmap Read / Write GIF Graphic Interchange Format (optional) Read JPG Joint Photographic Experts Group Read / Write JPEG Joint Photographic Experts Group Read / Write PNG Portable Network Graphics Read / Write PBM Portable Bitmap Read PGM Portable Graymap Read PPM Portable Pixmap Read / Write TIFF Tagged Image File Format Read / Write XBM X11 Bitmap Read / Write XPM X11 Pixmap Read / Write
Extra High Dynamic Range image formats supported by Milton:
Format Description Support ------ ------------------------------------------- ----------- HDR Also known as RGBE (Radiance, by Greg Ward) Read / Write EXR ILM's OpenEXR Format Read / Write* PFM Portable Float Map Format Read / Write
- Note:
- OpenEXR is only supported on platforms / builds with ILM's OpenEXR libraries which do not come bundled with Milton.
Definition at line 51 of file Image.h.
Constructor & Destructor Documentation
| Image::Image | ( | unsigned | width = 640, |
|
| unsigned | height = 480 | |||
| ) | [inline] |
Member Function Documentation
| Image * Image::load | ( | const std::string & | filename | ) | [static] |
Attempts to load an image from the given file, inferring the image file format by the filename's extension.
- Note:
- If the actual file loaded is RgbaHDR and the requested image format is RgbaImage, the loaded HDRImage image will be converted to an RgbaImage before returning. Similarly, if the image was stored in an Rgba32 format (PNG, JPEG, etc.), and the requested image format is HDRImage, the loaded RgbaImage will be converted to an HDRImage before returning.
- Returns:
- a new image of the desired type upon success or NULL upon failur
| bool Image::save | ( | const std::string & | filename | ) | const [virtual] |
| virtual bool Image::isHDR | ( | ) | const [pure virtual] |
- Returns:
- whether or not the underlying data for this image is stored in a floating-point HDR format
- Note:
- that some operations will be more of less efficient when performed on an HDR image versus a standard 32-bit Rgba image, and knowing whether or not an image is in HDR format can facilitate efficient usage (cutting down on the number of implicit conversions between HDR and non-HDR pixel formats that must be performed)
| T Image::getPixel | ( | unsigned | row, | |
| unsigned | col | |||
| ) | const [inline] |
| void Image::setPixel | ( | unsigned | row, | |
| unsigned | col, | |||
| const T & | val | |||
| ) | [inline] |
| virtual real_t Image::getLuminance | ( | unsigned | row, | |
| unsigned | col | |||
| ) | const [pure virtual] |
| unsigned Image::getWidth | ( | ) | const [inline] |
| unsigned Image::getHeight | ( | ) | const [inline] |
| unsigned Image::getSize | ( | ) | const [inline] |
| virtual void Image::setSize | ( | unsigned | width, | |
| unsigned | height | |||
| ) | [pure virtual] |
| void Image::setData | ( | const T * | data | ) | [inline] |
Sets the underlying data - data should be the size of the image.
| void Image::setData | ( | const T * | data, | |
| unsigned | width, | |||
| unsigned | height | |||
| ) | [inline] |
Sets the underlying data and image dimensions, where the given data should be preallocated to the desired size of the image.
| virtual Image* Image::clone | ( | ) | const [pure virtual] |
| virtual void Image::copyData | ( | const Image * | image | ) | [pure virtual] |
| virtual Rgba32 Image::_getPixelRgba32 | ( | unsigned | row, | |
| unsigned | col | |||
| ) | const [protected, pure virtual] |
| virtual RgbaHDR Image::_getPixelRgbaHDR | ( | unsigned | row, | |
| unsigned | col | |||
| ) | const [protected, pure virtual] |
| virtual void Image::_setPixel | ( | unsigned | row, | |
| unsigned | col, | |||
| const Rgba32 & | val | |||
| ) | [protected, pure virtual] |
| virtual void Image::_setPixel | ( | unsigned | row, | |
| unsigned | col, | |||
| const RgbaHDR & | val | |||
| ) | [protected, pure virtual] |
| virtual void Image::_setData | ( | const Rgba32 * | data | ) | [protected, pure virtual] |
| virtual void Image::_setData | ( | const RgbaHDR * | data | ) | [protected, pure virtual] |
Member Data Documentation
unsigned Image::m_width [protected] |
unsigned Image::m_height [protected] |
unsigned Image::m_size [protected] |
The documentation for this class was generated from the following files:
Generated on 28 Feb 2009 for Milton by
1.5.6