Added PPM writer
This commit is contained in:
@@ -9,4 +9,5 @@ target_compile_features(${target} PRIVATE cxx_std_23)
|
||||
target_link_libraries(${target}
|
||||
PRIVATE
|
||||
project_core
|
||||
project_image_writers
|
||||
)
|
||||
@@ -1,6 +1,27 @@
|
||||
#include "PpmImage.hpp"
|
||||
#include <cstdint>
|
||||
#include <print>
|
||||
#include <vector>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
std::println("Hello, GraphicsSandbox!");
|
||||
|
||||
// Generate PPM image
|
||||
constexpr size_t imageWidth = 256;
|
||||
constexpr size_t imageHeight = 256;
|
||||
std::vector<std::vector<std::uint8_t>> imageData;
|
||||
imageData.resize(imageWidth);
|
||||
for (auto &row : imageData) {
|
||||
row.resize(imageHeight);
|
||||
}
|
||||
|
||||
image_writers::PpmImage ppmImage(imageData);
|
||||
|
||||
if (ppmImage.writeToFile("Image.ppm")) {
|
||||
std::println("Wrote PPM image");
|
||||
} else {
|
||||
std::println("Failed to write PPM image");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user