Skip to content

Commit e862542

Browse files
committed
.
1 parent 6f0f783 commit e862542

7 files changed

+85
-22
lines changed

Advanced-Cpp-Programming.vcxproj

+3-1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@
128128
</Link>
129129
</ItemDefinitionGroup>
130130
<ItemGroup>
131+
<ClInclude Include="Fractal Images\Bitmap.h" />
131132
<ClInclude Include="Fractal Images\BitmapFileHeader.h" />
132133
<ClInclude Include="Fractal Images\BitmapInfoHeader.h" />
133134
<ClInclude Include="Operator Overloading\Complex.h" />
@@ -136,7 +137,8 @@
136137
<ClInclude Include="Template Classes and Functions\Template-class.h" />
137138
</ItemGroup>
138139
<ItemGroup>
139-
<ClCompile Include="Fractal Images\Fractal.cpp" />
140+
<ClCompile Include="Fractal Images\Bitmap.cpp" />
141+
<ClCompile Include="Fractal Images\main.cpp" />
140142
<ClCompile Include="Operator Overloading\Complex.cpp" />
141143
</ItemGroup>
142144
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

Advanced-Cpp-Programming.vcxproj.filters

+7-1
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,18 @@
3333
<ClInclude Include="Fractal Images\BitmapInfoHeader.h">
3434
<Filter>Header Files</Filter>
3535
</ClInclude>
36+
<ClInclude Include="Fractal Images\Bitmap.h">
37+
<Filter>Header Files</Filter>
38+
</ClInclude>
3639
</ItemGroup>
3740
<ItemGroup>
3841
<ClCompile Include="Operator Overloading\Complex.cpp">
3942
<Filter>Source Files</Filter>
4043
</ClCompile>
41-
<ClCompile Include="Fractal Images\Fractal.cpp">
44+
<ClCompile Include="Fractal Images\main.cpp">
45+
<Filter>Source Files</Filter>
46+
</ClCompile>
47+
<ClCompile Include="Fractal Images\Bitmap.cpp">
4248
<Filter>Source Files</Filter>
4349
</ClCompile>
4450
</ItemGroup>

Fractal Images/Bitmap.cpp

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include "Bitmap.h"
2+
3+
namespace fractal {
4+
5+
Bitmap::Bitmap(int width, int height): m_width(width), m_height(height) {
6+
7+
}
8+
9+
bool Bitmap::write(string filename) {
10+
return false;
11+
}
12+
void setPixel(int x, int y, uint8_t red, uint8_t green, uint8_t blue) {
13+
14+
}
15+
16+
Bitmap:: ~Bitmap() {
17+
18+
}
19+
20+
}

Fractal Images/Bitmap.h

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#pragma once
2+
3+
#ifndef BITMAP_H_
4+
#define BITMAP_H_
5+
6+
#include<string>
7+
#include<cstdint>
8+
9+
using namespace std;
10+
11+
namespace fractal {
12+
13+
class Bitmap{
14+
private:
15+
int m_width{0};
16+
int m_height{0};
17+
public:
18+
Bitmap(int width, int height);
19+
20+
bool write(string filename);
21+
void setPixel(int x, int y, uint8_t red, uint8_t green, uint8_t blue);
22+
23+
virtual ~Bitmap();
24+
};
25+
26+
}
27+
#endif /* BITMAP_H_ */

Fractal Images/BitmapFileHeader.h

+9-6
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ using namespace std;
77

88
#pragma pack(2)
99

10-
struct BitmapFileHeader {
11-
char header[2]{'B','M'};
12-
int32_t fileSize;
13-
int32_t reserved{0};
14-
int32_t dataOffset;
15-
};
10+
namespace fractal {
1611

12+
struct BitmapFileHeader {
13+
char header[2]{ 'B','M' };
14+
int32_t fileSize;
15+
int32_t reserved{ 0 };
16+
int32_t dataOffset;
17+
};
18+
19+
}
1720
#endif /* BITMAPFILEHEADER_H_ */

Fractal Images/BitmapInfoHeader.h

+16-13
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,21 @@ using namespace std;
77

88
#pragma pack(2)
99

10-
struct BitmapInfoHeader {
11-
int32_t headerSize{ 40 };
12-
int32_t width;
13-
int32_t height;
14-
int16_t planes{ 1 };
15-
int16_t bitsPerPixel{ 24 };
16-
int32_t compression{ 0 };
17-
int32_t dataSize{ 0 };
18-
int32_t horizontalResolution{ 2400 };
19-
int32_t vertialResolution{ 2400 };
20-
int32_t colors{ 0 };
21-
int32_t importantColors{ 0 };
22-
};
10+
namespace fractal {
2311

12+
struct BitmapInfoHeader {
13+
int32_t headerSize{ 40 };
14+
int32_t width;
15+
int32_t height;
16+
int16_t planes{ 1 };
17+
int16_t bitsPerPixel{ 24 };
18+
int32_t compression{ 0 };
19+
int32_t dataSize{ 0 };
20+
int32_t horizontalResolution{ 2400 };
21+
int32_t vertialResolution{ 2400 };
22+
int32_t colors{ 0 };
23+
int32_t importantColors{ 0 };
24+
};
25+
26+
}
2427
#endif /* BITMAPINFOHEADER_H_ */

Fractal Images/Fractal.cpp renamed to Fractal Images/main.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
// Learn Advanced C++ Programming
2-
// Bitmap File Headers
2+
// Main
33

44
#include<iostream>
55
#include"BitmapFileHeader.h"
6+
#include"BitmapInfoHeader.h"
67

78
using namespace std;
9+
using namespace fractal;
810

911
int main() {
1012
cout << "Hello World" << endl;

0 commit comments

Comments
 (0)