Skip to content

Commit 09ac437

Browse files
committed
.
1 parent e862542 commit 09ac437

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

Fractal Images/Bitmap.cpp

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
11
#include "Bitmap.h"
2+
#include "BitmapFileHeader.h"
3+
#include "BitmapInfoHeader.h"
4+
5+
using namespace fractal;
26

37
namespace fractal {
48

5-
Bitmap::Bitmap(int width, int height): m_width(width), m_height(height) {
9+
Bitmap::Bitmap(int width, int height) : m_width(width), m_height(height), m_pPixel(new uint8_t[width * height * 3]{}) {
610

711
}
812

913
bool Bitmap::write(string filename) {
14+
BitmapFileHeader fileheader;
15+
BitmapInfoHeader infoheader;
16+
17+
fileheader.fileSize = sizeof(BitmapFileHeader) + sizeof(BitmapInfoHeader) + (m_width * m_height * 3);
18+
fileheader.dataOffset = sizeof(BitmapFileHeader) + sizeof(BitmapInfoHeader);
19+
20+
infoheader.width = m_width;
21+
infoheader.height = m_height;
22+
23+
1024
return false;
1125
}
1226
void setPixel(int x, int y, uint8_t red, uint8_t green, uint8_t blue) {

Fractal Images/Bitmap.h

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include<string>
77
#include<cstdint>
8+
#include<memory>
89

910
using namespace std;
1011

@@ -14,6 +15,7 @@ namespace fractal {
1415
private:
1516
int m_width{0};
1617
int m_height{0};
18+
unique_ptr<uint8_t[]> m_pPixel{nullptr};
1719
public:
1820
Bitmap(int width, int height);
1921

0 commit comments

Comments
 (0)