forked from satu0king/ImageProcessing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImage.h
More file actions
48 lines (36 loc) · 1.3 KB
/
Image.h
File metadata and controls
48 lines (36 loc) · 1.3 KB
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
#ifndef Image_H_
#define Image_H_
#include <iostream>
#include <vector>
#include <string>
using namespace std;
#include "Pixel.h"
class Image {
protected:
unsigned int _width, _height;
Pixel **_img;
int maxColor;
public:
Image(char const *fileName); // Reads the Image from a file
Image(const Image &); // Copy constructor
// Basic constructor, all pixels initialzed to 0
Image(unsigned int width, unsigned int height, int maxColor = 255);
// Basic constructor2, all pixels initialzed to color c
Image(unsigned int width, unsigned int height, Color c, int maxColor = 255);
~Image(); // destructor
Image &operator=(Image const &i1); // Assignment operator
Color color(int i, int j) const; // getter
int width() const; // getter
int height() const; // getter
int resolution() const; // getter
void set_color(int i, int j, Color c); // setter
void set_pixel(int i, int j, Pixel p); // setter
// Overloaded + operator - helpful in composition
friend Image operator+(Image const &i1, Image const &i2);
// Overloaded * operator - helpful in composition
friend Image operator*(Image const &i1, float f);
void write(char const *file); // Writes the image to a file
void findColor(Color c, int &x, int &y);
friend class Histogram;
};
#endif