-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRGBPixelSet.h
More file actions
29 lines (25 loc) · 804 Bytes
/
RGBPixelSet.h
File metadata and controls
29 lines (25 loc) · 804 Bytes
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
#ifndef RGBPIXELSET_H_INCLUDED
#define RGBPIXELSET_H_INCLUDED
#include <vector>
#include <algorithm>
#include "RGBPixel.h"
namespace Compression {
class RGBPixelSet {
public:
RGBPixelSet(int width, int height):width(width), height(height){
image.reserve(width*height);
}
void addPixel(RGBPixel px){
image.push_back(px);
}
RGBPixel* getPixel(int ind){ return &(image[ind]); }
RGBPixel* getPixel(int x, int y){ return &(image[x * width + y]); }
int getHeight(){return height;}
int getWidth(){return width;}
int getSize(){return height * width;}
private:
std::vector<RGBPixel> image;
int width, height;
};
}
#endif