Jump to content

Recommended Posts

Posted (edited)

This QRCode UDF makes it possible to generate QRCodes and create an image or print it to the console.
It provides functions to create a 2D-Boolean-Array of the QRCode, get a Bitmap (_GDIPlus) of that QRCode or to draw it directly at a GraphicsContext (_GDIPlus).
To achieve this, I created a .dll in rust, which uses the "QR Code generator library (Rust)" by Project Nayuki (https://www.nayuki.io/page/qr-code-generator-library).

Currently the following functions are included in the UDF:

_QRCode_StartUp                       - Startup needed before using most other functions (Includes _GDIPlus_Startup)
_QRCode_Shutdown                      - Shutdown should be called at the and to clean up (Includes _GDIPlus_Shutdown)

_QRCode_GetQRCode                     - Generate a QRCode as 2D-Boolean-Array, where the first index = lines, the second index=cols, normally False=White, True=Black
_QRCode_GetBitmap                     - Creates a GDIPlus-Bitmap with the QRCode
_QRCode_DrawQRCode                    - Draws a QRCode on a provides GDIPlus-GraphicsContext
_QRCode_DrawQRCodeFast                - Same as _QRCode_DrawQRCode, but without error checks and requires brushes for the colors to be provided (=> higher FPS)
_QRCode_ConsoleWrite                  - Print the QRCode to the console
_QRCode_GetSize                       - Get the size of the generated QRCode
_QRCode_GetECLMaxLoss                 - Get the maximum allowed loss before the qrcode becomes unreadable (decimal multiplier)

Possible error correction levels:
$_QRCode_ECL_LOW = 1
$_QRCode_ECL_MEDIUM = 2
$_QRCode_ECL_QUARTILE = 3
$_QRCode_ECL_HIGH = 4                 - Default

Here is an example, how the UDF could be used:

  Reveal hidden contents


Another example can be found with the QRCodeGenerator-cli: QRCode generator cli
That is a console application with detailed possibilities for settings to generate qrcodes from the commandline.

While developing in rust, I first created a .exe instead of the .dll. Calling the .exe and parsing the result was relatively slow (~1 sec), so I ditched that for the .dll.
You can find the created .exe in the files as Rust-Executable (QRCode-Wrapper-Console-Rust-Exe.zip).
It is a commandline utility to be called with a text with the corresponding qrcode being written to the console with 0 (white), 1 (black), 2 (new line).
With --human the qrcode will be printed humanreadable and with --errorlvl low/medium/quartile/high, the error correction level can be provided.
But this appilcation is inferior to the QRCodeGenerator-cli mentioned above and is just included for completeness.

Files:
    The QRCode UDF with all needed files: qrcode.zip
    The Rust-Sourcecode of the .dll and .exe: QRCode-Dll-Exe-Rust-Src.zip
    The Rust-Executable: QRCode-Wrapper-Console-Rust.zip

QRCode-Wrapper-Console-Rust-Exe.zipFetching info... qrcode.zipFetching info... QRCode-Dll-Exe-Rust-Src.zipFetching info...

Edited by Kanashius

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...