-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcurseur.h
40 lines (33 loc) · 1.28 KB
/
curseur.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
#ifndef CURSEUR_H
#define CURSEUR_H
#include "image.h"
class Curseur
{
public:
//enum ModeDeDeplacement{ParPixel, ParCouleur};
Curseur(Image &image);
bool seek(unsigned int x, unsigned int y, Couleur couleur);
void getPosition(unsigned int *x, unsigned int *y, Couleur *couleur = NULL) const;
inline unsigned int getX() const {return m_x;}
inline unsigned int getY() const {return m_y;}
inline Couleur getCouleur() const {return m_couleur;}
inline unsigned char read() {return m_image.get(m_x, m_y, m_couleur);}
void readPixel(unsigned char &rouge, unsigned char &vert, unsigned char &bleu, unsigned char &alpha);
inline void set(unsigned char valeur) {m_image.set(m_x, m_y, m_couleur, valeur);}
void setPixel(unsigned char rouge, unsigned char vert, unsigned char bleu, unsigned char alpha);
bool atEnd() const;
bool exist(unsigned int x, unsigned int y) const;
bool moveToNextPixel(Couleur couleur = ROUGE);
bool moveToNextColor(bool considererAlpha = false);
static Couleur nextColor(Couleur c, bool considererAlpha = false);
private:
Image &m_image;
unsigned int m_x, m_y;
Couleur m_couleur;
//ModeDeDeplacement m_mode;
};
//class CurseurPixel
//{z
//public:
//};
#endif // CURSEUR_H