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

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];
};