TonicTones
|
00001 // HdrImage.h 00002 // 00003 // Copyright 2010 Jérémy Laumon <jeremy.laumon@gmail.com> 00004 // 00005 // This program is free software; you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation; either version 2 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program; if not, write to the Free Software 00017 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 00018 // MA 02110-1301, USA. 00019 00020 00021 #ifndef HDRIMAGE_H 00022 #define HDRIMAGE_H 00023 00024 #include <QtGui> 00025 #include <Color.h> 00026 00027 class HdrImage 00028 { 00029 00030 public: 00031 enum ColorSpace 00032 { 00033 NONE, 00034 RGB, 00035 Yxy 00036 }; 00037 00038 HdrImage(); 00039 HdrImage(const HdrImage& im); 00040 HdrImage(const QString& fileName); 00041 ~HdrImage(); 00042 QSize size() const; 00043 ColorSpace colorSpace() const; 00044 bool isNull() const; 00045 HdrImage* toRgb(const float mXyzToRgb[3][3]) const; 00046 void load(const QString &fileName); 00047 Color* operator[] (int i); 00048 const Color* operator[] (int i) const; 00049 bool hasY() const; 00050 int YIndex() const; 00051 00052 private: 00053 void resize(int width, int height); 00054 HdrImage* fromYxyToRgb(const float m[3][3]) const; 00055 00056 int width; 00057 int height; 00058 Color* data; 00059 bool null; 00060 ColorSpace space; 00061 float pMin; 00062 float pMax; 00063 00064 static int YIndices[]; 00065 }; 00066 00067 #endif