From 0545c9c7db79d09e44b43967e6af6ca0dccd1b03 Mon Sep 17 00:00:00 2001 From: Leonetienne Date: Sun, 6 Mar 2022 20:16:54 +0100 Subject: [PATCH] Put simple example in exec project --- Exec/main.cpp | 44 +++++++------------------------------------- 1 file changed, 7 insertions(+), 37 deletions(-) diff --git a/Exec/main.cpp b/Exec/main.cpp index 017755d..28f04fe 100644 --- a/Exec/main.cpp +++ b/Exec/main.cpp @@ -4,48 +4,18 @@ #include using namespace Leonetienne::BmpPP; -using namespace Eule; +using namespace Leonetienne::Eule; int main() { -/* + // Draw gradient + BMP bmp(Vector2i(800, 600), Colormode::RGB); - BMP bmp({800, 600}, Colormode::RGB); + for (std::size_t x = 0; x < bmp.GetDimensions().x; x++) + for (std::size_t y = 0; y < bmp.GetDimensions().y; y++) + bmp.SetPixel(Vector2i(x, y), (float)x / (float)bmp.GetDimensions().x * 255.0f); - 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 - ); - } - - bmp.Write("write.bmp"); - -*/ - BMP bmp("basea_hachi.bmp"); - - BMP cropped = bmp.Crop(Vector2i(95, 83), Vector2i(95 + 149, 83 + 239)); - - if(!cropped.Write("basea_hachi_cropped.bmp")) - std::cerr << "What the hell" << std::endl; - - /* - - BMP bmp; - - if (!bmp.Read("test.bmp")) - std::cerr << "Failed to read" << std::endl; - - std::cout << (bmp.GetColormode() == Colormode::RGB) << std::endl; - - if (!bmp.Write("testwrite.bmp")) - std::cerr << "What the hell" << std::endl; - -*/ + bmp.Write("gradient.bmp"); return 0; }