1 /**
2  * @brief IO operations on Radiance's RGBE file format
3  *
4  * This file is a part of PFSTOOLS package.
5  * ----------------------------------------------------------------------
6  * Copyright (C) 2003,2004 Rafal Mantiuk and Grzegorz Krawczyk
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  * ----------------------------------------------------------------------
22  *
23  * @author Grzegorz Krawczyk, <krawczyk@mpi-sb.mpg.de>
24  *
25  * $Id: rgbeio.h,v 1.4 2014/06/17 21:57:09 rafm Exp $
26  */
27 
28 #ifndef _RGBEIO_H_
29 #define _RGBEIO_H_
30 
31 #include <stdio.h>
32 #include <array2d.h>
33 
34 
35 class RGBEReader
36 {
37   FILE *fh;
38   int width, height;
39   float exposure;
40   bool radiance_compatibility;
41 
42 public:
43   RGBEReader( FILE *fh, bool radiance_compatibility = false );
44   ~RGBEReader();
45 
getWidth()46   int getWidth() const
47     {
48       return width;
49     }
50 
getHeight()51   int getHeight() const
52     {
53       return height;
54     }
55 
56   void readImage( pfs::Array2D *X, pfs::Array2D *Y, pfs::Array2D *Z );
57 
58 };
59 
60 
61 class RGBEWriter
62 {
63   FILE *fh;
64   bool radiance_compatibility;
65 public:
fh(fh)66 	RGBEWriter(FILE *fh, bool radiance_compatibility = false) : fh(fh), radiance_compatibility(radiance_compatibility)
67     {
68     }
69 
70   void writeImage( pfs::Array2D *X, pfs::Array2D *Y, pfs::Array2D *Z );
71 };
72 
73 #endif
74