Aurore
A Switch-like interface for your app, on every screen
Loading...
Searching...
No Matches
qr_view.hpp
Go to the documentation of this file.
1// QrView — a QR code of a text (a URL), dark modules on white with the
2// four-module quiet zone, whatever the theme: phones read it best that way.
3// Square: the code fills the smaller side, in whole pixels per module.
4// Drawn as one texture, scaled without smoothing: a path per module was a
5// draw call each, and a long link (the bug-report form with a gist link)
6// overflowed the frame's GPU command memory, which aborts the app.
7// Copyright (C) 2026 JigSawFr. GPLv3-or-later (see LICENSE.GPL).
8#pragma once
9
10#include <string>
11#include <vector>
12#include <aurore.hpp>
13
15class QrView : public aurore::View
16{
17 public:
18 QrView(const std::string& text, float side);
19 ~QrView() override;
20
21 void draw(NVGcontext* vg, float x, float y, float width, float height,
22 aurore::Style style, aurore::FrameContext* ctx) override;
23
24 private:
25 int size = 0;
26 std::vector<bool> modules;
27 int image = 0;
28};
A QR code of a text, dark on white with its quiet zone whatever the theme.
Definition qr_view.hpp:16
~QrView() override
QrView(const std::string &text, float side)
void draw(NVGcontext *vg, float x, float y, float width, float height, aurore::Style style, aurore::FrameContext *ctx) override
Definition frame_context.hpp:30
Simple wrapper around StyleValues for the array operator.
Definition style.hpp:115
Definition view.hpp:232
Definition text.hpp:13