-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHeader.h
65 lines (52 loc) · 1.19 KB
/
Header.h
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#pragma once
#include <iostream>
#include "Data.h"
using namespace std;
class Header
{
public:
Header();
~Header();
Data byteData = Data(17);
void setType(int type)
{
byteData.data[0] = type >> 8;
byteData.data[1] = (type << 24) >> 24;
}
void setFileSize(int fileSize)
{
byteData.data[2] = fileSize >> 24;
byteData.data[3] = (fileSize << 8) >> 24;
byteData.data[4] = (fileSize << 16) >> 24;
byteData.data[5] = (fileSize << 24) >> 24;
}
void setBeginning(int beginning)
{
byteData.data[6] = beginning >> 8;
byteData.data[7] = (beginning << 24) >> 24;
}
void setImageSize(int width, int height)
{
byteData.data[8] = width >> 24;
byteData.data[9] = (width << 8) >> 24;
byteData.data[10] = (width << 16) >> 24;
byteData.data[11] = (width << 24) >> 24;
cout << unsigned(byteData.data[11]) << endl;
width = 0;
byteData.data[12] = height >> 24;
byteData.data[13] = (height << 8) >> 24;
byteData.data[14] = (height << 16) >> 24;
byteData.data[15] = (height << 24) >> 24;
}
void setColorSet(char value)
{
byteData.data[16] = value;
}
void loadColorSet(char * colorSet)
{
for (int i = 0; i < 192; ++i)
{
byteData.data[i + 17] = colorSet[i];
}
}
};