OpenGL ES SDK for Android ARM Developer Center
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HDRImage.h
Go to the documentation of this file.
1 /* Copyright (c) 2012-2017, ARM Limited and Contributors
2  *
3  * SPDX-License-Identifier: MIT
4  *
5  * Permission is hereby granted, free of charge,
6  * to any person obtaining a copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
9  * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
14  * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19  */
20 
21 #ifndef HDR_IMAGE_LOADER_H
22 #define HDR_IMAGE_LOADER_H
23 
24 namespace MaliSDK
25 {
33  class HDRImage
34  {
35  public:
39  HDRImage(void);
40 
46  HDRImage(const std::string& filePath);
47 
53  HDRImage(HDRImage& another);
54 
58  virtual ~HDRImage(void);
59 
65  void loadFromFile(const std::string& filePath);
66 
72  HDRImage& operator=(const HDRImage &another);
73 
80  float* rgbData;
81 
85  int width;
86 
90  int height;
91 
92  private:
93 
94  struct RGBEPixel
95  {
96  unsigned char r;
97  unsigned char g;
98  unsigned char b;
99  unsigned char e;
100  };
101 
102  static void convertRGBEPixel(const RGBEPixel& pixel, float* rgbData);
103 
104  static float convertSingleComponent(unsigned char value, int exponent);
105 
106  static bool decodeLine(FILE* file, int lineLength, RGBEPixel* scanLine);
107 
108  static void writeDecodedComponent(int componentIndicator, unsigned char value, RGBEPixel* pixel);
109  };
110 
111 }
112 #endif /* HDR_IMAGE_LOADER_H */
static float convertSingleComponent(unsigned char value, int exponent)
Definition: HDRImage.cpp:192
virtual ~HDRImage(void)
Destructor.
Definition: HDRImage.cpp:61
static bool decodeLine(FILE *file, int lineLength, RGBEPixel *scanLine)
Definition: HDRImage.cpp:200
int width
The width of the HDR image.
Definition: HDRImage.h:85
void loadFromFile(const std::string &filePath)
Load a HDRImage from a file.
Definition: HDRImage.cpp:95
GLint value
Definition: gl2ext.h:558
HDRImage(void)
Default constructor.
Definition: HDRImage.cpp:49
float * rgbData
The HDR image data.
Definition: HDRImage.h:80
Class to load an manage HDR images.
Definition: HDRImage.h:33
HDRImage & operator=(const HDRImage &another)
Overloading assignment operater to do deep copy of the HDRImage data.
Definition: HDRImage.cpp:70
static void writeDecodedComponent(int componentIndicator, unsigned char value, RGBEPixel *pixel)
Definition: HDRImage.cpp:260
static void convertRGBEPixel(const RGBEPixel &pixel, float *rgbData)
Definition: HDRImage.cpp:183
int height
The height of the HDR image.
Definition: HDRImage.h:90