-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathImageRow.hpp
46 lines (34 loc) · 867 Bytes
/
ImageRow.hpp
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
#pragma once
#include "Color.hpp"
class Image;
class ImageRow
{
Image const& mParent;
int mRow;
int mLeft; //first pixel
int mRight; //pixel after last pixel
public:
struct Iterator
{
ImageRow const& row;
int position;
Color operator*();
Iterator & operator++();
friend bool operator!=( Iterator const& left, Iterator const& right )
{
return left.row != right.row || left.position != right.position;
}
};
ImageRow( Image const& parent, int row, int left, int right );
~ImageRow() = default;
Iterator begin() const;
Iterator end() const;
size_t size() const;
friend bool operator!=( ImageRow const& left, ImageRow const& right )
{
return left.mRow != right.mRow || left.mLeft != right.mLeft || left.mRight != right.mRight;
}
private:
Color color( int position ) const;
};
#pragma once