aboutsummaryrefslogtreecommitdiff
path: root/src/image.h
blob: d6fec04c8f2e8c2ee85d9a609adbfd0b511a22a2 (plain) (blame)
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
#pragma once

#include <cstdint>
#include <cstring>
#include <memory>
#include <string>

namespace TehImage
{

	struct Pixel
	{
		uint8_t r, g, b, a;
	};

	class Image
	{
	protected:
		std::unique_ptr<Pixel[]> pixels;
		// uint8_t* imageData;
		uint8_t colorValues;
		uint8_t bpp;
	public:
		Image() = default;

		// template<std::derived_from<Image> T>
		Image(const Image& other);

		virtual int readFromFile(std::string filename) = 0;
		virtual int writeToFile(std::string filename) = 0;
	
		Pixel& operator[](int x, int y);

		uint32_t width = 0;
		uint32_t height = 0;
		uint8_t bitDepth;
		uint8_t colorType;
		uint8_t compressionMethod;
		uint8_t filterMethod;
		uint8_t interlaceMethod;
	};

}