rghost_barcode 0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. data/lib/doc/classes/RGhost.html +109 -0
  2. data/lib/doc/classes/RGhost/Barcode.html +147 -0
  3. data/lib/doc/classes/RGhost/Barcode/Auspost.html +113 -0
  4. data/lib/doc/classes/RGhost/Barcode/Azteccode.html +113 -0
  5. data/lib/doc/classes/RGhost/Barcode/Base.html +266 -0
  6. data/lib/doc/classes/RGhost/Barcode/Base.src/M000004.html +34 -0
  7. data/lib/doc/classes/RGhost/Barcode/Base.src/M000005.html +30 -0
  8. data/lib/doc/classes/RGhost/Barcode/Base.src/M000006.html +20 -0
  9. data/lib/doc/classes/RGhost/Barcode/Border.html +170 -0
  10. data/lib/doc/classes/RGhost/Barcode/Border.src/M000001.html +27 -0
  11. data/lib/doc/classes/RGhost/Barcode/Code11.html +113 -0
  12. data/lib/doc/classes/RGhost/Barcode/Code128.html +113 -0
  13. data/lib/doc/classes/RGhost/Barcode/Code2of5.html +113 -0
  14. data/lib/doc/classes/RGhost/Barcode/Code39.html +113 -0
  15. data/lib/doc/classes/RGhost/Barcode/Code93.html +113 -0
  16. data/lib/doc/classes/RGhost/Barcode/Datamatrix.html +113 -0
  17. data/lib/doc/classes/RGhost/Barcode/Ean13.html +113 -0
  18. data/lib/doc/classes/RGhost/Barcode/Ean2.html +113 -0
  19. data/lib/doc/classes/RGhost/Barcode/Ean5.html +113 -0
  20. data/lib/doc/classes/RGhost/Barcode/Ean8.html +113 -0
  21. data/lib/doc/classes/RGhost/Barcode/Guard.html +174 -0
  22. data/lib/doc/classes/RGhost/Barcode/Guard.src/M000003.html +27 -0
  23. data/lib/doc/classes/RGhost/Barcode/Interleaved2of5.html +113 -0
  24. data/lib/doc/classes/RGhost/Barcode/Isbn.html +113 -0
  25. data/lib/doc/classes/RGhost/Barcode/Kix.html +113 -0
  26. data/lib/doc/classes/RGhost/Barcode/Maxicode.html +113 -0
  27. data/lib/doc/classes/RGhost/Barcode/Msi.html +113 -0
  28. data/lib/doc/classes/RGhost/Barcode/Onecode.html +113 -0
  29. data/lib/doc/classes/RGhost/Barcode/Parameter.html +262 -0
  30. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000007.html +20 -0
  31. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000008.html +18 -0
  32. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000009.html +18 -0
  33. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000010.html +18 -0
  34. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000011.html +18 -0
  35. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000012.html +24 -0
  36. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000013.html +18 -0
  37. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000014.html +18 -0
  38. data/lib/doc/classes/RGhost/Barcode/Parameter.src/M000015.html +16 -0
  39. data/lib/doc/classes/RGhost/Barcode/Pdf417.html +113 -0
  40. data/lib/doc/classes/RGhost/Barcode/Pharmacode.html +113 -0
  41. data/lib/doc/classes/RGhost/Barcode/Plessey.html +113 -0
  42. data/lib/doc/classes/RGhost/Barcode/Postnet.html +113 -0
  43. data/lib/doc/classes/RGhost/Barcode/Qrcode.html +113 -0
  44. data/lib/doc/classes/RGhost/Barcode/Rationalizedcodabar.html +113 -0
  45. data/lib/doc/classes/RGhost/Barcode/Raw.html +113 -0
  46. data/lib/doc/classes/RGhost/Barcode/Royalmail.html +113 -0
  47. data/lib/doc/classes/RGhost/Barcode/Rss14.html +113 -0
  48. data/lib/doc/classes/RGhost/Barcode/Rssexpanded.html +113 -0
  49. data/lib/doc/classes/RGhost/Barcode/Rsslimited.html +113 -0
  50. data/lib/doc/classes/RGhost/Barcode/Symbol.html +113 -0
  51. data/lib/doc/classes/RGhost/Barcode/Text.html +193 -0
  52. data/lib/doc/classes/RGhost/Barcode/Text.src/M000002.html +30 -0
  53. data/lib/doc/classes/RGhost/Barcode/Upca.html +113 -0
  54. data/lib/doc/classes/RGhost/Barcode/Upce.html +113 -0
  55. data/lib/doc/classes/RGhost/Config.html +150 -0
  56. data/lib/doc/classes/RGhost/Config.src/M000016.html +45 -0
  57. data/lib/doc/classes/RGhost/Document.html +704 -0
  58. data/lib/doc/classes/RGhost/Document.src/M000017.html +19 -0
  59. data/lib/doc/classes/RGhost/Document.src/M000018.html +18 -0
  60. data/lib/doc/classes/RGhost/Document.src/M000019.html +18 -0
  61. data/lib/doc/classes/RGhost/Document.src/M000020.html +18 -0
  62. data/lib/doc/classes/RGhost/Document.src/M000021.html +18 -0
  63. data/lib/doc/classes/RGhost/Document.src/M000022.html +18 -0
  64. data/lib/doc/classes/RGhost/Document.src/M000023.html +18 -0
  65. data/lib/doc/classes/RGhost/Document.src/M000024.html +18 -0
  66. data/lib/doc/classes/RGhost/Document.src/M000025.html +18 -0
  67. data/lib/doc/classes/RGhost/Document.src/M000026.html +18 -0
  68. data/lib/doc/classes/RGhost/Document.src/M000027.html +18 -0
  69. data/lib/doc/classes/RGhost/Document.src/M000028.html +18 -0
  70. data/lib/doc/classes/RGhost/Document.src/M000029.html +18 -0
  71. data/lib/doc/classes/RGhost/Document.src/M000030.html +18 -0
  72. data/lib/doc/classes/RGhost/Document.src/M000031.html +18 -0
  73. data/lib/doc/classes/RGhost/Document.src/M000032.html +18 -0
  74. data/lib/doc/classes/RGhost/Document.src/M000033.html +18 -0
  75. data/lib/doc/classes/RGhost/Document.src/M000034.html +18 -0
  76. data/lib/doc/classes/RGhost/Document.src/M000035.html +18 -0
  77. data/lib/doc/classes/RGhost/Document.src/M000036.html +18 -0
  78. data/lib/doc/classes/RGhost/Document.src/M000037.html +18 -0
  79. data/lib/doc/classes/RGhost/Document.src/M000038.html +18 -0
  80. data/lib/doc/classes/RGhost/Document.src/M000039.html +18 -0
  81. data/lib/doc/classes/RGhost/Document.src/M000040.html +18 -0
  82. data/lib/doc/classes/RGhost/Document.src/M000041.html +18 -0
  83. data/lib/doc/classes/RGhost/Document.src/M000042.html +18 -0
  84. data/lib/doc/classes/RGhost/Document.src/M000043.html +18 -0
  85. data/lib/doc/classes/RGhost/Document.src/M000044.html +18 -0
  86. data/lib/doc/classes/RGhost/Document.src/M000045.html +18 -0
  87. data/lib/doc/classes/RGhost/Document.src/M000046.html +18 -0
  88. data/lib/doc/classes/RGhost/Document.src/M000047.html +18 -0
  89. data/lib/doc/classes/RGhost/Document.src/M000048.html +18 -0
  90. data/lib/doc/created.rid +1 -0
  91. data/lib/doc/files/rghost_barcode/rghost_barcode_adapter_rb.html +101 -0
  92. data/lib/doc/files/rghost_barcode/rghost_barcode_base_rb.html +101 -0
  93. data/lib/doc/files/rghost_barcode/rghost_barcode_classes_rb.html +101 -0
  94. data/lib/doc/files/rghost_barcode/rghost_barcode_examples_rb.html +101 -0
  95. data/lib/doc/files/rghost_barcode/rghost_barcode_version_rb.html +101 -0
  96. data/lib/doc/files/rghost_barcode_rb.html +111 -0
  97. data/lib/doc/files/teste_main_rb.html +110 -0
  98. data/lib/doc/fr_class_index.html +67 -0
  99. data/lib/doc/fr_file_index.html +33 -0
  100. data/lib/doc/fr_method_index.html +74 -0
  101. data/lib/doc/index.html +24 -0
  102. data/lib/rghost_barcode.rb +7 -0
  103. data/lib/rghost_barcode/ps/auspost.ps +192 -0
  104. data/lib/rghost_barcode/ps/azteccode.ps +357 -0
  105. data/lib/rghost_barcode/ps/barcode_template.eps +1193 -0
  106. data/lib/rghost_barcode/ps/code11.ps +128 -0
  107. data/lib/rghost_barcode/ps/code128.ps +121 -0
  108. data/lib/rghost_barcode/ps/code2of5.ps +106 -0
  109. data/lib/rghost_barcode/ps/code39.ps +109 -0
  110. data/lib/rghost_barcode/ps/code93.ps +117 -0
  111. data/lib/rghost_barcode/ps/datamatrix.ps +328 -0
  112. data/lib/rghost_barcode/ps/ean13.ps +183 -0
  113. data/lib/rghost_barcode/ps/ean2.ps +101 -0
  114. data/lib/rghost_barcode/ps/ean5.ps +116 -0
  115. data/lib/rghost_barcode/ps/ean8.ps +101 -0
  116. data/lib/rghost_barcode/ps/interleaved2of5.ps +132 -0
  117. data/lib/rghost_barcode/ps/isbn.ps +118 -0
  118. data/lib/rghost_barcode/ps/kix.ps +98 -0
  119. data/lib/rghost_barcode/ps/maxicode.ps +307 -0
  120. data/lib/rghost_barcode/ps/msi.ps +104 -0
  121. data/lib/rghost_barcode/ps/onecode.ps +276 -0
  122. data/lib/rghost_barcode/ps/pdf417.ps +428 -0
  123. data/lib/rghost_barcode/ps/pharmacode.ps +69 -0
  124. data/lib/rghost_barcode/ps/plessey.ps +121 -0
  125. data/lib/rghost_barcode/ps/postnet.ps +114 -0
  126. data/lib/rghost_barcode/ps/qrcode.ps +530 -0
  127. data/lib/rghost_barcode/ps/rationalizedcodabar.ps +117 -0
  128. data/lib/rghost_barcode/ps/raw.ps +35 -0
  129. data/lib/rghost_barcode/ps/render.ps +307 -0
  130. data/lib/rghost_barcode/ps/render.ps~ +308 -0
  131. data/lib/rghost_barcode/ps/royalmail.ps +119 -0
  132. data/lib/rghost_barcode/ps/rss14.ps +237 -0
  133. data/lib/rghost_barcode/ps/rssexpanded.ps +211 -0
  134. data/lib/rghost_barcode/ps/rsslimited.ps +191 -0
  135. data/lib/rghost_barcode/ps/symbol.ps +49 -0
  136. data/lib/rghost_barcode/ps/upca.ps +128 -0
  137. data/lib/rghost_barcode/ps/upce.ps +157 -0
  138. data/lib/rghost_barcode/rghost_barcode_adapter.rb +249 -0
  139. data/lib/rghost_barcode/rghost_barcode_base.rb +210 -0
  140. data/lib/rghost_barcode/rghost_barcode_classes.rb +96 -0
  141. data/lib/rghost_barcode/rghost_barcode_examples.rb +35 -0
  142. data/lib/rghost_barcode/rghost_barcode_version.rb +8 -0
  143. data/lib/teste_main.rb +94 -0
  144. metadata +218 -0
@@ -0,0 +1,69 @@
1
+
2
+ % --DESC: Pharmaceutical Binary Code
3
+ % --EXAM: 117480
4
+ % --EXOP: showborder
5
+ % --RNDR: renlinear
6
+ /pharmacode {
7
+
8
+ 0 begin % Confine variables to local scope
9
+
10
+ /options exch def % We are given an option string
11
+ /useropts options def
12
+ /barcode exch def % We are given a barcode string
13
+
14
+ /height 8 2.835 mul 72 div def
15
+ /nwidth 0.5 2.835 mul def
16
+ /wwidth 1.5 2.835 mul def
17
+ /swidth 1.0 2.835 mul def
18
+
19
+ % Parse the input options
20
+ options {
21
+ token false eq {exit} if dup length string cvs (=) search
22
+ true eq {cvlit exch pop exch def} {cvlit true def} ifelse
23
+ } loop
24
+
25
+ /height height cvr def
26
+ /nwidth nwidth cvr def
27
+ /wwidth wwidth cvr def
28
+ /swidth swidth cvr def
29
+
30
+ % Create the human readable text
31
+ /txt barcode length array def
32
+ 0 1 barcode length 1 sub {
33
+ /i exch def
34
+ txt i [barcode i 1 getinterval 0 0 () 0] put
35
+ } for
36
+
37
+ % Convert the integer into the paramacode string
38
+ /barcode barcode cvi 1 add 2 17 string cvrs def
39
+ /barcode barcode 1 barcode length 1 sub getinterval def
40
+
41
+ /barlen barcode length def % Length of the code
42
+ /sbs barlen 2 mul array def
43
+
44
+ 0 1 barlen 1 sub {
45
+ /i exch def
46
+ /enc barcode i 1 getinterval def
47
+ enc (0) eq {
48
+ sbs i 2 mul nwidth put
49
+ } {
50
+ sbs i 2 mul wwidth put
51
+ } ifelse
52
+ sbs i 2 mul 1 add swidth put
53
+ } for
54
+
55
+ % Return the arguments
56
+ /retval 8 dict def
57
+ retval (ren) (renlinear) put
58
+ retval (sbs) sbs put
59
+ retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put
60
+ retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put
61
+ retval (txt) txt put
62
+ retval (textxalign) (center) put
63
+ retval (opt) useropts put
64
+ retval
65
+
66
+ end
67
+
68
+ } bind def
69
+ /pharmacode load 0 1 dict put
@@ -0,0 +1,121 @@
1
+
2
+ % --DESC: Plessey
3
+ % --EXAM: 01234ABCD
4
+ % --EXOP: includetext includecheckintext
5
+ % --RNDR: renlinear
6
+ /plessey {
7
+
8
+ 0 begin % Confine variables to local scope
9
+
10
+ /options exch def % We are given an option string
11
+ /useropts options def
12
+ /barcode exch def % We are given a barcode string
13
+
14
+ /includetext false def % Enable/disable text
15
+ /includecheckintext false def
16
+ /textfont /Courier def
17
+ /textsize 10 def
18
+ /textyoffset -7 def
19
+ /height 1 def
20
+
21
+ % Parse the input options
22
+ options {
23
+ token false eq {exit} if dup length string cvs (=) search
24
+ true eq {cvlit exch pop exch def} {cvlit true def} ifelse
25
+ } loop
26
+
27
+ /textfont textfont cvlit def
28
+ /textsize textsize cvr def
29
+ /textyoffset textyoffset cvr def
30
+ /height height cvr def
31
+
32
+ % Create an array containing the character mappings
33
+ /encs
34
+ [ (13131313) (31131313) (13311313) (31311313)
35
+ (13133113) (31133113) (13313113) (31313113)
36
+ (13131331) (31131331) (13311331) (31311331)
37
+ (13133131) (31133131) (13313131) (31313131)
38
+ (31311331) (331311313)
39
+ ] def
40
+
41
+ % Create a string of the available characters
42
+ /barchars (0123456789ABCDEF) def
43
+
44
+ /barlen barcode length def % Length of the code
45
+ /sbs barlen 8 mul 33 add string def
46
+ /txt barlen 2 add array def
47
+ /checkbits barlen 4 mul 8 add array def
48
+ checkbits barlen 4 mul [ 0 0 0 0 0 0 0 0 ] putinterval
49
+
50
+ % Put start character
51
+ sbs 0 encs 16 get putinterval
52
+
53
+ 0 1 barlen 1 sub {
54
+ /i exch def
55
+ % Lookup the encoding for the each barcode character
56
+ barcode i 1 getinterval barchars exch search
57
+ pop % Discard true leaving pre
58
+ length /indx exch def % indx is the length of pre
59
+ pop pop % Discard seek and post
60
+ /enc encs indx get def % Get the indxth encoding
61
+ sbs i 8 mul 8 add enc putinterval % Put encoded digit into sbs
62
+ txt i [barcode i 1 getinterval i 16 mul 16 add textyoffset textfont textsize] put
63
+ checkbits i 4 mul [
64
+ indx 1 and
65
+ indx -1 bitshift 1 and
66
+ indx -2 bitshift 1 and
67
+ indx -3 bitshift
68
+ ] putinterval
69
+ } for
70
+
71
+ % Checksum is last 8 bits of a CRC using a salt
72
+ /checksalt [ 1 1 1 1 0 1 0 0 1 ] def
73
+ 0 1 barlen 4 mul 1 sub {
74
+ /i exch def
75
+ checkbits i get 1 eq {
76
+ 0 1 8 {
77
+ /j exch def
78
+ checkbits i j add checkbits i j add get checksalt j get xor put
79
+ } for
80
+ } if
81
+ } for
82
+
83
+ % Calculate the value of the checksum digits
84
+ /checkval 0 def
85
+ 0 1 7 {
86
+ /i exch def
87
+ /checkval checkval 2 7 i sub exp cvi checkbits barlen 4 mul i add get mul add def
88
+ } for
89
+
90
+ % Put the checksum characters
91
+ /checksum1 checkval -4 bitshift def
92
+ /checksum2 checkval 15 and def
93
+ sbs barlen 8 mul 8 add encs checksum1 get putinterval
94
+ sbs barlen 8 mul 16 add encs checksum2 get putinterval
95
+ includecheckintext {
96
+ txt barlen [barchars checksum1 1 getinterval barlen 16 mul 16 add textyoffset textfont textsize] put
97
+ txt barlen 1 add [barchars checksum2 1 getinterval barlen 1 add 16 mul 16 add textyoffset textfont textsize] put
98
+ } {
99
+ txt barlen [( ) barlen 16 mul 16 add textyoffset textfont textsize] put
100
+ txt barlen 1 add [( ) barlen 1 add 16 mul 16 add textyoffset textfont textsize] put
101
+ } ifelse
102
+
103
+ % Put end character
104
+ sbs barlen 8 mul 24 add encs 17 get putinterval
105
+
106
+ % Return the arguments
107
+ /retval 8 dict def
108
+ retval (ren) (renlinear) put
109
+ retval (sbs) [sbs {48 sub} forall] put
110
+ retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put
111
+ retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put
112
+ includetext {
113
+ retval (txt) txt put
114
+ } if
115
+ retval (opt) useropts put
116
+ retval
117
+
118
+ end
119
+
120
+ } bind def
121
+ /plessey load 0 1 dict put
@@ -0,0 +1,114 @@
1
+
2
+ % --DESC: United States Postal Service Postnet
3
+ % --EXAM: 012345
4
+ % --EXOP: includetext includecheckintext
5
+ % --RNDR: renlinear
6
+ /postnet {
7
+
8
+ 0 begin
9
+
10
+ /options exch def % We are given an option string
11
+ /useropts options def
12
+ /barcode exch def % We are given a barcode string
13
+
14
+ /includetext false def % Enable/disable text
15
+ /includecheckintext false def
16
+ /textfont /Courier def
17
+ /textsize 10 def
18
+ /textyoffset -7 def
19
+ /height 0.125 def
20
+
21
+ % Parse the input options
22
+ options {
23
+ token false eq {exit} if dup length string cvs (=) search
24
+ true eq {cvlit exch pop exch def} {cvlit true def} ifelse
25
+ } loop
26
+
27
+ /textfont textfont cvlit def
28
+ /textsize textsize cvr def
29
+ /textyoffset textyoffset cvr def
30
+ /height height cvr def
31
+
32
+ /barlen barcode length def
33
+
34
+ % Create an array containing the character mappings
35
+ /encs
36
+ [ (55222) (22255) (22525) (22552) (25225)
37
+ (25252) (25522) (52225) (52252) (52522)
38
+ (5) (5)
39
+ ] def
40
+
41
+ % Create a string of the available characters
42
+ /barchars (0123456789) def
43
+
44
+ /bhs barlen 5 mul 7 add array def
45
+ /txt barlen 1 add array def
46
+
47
+ % Put start character
48
+ /enc encs 10 get def
49
+ /heights enc length array def
50
+ 0 1 enc length 1 sub {
51
+ /j exch def
52
+ heights j enc j 1 getinterval cvi height mul 5 div put
53
+ } for
54
+ bhs 0 heights putinterval % Put encoded digit into sbs
55
+
56
+ /checksum 0 def
57
+ 0 1 barlen 1 sub {
58
+ /i exch def
59
+ % Lookup the encoding for the each barcode character
60
+ barcode i 1 getinterval barchars exch search
61
+ pop % Discard true leaving pre
62
+ length /indx exch def % indx is the length of pre
63
+ pop pop % Discard seek and post
64
+ /enc encs indx get def % Get the indxth encoding
65
+ /heights enc length array def
66
+ 0 1 enc length 1 sub {
67
+ /j exch def
68
+ heights j enc j 1 getinterval cvi height mul 5 div put
69
+ } for
70
+ bhs i 5 mul 1 add heights putinterval % Put encoded digit into sbs
71
+ txt i [barcode i 1 getinterval i 5 mul 1 add 3.312 mul textyoffset textfont textsize] put
72
+ /checksum checksum indx add def % checksum+=indx
73
+ } for
74
+
75
+ % Put the checksum character
76
+ /checksum 10 checksum 10 mod sub 10 mod def
77
+ /enc encs checksum get def
78
+ /heights enc length array def
79
+ 0 1 enc length 1 sub {
80
+ /j exch def
81
+ heights j enc j 1 getinterval cvi height mul 5 div put
82
+ } for
83
+ bhs barlen 5 mul 1 add heights putinterval
84
+
85
+ includecheckintext {
86
+ txt barlen [barchars checksum 1 getinterval barlen 5 mul 1 add 3.312 mul textyoffset textfont textsize] put
87
+ } {
88
+ txt barlen [( ) barlen 5 mul 1 add 72 mul 25 div textyoffset textfont textsize] put
89
+ } ifelse
90
+
91
+ % Put end character
92
+ /enc encs 11 get def
93
+ /heights enc length array def
94
+ 0 1 enc length 1 sub {
95
+ /j exch def
96
+ heights j enc j 1 getinterval cvi height mul 5 div put
97
+ } for
98
+ bhs barlen 5 mul 6 add heights putinterval
99
+
100
+ /retval 8 dict def
101
+ retval (ren) (renlinear) put
102
+ retval (bhs) bhs put
103
+ retval (bbs) [bhs length {0} repeat] put
104
+ retval (sbs) [bhs length 1 sub {1.44 1.872} repeat 1.44] put
105
+ includetext {
106
+ retval (txt) txt put
107
+ } if
108
+ retval (opt) useropts put
109
+ retval
110
+
111
+ end
112
+
113
+ } bind def
114
+ /postnet load 0 1 dict put
@@ -0,0 +1,530 @@
1
+
2
+ % --DESC: QR Code
3
+ % --EXAM: 000100000010000000001100010101100110000110000
4
+ % --EXOP: version=1 eclevel=M
5
+ % --RNDR: renmatrix
6
+ /qrcode {
7
+
8
+ 0 begin
9
+
10
+ /options exch def
11
+ /useropts options def
12
+ /barcode exch def
13
+
14
+ /format (full) def % full or micro
15
+ /version (unset) def
16
+ /eclevel (L) def % L, M, Q or H
17
+
18
+ % Parse the input options
19
+ options {
20
+ token false eq {exit} if dup length string cvs (=) search
21
+ true eq {cvlit exch pop exch def} {cvlit true def} ifelse
22
+ } loop
23
+
24
+ % Convert from input into message bitstream
25
+ /msgbits barcode def
26
+
27
+ % Lookup the most appropriate symbol specification
28
+ /metrics [
29
+ % format vers size align modules error codewords error correction blocks
30
+ % L M Q H L1 L2 M1 M2 Q1 Q2 H1 H2
31
+ [ (micro) (M1) 11 98 99 36 [ 2 99 99 99 ] [ 1 0 99 99 99 99 99 99 ] ]
32
+ [ (micro) (M2) 13 98 99 80 [ 5 6 99 99 ] [ 1 0 1 0 99 99 99 99 ] ]
33
+ [ (micro) (M3) 15 98 99 132 [ 6 8 99 99 ] [ 1 0 1 0 99 99 99 99 ] ]
34
+ [ (micro) (M4) 17 98 99 192 [ 8 10 14 99 ] [ 1 0 1 0 1 0 99 99 ] ]
35
+ [ (full) (1) 21 98 99 208 [ 7 10 13 17 ] [ 1 0 1 0 1 0 1 0 ] ]
36
+ [ (full) (2) 25 18 99 359 [ 10 16 22 28 ] [ 1 0 1 0 1 0 1 0 ] ]
37
+ [ (full) (3) 29 22 99 567 [ 15 26 36 44 ] [ 1 0 1 0 2 0 2 0 ] ]
38
+ [ (full) (4) 33 26 99 807 [ 20 36 52 64 ] [ 1 0 2 0 2 0 4 0 ] ]
39
+ [ (full) (5) 37 30 99 1079 [ 26 48 72 88 ] [ 1 0 2 0 2 2 2 2 ] ]
40
+ [ (full) (6) 41 34 99 1383 [ 36 64 96 112 ] [ 2 0 4 0 4 0 4 0 ] ]
41
+ [ (full) (7) 45 22 38 1568 [ 40 72 108 130 ] [ 2 0 4 0 2 4 4 1 ] ]
42
+ [ (full) (8) 49 24 42 1936 [ 48 88 132 156 ] [ 2 0 2 2 4 2 4 2 ] ]
43
+ [ (full) (9) 53 26 46 2336 [ 60 110 160 192 ] [ 2 0 3 2 4 4 4 4 ] ]
44
+ [ (full) (10) 57 28 50 2768 [ 72 130 192 224 ] [ 2 2 4 1 6 2 6 2 ] ]
45
+ [ (full) (11) 61 30 54 3232 [ 80 150 224 264 ] [ 4 0 1 4 4 4 3 8 ] ]
46
+ [ (full) (12) 65 32 58 3728 [ 96 176 260 308 ] [ 2 2 6 2 4 6 7 4 ] ]
47
+ [ (full) (13) 69 34 62 4256 [ 104 198 288 352 ] [ 4 0 8 1 8 4 12 4 ] ]
48
+ [ (full) (14) 73 26 46 4651 [ 120 216 320 384 ] [ 3 1 4 5 11 5 11 5 ] ]
49
+ [ (full) (15) 77 26 48 5243 [ 132 240 360 432 ] [ 5 1 5 5 5 7 11 7 ] ]
50
+ [ (full) (16) 81 26 50 5867 [ 144 280 408 480 ] [ 5 1 7 3 15 2 3 13 ] ]
51
+ [ (full) (17) 85 30 54 6523 [ 168 308 448 532 ] [ 1 5 10 1 1 15 2 17 ] ]
52
+ [ (full) (18) 89 30 56 7211 [ 180 338 504 588 ] [ 5 1 9 4 17 1 2 19 ] ]
53
+ [ (full) (19) 93 30 58 7931 [ 196 364 546 650 ] [ 3 4 3 11 17 4 9 16 ] ]
54
+ [ (full) (20) 97 34 62 8683 [ 224 416 600 700 ] [ 3 5 3 13 15 5 15 10 ] ]
55
+ [ (full) (21) 101 28 50 9252 [ 224 442 644 750 ] [ 4 4 17 0 17 6 19 6 ] ]
56
+ [ (full) (22) 105 26 50 10068 [ 252 476 690 816 ] [ 2 7 17 0 7 16 34 0 ] ]
57
+ [ (full) (23) 109 30 54 10916 [ 270 504 750 900 ] [ 4 5 4 14 11 14 16 14 ] ]
58
+ [ (full) (24) 113 28 54 11796 [ 300 560 810 960 ] [ 6 4 6 14 11 16 30 2 ] ]
59
+ [ (full) (25) 117 32 58 12708 [ 312 588 870 1050 ] [ 8 4 8 13 7 22 22 13 ] ]
60
+ [ (full) (26) 121 30 58 13652 [ 336 644 952 1110 ] [ 10 2 19 4 28 6 33 4 ] ]
61
+ [ (full) (27) 125 34 62 14628 [ 360 700 1020 1200 ] [ 8 4 22 3 8 26 12 28 ] ]
62
+ [ (full) (28) 129 26 50 15371 [ 390 728 1050 1260 ] [ 3 10 3 23 4 31 11 31 ] ]
63
+ [ (full) (29) 133 30 54 16411 [ 420 784 1140 1350 ] [ 7 7 21 7 1 37 19 26 ] ]
64
+ [ (full) (30) 137 26 52 17483 [ 450 812 1200 1440 ] [ 5 10 19 10 15 25 23 25 ] ]
65
+ [ (full) (31) 141 30 56 18587 [ 480 868 1290 1530 ] [ 13 3 2 29 42 1 23 28 ] ]
66
+ [ (full) (32) 145 34 60 19723 [ 510 924 1350 1620 ] [ 17 0 10 23 10 35 19 35 ] ]
67
+ [ (full) (33) 149 30 58 20891 [ 540 980 1440 1710 ] [ 17 1 14 21 29 19 11 46 ] ]
68
+ [ (full) (34) 153 34 62 22091 [ 570 1036 1530 1800 ] [ 13 6 14 23 44 7 59 1 ] ]
69
+ [ (full) (35) 157 30 54 23008 [ 570 1064 1590 1890 ] [ 12 7 12 26 39 14 22 41 ] ]
70
+ [ (full) (36) 161 24 50 24272 [ 600 1120 1680 1980 ] [ 6 14 6 34 46 10 2 64 ] ]
71
+ [ (full) (37) 165 28 54 25568 [ 630 1204 1770 2100 ] [ 17 4 29 14 49 10 24 46 ] ]
72
+ [ (full) (38) 169 32 58 26896 [ 660 1260 1860 2220 ] [ 4 18 13 32 48 14 42 32 ] ]
73
+ [ (full) (39) 173 26 54 28256 [ 720 1316 1950 2310 ] [ 20 4 40 7 43 22 10 67 ] ]
74
+ [ (full) (40) 177 30 58 29648 [ 750 1372 2040 2430 ] [ 19 6 18 31 34 34 20 61 ] ]
75
+ ] def
76
+
77
+ /eclval (LMQH) eclevel search pop length exch pop exch pop def
78
+ /i 0 def
79
+ { % loop
80
+ /m metrics i get def
81
+ /frmt m 0 get def % Format of the symbol
82
+ /vers m 1 get def % Version of symbol
83
+ /size m 2 get def % Length of side
84
+ /asp2 m 3 get def % Position of second alignment symbol
85
+ /asp3 m 4 get def % Position of third alignment symbol
86
+ /nmod m 5 get def % Number of modules
87
+ /ncws nmod 8 idiv def % Total number of codewords
88
+ /rbit nmod 8 mod def % Number of remainder bits
89
+ /lc4b false def % Last data codeword is 4 bits long
90
+ size 11 eq size 15 eq or { % Adjustments for M1 and M3 symbols
91
+ /ncws ncws 1 add def
92
+ /rbit 0 def
93
+ /lc4b true def
94
+ } if
95
+ /ecws m 6 get eclval get def % Number of error correction codewords
96
+ /dcws ncws ecws sub def % Number of data codewords
97
+ /dmod dcws 8 mul lc4b {4} {0} ifelse sub def % Number of data modules
98
+ /ecb1 m 7 get eclval 2 mul get def % First error correction blocks
99
+ /ecb2 m 7 get eclval 2 mul 1 add get def % Second error correction blocks
100
+ /dcpb dcws ecb1 ecb2 add idiv def % Base data codewords per block
101
+ /ecpb ncws ecb1 ecb2 add idiv dcpb sub def % Error correction codewords per block
102
+ /okay true def
103
+ version (unset) ne version vers ne and {/okay false def} if
104
+ version (unset) eq format frmt ne and {/okay false def} if
105
+ msgbits length dmod gt {/okay false def} if
106
+ okay {exit} if
107
+ /i i 1 add def
108
+ } loop
109
+ /format frmt def
110
+ /version vers def
111
+
112
+ % Expand the message bits by adding padding as necessary
113
+ /pad dmod string def
114
+ 0 4 dmod 1 sub {pad exch (0000) putinterval} for
115
+ pad 0 msgbits putinterval
116
+ /padstrs [ (11101100) (00010001) ] def
117
+ /padnum 0 def
118
+ msgbits length 8 div ceiling 8 mul cvi 8 dmod lc4b {5} {1} ifelse sub {
119
+ pad exch padstrs padnum get putinterval
120
+ /padnum padnum 1 add 2 mod def
121
+ } for
122
+
123
+ % Evaluate the padded message into codewords
124
+ /cws dcws array def
125
+ 0 1 cws length 1 sub {
126
+ /c exch def
127
+ /bpcw 8 def
128
+ lc4b c cws length 1 sub eq and {/bpcw 4 def} if
129
+ /cwb pad c 8 mul bpcw getinterval def
130
+ /cw 0 def
131
+ 0 1 bpcw 1 sub {
132
+ /i exch def
133
+ /cw cw 2 bpcw i sub 1 sub exp cvi cwb i get 48 sub mul add def
134
+ } for
135
+ cws c cw put
136
+ } for
137
+
138
+ % Calculate the log and anti-log tables
139
+ /rslog [ -255 255 {0} repeat ] def
140
+ /rsalog [ 1 255 {0} repeat ] def
141
+ 1 1 255 {
142
+ /i exch def
143
+ rsalog i rsalog i 1 sub get 2 mul put
144
+ rsalog i get 256 ge { rsalog i rsalog i get 285 xor put } if
145
+ rslog rsalog i get i put
146
+ } for
147
+
148
+ % Function to calculate the product in the field
149
+ /rsprod {
150
+ /y exch def
151
+ /x exch def
152
+ x y mul 0 ne {
153
+ rsalog rslog x get rslog y get add 255 mod get
154
+ } {
155
+ 0
156
+ } ifelse
157
+ } bind def
158
+
159
+ % Generate the coefficients for the Reed-Solomon algorithm
160
+ /coeffs [ 1 ecpb {0} repeat ] def
161
+ 0 1 ecpb 1 sub {
162
+ /i exch def
163
+ coeffs i 1 add coeffs i get put
164
+ i -1 1 {
165
+ /j exch def
166
+ coeffs j coeffs j 1 sub get coeffs j get rsalog i get rsprod xor put
167
+ } for
168
+ coeffs 0 coeffs 0 get rsalog i get rsprod put
169
+ } for
170
+ /coeffs coeffs 0 coeffs length 1 sub getinterval def
171
+
172
+ % Reed-Solomon algorithm to derive the error correction codewords
173
+ /rscodes {
174
+ /rscws exch def
175
+ /rsnd rscws length def
176
+ /rscws [ rscws {} forall ecpb {0} repeat ] def
177
+ 0 1 rsnd 1 sub {
178
+ /m exch def
179
+ /k rscws m get def
180
+ 0 1 ecpb 1 sub {
181
+ /j exch def
182
+ rscws m j add 1 add coeffs ecpb j sub 1 sub get k rsprod rscws m j add 1 add get xor put
183
+ } for
184
+ } for
185
+ rscws rsnd ecpb getinterval
186
+ } bind def
187
+
188
+ % Divide codewords into two groups of blocks and calculate the error correction codewords
189
+ /dcwsb ecb1 ecb2 add array def
190
+ /ecwsb ecb1 ecb2 add array def
191
+ 0 1 ecb1 1 sub { % First group of blocks has smaller number of data codewords
192
+ /i exch def
193
+ dcwsb i cws i dcpb mul dcpb getinterval put
194
+ ecwsb i dcwsb i get rscodes put
195
+ } for
196
+ 0 1 ecb2 1 sub { % Second group of blocks has larger number of data codewords
197
+ /i exch def
198
+ dcwsb ecb1 i add cws ecb1 dcpb mul i dcpb 1 add mul add dcpb 1 add getinterval put
199
+ ecwsb ecb1 i add dcwsb ecb1 i add get rscodes put
200
+ } for
201
+
202
+ % Reassemble the codewords
203
+ /cws ncws array def
204
+ /cw 0 def
205
+ 0 1 dcpb { % Interleave the data codeword blocks
206
+ /i exch def
207
+ 0 1 ecb1 ecb2 add 1 sub {
208
+ /j exch def
209
+ i dcwsb j get length lt { % Ignore the end of short blocks
210
+ cws cw dcwsb j get i get put
211
+ /cw cw 1 add def
212
+ } if
213
+ } for
214
+ } for
215
+ 0 1 ecpb 1 sub { % Interleave the error codeword blocks
216
+ /i exch def
217
+ 0 1 ecb1 ecb2 add 1 sub {
218
+ /j exch def
219
+ cws cw ecwsb j get i get put
220
+ /cw cw 1 add def
221
+ } for
222
+ } for
223
+
224
+ % Extend codewords by one if there are remainder bits
225
+ rbit 0 gt {
226
+ /pad cws length 1 add array def
227
+ pad 0 cws putinterval
228
+ pad pad length 1 sub 0 put
229
+ /cws pad def
230
+ } if
231
+
232
+ % Fixups for the short final data byte in M1 and M3 symbols
233
+ lc4b {
234
+ dcws 1 sub 1 ncws 2 sub {
235
+ /i exch def
236
+ cws i cws i get 15 and 4 bitshift put
237
+ cws i cws i 1 add get -4 bitshift 15 and cws i get or put
238
+ } for
239
+ cws ncws 1 sub cws ncws 1 sub get 15 and 4 bitshift put
240
+ } if
241
+
242
+ % Create the bitmap
243
+ /pixs [ size size mul {-1} repeat ] def
244
+ /qmv {size mul add} bind def
245
+
246
+ % Finder patterns
247
+ /fpat [
248
+ [ 1 1 1 1 1 1 1 0 ]
249
+ [ 1 0 0 0 0 0 1 0 ]
250
+ [ 1 0 1 1 1 0 1 0 ]
251
+ [ 1 0 1 1 1 0 1 0 ]
252
+ [ 1 0 1 1 1 0 1 0 ]
253
+ [ 1 0 0 0 0 0 1 0 ]
254
+ [ 1 1 1 1 1 1 1 0 ]
255
+ [ 0 0 0 0 0 0 0 0 ]
256
+ ] def
257
+ 0 1 fpat length 1 sub {
258
+ /y exch def
259
+ 0 1 fpat 0 get length 1 sub {
260
+ /x exch def
261
+ /fpb fpat y get x get def
262
+ pixs x y qmv fpb put
263
+ format (full) eq {
264
+ pixs size x sub 1 sub y qmv fpb put
265
+ pixs x size y sub 1 sub qmv fpb put
266
+ } if
267
+ } for
268
+ } for
269
+
270
+ % Alignment patterns
271
+ /algnpat [
272
+ [ 1 1 1 1 1 ]
273
+ [ 1 0 0 0 1 ]
274
+ [ 1 0 1 0 1 ]
275
+ [ 1 0 0 0 1 ]
276
+ [ 1 1 1 1 1 ]
277
+ ] def
278
+ /putalgnpat {
279
+ /py exch def
280
+ /px exch def
281
+ 0 1 4 {
282
+ /pb exch def
283
+ 0 1 4 {
284
+ /pa exch def
285
+ pixs px pa add py pb add qmv algnpat pb get pa get put
286
+ } for
287
+ } for
288
+ } bind def
289
+ asp2 2 sub asp3 asp2 sub size 13 sub {
290
+ /i exch def
291
+ i 4 putalgnpat
292
+ 4 i putalgnpat
293
+ } for
294
+ asp2 2 sub asp3 asp2 sub size 9 sub {
295
+ /x exch def
296
+ asp2 2 sub asp3 asp2 sub size 9 sub {
297
+ /y exch def
298
+ x y putalgnpat
299
+ } for
300
+ } for
301
+
302
+ % Timing patterns
303
+ format (full) eq {
304
+ 8 1 size 9 sub {
305
+ /i exch def
306
+ pixs i 6 qmv i 1 add 2 mod put
307
+ pixs 6 i qmv i 1 add 2 mod put
308
+ } for
309
+ } {
310
+ 8 1 size 1 sub {
311
+ /i exch def
312
+ pixs i 0 qmv i 1 add 2 mod put
313
+ pixs 0 i qmv i 1 add 2 mod put
314
+ } for
315
+ } ifelse
316
+
317
+ % Format information modules
318
+ format (full) eq {
319
+ /formatmap [
320
+ [ [ 0 8 ] [ 8 size 1 sub ] ] [ [ 1 8 ] [ 8 size 2 sub ] ] [ [ 2 8 ] [ 8 size 3 sub ] ]
321
+ [ [ 3 8 ] [ 8 size 4 sub ] ] [ [ 4 8 ] [ 8 size 5 sub ] ] [ [ 5 8 ] [ 8 size 6 sub ] ]
322
+ [ [ 7 8 ] [ 8 size 7 sub ] ] [ [ 8 8 ] [ size 8 sub 8 ] ] [ [ 8 7 ] [ size 7 sub 8 ] ]
323
+ [ [ 8 5 ] [ size 6 sub 8 ] ] [ [ 8 4 ] [ size 5 sub 8 ] ] [ [ 8 3 ] [ size 4 sub 8 ] ]
324
+ [ [ 8 2 ] [ size 3 sub 8 ] ] [ [ 8 1 ] [ size 2 sub 8 ] ] [ [ 8 0 ] [ size 1 sub 8 ] ]
325
+ ] def
326
+ } {
327
+ /formatmap [
328
+ [ [ 1 8 ] ] [ [ 2 8 ] ] [ [ 3 8 ] ] [ [ 4 8 ] ] [ [ 5 8 ] ]
329
+ [ [ 6 8 ] ] [ [ 7 8 ] ] [ [ 8 8 ] ] [ [ 8 7 ] ] [ [ 8 6 ] ]
330
+ [ [ 8 5 ] ] [ [ 8 4 ] ] [ [ 8 3 ] ] [ [ 8 2 ] ] [ [ 8 1 ] ]
331
+ ] def
332
+ } ifelse
333
+ formatmap {
334
+ { {} forall qmv pixs exch 0 put } forall
335
+ } forall
336
+
337
+ % Version information modules
338
+ size 45 ge {
339
+ /versionmap [
340
+ [ [ size 9 sub 5 ] [ 5 size 9 sub ] ] [ [ size 10 sub 5 ] [ 5 size 10 sub ] ]
341
+ [ [ size 11 sub 5 ] [ 5 size 11 sub ] ] [ [ size 9 sub 4 ] [ 4 size 9 sub ] ]
342
+ [ [ size 10 sub 4 ] [ 4 size 10 sub ] ] [ [ size 11 sub 4 ] [ 4 size 11 sub ] ]
343
+ [ [ size 9 sub 3 ] [ 3 size 9 sub ] ] [ [ size 10 sub 3 ] [ 3 size 10 sub ] ]
344
+ [ [ size 11 sub 3 ] [ 3 size 11 sub ] ] [ [ size 9 sub 2 ] [ 2 size 9 sub ] ]
345
+ [ [ size 10 sub 2 ] [ 2 size 10 sub ] ] [ [ size 11 sub 2 ] [ 2 size 11 sub ] ]
346
+ [ [ size 9 sub 1 ] [ 1 size 9 sub ] ] [ [ size 10 sub 1 ] [ 1 size 10 sub ] ]
347
+ [ [ size 11 sub 1 ] [ 1 size 11 sub ] ] [ [ size 9 sub 0 ] [ 0 size 9 sub ] ]
348
+ [ [ size 10 sub 0 ] [ 0 size 10 sub ] ] [ [ size 11 sub 0 ] [ 0 size 11 sub ] ]
349
+ ] def
350
+ } {
351
+ /versionmap [] def
352
+ } ifelse
353
+ versionmap {
354
+ { {} forall qmv pixs exch 0 put } forall
355
+ } forall
356
+
357
+ % Solitary dark module in full symbols
358
+ format (full) eq {
359
+ pixs 8 size 8 sub qmv 1 put
360
+ } if
361
+
362
+ % Calculate the mask patterns
363
+ format (full) eq {
364
+ /maskfuncs [
365
+ {add 2 mod} bind
366
+ {exch pop 2 mod} bind
367
+ {pop 3 mod} bind
368
+ {add 3 mod} bind
369
+ {2 idiv exch 3 idiv add 2 mod} bind
370
+ {mul dup 2 mod exch 3 mod add} bind
371
+ {mul dup 2 mod exch 3 mod add 2 mod} bind
372
+ {2 copy mul 3 mod 3 1 roll add 2 mod add 2 mod} bind
373
+ ] def
374
+ } {
375
+ /maskfuncs [
376
+ {exch pop 2 mod} bind
377
+ {2 idiv exch 3 idiv add 2 mod} bind
378
+ {mul dup 2 mod exch 3 mod add 2 mod} bind
379
+ {2 copy mul 3 mod 3 1 roll add 2 mod add 2 mod} bind
380
+ ] def
381
+ } ifelse
382
+ /masks maskfuncs length array def
383
+ 0 1 masks length 1 sub {
384
+ /m exch def
385
+ /mask size size mul array def
386
+ 0 1 size 1 sub {
387
+ /j exch def
388
+ 0 1 size 1 sub {
389
+ /i exch def
390
+ i j maskfuncs m get exec 0 eq
391
+ pixs i j qmv get -1 eq and {1} {0} ifelse
392
+ mask i j qmv 3 -1 roll put
393
+ } for
394
+ } for
395
+ masks m mask put
396
+ } for
397
+
398
+ % Walk the symbol placing the bitstream
399
+ /posx size 1 sub def
400
+ /posy size 1 sub def
401
+ /dir -1 def % -1 is upwards, 1 is downwards
402
+ /col 1 def % 0 is left bit, 1 is right bit
403
+ /num 0 def
404
+ { % loop
405
+ posx 0 lt {exit} if
406
+ pixs posx posy qmv get -1 eq {
407
+ cws num 8 idiv get 7 num 8 mod sub neg bitshift 1 and
408
+ pixs posx posy qmv 3 -1 roll put
409
+ /num num 1 add def
410
+ } if
411
+ col 1 eq {
412
+ /col 0 def
413
+ /posx posx 1 sub def
414
+ } {
415
+ /col 1 def
416
+ /posx posx 1 add def
417
+ /posy posy dir add def
418
+ posy 0 lt posy size ge or { % Turn around at top and bottom
419
+ /dir dir -1 mul def
420
+ /posy posy dir add def
421
+ /posx posx 2 sub def
422
+ % Hop over the timing pattern in full size symbols
423
+ format (full) eq posx 6 eq and {/posx posx 1 sub def} if
424
+ } if
425
+ } ifelse
426
+ } loop
427
+
428
+ % Evaluation algorithm for full symbols
429
+ /evalfull {
430
+ /sym exch def
431
+ m 2 eq {1} {2} ifelse % In future we may evaluate the masks
432
+ } bind def
433
+
434
+ % Evaluation algoritm for micro symbols
435
+ /evalmicro {
436
+ /sym exch def
437
+ /dkrhs 0 def /dkbot 0 def
438
+ 1 1 size 1 sub {
439
+ /i exch def
440
+ /dkrhs dkrhs sym size 1 sub i qmv get add def
441
+ /dkbot dkbot sym i size 1 sub qmv get add def
442
+ } for
443
+ dkrhs dkbot le {
444
+ dkrhs 16 mul dkbot add neg
445
+ } {
446
+ dkbot 16 mul dkrhs add neg
447
+ } ifelse
448
+ } bind def
449
+
450
+ % Evaluate the masked symbols to find the most suitable
451
+ /bestscore 999999999 def
452
+ 0 1 masks length 1 sub {
453
+ /m exch def
454
+ /masksym size size mul array def
455
+ 0 1 size size mul 1 sub {
456
+ /i exch def
457
+ masksym i pixs i get masks m get i get xor put
458
+ } for
459
+ format (full) eq {
460
+ masksym evalfull /score exch def
461
+ } {
462
+ masksym evalmicro /score exch def
463
+ } ifelse
464
+ score bestscore lt {
465
+ /bestsym masksym def
466
+ /bestmaskval m def
467
+ /bestscore score def
468
+ } if
469
+ } for
470
+ /pixs bestsym def
471
+
472
+ % Add the format information
473
+ format (full) eq {
474
+ /fmtvals [
475
+ 16#5412 16#5125 16#5e7c 16#5b4b 16#45f9 16#40ce 16#4f97 16#4aa0
476
+ 16#77c4 16#72f3 16#7daa 16#789d 16#662f 16#6318 16#6c41 16#6976
477
+ 16#1689 16#13be 16#1ce7 16#19d0 16#0762 16#0255 16#0d0c 16#083b
478
+ 16#355f 16#3068 16#3f31 16#3a06 16#24b4 16#2183 16#2eda 16#2bed
479
+ ] def
480
+ /ecid (MLHQ) eclevel search pop length exch pop exch pop def
481
+ /fmtval fmtvals ecid 3 bitshift bestmaskval add get def
482
+ } {
483
+ /fmtvals [
484
+ 16#4445 16#4172 16#4e2b 16#4b1c 16#55ae 16#5099 16#5fc0 16#5af7
485
+ 16#6793 16#62a4 16#6dfd 16#68ca 16#7678 16#734f 16#7c16 16#7921
486
+ 16#06de 16#03e9 16#0cb0 16#0987 16#1735 16#1202 16#1d5b 16#186c
487
+ 16#2508 16#203f 16#2f66 16#2a51 16#34e3 16#31d4 16#3e8d 16#3bba
488
+ ] def
489
+ /symid [ [0] [1 2] [3 4] [5 6 7] ] size 11 sub 2 idiv get eclval get def
490
+ /fmtval fmtvals symid 2 bitshift bestmaskval add get def
491
+ } ifelse
492
+ 0 1 formatmap length 1 sub {
493
+ /i exch def
494
+ formatmap i get {
495
+ pixs exch {} forall qmv fmtval 14 i sub neg bitshift 1 and put
496
+ } forall
497
+ } for
498
+
499
+ % Add the version information
500
+ size 45 ge {
501
+ /vervals [
502
+ 16#07c94 16#085bc 16#09a99 16#0a4d3 16#0bbf6 16#0c762 16#0d847
503
+ 16#0e60d 16#0f928 16#10b78 16#1145d 16#12a17 16#13532 16#149a6
504
+ 16#15683 16#168c9 16#177ec 16#18ec4 16#191e1 16#1afab 16#1b08e
505
+ 16#1cc1a 16#1d33f 16#1ed75 16#1f250 16#209d5 16#216fd 16#228ba
506
+ 16#2379f 16#24b0b 16#2542e 16#26a64 16#27541 16#28c69
507
+ ] def
508
+ /verval vervals size 17 sub 4 idiv 7 sub get def
509
+ 0 1 versionmap length 1 sub {
510
+ /i exch def
511
+ versionmap i get {
512
+ pixs exch {} forall qmv verval 17 i sub neg bitshift 1 and put
513
+ } forall
514
+ } for
515
+ } if
516
+
517
+ /retval 7 dict def
518
+ retval (ren) (renmatrix) put
519
+ retval (pixs) pixs put
520
+ retval (pixx) size put
521
+ retval (pixy) size put
522
+ retval (height) size 2 mul 72 div put
523
+ retval (width) size 2 mul 72 div put
524
+ retval (opt) useropts put
525
+ retval
526
+
527
+ end
528
+
529
+ } bind def
530
+ /qrcode load 0 1 dict put