-
Notifications
You must be signed in to change notification settings - Fork 0
/
Image.h
68 lines (50 loc) · 1.37 KB
/
Image.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright (C) Kevin Suffern 2000-2007.
// Copyright (C) Stefan Brumme 2005.
// Copyright (C) Sverre Kvaale 2007.
// This C++ code is for non-commercial purposes only.
// This C++ code is licensed under the GNU General Public License Version 2.
// See the file COPYING.txt for the full license.
// This is not a texture
// The Image class stores an image in PPM format
// This is used for image based textures, including ramp textures such as marble and sandstone
// I originally chose the PPM format because it's simple to parse
#pragma once
#include <vector>
#include "ColorRGB.h"
using namespace std;
//--------------------------------------------------------------------- class Image
class Image
{
public:
Image(void);
Image(const Image &image);
Image &
operator=(const Image &image);
~Image(void);
void
read_ppm_file(const char *file_name);
int
get_hres(void);
int
get_vres(void);
ColorRGB
get_color(int &index);
ColorRGB
get_color(const int row, const int col) const;
private:
int hres; // horizontal resolution of image
int vres; // vertical resolution of image
vector<ColorRGB> pixels;
};
//--------------------------------------------------------------------- get_hres
inline int
Image::get_hres(void)
{
return (hres);
}
//--------------------------------------------------------------------- get_vres
inline int
Image::get_vres(void)
{
return (vres);
}