-
Notifications
You must be signed in to change notification settings - Fork 0
/
Image.h
95 lines (78 loc) · 1.81 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/**
* Image.h
*
* Created on: Aug 3, 2011
* Author: Jeroen Vlek
* Email: [email protected]
* Website: www.perceptivebits.com
* License: Free Beer (Feel free to use it in every
* way possible and if you like it, make
* sure to give me credit and buy me a drink
* if we ever meet ;) )
*/
#ifndef IMAGE_H_
#define IMAGE_H_
#include "Gene.h"
#include "ImageImp.h"
#include "Pixel.h"
#include <string>
/**
* The base class for the images used. It uses a bridge to decouple interface
* from implementation. The implementation is stored in an ImageImp object.
*/
class Image
{
public:
virtual ~Image();
/**
* Clears the image to black.
*/
void clear();
/**
* @return The width of the image in pixels.
*/
unsigned int getWidth();
/**
* @return The height of the image in pixels.
*/
unsigned int getHeight();
/**
* @return A reference to the object containing the implementation.
*/
ImageImp& getImageImp();
/**
* @return The pixel at location (x,y)
*/
const PIXEL* get(unsigned int x, unsigned int y);
/**
* Returns the horizontal pixel line at height y
*
* @param y
* @return
*/
const PIXEL* getScanline(unsigned int y);
protected:
/**
* The actual implementation of the image.
*/
ImageImp* m_imp;
/**
* Constructor
*/
Image();
/**
* Loads an image from file.
* Virtual implementation to be overridden by TargetImage. The default
* implementation only prints a message to cout.
* @param filename
*/
virtual void loadFromFile(const std::string& filename);
/**
* Draws the gene onto the image.
* Virtual implementation to be overridden by PhenotypeImage. The default
* implementation only prints a message to cout.
* @param gene
*/
virtual void drawGene(const Gene& gene);
};
#endif /* IMAGE_H_ */