-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bmp24Content.cpp
51 lines (45 loc) · 1008 Bytes
/
Bmp24Content.cpp
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
44
45
46
47
48
49
50
51
#include "Bmp24Content.h"
Bmp24Content::Bmp24Content(const Bmp24Content& content) : ImageContent(content)
{
numberOfZeroBytes = content.numberOfZeroBytes;
createUninitializedPixels();
int height = getHeight();
int width = getWidth();
auto sourcePixels = content.getPixels();
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
pixels[y][x] = sourcePixels[y][x];
}
}
}
int Bmp24Content::getNumberOfZeroBytes() const
{
return numberOfZeroBytes;
}
Pixels Bmp24Content::getPixels() const
{
return pixels;
}
void Bmp24Content::setNumberOfZeroBytes(int numberOfZeroBytes)
{
this->numberOfZeroBytes = numberOfZeroBytes;
}
void Bmp24Content::createUninitializedPixels()
{
pixels = Pixels(new PixelsRow[height]);
for (int y = 0; y < height; y++)
{
pixels[y] = PixelsRow(new Pixel[width]);
for (int x = 0; x < width; x++)
{
pixels[y][x].x = x;
pixels[y][x].y = y;
}
}
}
Pixel& Bmp24Content::operator()(int y, int x) const
{
return pixels[y][x];
}