From: Skullheadx Date: Mon, 18 Nov 2024 16:24:09 +0000 (-0500) Subject: 69 qr code X-Git-Url: http://git.skullheadx.com/nixos/static/gitweb.js?a=commitdiff_plain;h=75ad3c7194602d77130bae96103229502a30ed5e;p=qrcodescanner.git 69 qr code --- diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..4c68ead Binary files /dev/null and b/.DS_Store differ diff --git a/123.png b/123.png new file mode 100644 index 0000000..3ac05d3 Binary files /dev/null and b/123.png differ diff --git a/output.pbm b/output.pbm new file mode 100644 index 0000000..363237f --- /dev/null +++ b/output.pbm @@ -0,0 +1,23 @@ +P1 +21 21 +1 1 1 1 1 1 1 0 1 0 0 0 0 0 1 1 1 1 1 1 1 +1 0 0 0 0 0 1 0 0 1 0 1 1 0 1 0 0 0 0 0 1 +1 0 1 1 1 0 1 0 0 0 0 0 1 0 1 0 1 1 1 0 1 +1 0 1 1 1 0 1 0 1 1 0 1 1 0 1 0 1 1 1 0 1 +1 0 1 1 1 0 1 0 1 1 1 0 0 0 1 0 1 1 1 0 1 +1 0 0 0 0 0 1 0 1 0 1 0 0 0 1 0 0 0 0 0 1 +1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 +0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 +1 0 0 0 1 0 1 1 1 0 0 0 0 1 1 1 1 1 0 0 1 +0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 +1 0 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 0 1 0 1 +0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 0 1 0 1 1 1 +1 0 1 1 1 0 1 1 1 1 0 1 0 0 0 1 1 0 1 0 0 +0 0 0 0 0 0 0 0 1 1 1 0 1 0 0 0 0 1 1 0 1 +1 1 1 1 1 1 1 0 1 0 1 0 0 1 0 1 0 0 1 1 1 +1 0 0 0 0 0 1 0 0 1 1 1 1 0 0 0 1 0 1 0 0 +1 0 1 1 1 0 1 0 1 0 0 1 1 0 0 0 0 1 0 0 1 +1 0 1 1 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 +1 0 1 1 1 0 1 0 0 1 0 0 1 0 1 0 1 0 0 0 0 +1 0 0 0 0 0 1 0 0 0 0 1 1 0 0 1 1 0 1 0 1 +1 1 1 1 1 1 1 0 1 1 0 0 1 0 1 1 1 1 1 0 1 diff --git a/qrgenerator.cpp b/qrgenerator.cpp index 349d2eb..442ad61 100644 --- a/qrgenerator.cpp +++ b/qrgenerator.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #define ID_LENGTH 34 #define MODE_INDICATOR_LENGTH 4 #define grid_length 21 @@ -21,11 +22,12 @@ std::vector> symbol_placement_down_special(std::vector> grid); void print_grid(std::vector> grid); std::vector calculate_remainder(const std::vector& data, const std::vector& generator); +void create_image(std::vector> &grid); int main() { int k; //std::cout << id_generator(69) << std::endl; - std::string input_data{"01234567"}; + std::string input_data{"6969696969"}; const unsigned int input_length = 8; std::vector input_data_vector{}; for (unsigned int i{0}; i < input_length; i+=3){ @@ -573,11 +575,27 @@ int main() { print_grid(grid); - + create_image(grid); return 0; } +void create_image(std::vector> &grid){ + std::ofstream file("output.pbm"); + if (!file){ + std::cerr << "error creating file" << std::endl; + } + + file << "P1\n21 21\n"; + for (const auto &row : grid){ + for (bool pixel : row){ + file << pixel << " "; + } + file << "\n"; + } + file.close(); + std::cout << "Image created!" << std::endl; +} std::vector calculate_remainder(const std::vector& data, const std::vector& generator) {