class QRCode

Overview

https://github.com/whomwah/rqrcode/blob/master/lib/rqrcode/export/png.rb#L1

Defined in:

qr-code.cr:1
qr-code.cr:144
qr-code/export/png.cr
qr-code/export/svg.cr

Constant Summary

ALPHANUMERIC = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', '$', '%', '*', '+', '-', '.', '/', ':']
ERROR_CORRECT_LEVEL = {l: 1, m: 0, q: 3, h: 2}
FORMAT_INFO_LENGTH = 15
MASK_COMPUTATIONS = [Proc(Int32, Int32, Bool).new do |i, j| ((i + j) % 2) == 0 end, Proc(Int32, Int32, Bool).new do |i, _| (i % 2) == 0 end, Proc(Int32, Int32, Bool).new do |_, j| (j % 3) == 0 end, Proc(Int32, Int32, Bool).new do |i, j| ((i + j) % 3) == 0 end, Proc(Int32, Int32, Bool).new do |i, j| (((i // 2) + (j // 3)) % 2) == 0 end, Proc(Int32, Int32, Bool).new do |i, j| (((i * j) % 2) + ((i * j) % 3)) == 0 end, Proc(Int32, Int32, Bool).new do |i, j| ((((i * j) % 2) + ((i * j) % 3)) % 2) == 0 end, Proc(Int32, Int32, Bool).new do |i, j| ((((i * j) % 3) + ((i + j) % 2)) % 2) == 0 end]
MASK_PATTERN = {pattern000: 0, pattern001: 1, pattern010: 2, pattern011: 3, pattern100: 4, pattern101: 5, pattern110: 6, pattern111: 7}
MAX_DIGITS = {l: {mode_number: [41, 77, 127, 187, 255, 322, 370, 461, 552, 652, 772, 883, 1022, 1101, 1250, 1408, 1548, 1725, 1903, 2061, 2232, 2409, 2620, 2812, 3057, 3283, 3514, 3669, 3909, 4158, 4417, 4686, 4965, 5253, 5529, 5836, 6153, 6479, 6743, 7089], mode_alpha_numk: [25, 47, 77, 114, 154, 195, 224, 279, 335, 395, 468, 535, 619, 667, 758, 854, 938, 1046, 1153, 1249, 1352, 1460, 1588, 1704, 1853, 1990, 2132, 2223, 2369, 2520, 2677, 2840, 3009, 3183, 3351, 3537, 3729, 3927, 4087, 4296], mode_8bit_byte: [17, 32, 53, 78, 106, 134, 154, 192, 230, 271, 321, 367, 425, 458, 520, 586, 644, 718, 792, 858, 929, 1003, 1091, 1171, 1273, 1367, 1465, 1528, 1628, 1732, 1840, 1952, 2068, 2188, 2303, 2431, 2563, 2699, 2809, 2953]}, m: {mode_number: [34, 63, 101, 149, 202, 255, 293, 365, 432, 513, 604, 691, 796, 871, 991, 1082, 1212, 1346, 1500, 1600, 1708, 1872, 2059, 2188, 2395, 2544, 2701, 2857, 3035, 3289, 3486, 3693, 3909, 4134, 4343, 4588, 4775, 5039, 5313, 5596], mode_alpha_numk: [20, 38, 61, 90, 122, 154, 178, 221, 262, 311, 366, 419, 483, 528, 600, 656, 734, 816, 909, 970, 1035, 1134, 1248, 1326, 1451, 1542, 1637, 1732, 1839, 1994, 2113, 2238, 2369, 2506, 2632, 2780, 2894, 3054, 3220, 3391], mode_8bit_byte: [14, 26, 42, 62, 84, 106, 122, 152, 180, 213, 251, 287, 331, 362, 412, 450, 504, 560, 624, 666, 711, 779, 857, 911, 997, 1059, 1125, 1190, 1264, 1370, 1452, 1538, 1628, 1722, 1809, 1911, 1989, 2099, 2213, 2331]}, q: {mode_number: [27, 48, 77, 111, 144, 178, 207, 259, 312, 364, 427, 489, 580, 621, 703, 775, 876, 948, 1063, 1159, 1224, 1358, 1468, 1588, 1718, 1804, 1933, 2085, 2181, 2358, 2473, 2670, 2805, 2949, 3081, 3244, 3417, 3599, 3791, 3993], mode_alpha_numk: [16, 29, 47, 67, 87, 108, 125, 157, 189, 221, 259, 296, 352, 376, 426, 470, 531, 574, 644, 702, 742, 823, 890, 963, 1041, 1094, 1172, 1263, 1322, 1429, 1499, 1618, 1700, 1787, 1867, 1966, 2071, 2181, 2298, 2420], mode_8bit_byte: [11, 20, 32, 46, 60, 74, 86, 108, 130, 151, 177, 203, 241, 258, 292, 22, 364, 394, 442, 482, 509, 565, 611, 661, 715, 751, 805, 868, 908, 982, 1030, 1112, 1168, 1228, 1283, 1351, 1423, 1499, 1579, 1663]}, h: {mode_number: [17, 34, 58, 82, 106, 139, 154, 202, 235, 288, 331, 374, 427, 468, 530, 602, 674, 331, 374, 427, 468, 530, 602, 674, 746, 813, 919, 969, 1056, 1108, 1228, 1286, 1425, 1501, 1581, 1677, 1782, 1897, 2022, 2157, 2301, 2361, 2524, 2625, 2735, 2927, 3057], mode_alpha_numk: [10, 20, 35, 50, 64, 84, 93, 122, 143, 174, 200, 200, 227, 259, 283, 321, 365, 408, 452, 493, 557, 587, 640, 672, 744, 779, 864, 910, 958, 1016, 1080, 1150, 1226, 1307, 1394, 1431, 1530, 1591, 1658, 1774, 1852], mode_8bit_byte: [7, 14, 24, 34, 44, 58, 64, 84, 98, 119, 137, 155, 177, 194, 220, 250, 280, 310, 338, 382, 403, 439, 461, 511, 535, 593, 625, 658, 698, 742, 790, 842, 898, 958, 983, 1051, 1093, 1139, 1219, 1273]}}

http://web.archive.org/web/20110710094955/http://www.denso-wave.com/qrcode/vertable1-e.html http://web.archive.org/web/20110710094955/http://www.denso-wave.com/qrcode/vertable2-e.html http://web.archive.org/web/20110710094955/http://www.denso-wave.com/qrcode/vertable3-e.html http://web.archive.org/web/20110710094955/http://www.denso-wave.com/qrcode/vertable4-e.html Each array contains levels max chars from level 1 to level 40

MODE = {mode_number: 1 << 0, mode_alpha_numk: 1 << 1, mode_8bit_byte: 1 << 2}
MODE_NAME = {number: :mode_number, alphanumeric: :mode_alpha_numk, byte_8bit: :mode_8bit_byte}
NUMERIC = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
POSITION_PATTERN_LENGTH = ((7 + 1) * 2) + 1

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(data : String, size : Int32 | Nil = nil, level : Symbol = :h, mode : Symbol | Nil = nil) #

[View source]

Class Method Detail

def self.count_max_data_bits(rs_blocks) #

[View source]
def self.create_bytes(buffer, rs_blocks) #

[View source]
def self.create_data(version, error_correct_level, data_list) #

[View source]

Instance Method Detail

def as_canvas(bit_depth : Int32 = 1, border_modules : Int32 = 3, color_type : Symbol = :grayscale, color : String = "#000000", fill : String = "#ffffff", size : Int32 = 128) #

[View source]
def as_png(bit_depth : Int32 = 1, border_modules : Int32 = 3, color_type : Symbol = :grayscale, color : String = "#000000", fill : String = "#ffffff", size : Int32 = 128) #

[View source]
def as_svg(offset = 0, color = "000", shape_rendering = "crispEdges", module_size = 11, standalone = true, fill : String | Nil = "fff") #

[View source]
def checked?(row, col) #

[View source]
def error_correction_level #

Return a symbol for current error connection level


[View source]
def inspect #
Description copied from class Object

Returns an unambiguous and information-rich string representation of this object, typically intended for developers.

This method should usually not be overridden. It delegates to #inspect(IO) which can be overridden for custom implementations.

Also see #to_s.


[View source]
def mode #

Return a symbol in QRMODE.keys for current mode used


[View source]
def module_count : Int32 #

[View source]
def modules : Array(Array(Bool | Nil)) #

[View source]
def to_s(dark : Char = 'x', light : Char = ' ', quiet_zone_size : Int32 = 0) #
Description copied from class Object

Returns a nicely readable and concise string representation of this object, typically intended for users.

This method should usually not be overridden. It delegates to #to_s(IO) which can be overridden for custom implementations.

Also see #inspect.


[View source]
def version : Int32 #

[View source]