Nori  23
bitmap.h
1 /*
2  This file is part of Nori, a simple educational ray tracer
3 
4  Copyright (c) 2015 by Wenzel Jakob
5 
6  Nori is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License Version 3
8  as published by the Free Software Foundation.
9 
10  Nori is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #if !defined(__NORI_BITMAP_H)
20 #define __NORI_BITMAP_H
21 
22 #include <nori/color.h>
23 #include <nori/vector.h>
24 
25 NORI_NAMESPACE_BEGIN
26 
32 class Bitmap : public Eigen::Array<Color3f, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> {
33 public:
34  typedef Eigen::Array<Color3f, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> Base;
35 
42  Bitmap(const Vector2i &size = Vector2i(0, 0))
43  : Base(size.y(), size.x()) { }
44 
46  Bitmap(const std::string &filename);
47 
49  void save(const std::string &filenameStem);
50 
52  void saveEXR(const std::string &filenameStem);
53 
55  void savePNG(const std::string &filenameStem);
56 };
57 
58 NORI_NAMESPACE_END
59 
60 #endif /* __NORI_BITMAP_H */
Stores a RGB high dynamic-range bitmap.
Definition: bitmap.h:32
void save(const std::string &filenameStem)
Save the bitmap as an EXR and PNG file with the specified filename.
Definition: bitmap.cpp:82
void saveEXR(const std::string &filenameStem)
Save the bitmap as an EXR file with the specified filename.
Definition: bitmap.cpp:88
void savePNG(const std::string &filenameStem)
Save the bitmap as a PNG file with the specified filename.
Definition: bitmap.cpp:129
Bitmap(const Vector2i &size=Vector2i(0, 0))
Allocate a new bitmap of the specified size.
Definition: bitmap.h:42