aboutsummaryrefslogtreecommitdiff
path: root/src/image.cpp
blob: e20b05ef37805741e51399330f4c692f1a7ef461 (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
#include "image.h"
#include <algorithm>
#include <cstdint>

namespace TehImage
{

	Image::Image(const Image& other)
	{
		this->colorValues = other.colorValues;
		this->bpp = other.bpp;
	
		this->width = other.width;
		this->height = other.height;
		this->bitDepth = other.bitDepth;
		this->colorType = other.colorType;
		this->compressionMethod = other.compressionMethod;
		this->filterMethod = other.filterMethod;
		this->interlaceMethod = other.interlaceMethod;
	
		pixels = std::make_unique<Pixel[]>(width*height);
		std::copy_n(other.pixels.get(), width*height, pixels.get());
	}

	Pixel& Image::operator[](int x, int y)
	{
		return pixels[x + y*width];
	};

}