summaryrefslogtreecommitdiffhomepage
path: root/qrcode.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2023-01-02 19:59:41 +0100
committerRoland Reichwein <mail@reichwein.it>2023-01-02 19:59:41 +0100
commit992a1b3d2653ed527c2a301f80140bc35d84e832 (patch)
tree73981b8a28a0368f2b74b0369b1ecf649c908f77 /qrcode.cpp
parent20ceb53ec1c1bc18face8e831292dfe81fed3817 (diff)
Switch from ImageMagick to GraphicsMagick for deterministic data; added tests
Diffstat (limited to 'qrcode.cpp')
-rw-r--r--qrcode.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/qrcode.cpp b/qrcode.cpp
index 5e45afc..da747a5 100644
--- a/qrcode.cpp
+++ b/qrcode.cpp
@@ -4,12 +4,17 @@
#include <qrcodegen/QrCode.hpp>
-#include <ImageMagick-6/Magick++.h>
+#include <Magick++.h>
using namespace qrcodegen;
using namespace Magick;
-std::string getQRCode(const std::string& data)
+void QRCode::init()
+{
+ Magick::InitializeMagick(NULL);
+}
+
+std::string QRCode::getQRCode(const std::string& data)
{
QrCode qrc {QrCode::encodeText(data.c_str(), QrCode::Ecc::MEDIUM)};
@@ -17,7 +22,6 @@ std::string getQRCode(const std::string& data)
Image image(fmt::format("{0}x{0}", size).c_str(), "white");
image.type(GrayscaleType);
- //image.size(fmt::format("{0}x{0}", size));
for (int x = 0; x < size; x++) {
for (int y = 0; y < size; y++) {