zxing 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +6 -1
- data/bin/zxing +1 -0
- data/bin/zxing.compiled.rbc +390 -0
- data/lib/zxing.rb +34 -0
- data/lib/zxing.rbc +715 -0
- data/lib/zxing.rb~ +54 -0
- data/lib/zxing/client.rbc +967 -0
- data/lib/zxing/decodable.rb +8 -0
- data/lib/zxing/decodable.rbc +424 -0
- data/lib/zxing/decodable.rb~ +9 -0
- data/lib/zxing/decoder.rb +26 -1
- data/lib/zxing/decoder.rbc +2374 -0
- data/lib/zxing/version.rb +1 -1
- data/lib/zxing/version.rbc +130 -0
- data/spec/fixtures/multi_barcode_example.png +0 -0
- data/spec/spec_helper.rbc +233 -0
- data/spec/zxing/decodable_spec.rbc +1001 -0
- data/spec/zxing_spec.rb +56 -0
- data/spec/zxing_spec.rbc +4949 -0
- metadata +50 -11
data/lib/zxing/decodable.rb
CHANGED
@@ -0,0 +1,424 @@
|
|
1
|
+
!RBIX
|
2
|
+
2390329161478264409
|
3
|
+
x
|
4
|
+
M
|
5
|
+
1
|
6
|
+
n
|
7
|
+
n
|
8
|
+
x
|
9
|
+
10
|
10
|
+
__script__
|
11
|
+
i
|
12
|
+
37
|
13
|
+
5
|
14
|
+
7
|
15
|
+
0
|
16
|
+
64
|
17
|
+
47
|
18
|
+
49
|
19
|
+
1
|
20
|
+
1
|
21
|
+
15
|
22
|
+
99
|
23
|
+
7
|
24
|
+
2
|
25
|
+
65
|
26
|
+
49
|
27
|
+
3
|
28
|
+
2
|
29
|
+
13
|
30
|
+
99
|
31
|
+
12
|
32
|
+
7
|
33
|
+
4
|
34
|
+
12
|
35
|
+
7
|
36
|
+
5
|
37
|
+
12
|
38
|
+
65
|
39
|
+
12
|
40
|
+
49
|
41
|
+
6
|
42
|
+
4
|
43
|
+
15
|
44
|
+
49
|
45
|
+
4
|
46
|
+
0
|
47
|
+
15
|
48
|
+
2
|
49
|
+
11
|
50
|
+
I
|
51
|
+
6
|
52
|
+
I
|
53
|
+
0
|
54
|
+
I
|
55
|
+
0
|
56
|
+
I
|
57
|
+
0
|
58
|
+
n
|
59
|
+
p
|
60
|
+
7
|
61
|
+
s
|
62
|
+
5
|
63
|
+
zxing
|
64
|
+
x
|
65
|
+
7
|
66
|
+
require
|
67
|
+
x
|
68
|
+
9
|
69
|
+
Decodable
|
70
|
+
x
|
71
|
+
11
|
72
|
+
open_module
|
73
|
+
x
|
74
|
+
15
|
75
|
+
__module_init__
|
76
|
+
M
|
77
|
+
1
|
78
|
+
n
|
79
|
+
n
|
80
|
+
x
|
81
|
+
9
|
82
|
+
Decodable
|
83
|
+
i
|
84
|
+
58
|
85
|
+
5
|
86
|
+
66
|
87
|
+
99
|
88
|
+
7
|
89
|
+
0
|
90
|
+
7
|
91
|
+
1
|
92
|
+
65
|
93
|
+
67
|
94
|
+
49
|
95
|
+
2
|
96
|
+
0
|
97
|
+
49
|
98
|
+
3
|
99
|
+
4
|
100
|
+
15
|
101
|
+
99
|
102
|
+
7
|
103
|
+
4
|
104
|
+
7
|
105
|
+
5
|
106
|
+
65
|
107
|
+
67
|
108
|
+
49
|
109
|
+
2
|
110
|
+
0
|
111
|
+
49
|
112
|
+
3
|
113
|
+
4
|
114
|
+
15
|
115
|
+
99
|
116
|
+
7
|
117
|
+
6
|
118
|
+
7
|
119
|
+
7
|
120
|
+
65
|
121
|
+
67
|
122
|
+
49
|
123
|
+
2
|
124
|
+
0
|
125
|
+
49
|
126
|
+
3
|
127
|
+
4
|
128
|
+
15
|
129
|
+
99
|
130
|
+
7
|
131
|
+
8
|
132
|
+
7
|
133
|
+
9
|
134
|
+
65
|
135
|
+
67
|
136
|
+
49
|
137
|
+
2
|
138
|
+
0
|
139
|
+
49
|
140
|
+
3
|
141
|
+
4
|
142
|
+
11
|
143
|
+
I
|
144
|
+
5
|
145
|
+
I
|
146
|
+
0
|
147
|
+
I
|
148
|
+
0
|
149
|
+
I
|
150
|
+
0
|
151
|
+
n
|
152
|
+
p
|
153
|
+
10
|
154
|
+
x
|
155
|
+
6
|
156
|
+
decode
|
157
|
+
M
|
158
|
+
1
|
159
|
+
n
|
160
|
+
n
|
161
|
+
x
|
162
|
+
6
|
163
|
+
decode
|
164
|
+
i
|
165
|
+
8
|
166
|
+
45
|
167
|
+
0
|
168
|
+
1
|
169
|
+
5
|
170
|
+
49
|
171
|
+
2
|
172
|
+
1
|
173
|
+
11
|
174
|
+
I
|
175
|
+
2
|
176
|
+
I
|
177
|
+
0
|
178
|
+
I
|
179
|
+
0
|
180
|
+
I
|
181
|
+
0
|
182
|
+
n
|
183
|
+
p
|
184
|
+
3
|
185
|
+
x
|
186
|
+
5
|
187
|
+
ZXing
|
188
|
+
n
|
189
|
+
x
|
190
|
+
6
|
191
|
+
decode
|
192
|
+
p
|
193
|
+
5
|
194
|
+
I
|
195
|
+
-1
|
196
|
+
I
|
197
|
+
4
|
198
|
+
I
|
199
|
+
0
|
200
|
+
I
|
201
|
+
5
|
202
|
+
I
|
203
|
+
8
|
204
|
+
x
|
205
|
+
63
|
206
|
+
/Users/ncrespo/Developer/ruby/ruby/zxing/lib/zxing/decodable.rb
|
207
|
+
p
|
208
|
+
0
|
209
|
+
x
|
210
|
+
17
|
211
|
+
method_visibility
|
212
|
+
x
|
213
|
+
15
|
214
|
+
add_defn_method
|
215
|
+
x
|
216
|
+
7
|
217
|
+
decode!
|
218
|
+
M
|
219
|
+
1
|
220
|
+
n
|
221
|
+
n
|
222
|
+
x
|
223
|
+
7
|
224
|
+
decode!
|
225
|
+
i
|
226
|
+
8
|
227
|
+
45
|
228
|
+
0
|
229
|
+
1
|
230
|
+
5
|
231
|
+
49
|
232
|
+
2
|
233
|
+
1
|
234
|
+
11
|
235
|
+
I
|
236
|
+
2
|
237
|
+
I
|
238
|
+
0
|
239
|
+
I
|
240
|
+
0
|
241
|
+
I
|
242
|
+
0
|
243
|
+
n
|
244
|
+
p
|
245
|
+
3
|
246
|
+
x
|
247
|
+
5
|
248
|
+
ZXing
|
249
|
+
n
|
250
|
+
x
|
251
|
+
7
|
252
|
+
decode!
|
253
|
+
p
|
254
|
+
5
|
255
|
+
I
|
256
|
+
-1
|
257
|
+
I
|
258
|
+
8
|
259
|
+
I
|
260
|
+
0
|
261
|
+
I
|
262
|
+
9
|
263
|
+
I
|
264
|
+
8
|
265
|
+
x
|
266
|
+
63
|
267
|
+
/Users/ncrespo/Developer/ruby/ruby/zxing/lib/zxing/decodable.rb
|
268
|
+
p
|
269
|
+
0
|
270
|
+
x
|
271
|
+
10
|
272
|
+
decode_all
|
273
|
+
M
|
274
|
+
1
|
275
|
+
n
|
276
|
+
n
|
277
|
+
x
|
278
|
+
10
|
279
|
+
decode_all
|
280
|
+
i
|
281
|
+
8
|
282
|
+
45
|
283
|
+
0
|
284
|
+
1
|
285
|
+
5
|
286
|
+
49
|
287
|
+
2
|
288
|
+
1
|
289
|
+
11
|
290
|
+
I
|
291
|
+
2
|
292
|
+
I
|
293
|
+
0
|
294
|
+
I
|
295
|
+
0
|
296
|
+
I
|
297
|
+
0
|
298
|
+
n
|
299
|
+
p
|
300
|
+
3
|
301
|
+
x
|
302
|
+
5
|
303
|
+
ZXing
|
304
|
+
n
|
305
|
+
x
|
306
|
+
10
|
307
|
+
decode_all
|
308
|
+
p
|
309
|
+
5
|
310
|
+
I
|
311
|
+
-1
|
312
|
+
I
|
313
|
+
c
|
314
|
+
I
|
315
|
+
0
|
316
|
+
I
|
317
|
+
d
|
318
|
+
I
|
319
|
+
8
|
320
|
+
x
|
321
|
+
63
|
322
|
+
/Users/ncrespo/Developer/ruby/ruby/zxing/lib/zxing/decodable.rb
|
323
|
+
p
|
324
|
+
0
|
325
|
+
x
|
326
|
+
11
|
327
|
+
decode_all!
|
328
|
+
M
|
329
|
+
1
|
330
|
+
n
|
331
|
+
n
|
332
|
+
x
|
333
|
+
11
|
334
|
+
decode_all!
|
335
|
+
i
|
336
|
+
8
|
337
|
+
45
|
338
|
+
0
|
339
|
+
1
|
340
|
+
5
|
341
|
+
49
|
342
|
+
2
|
343
|
+
1
|
344
|
+
11
|
345
|
+
I
|
346
|
+
2
|
347
|
+
I
|
348
|
+
0
|
349
|
+
I
|
350
|
+
0
|
351
|
+
I
|
352
|
+
0
|
353
|
+
n
|
354
|
+
p
|
355
|
+
3
|
356
|
+
x
|
357
|
+
5
|
358
|
+
ZXing
|
359
|
+
n
|
360
|
+
x
|
361
|
+
11
|
362
|
+
decode_all!
|
363
|
+
p
|
364
|
+
5
|
365
|
+
I
|
366
|
+
-1
|
367
|
+
I
|
368
|
+
10
|
369
|
+
I
|
370
|
+
0
|
371
|
+
I
|
372
|
+
11
|
373
|
+
I
|
374
|
+
8
|
375
|
+
x
|
376
|
+
63
|
377
|
+
/Users/ncrespo/Developer/ruby/ruby/zxing/lib/zxing/decodable.rb
|
378
|
+
p
|
379
|
+
0
|
380
|
+
p
|
381
|
+
9
|
382
|
+
I
|
383
|
+
2
|
384
|
+
I
|
385
|
+
4
|
386
|
+
I
|
387
|
+
10
|
388
|
+
I
|
389
|
+
8
|
390
|
+
I
|
391
|
+
1e
|
392
|
+
I
|
393
|
+
c
|
394
|
+
I
|
395
|
+
2c
|
396
|
+
I
|
397
|
+
10
|
398
|
+
I
|
399
|
+
3a
|
400
|
+
x
|
401
|
+
63
|
402
|
+
/Users/ncrespo/Developer/ruby/ruby/zxing/lib/zxing/decodable.rb
|
403
|
+
p
|
404
|
+
0
|
405
|
+
x
|
406
|
+
13
|
407
|
+
attach_method
|
408
|
+
p
|
409
|
+
5
|
410
|
+
I
|
411
|
+
0
|
412
|
+
I
|
413
|
+
1
|
414
|
+
I
|
415
|
+
9
|
416
|
+
I
|
417
|
+
3
|
418
|
+
I
|
419
|
+
25
|
420
|
+
x
|
421
|
+
63
|
422
|
+
/Users/ncrespo/Developer/ruby/ruby/zxing/lib/zxing/decodable.rb
|
423
|
+
p
|
424
|
+
0
|
data/lib/zxing/decoder.rb
CHANGED
@@ -15,6 +15,7 @@ module ZXing
|
|
15
15
|
java_import com.google.zxing.common.GlobalHistogramBinarizer
|
16
16
|
java_import com.google.zxing.LuminanceSource
|
17
17
|
java_import com.google.zxing.client.j2se.BufferedImageLuminanceSource
|
18
|
+
java_import com.google.zxing.multi.GenericMultipleBarcodeReader
|
18
19
|
|
19
20
|
java_import javax.imageio.ImageIO
|
20
21
|
java_import java.net.URL
|
@@ -34,12 +35,36 @@ module ZXing
|
|
34
35
|
nil
|
35
36
|
end
|
36
37
|
|
38
|
+
def self.decode_all!(file)
|
39
|
+
new(file).decode_all
|
40
|
+
rescue NativeException
|
41
|
+
raise UndecodableError
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.decode_all(file)
|
45
|
+
decode_all!(file)
|
46
|
+
rescue UndecodableError
|
47
|
+
[]
|
48
|
+
end
|
49
|
+
|
37
50
|
def initialize(file)
|
38
51
|
self.file = file
|
39
52
|
end
|
40
53
|
|
54
|
+
def reader
|
55
|
+
MultiFormatReader.new
|
56
|
+
end
|
57
|
+
|
41
58
|
def decode
|
42
|
-
|
59
|
+
reader.decode(bitmap).to_s
|
60
|
+
end
|
61
|
+
|
62
|
+
def decode_all
|
63
|
+
multi_barcode_reader = GenericMultipleBarcodeReader.new(reader)
|
64
|
+
|
65
|
+
multi_barcode_reader.decode_multiple(bitmap).map do |result|
|
66
|
+
result.get_text
|
67
|
+
end
|
43
68
|
end
|
44
69
|
|
45
70
|
private
|