QR code 2005 encoder in Common Lisp
There are some examples in demo.lisp. More detailed explanations are listed below.
(in-package :cl-qrencode) (defclass qr-symbol () (matrix modules)) (defun dark-module-p (matrix i j))
QR code is represented by a
QR-SYMBOL object in this package, where
MATRIX is an
MODULES * MODULES array, and the color of each module (dark or light) is indicated by
(use-package :cl-qrencode) (defun encode-symbol (text &key (version 1) (level :level-m) (mode nil))) (defun encode-symbol-bytes (bytes &key (version 1) (level :level-m) (mode nil)))
TEXT into a
VERSION may be adapted to accommodate the encoding data.
LEVEL is the error correction level, which should be one of
:level-h. For most of the time,
MODE should be left
(defun encode-png (text &key (fpath "qrcode.png") (version 1) (level :level-m) (mode nil) (pixsize 9) (margin 8)))
This package also supports writing
QR-SYMBOL into png files.
PIXSIZE is number of pixels for each
MARGIN is number of pixels for each side of the QRcode quiet zone.
Run via ASDF and
(asdf:test-system '#:cl-qrencode), or manually using
(cl-qrencode-test:run-all-tests) once the
cl-qrencode-test has been loaded.
The tests require the
lisp-unit library to be installed.
Copyright (c) 2011-2014 jnjcc, Yste.org
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.
- jnjcc at live.com