From 04dd0fc06c9bf977fed68c0e96100d60b54edf58 Mon Sep 17 00:00:00 2001 From: Project Nayuki Date: Wed, 28 Jul 2021 19:15:14 +0000 Subject: [PATCH] Tweaked QrCodeGeneratorDemo code to use QrSegmentAdvanced.makeKanji() instead of hard-coding the data words, while maintaining identical output image. --- .../nayuki/fastqrcodegen/QrCodeGeneratorDemo.java | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/io/nayuki/fastqrcodegen/QrCodeGeneratorDemo.java b/src/io/nayuki/fastqrcodegen/QrCodeGeneratorDemo.java index 3f76d83..558d221 100644 --- a/src/io/nayuki/fastqrcodegen/QrCodeGeneratorDemo.java +++ b/src/io/nayuki/fastqrcodegen/QrCodeGeneratorDemo.java @@ -134,18 +134,7 @@ public final class QrCodeGeneratorDemo { qr = QrCode.encodeText(madoka, QrCode.Ecc.LOW); writePng(toImage(qr, 9, 4, 0xFFFFE0, 0x303080), "madoka-utf8-QR.png"); - int[] kanjiChars = { // Kanji mode encoding (13 bits per character) - 0x0035, 0x1002, 0x0FC0, 0x0AED, 0x0AD7, - 0x015C, 0x0147, 0x0129, 0x0059, 0x01BD, - 0x018D, 0x018A, 0x0036, 0x0141, 0x0144, - 0x0001, 0x0000, 0x0249, 0x0240, 0x0249, - 0x0000, 0x0104, 0x0105, 0x0113, 0x0115, - 0x0000, 0x0208, 0x01FF, 0x0008, - }; - BitBuffer bb = new BitBuffer(); - for (int c : kanjiChars) - bb.appendBits(c, 13); - segs = Arrays.asList(new QrSegment(QrSegment.Mode.KANJI, kanjiChars.length, bb.data, bb.bitLength)); + segs = Arrays.asList(QrSegmentAdvanced.makeKanji(madoka)); qr = QrCode.encodeSegments(segs, QrCode.Ecc.LOW); writePng(toImage(qr, 9, 4, 0xE0F0FF, 0x404040), "madoka-kanji-QR.png"); }