3 | //
4 | // This file is part of the ZBar Bar Code Reader.
5 | //
6 | // The ZBar Bar Code Reader is free software; you can redistribute it
7 | // and/or modify it under the terms of the GNU Lesser Public License as
8 | // published by the Free Software Foundation; either version 2.1 of
9 | // the License, or (at your option) any later version.
10 | //
11 | // The ZBar Bar Code Reader is distributed in the hope that it will be
12 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13 | // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU Lesser Public License for more details.
15 | //
16 | // You should have received a copy of the GNU Lesser Public License
17 | // along with the ZBar Bar Code Reader; if not, write to the Free
18 | // Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19 | // Boston, MA 02110-1301 USA
20 | //
21 | // http://sourceforge.net/projects/zbar
22 | //------------------------------------------------------------------------
23 | #ifndef _ZBAR_WINDOW_H_
24 | #define _ZBAR_WINDOW_H_
25 |
26 | /// @file
27 | /// Output Window C++ wrapper
28 |
29 | #ifndef _ZBAR_H_
30 | # error "include zbar.h in your application, **not** zbar/Window.h"
31 | #endif
32 |
33 | #include "Image.h"
34 |
35 | namespace zbar {
36 |
37 | /// mid-level output window abstraction.
38 | /// displays images to user-specified platform specific output window
39 |
40 | class Window {
41 | public:
42 | /// constructor.
43 | Window (zbar_window_t *window = NULL)
44 | {
45 | if(window)
46 | _window = window;
47 | else
48 | _window = zbar_window_create();
49 | }
50 |
51 | /// constructor.
52 | Window (void *x11_display_w32_hwnd,
53 | unsigned long x11_drawable)
54 | {
55 | _window = zbar_window_create();
56 | attach(x11_display_w32_hwnd, x11_drawable);
57 | }
58 |
59 | ~Window ()
60 | {
61 | zbar_window_destroy(_window);
62 | }
63 |
64 | /// cast to C window object.
65 | operator zbar_window_t* () const
66 | {
67 | return(_window);
68 | }
69 |
70 | /// associate reader with an existing platform window.
71 | /// see zbar_window_attach()
72 | void attach (void *x11_display_w32_hwnd,
73 | unsigned long x11_drawable = 0)
74 | {
75 | if(zbar_window_attach(_window,
76 | x11_display_w32_hwnd, x11_drawable) < 0)
77 | throw_exception(_window);
78 | }
79 |
80 | /// control content level of the reader overlay.
81 | /// see zbar_window_set_overlay()
82 | void set_overlay (int level)
83 | {
84 | zbar_window_set_overlay(_window, level);
85 | }
86 |
87 | /// retrieve current content level of reader overlay.
88 | /// see zbar_window_get_overlay()
89 |
90 | /// draw a new image into the output window.
91 | /// see zbar_window_draw()
92 | void draw (Image& image)
93 | {
94 | if(zbar_window_draw(_window, image) < 0)
95 | throw_exception(_window);
96 | }
97 |
98 | /// clear the image from the output window.
99 | /// see zbar_window_draw()
100 | void clear ()
101 | {
102 | if(zbar_window_draw(_window, NULL) < 0)
103 | throw_exception(_window);
104 | }
105 |
106 | /// redraw the last image.
107 | /// zbar_window_redraw()
108 | void redraw ()
109 | {
110 | if(zbar_window_redraw(_window) < 0)
111 | throw_exception(_window);
112 | }
113 |
114 | /// resize the image window.
115 | /// zbar_window_resize()
116 | void resize (unsigned width, unsigned height)
117 | {
118 | if(zbar_window_resize(_window, width, height) < 0)
119 | throw_exception(_window);
120 | }
121 |
122 | private:
123 | zbar_window_t *_window;
124 | };
125 |
126 | /// select a compatible format between video input and output window.
127 | /// see zbar_negotiate_format()
128 | static inline void negotiate_format (Video& video, Window& window)
129 | {
130 | if(zbar_negotiate_format(video, window) < 0)
131 | throw_exception(video);
132 | }
133 |
134 | }
135 |
136 | #endif
137 |
--------------------------------------------------------------------------------
/JB_ZBarSDK_Demo/Vendor/ZBarSDK/Resources/zbar-back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaybinhe/JB_ZBarSDK_Demo/952e76a5a04fdd6dc09e92278aa792898a1cd012/JB_ZBarSDK_Demo/Vendor/ZBarSDK/Resources/zbar-back.png
--------------------------------------------------------------------------------
/JB_ZBarSDK_Demo/Vendor/ZBarSDK/Resources/zbar-help.html:
--------------------------------------------------------------------------------
1 |
2 |
4 |
8 |
9 |
10 | Barcode Reader Help
11 |
31 |
32 |
33 | Barcode Reader Help
34 |
35 | Recognized barcodes should look like
36 |
40 |
44 | Also recognized, but not shown:
45 | Code 128,
46 | DataBar (RSS),
47 | Code 93,
48 | Code 39 and
49 | Interleaved 2 of 5
50 |
51 | Hints for successful scanning
52 |
53 |
54 |
Ensure there is plenty of
55 |
Light
56 |
57 |
58 |
4"
59 |
Distance
60 |
should be about 3 to 5 inches
61 |
62 |
63 |
64 |
Shake
65 |
to force the camera to focus
66 |
67 |
68 |
69 |
Wait
70 |
for the autofocus to finish
71 |
72 |
73 |
74 |
Hold Still
75 |
while the barcode is scanned
76 |
77 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/JB_ZBarSDK_Demo/Vendor/ZBarSDK/Resources/zbar-helpicons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaybinhe/JB_ZBarSDK_Demo/952e76a5a04fdd6dc09e92278aa792898a1cd012/JB_ZBarSDK_Demo/Vendor/ZBarSDK/Resources/zbar-helpicons.png
--------------------------------------------------------------------------------
/JB_ZBarSDK_Demo/Vendor/ZBarSDK/Resources/zbar-samples.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaybinhe/JB_ZBarSDK_Demo/952e76a5a04fdd6dc09e92278aa792898a1cd012/JB_ZBarSDK_Demo/Vendor/ZBarSDK/Resources/zbar-samples.png
--------------------------------------------------------------------------------
/JB_ZBarSDK_Demo/Vendor/ZBarSDK/libzbar.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaybinhe/JB_ZBarSDK_Demo/952e76a5a04fdd6dc09e92278aa792898a1cd012/JB_ZBarSDK_Demo/Vendor/ZBarSDK/libzbar.a
--------------------------------------------------------------------------------
/JB_ZBarSDK_Demo/Vendor/libqrencode/QRCodeGenerator.h:
--------------------------------------------------------------------------------
1 | //
2 | // QR Code Generator - generates UIImage from NSString
3 | //
4 | // Copyright (C) 2012 http://moqod.com Andrew Kopanev
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
10 | // of the Software, and to permit persons to whom the Software is furnished to do so,
11 | // subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in all
14 | // copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
17 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
18 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
19 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 | // DEALINGS IN THE SOFTWARE.
22 | //
23 |
24 | #import
25 |
26 | @interface QRCodeGenerator : NSObject
27 |
28 | + (UIImage *)qrImageForString:(NSString *)string imageSize:(CGFloat)size;
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/JB_ZBarSDK_Demo/Vendor/libqrencode/QRCodeGenerator.m:
--------------------------------------------------------------------------------
1 | //
2 | // QR Code Generator - generates UIImage from NSString
3 | //
4 | // Copyright (C) 2012 http://moqod.com Andrew Kopanev
5 | //
6 | // Permission is hereby granted, free of charge, to any person obtaining a copy
7 | // of this software and associated documentation files (the "Software"), to deal
8 | // in the Software without restriction, including without limitation the rights
9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
10 | // of the Software, and to permit persons to whom the Software is furnished to do so,
11 | // subject to the following conditions:
12 | //
13 | // The above copyright notice and this permission notice shall be included in all
14 | // copies or substantial portions of the Software.
15 | //
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
17 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
18 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
19 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 | // DEALINGS IN THE SOFTWARE.
22 | //
23 |
24 | #import "QRCodeGenerator.h"
25 | #import "qrencode.h"
26 |
27 | enum {
28 | qr_margin = 3
29 | };
30 |
31 | @implementation QRCodeGenerator
32 |
33 | + (void)drawQRCode:(QRcode *)code context:(CGContextRef)ctx size:(CGFloat)size {
34 | unsigned char *data = 0;
35 | int width;
36 | data = code->data;
37 | width = code->width;
38 | float zoom = (double)size / (code->width + 2.0 * qr_margin);
39 | CGRect rectDraw = CGRectMake(0, 0, zoom, zoom);
40 |
41 | // draw
42 | CGContextSetFillColor(ctx, CGColorGetComponents([UIColor blackColor].CGColor));
43 | for(int i = 0; i < width; ++i) {
44 | for(int j = 0; j < width; ++j) {
45 | if(*data & 1) {
46 | rectDraw.origin = CGPointMake((j + qr_margin) * zoom,(i + qr_margin) * zoom);
47 | CGContextAddRect(ctx, rectDraw);
48 | }
49 | ++data;
50 | }
51 | }
52 | CGContextFillPath(ctx);
53 | }
54 |
55 | + (UIImage *)qrImageForString:(NSString *)string imageSize:(CGFloat)size {
56 | if (![string length]) {
57 | return nil;
58 | }
59 |
60 | QRcode *code = QRcode_encodeString([string UTF8String], 0, QR_ECLEVEL_L, QR_MODE_8, 1);
61 | if (!code) {
62 | return nil;
63 | }
64 |
65 | // create context
66 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
67 | CGContextRef ctx = CGBitmapContextCreate(0, size, size, 8, size * 4, colorSpace, kCGImageAlphaPremultipliedLast);
68 |
69 | CGAffineTransform translateTransform = CGAffineTransformMakeTranslation(0, -size);
70 | CGAffineTransform scaleTransform = CGAffineTransformMakeScale(1, -1);
71 | CGContextConcatCTM(ctx, CGAffineTransformConcat(translateTransform, scaleTransform));
72 |
73 | // draw QR on this context
74 | [QRCodeGenerator drawQRCode:code context:ctx size:size];
75 |
76 | // get image
77 | CGImageRef qrCGImage = CGBitmapContextCreateImage(ctx);
78 | UIImage * qrImage = [UIImage imageWithCGImage:qrCGImage];
79 |
80 | // some releases
81 | CGContextRelease(ctx);
82 | CGImageRelease(qrCGImage);
83 | CGColorSpaceRelease(colorSpace);
84 | QRcode_free(code);
85 |
86 | return qrImage;
87 | }
88 |
89 | @end
90 |
--------------------------------------------------------------------------------
/JB_ZBarSDK_Demo/Vendor/libqrencode/bitstream.c:
--------------------------------------------------------------------------------
1 | /*
2 | * qrencode - QR Code encoder
3 | *
4 | * Binary sequence class.
5 | * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi
6 | *
7 | * This library is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Lesser General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or any later version.
11 | *
12 | * This library is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this library; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 | */
21 |
22 | #include
23 | #include
24 | #include
25 |
26 | #include "bitstream.h"
27 |
28 | BitStream *BitStream_new(void)
29 | {
30 | BitStream *bstream;
31 |
32 | bstream = (BitStream *)malloc(sizeof(BitStream));
33 | if(bstream == NULL) return NULL;
34 |
35 | bstream->length = 0;
36 | bstream->data = NULL;
37 |
38 | return bstream;
39 | }
40 |
41 | static int BitStream_allocate(BitStream *bstream, int length)
42 | {
43 | unsigned char *data;
44 |
45 | if(bstream == NULL) {
46 | return -1;
47 | }
48 |
49 | data = (unsigned char *)malloc(length);
50 | if(data == NULL) {
51 | return -1;
52 | }
53 |
54 | if(bstream->data) {
55 | free(bstream->data);
56 | }
57 | bstream->length = length;
58 | bstream->data = data;
59 |
60 | return 0;
61 | }
62 |
63 | static BitStream *BitStream_newFromNum(int bits, unsigned int num)
64 | {
65 | unsigned int mask;
66 | int i;
67 | unsigned char *p;
68 | BitStream *bstream;
69 |
70 | bstream = BitStream_new();
71 | if(bstream == NULL) return NULL;
72 |
73 | if(BitStream_allocate(bstream, bits)) {
74 | BitStream_free(bstream);
75 | return NULL;
76 | }
77 |
78 | p = bstream->data;
79 | mask = 1 << (bits - 1);
80 | for(i=0; i> 1;
88 | }
89 |
90 | return bstream;
91 | }
92 |
93 | static BitStream *BitStream_newFromBytes(int size, unsigned char *data)
94 | {
95 | unsigned char mask;
96 | int i, j;
97 | unsigned char *p;
98 | BitStream *bstream;
99 |
100 | bstream = BitStream_new();
101 | if(bstream == NULL) return NULL;
102 |
103 | if(BitStream_allocate(bstream, size * 8)) {
104 | BitStream_free(bstream);
105 | return NULL;
106 | }
107 |
108 | p = bstream->data;
109 | for(i=0; i> 1;
119 | }
120 | }
121 |
122 | return bstream;
123 | }
124 |
125 | int BitStream_append(BitStream *bstream, BitStream *arg)
126 | {
127 | unsigned char *data;
128 |
129 | if(arg == NULL) {
130 | return -1;
131 | }
132 | if(arg->length == 0) {
133 | return 0;
134 | }
135 | if(bstream->length == 0) {
136 | if(BitStream_allocate(bstream, arg->length)) {
137 | return -1;
138 | }
139 | memcpy(bstream->data, arg->data, arg->length);
140 | return 0;
141 | }
142 |
143 | data = (unsigned char *)malloc(bstream->length + arg->length);
144 | if(data == NULL) {
145 | return -1;
146 | }
147 | memcpy(data, bstream->data, bstream->length);
148 | memcpy(data + bstream->length, arg->data, arg->length);
149 |
150 | free(bstream->data);
151 | bstream->length += arg->length;
152 | bstream->data = data;
153 |
154 | return 0;
155 | }
156 |
157 | int BitStream_appendNum(BitStream *bstream, int bits, unsigned int num)
158 | {
159 | BitStream *b;
160 | int ret;
161 |
162 | if(bits == 0) return 0;
163 |
164 | b = BitStream_newFromNum(bits, num);
165 | if(b == NULL) return -1;
166 |
167 | ret = BitStream_append(bstream, b);
168 | BitStream_free(b);
169 |
170 | return ret;
171 | }
172 |
173 | int BitStream_appendBytes(BitStream *bstream, int size, unsigned char *data)
174 | {
175 | BitStream *b;
176 | int ret;
177 |
178 | if(size == 0) return 0;
179 |
180 | b = BitStream_newFromBytes(size, data);
181 | if(b == NULL) return -1;
182 |
183 | ret = BitStream_append(bstream, b);
184 | BitStream_free(b);
185 |
186 | return ret;
187 | }
188 |
189 | unsigned char *BitStream_toByte(BitStream *bstream)
190 | {
191 | int i, j, size, bytes;
192 | unsigned char *data, v;
193 | unsigned char *p;
194 |
195 | size = BitStream_size(bstream);
196 | if(size == 0) {
197 | return NULL;
198 | }
199 | data = (unsigned char *)malloc((size + 7) / 8);
200 | if(data == NULL) {
201 | return NULL;
202 | }
203 |
204 | bytes = size / 8;
205 |
206 | p = bstream->data;
207 | for(i=0; idata);
233 | free(bstream);
234 | }
235 | }
236 |
--------------------------------------------------------------------------------
/JB_ZBarSDK_Demo/Vendor/libqrencode/bitstream.h:
--------------------------------------------------------------------------------
1 | /*
2 | * qrencode - QR Code encoder
3 | *
4 | * Binary sequence class.
5 | * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi
6 | *
7 | * This library is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Lesser General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or any later version.
11 | *
12 | * This library is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this library; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 | */
21 |
22 | #ifndef __BITSTREAM_H__
23 | #define __BITSTREAM_H__
24 |
25 | typedef struct {
26 | int length;
27 | unsigned char *data;
28 | } BitStream;
29 |
30 | extern BitStream *BitStream_new(void);
31 | extern int BitStream_append(BitStream *bstream, BitStream *arg);
32 | extern int BitStream_appendNum(BitStream *bstream, int bits, unsigned int num);
33 | extern int BitStream_appendBytes(BitStream *bstream, int size, unsigned char *data);
34 | #define BitStream_size(__bstream__) (__bstream__->length)
35 | extern unsigned char *BitStream_toByte(BitStream *bstream);
36 | extern void BitStream_free(BitStream *bstream);
37 |
38 | #endif /* __BITSTREAM_H__ */
39 |
--------------------------------------------------------------------------------
/JB_ZBarSDK_Demo/Vendor/libqrencode/mask.c:
--------------------------------------------------------------------------------
1 | /*
2 | * qrencode - QR Code encoder
3 | *
4 | * Masking.
5 | * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi
6 | *
7 | * This library is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Lesser General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or any later version.
11 | *
12 | * This library is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this library; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 | */
21 |
22 | #include
23 | #include
24 | #include
25 | //#include "config.h"
26 | #include "qrencode.h"
27 | #include "qrspec.h"
28 | #include "mask.h"
29 |
30 | //__STATIC
31 | static int Mask_writeFormatInformation(int width, unsigned char *frame, int mask, QRecLevel level)
32 | {
33 | unsigned int format;
34 | unsigned char v;
35 | int i;
36 | int blacks = 0;
37 |
38 | format = QRspec_getFormatInfo(mask, level);
39 |
40 | for(i=0; i<8; i++) {
41 | if(format & 1) {
42 | blacks += 2;
43 | v = 0x85;
44 | } else {
45 | v = 0x84;
46 | }
47 | frame[width * 8 + width - 1 - i] = v;
48 | if(i < 6) {
49 | frame[width * i + 8] = v;
50 | } else {
51 | frame[width * (i + 1) + 8] = v;
52 | }
53 | format= format >> 1;
54 | }
55 | for(i=0; i<7; i++) {
56 | if(format & 1) {
57 | blacks += 2;
58 | v = 0x85;
59 | } else {
60 | v = 0x84;
61 | }
62 | frame[width * (width - 7 + i) + 8] = v;
63 | if(i == 0) {
64 | frame[width * 8 + 7] = v;
65 | } else {
66 | frame[width * 8 + 6 - i] = v;
67 | }
68 | format= format >> 1;
69 | }
70 |
71 | return blacks;
72 | }
73 |
74 | /**
75 | * Demerit coefficients.
76 | * See Section 8.8.2, pp.45, JIS X0510:2004.
77 | */
78 | #define N1 (3)
79 | #define N2 (3)
80 | #define N3 (40)
81 | #define N4 (10)
82 |
83 | #define MASKMAKER(__exp__) \
84 | int x, y;\
85 | int b = 0;\
86 | \
87 | for(y=0; y= 5) {
174 | demerit += N1 + (runLength[i] - 5);
175 | //n1 += N1 + (runLength[i] - 5);
176 | }
177 | if((i & 1)) {
178 | if(i >= 3 && i < length-2 && (runLength[i] % 3) == 0) {
179 | fact = runLength[i] / 3;
180 | if(runLength[i-2] == fact &&
181 | runLength[i-1] == fact &&
182 | runLength[i+1] == fact &&
183 | runLength[i+2] == fact) {
184 | if(runLength[i-3] < 0 || runLength[i-3] >= 4 * fact) {
185 | demerit += N3;
186 | //n3 += N3;
187 | } else if(i+3 >= length || runLength[i+3] >= 4 * fact) {
188 | demerit += N3;
189 | //n3 += N3;
190 | }
191 | }
192 | }
193 | }
194 | }
195 |
196 | return demerit;
197 | }
198 |
199 | //__STATIC
200 | static int Mask_evaluateSymbol(int width, unsigned char *frame)
201 | {
202 | int x, y;
203 | unsigned char *p;
204 | unsigned char b22, w22;
205 | int head;
206 | int demerit = 0;
207 |
208 | p = frame;
209 | for(y=0; y 0 && y > 0) {
214 | b22 = p[0] & p[-1] & p[-width] & p [-width-1];
215 | w22 = p[0] | p[-1] | p[-width] | p [-width-1];
216 | if((b22 | (w22 ^ 1))&1) {
217 | demerit += N2;
218 | }
219 | }
220 | if(x == 0 && (p[0] & 1)) {
221 | runLength[0] = -1;
222 | head = 1;
223 | runLength[head] = 1;
224 | } else if(x > 0) {
225 | if((p[0] ^ p[-1]) & 1) {
226 | head++;
227 | runLength[head] = 1;
228 | } else {
229 | runLength[head]++;
230 | }
231 | }
232 | p++;
233 | }
234 | demerit += Mask_calcN1N3(head+1, runLength);
235 | }
236 |
237 | for(x=0; x 0) {
247 | if((p[0] ^ p[-width]) & 1) {
248 | head++;
249 | runLength[head] = 1;
250 | } else {
251 | runLength[head]++;
252 | }
253 | }
254 | p+=width;
255 | }
256 | demerit += Mask_calcN1N3(head+1, runLength);
257 | }
258 |
259 | return demerit;
260 | }
261 |
262 | unsigned char *Mask_mask(int width, unsigned char *frame, QRecLevel level)
263 | {
264 | int i;
265 | unsigned char *mask, *bestMask;
266 | int minDemerit = INT_MAX;
267 | int bestMaskNum = 0;
268 | int blacks;
269 | int demerit;
270 |
271 | mask = (unsigned char *)malloc(width * width);
272 | if(mask == NULL) return NULL;
273 | bestMask = NULL;
274 |
275 | for(i=0; i<8; i++) {
276 | // n1 = n2 = n3 = n4 = 0;
277 | demerit = 0;
278 | blacks = maskMakers[i](width, frame, mask);
279 | blacks += Mask_writeFormatInformation(width, mask, i, level);
280 | blacks = 100 * blacks / (width * width);
281 | demerit = (abs(blacks - 50) / 5) * N4;
282 | // n4 = demerit;
283 | demerit += Mask_evaluateSymbol(width, mask);
284 | // printf("(%d,%d,%d,%d)=%d\n", n1, n2, n3 ,n4, demerit);
285 | if(demerit < minDemerit) {
286 | minDemerit = demerit;
287 | bestMaskNum = i;
288 | if(bestMask != NULL) {
289 | free(bestMask);
290 | }
291 | bestMask = (unsigned char *)malloc(width * width);
292 | if(bestMask == NULL) break;
293 | memcpy(bestMask, mask, width * width);
294 | }
295 | }
296 | free(mask);
297 | return bestMask;
298 | }
299 |
--------------------------------------------------------------------------------
/JB_ZBarSDK_Demo/Vendor/libqrencode/mask.h:
--------------------------------------------------------------------------------
1 | /*
2 | * qrencode - QR Code encoder
3 | *
4 | * Masking.
5 | * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi
6 | *
7 | * This library is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Lesser General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or any later version.
11 | *
12 | * This library is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this library; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 | */
21 |
22 | #ifndef __MASK_H__
23 | #define __MASK_H__
24 |
25 | #include "qrinput.h"
26 |
27 | extern unsigned char *Mask_makeMask(int width, unsigned char *frame, int mask, QRecLevel level);
28 | extern unsigned char *Mask_mask(int width, unsigned char *frame, QRecLevel level);
29 |
30 | #endif /* __MASK_H__ */
31 |
--------------------------------------------------------------------------------
/JB_ZBarSDK_Demo/Vendor/libqrencode/qrinput.h:
--------------------------------------------------------------------------------
1 | /*
2 | * qrencode - QR Code encoder
3 | *
4 | * Input data chunk class
5 | * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi
6 | *
7 | * This library is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Lesser General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or any later version.
11 | *
12 | * This library is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this library; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 | */
21 |
22 | #ifndef __QRINPUT_H__
23 | #define __QRINPUT_H__
24 |
25 | #include "qrencode.h"
26 | #include "bitstream.h"
27 |
28 | /******************************************************************************
29 | * Entry of input data
30 | *****************************************************************************/
31 | typedef struct _QRinput_List QRinput_List;
32 |
33 | struct _QRinput_List {
34 | QRencodeMode mode;
35 | int size; ///< Size of data chunk (byte).
36 | unsigned char *data; ///< Data chunk.
37 | BitStream *bstream;
38 | QRinput_List *next;
39 | };
40 |
41 | /******************************************************************************
42 | * Input Data
43 | *****************************************************************************/
44 | struct _QRinput {
45 | int version;
46 | QRecLevel level;
47 | QRinput_List *head;
48 | QRinput_List *tail;
49 | };
50 |
51 | /******************************************************************************
52 | * Structured append input data
53 | *****************************************************************************/
54 | typedef struct _QRinput_InputList QRinput_InputList;
55 |
56 | struct _QRinput_InputList {
57 | QRinput *input;
58 | QRinput_InputList *next;
59 | };
60 |
61 | struct _QRinput_Struct {
62 | int size; ///< number of structured symbols
63 | int parity;
64 | QRinput_InputList *head;
65 | QRinput_InputList *tail;
66 | };
67 |
68 | /**
69 | * Pack all bit streams padding bits into a byte array.
70 | * @param input input data.
71 | * @return padded merged byte stream
72 | */
73 | extern unsigned char *QRinput_getByteStream(QRinput *input);
74 |
75 |
76 | extern int QRinput_estimateBitsModeNum(int size);
77 | extern int QRinput_estimateBitsModeAn(int size);
78 | extern int QRinput_estimateBitsMode8(int size);
79 | extern int QRinput_estimateBitsModeKanji(int size);
80 |
81 | extern QRinput *QRinput_dup(QRinput *input);
82 |
83 | extern const signed char QRinput_anTable[128];
84 |
85 | /**
86 | * Look up the alphabet-numeric convesion table (see JIS X0510:2004, pp.19).
87 | * @param __c__ character
88 | * @return value
89 | */
90 | #define QRinput_lookAnTable(__c__) \
91 | ((__c__ & 0x80)?-1:QRinput_anTable[(int)__c__])
92 |
93 | /**
94 | * Length of a segment of structured-append header.
95 | */
96 | #define STRUCTURE_HEADER_BITS 20
97 |
98 | /**
99 | * Maximum number of symbols in a set of structured-appended symbols.
100 | */
101 | #define MAX_STRUCTURED_SYMBOLS 16
102 |
103 | #endif /* __QRINPUT_H__ */
104 |
--------------------------------------------------------------------------------
/JB_ZBarSDK_Demo/Vendor/libqrencode/qrspec.h:
--------------------------------------------------------------------------------
1 | /*
2 | * qrencode - QR Code encoder
3 | *
4 | * QR Code specification in convenient format.
5 | * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi
6 | *
7 | * This library is free software; you can redistribute it and/or
8 | * modify it under the terms of the GNU Lesser General Public
9 | * License as published by the Free Software Foundation; either
10 | * version 2.1 of the License, or any later version.
11 | *
12 | * This library is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | * Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public
18 | * License along with this library; if not, write to the Free Software
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 | */
21 |
22 | #ifndef __QRSPEC_H__
23 | #define __QRSPEC_H__
24 |
25 | #include "qrencode.h"
26 |
27 | /******************************************************************************
28 | * Version and capacity
29 | *****************************************************************************/
30 |
31 | /**
32 | * Maximum version (size) of QR-code symbol.
33 | */
34 | #define QRSPEC_VERSION_MAX 40
35 |
36 | /**
37 | * Maximum width of a symbol
38 | */
39 | #define QRSPEC_WIDTH_MAX 177
40 |
41 | /**
42 | * Return maximum data code length (bytes) for the version.
43 | * @param version
44 | * @param level
45 | * @return maximum size (bytes)
46 | */
47 | extern int QRspec_getDataLength(int version, QRecLevel level);
48 |
49 | /**
50 | * Return maximum error correction code length (bytes) for the version.
51 | * @param version
52 | * @param level
53 | * @return ECC size (bytes)
54 | */
55 | extern int QRspec_getECCLength(int version, QRecLevel level);
56 |
57 | /**
58 | * Return a version number that satisfies the input code length.
59 | * @param size input code length (byte)
60 | * @param level
61 | * @return version number
62 | */
63 | extern int QRspec_getMinimumVersion(int size, QRecLevel level);
64 |
65 | /**
66 | * Return the width of the symbol for the version.
67 | * @param version
68 | * @return width
69 | */
70 | extern int QRspec_getWidth(int version);
71 |
72 | /**
73 | * Return the numer of remainder bits.
74 | * @param version
75 | * @return number of remainder bits
76 | */
77 | extern int QRspec_getRemainder(int version);
78 |
79 | /******************************************************************************
80 | * Length indicator
81 | *****************************************************************************/
82 |
83 | /**
84 | * Return the size of lenght indicator for the mode and version.
85 | * @param mode
86 | * @param version
87 | * @return the size of the appropriate length indicator (bits).
88 | */
89 | extern int QRspec_lengthIndicator(QRencodeMode mode, int version);
90 |
91 | /**
92 | * Return the maximum length for the mode and version.
93 | * @param mode
94 | * @param version
95 | * @return the maximum length (bytes)
96 | */
97 | extern int QRspec_maximumWords(QRencodeMode mode, int version);
98 |
99 | /******************************************************************************
100 | * Error correction code
101 | *****************************************************************************/
102 |
103 | /**
104 | * Return an array of ECC specification.
105 | * @param version
106 | * @param level
107 | * @param spec an array of ECC specification contains as following:
108 | * {# of type1 blocks, # of data code, # of ecc code,
109 | * # of type2 blocks, # of data code}
110 | */
111 | void QRspec_getEccSpec(int version, QRecLevel level, int spec[5]);
112 |
113 | #define QRspec_rsBlockNum(__spec__) (__spec__[0] + __spec__[3])
114 | #define QRspec_rsBlockNum1(__spec__) (__spec__[0])
115 | #define QRspec_rsDataCodes1(__spec__) (__spec__[1])
116 | #define QRspec_rsEccCodes1(__spec__) (__spec__[2])
117 | #define QRspec_rsBlockNum2(__spec__) (__spec__[3])
118 | #define QRspec_rsDataCodes2(__spec__) (__spec__[4])
119 | #define QRspec_rsEccCodes2(__spec__) (__spec__[2])
120 |
121 | #define QRspec_rsDataLength(__spec__) \
122 | ((QRspec_rsBlockNum1(__spec__) * QRspec_rsDataCodes1(__spec__)) + \
123 | (QRspec_rsBlockNum2(__spec__) * QRspec_rsDataCodes2(__spec__)))
124 | #define QRspec_rsEccLength(__spec__) \
125 | (QRspec_rsBlockNum(__spec__) * QRspec_rsEccCodes1(__spec__))
126 |
127 | /******************************************************************************
128 | * Version information pattern
129 | *****************************************************************************/
130 |
131 | /**
132 | * Return BCH encoded version information pattern that is used for the symbol
133 | * of version 7 or greater. Use lower 18 bits.
134 | * @param version
135 | * @return BCH encoded version information pattern
136 | */
137 | extern unsigned int QRspec_getVersionPattern(int version);
138 |
139 | /******************************************************************************
140 | * Format information
141 | *****************************************************************************/
142 |
143 | /**
144 | * Return BCH encoded format information pattern.
145 | * @param mask
146 | * @param level
147 | * @return BCH encoded format information pattern
148 | */
149 | extern unsigned int QRspec_getFormatInfo(int mask, QRecLevel level);
150 |
151 | /******************************************************************************
152 | * Frame
153 | *****************************************************************************/
154 |
155 | /**
156 | * Return a copy of initialized frame.
157 | * When the same version is requested twice or more, a copy of cached frame
158 | * is returned.
159 | * WARNING: Thread unsafe!!!
160 | * @param version
161 | * @return Array of unsigned char. You can free it by free().
162 | */
163 | extern unsigned char *QRspec_newFrame(int version);
164 |
165 | /**
166 | * Clear the frame cache. Typically for debug.
167 | * WARNING: Thread unsafe!!!
168 | */
169 | extern void QRspec_clearCache(void);
170 |
171 | #endif /* __QRSPEC_H__ */
172 |
--------------------------------------------------------------------------------
/JB_ZBarSDK_Demo/Vendor/libqrencode/rscode.h:
--------------------------------------------------------------------------------
1 | /*
2 | * qrencode - QR Code encoder
3 | *
4 | * Reed solomon encoder. This code is taken from Phil Karn's libfec then
5 | * editted and packed into a pair of .c and .h files.
6 | *
7 | * Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q
8 | * (libfec is released under the GNU Lesser General Public License.)
9 | *
10 | * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi
11 | *
12 | * This library is free software; you can redistribute it and/or
13 | * modify it under the terms of the GNU Lesser General Public
14 | * License as published by the Free Software Foundation; either
15 | * version 2.1 of the License, or any later version.
16 | *
17 | * This library is distributed in the hope that it will be useful,
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 | * Lesser General Public License for more details.
21 | *
22 | * You should have received a copy of the GNU Lesser General Public
23 | * License along with this library; if not, write to the Free Software
24 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 | */
26 |
27 | #ifndef __RSCODE_H__
28 | #define __RSCODE_H__
29 |
30 | /*
31 | * General purpose RS codec, 8-bit symbols.
32 | */
33 |
34 | typedef struct _RS RS;
35 |
36 | /* WARNING: Thread unsafe!!! */
37 | extern RS *init_rs(int symsize, int gfpoly, int fcr, int prim, int nroots, int pad);
38 | extern void encode_rs_char(RS *rs, const unsigned char *data, unsigned char *parity);
39 | extern void free_rs_char(RS *rs);
40 | extern void free_rs_cache(void);
41 |
42 | #endif /* __RSCODE_H__ */
43 |
--------------------------------------------------------------------------------
/JB_ZBarSDK_Demo/Vendor/libqrencode/split.h:
--------------------------------------------------------------------------------
1 | /*
2 | * qrencode - QR Code encoder
3 | *
4 | * Input data splitter.
5 | * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi
6 | *
7 | * The following data / specifications are taken from
8 | * "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004)
9 | * or
10 | * "Automatic identification and data capture techniques --
11 | * QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006)
12 | *
13 | * This library is free software; you can redistribute it and/or
14 | * modify it under the terms of the GNU Lesser General Public
15 | * License as published by the Free Software Foundation; either
16 | * version 2.1 of the License, or any later version.
17 | *
18 | * This library is distributed in the hope that it will be useful,
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 | * Lesser General Public License for more details.
22 | *
23 | * You should have received a copy of the GNU Lesser General Public
24 | * License along with this library; if not, write to the Free Software
25 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 | */
27 |
28 | #ifndef __SPLIT_H__
29 | #define __SPLIT_H__
30 |
31 | #include "qrencode.h"
32 |
33 | /**
34 | * Split the input string (null terminated) into QRinput.
35 | * @param string input string
36 | * @param hint give QR_MODE_KANJI if the input string contains Kanji character encoded in Shift-JIS. If not, give QR_MODE_8.
37 | * @param casesensitive 0 for case-insensitive encoding (all alphabet characters are replaced to UPPER-CASE CHARACTERS.
38 | * @retval 0 success.
39 | * @retval -1 an error occurred. errno is set to indicate the error. See
40 | * Exceptions for the details.
41 | * @throw EINVAL invalid input object.
42 | * @throw ENOMEM unable to allocate memory for input objects.
43 | */
44 | extern int Split_splitStringToQRinput(const char *string, QRinput *input,
45 | QRencodeMode hint, int casesensitive);
46 |
47 | #endif /* __SPLIT_H__ */
48 |
--------------------------------------------------------------------------------
/JB_ZBarSDK_Demo/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // JB_ZBarSDK_Demo
4 | //
5 | // Created by jaybin on 15/8/26.
6 | // Copyright (c) 2015年 jaybin. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "ZBarSDK.h"
11 |
12 | @interface ViewController : UIViewController
13 |
14 |
15 | @end
16 |
17 |
--------------------------------------------------------------------------------
/JB_ZBarSDK_Demo/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // JB_ZBarSDK_Demo
4 | //
5 | // Created by jaybin on 15/8/26.
6 | // Copyright (c) 2015年 jaybin. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 | #import "Masonry.h"
11 | #import "ScanQRCodeViewController.h"
12 | #import "UIColor+HEX.h"
13 | #import "CreateRQCodeViewController.h"
14 |
15 | @interface ViewController ()
16 |
17 | @end
18 |
19 | @implementation ViewController
20 |
21 | - (void)viewDidLoad {
22 | [super viewDidLoad];
23 | // Do any additional setup after loading the view, typically from a nib.
24 | [self.view setBackgroundColor:[UIColor whiteColor]];
25 |
26 | UIButton *normalScanBtn = [UIButton buttonWithType:UIButtonTypeCustom];
27 | [normalScanBtn setTitle:@"常规扫描二维码" forState:UIControlStateNormal];
28 | [normalScanBtn setBackgroundColor:[UIColor colorWithHexString:@"#3498db"]];
29 | [normalScanBtn addTarget:self action:@selector(normalScanQRCodeView) forControlEvents:UIControlEventTouchUpInside];
30 | [self.view addSubview:normalScanBtn];
31 | __weak __typeof(self) weakSelf = self;
32 | [normalScanBtn mas_makeConstraints:^(MASConstraintMaker *make) {
33 | make.centerX.equalTo(weakSelf.view);
34 | make.top.equalTo(weakSelf.view).with.offset(100);
35 | make.size.mas_equalTo(CGSizeMake(150, 40));
36 | }];
37 |
38 | UIButton *customScanBtn = [UIButton buttonWithType:UIButtonTypeCustom];
39 | [customScanBtn setTitle:@"自定义扫描二维码" forState:UIControlStateNormal];
40 | [customScanBtn setBackgroundColor:[UIColor colorWithHexString:@"#3498db"]];
41 | [customScanBtn addTarget:self action:@selector(customScanQRCodeView) forControlEvents:UIControlEventTouchUpInside];
42 | [self.view addSubview:customScanBtn];
43 | [customScanBtn mas_makeConstraints:^(MASConstraintMaker *make) {
44 | make.centerX.equalTo(weakSelf.view);
45 | make.top.equalTo(weakSelf.view).with.offset(200);
46 | make.size.mas_equalTo(CGSizeMake(150, 40));
47 | }];
48 |
49 | UIButton *createBtn = [UIButton buttonWithType:UIButtonTypeCustom];
50 | [createBtn setTitle:@"生成二维码" forState:UIControlStateNormal];
51 | [createBtn setBackgroundColor:[UIColor colorWithHexString:@"#3498db"]];
52 | [createBtn addTarget:self action:@selector(createQRCodeView) forControlEvents:UIControlEventTouchUpInside];
53 | [self.view addSubview:createBtn];
54 | [createBtn mas_makeConstraints:^(MASConstraintMaker *make) {
55 | make.centerX.equalTo(weakSelf.view);
56 | make.top.equalTo(weakSelf.view).with.offset(300);
57 | make.size.mas_equalTo(CGSizeMake(150, 40));
58 | }];
59 | }
60 |
61 | - (void)customScanQRCodeView{
62 | ScanQRCodeViewController *scanQRCodeVC = [[ScanQRCodeViewController alloc] initWithNibName:@"ScanQRCodeViewController" bundle:nil];
63 | [self.navigationController pushViewController:scanQRCodeVC animated:YES];
64 | }
65 |
66 | - (void)createQRCodeView{
67 | CreateRQCodeViewController *createQRCodeVC = [[CreateRQCodeViewController alloc] initWithNibName:@"CreateRQCodeViewController" bundle:nil];
68 | [self.navigationController pushViewController:createQRCodeVC animated:YES];
69 | }
70 |
71 | - (void)normalScanQRCodeView{
72 | //初始化相机控制器
73 | ZBarReaderViewController *reader = [ZBarReaderViewController new];
74 | //设置代理
75 | reader.readerDelegate = self;
76 | //基本适配
77 | reader.supportedOrientationsMask = ZBarOrientationMaskAll;
78 | //二维码/条形码识别设置
79 | ZBarImageScanner *scanner = reader.scanner;
80 | [scanner setSymbology: ZBAR_I25
81 | config: ZBAR_CFG_ENABLE
82 | to: 0];
83 | //弹出系统照相机,全屏拍摄
84 | [self presentViewController:reader animated:YES completion:^{
85 |
86 | }];
87 | }
88 |
89 | #pragma mark -
90 | #pragma mark ZBarReaderDelegate
91 | //扫描二维码的时候,识别成功会进入此方法,读取二维码内容
92 | -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
93 | {
94 | id results = [info objectForKey:ZBarReaderControllerResults];
95 | ZBarSymbol * symbol;
96 | for(symbol in results)
97 | break;
98 |
99 | [picker dismissViewControllerAnimated:YES completion:nil];
100 |
101 | NSString *result = symbol.data;
102 |
103 | NSLog(@"%@",result);
104 |
105 | //二维码扫描成功,弹窗提示
106 | UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"扫描成功" message:[NSString stringWithFormat:@"二维码内容:\n%@",result] preferredStyle:UIAlertControllerStyleAlert];
107 | UIAlertAction *action = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
108 | }];
109 | [alertVC addAction:action];
110 | [self presentViewController:alertVC animated:YES completion:^{
111 | }];
112 | }
113 |
114 | - (void) readerControllerDidFailToRead: (ZBarReaderController*) reader
115 | withRetry: (BOOL) retry{
116 |
117 | }
118 |
119 | - (void)didReceiveMemoryWarning {
120 | [super didReceiveMemoryWarning];
121 | // Dispose of any resources that can be recreated.
122 | }
123 |
124 | @end
125 |
--------------------------------------------------------------------------------
/JB_ZBarSDK_Demo/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // JB_ZBarSDK_Demo
4 | //
5 | // Created by jaybin on 15/9/14.
6 | // Copyright (c) 2015年 jaybin. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/JB_ZBarSDK_Demo/screenshots/create.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaybinhe/JB_ZBarSDK_Demo/952e76a5a04fdd6dc09e92278aa792898a1cd012/JB_ZBarSDK_Demo/screenshots/create.gif
--------------------------------------------------------------------------------
/JB_ZBarSDK_Demo/screenshots/customScan.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaybinhe/JB_ZBarSDK_Demo/952e76a5a04fdd6dc09e92278aa792898a1cd012/JB_ZBarSDK_Demo/screenshots/customScan.gif
--------------------------------------------------------------------------------
/JB_ZBarSDK_Demo/screenshots/normalScan.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaybinhe/JB_ZBarSDK_Demo/952e76a5a04fdd6dc09e92278aa792898a1cd012/JB_ZBarSDK_Demo/screenshots/normalScan.gif
--------------------------------------------------------------------------------
/JB_ZBarSDK_DemoTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | com.jaybin.com.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/JB_ZBarSDK_DemoTests/JB_ZBarSDK_DemoTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // JB_ZBarSDK_DemoTests.m
3 | // JB_ZBarSDK_DemoTests
4 | //
5 | // Created by jaybin on 15/9/14.
6 | // Copyright (c) 2015年 jaybin. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface JB_ZBarSDK_DemoTests : XCTestCase
13 |
14 | @end
15 |
16 | @implementation JB_ZBarSDK_DemoTests
17 |
18 | - (void)setUp {
19 | [super setUp];
20 | // Put setup code here. This method is called before the invocation of each test method in the class.
21 | }
22 |
23 | - (void)tearDown {
24 | // Put teardown code here. This method is called after the invocation of each test method in the class.
25 | [super tearDown];
26 | }
27 |
28 | - (void)testExample {
29 | // This is an example of a functional test case.
30 | XCTAssert(YES, @"Pass");
31 | }
32 |
33 | - (void)testPerformanceExample {
34 | // This is an example of a performance test case.
35 | [self measureBlock:^{
36 | // Put the code you want to measure the time of here.
37 | }];
38 | }
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | JB_ZBarSDK_Demo
2 | ===================================
3 |
4 | Overview
5 | ----------------------------------
6 | 通过ZBar SDK,实现IOS扫描二维码的功能。Demo介绍了ZBar常规的扫描二维码方式,同时可以自定义扫描二维码界面,并且可以生成二维码。
7 |
8 |
9 | 一、常规的扫描二维码方式
10 | ----------------------------------
11 |
12 | 
13 |
14 |
15 | 二、自定义扫描二维码
16 | ----------------------------------
17 |
18 | 
19 |
20 |
21 | 三、生成二维码
22 | ----------------------------------
23 |
24 | 
25 |
--------------------------------------------------------------------------------