minor cleanup

pull/1/head
Michael Ochmann 2 years ago
parent 63c018e28b
commit 0c7c830d5b
  1. 18
      src/QR.cpp
  2. 1
      src/QR.hpp
  3. 0
      src/renderers/ConsoleRenderer.hpp
  4. 0
      src/renderers/PNGRenderer.hpp
  5. 0
      src/renderers/PixelRenderer.hpp
  6. 0
      src/renderers/SVGRenderer.hpp

@ -1,11 +1,11 @@
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include "qrcodegen.hpp"
#include "QR.hpp" #include "QR.hpp"
#include "ConsoleRenderer.hpp" #include "qrcodegen.hpp"
#include "PNGRenderer.hpp" #include "renderers/ConsoleRenderer.hpp"
#include "SVGRenderer.hpp" #include "renderers/PNGRenderer.hpp"
#include "renderers/SVGRenderer.hpp"
namespace massivedynamic { namespace massivedynamic {
@ -32,11 +32,11 @@ QR::QR(const std::string& data, std::string outputFile, size_t size, Type type,
this->renderers.insert({Format::PNG, std::make_unique<PNGRenderer>(this->pixels, qr.getSize(), size)}); this->renderers.insert({Format::PNG, std::make_unique<PNGRenderer>(this->pixels, qr.getSize(), size)});
this->renderers.insert({Format::SVG, std::make_unique<SVGRenderer>(this->pixels, qr.getSize(), size)}); this->renderers.insert({Format::SVG, std::make_unique<SVGRenderer>(this->pixels, qr.getSize(), size)});
// this is inherently stupid, but "qrcodegen" does not give access to the
// `segments` vector
for (int y = 0; y < qr.getSize(); y++) { for (int y = 0; y < qr.getSize(); y++) {
for (int x = 0; x < qr.getSize(); x++) { for (int x = 0; x < qr.getSize(); x++)
bool isFilled = qr.getModule(x, y); this->pixels.push_back(qr.getModule(x, y));
this->pixels.push_back(isFilled ? true : false);
}
} }
this->renderers.at(format)->render(this->outputFile); this->renderers.at(format)->render(this->outputFile);

@ -4,6 +4,7 @@
#include <string> #include <string>
#include <memory> #include <memory>
#include <unordered_map> #include <unordered_map>
#include "qrcodegen.hpp" #include "qrcodegen.hpp"
#include "Renderer.hpp" #include "Renderer.hpp"

Loading…
Cancel
Save