summaryrefslogtreecommitdiff
path: root/rotord/src/Pixels.h
blob: b6f586526c749f9c03b5f533a2a5f3e7a0fdb727 (plain)
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
#include <stdint.h>
#include <algorithm>
//for now always uint8_t* rather than templated

class Pixels{
	public:
		Pixels();
		~Pixels();
		void allocate(int w, int h, int channels);
		bool isAllocated() const;
		void setFromExternalPixels(uint8_t * newPixels,int w, int h, int channels);
		uint8_t * getPixels();
		int getWidth() const;
		int getHeight() const;
		void clear();
		void swap(Pixels & pix);
		int getBytesPerPixel() const;
		int getNumChannels() const;
		void set(uint8_t val);
	private:
		uint8_t * pixels;
		int width;
		int height;
		int channels;
		bool bAllocated;
		bool pixelsOwner;			// if set from external data don't delete it
};