summaryrefslogtreecommitdiff
path: root/source/codes/Qr.mc
diff options
context:
space:
mode:
authorcirakg <cirakg@cirakg.xyz>2026-10-20 11:24:58 +0200
committercirakg <cirakg@cirakg.xyz>2026-10-20 11:24:58 +0200
commitcc2fa8917b65eeda8d222dcbd69e9342884bb545 (patch)
tree910b9852ac4c29d5cb43cd475dc2426b0de4dddb /source/codes/Qr.mc
parent0a39c695e1fc78a7c8b8af0b301040f422303953 (diff)
feat(codes): add Data Matrix (ECC 200, 10x10-144x144) and PDF417 encoders as jobs
Data Matrix: ASCII with digit pairs, Base256 or Upper Shift for UTF-8, interleaved Reed-Solomon in steps, utah placement; matches ppf.datamatrix. PDF417: pdf417gen's compaction, automatic or fixed EC level, columns fitted to the screen, pattern tables as generated JSON resources; matches pdf417gen. 2D matrices gain a row height and 8-at-a-time packing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'source/codes/Qr.mc')
-rw-r--r--source/codes/Qr.mc11
1 files changed, 8 insertions, 3 deletions
diff --git a/source/codes/Qr.mc b/source/codes/Qr.mc
index 8af0f5a..1fa69da 100644
--- a/source/codes/Qr.mc
+++ b/source/codes/Qr.mc
@@ -207,9 +207,8 @@ module Qr {
return err != null ? new Codes.CodeError(err) : job.result as MatrixCode;
}
- class QrJob extends Jobs.Job {
+ class QrJob extends Codes.MatrixJob {
- var error as String? = null;
var result as MatrixCode? = null;
private var _data as ByteArray;
@@ -237,7 +236,7 @@ module Qr {
// ec: 0 L, 1 M, 2 Q, 3 H. forceVersion 0 = smallest that fits;
// forceMask -1 = best by penalty.
function initialize(text as String, ec as Number, forceVersion as Number, forceMask as Number) {
- Job.initialize();
+ MatrixJob.initialize();
_data = Bytes.fromUtf8(text);
_ec = ec;
_forceMask = forceMask;
@@ -249,6 +248,12 @@ module Qr {
return _phase * 100 / 6;
}
+ // The code as a generic matrix with QR's 4-module quiet zone.
+ function matrix() as Codes.Matrix? {
+ var r = result;
+ return r != null ? new Codes.Matrix(r.size, r.size, 4, r.modules) : null;
+ }
+
function step(budget as Number) as Boolean {
if (_phase == 0) {
buildCodewords();