Basic implementation, and write function

This commit is contained in:
Leonetienne
2022-03-05 19:30:41 +01:00
parent 0cd22f3bd2
commit 14294fcebf
6 changed files with 333 additions and 4 deletions

View File

@@ -1,9 +1,26 @@
#include <BMP.h>
#include <iostream>
#include <BmpHeader.h>
using namespace Leonetienne::BmpPP;
int main() {
BMP bmp({800, 600});
BMP bmp({800, 600}, Colormode::RGB);
for (int x = 0; x < 800; x++)
for (int y = 0; y < 600; y++) {
bmp.SetPixel({x, y},
(std::uint8_t)( ((double)x / 800.0) * 255.0),
(std::uint8_t)((1.0 - ((double)x / 800.0)) * 255.0),
(std::uint8_t)((1.0 - ((double)y / 800.0)) * 255.0),
255
);
}
if (!bmp.Write("test.bmp"))
std::cerr << "What the hell" << std::endl;
return 0;
}