diff --git a/.editorconfig b/.editorconfig
index bef7531..4e50c9e 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -3,11 +3,8 @@ root = true
[*]
indent_size = 2
-indent_style = tab
+indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
-
-[*.js]
-indent_style = space
diff --git a/.gitignore b/.gitignore
index a088b6f..fd5da80 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,5 @@
-node_modules
-bower_components
+node_modules/
+bower_components/
+.sass-cache/
+
+*.log
diff --git a/.jshintrc b/.jshintrc
index e8c588a..415d0e9 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -1,24 +1,18 @@
{
- "curly" : true,
- "eqeqeq" : true,
- "immed" : true,
- "latedef" : true,
- "newcap" : true,
- "noarg" : true,
- "sub" : true,
- "undef" : true,
- "boss" : true,
- "eqnull" : true,
- "node" : true,
- "globals" : {
- "window": false,
- "document": false,
- "navigator": false,
- "qrcode": false,
- "test": false,
- "ok": false,
- "asyncTest": false,
- "expect": false,
- "MediaStreamTrack": true
- }
+ "bitwise": false,
+ "curly": false,
+ "freeze": true,
+ "undef": true,
+ "unused": true,
+
+ "laxcomma": true,
+ "expr": true,
+
+ "browser": true,
+ "node": true,
+ "predef": [
+ "qrcode",
+ "MediaStreamTrack",
+ "define"
+ ]
}
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..556b073
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,7 @@
+language: node_js
+node_js:
+ - '0.10'
+env:
+ global:
+ - secure: k++7lCMP9FL3XVMI/VbKDsQB2wxoUq944WeuKcBS4+iHFaDiO1Bu0LZV6VIcWc+5xwvpgLQmjEK0ksW3lHiQ703PCZ9A2IJn6Nic9iiN55U7AnNsTRxKgD1U7GbO8w/21B81TXATNlEsf/azsE80wCVurcSENp53q4bBfwZyxuU=
+ - secure: LegkxjHVLvk1tnOqeknBgKjPlkbLZn1k8xAQMjeZzOl9jhTSJMtPgud+KqRtOLHYQBWGpBidUHaYy7VBVBjP0bldD6C0gco1swT09QIRh0A5BZY3ePOWAvq1J2yutGEiFvOdRjXeIv2bPphPEhy2W78c6Kl+kJqX+ge7iel0YMk=
diff --git a/.zuul.yml b/.zuul.yml
new file mode 100644
index 0000000..647c0e2
--- /dev/null
+++ b/.zuul.yml
@@ -0,0 +1,12 @@
+ui: mocha-bdd
+browsers:
+ - name: chrome
+ version: latest
+ - name: firefox
+ version: 27..latest
+ - name: ie
+ version: 9..latest
+ - name: iphone
+ version: 6.1..latest
+ - name: android
+ version: 4.0..latest
diff --git a/README.md b/README.md
index f6ba068..4bffd6a 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,8 @@
# qcode-decoder
-> Decodes QRCode in the browser / node
+> Decodes QRCode in the browser
+
+[![Sauce Test Status](https://saucelabs.com/browser-matrix/cirocosta_github.svg)](https://saucelabs.com/u/cirocosta_github)
## Using in your project
@@ -10,7 +12,7 @@ Download it as a dependency
$ bower install qcode-decoder
```
-attach it to your html file
+attach it to your `.html` file
```html
@@ -20,14 +22,68 @@ and use it!
**For a full example, see `/examples` or [this plunkr](http://plnkr.co/aWikiL)**
+The API is Pretty simple:
+
+### QCodeDecoder()
+Constructor. No args. Might be create with or without `new`.
+
+```javascript
+var qr = new QCodeDecoder();
+// or
+var qr = QCodeDecoder();
+```
+
+This construction lets us be able to chain some methods (although not very necessary - the API is **really** simple).
+
+#### ::decodeFromImage(img)
+
+Decodes an image from a source provided or an `` element with a `src` attribute set.
+
+```javascript
+qr.decodeFromImage(img, function (err, result) {
+ if (err) throw err;
+
+ alert(result);
+});
+```
+
+#### ::decodeFromVideo(videoElem, cb, [,once])
+Decodes directly from a video with a well specified `src` attribute
+
+```javascript
+QCodeDecoder()
+ .decodeFromVideo(document.querySelector('video'), function (err, result) {
+ if (err) throw err;
+
+ alert(result);
+ }, true);
+```
+
+
+#### ::decodeFromCamera(videoElem, cb, [,once])
+Decodes from a videoElement. The optional argument **once** makes the *QCodeDecoder* to only find a QRCode once.
+
+```javascript
+qr.decodeFromCamera(videoElem, function (err) {
+ if (err) throw err;
+
+ alert(result);
+});
+```
+
+#### ::stop()
+
+Stops the current `qr` from searching for a QRCode.
+
+
## Messing around
-For messing around w/ this module and making the example alive, run `npm run start-server` and then go to `http://localhost:8080/examples`
+The proper use of camera APIs and, then, the use of this module, the developer needs to first initiate a webserver for running the examples. I suggest going with [http-server](https://github.com/nodeapps/http-server).
## Credits
The main decoder methods are from [Lazar Laszlo](http://www.
-lazarsoft.info/). Go check his work!
+lazarsoft.info/), who ported ZXing lib (Apache V2) to JavaScript.
## LICENSE
diff --git a/bower.json b/bower.json
index 65f0951..c504da6 100644
--- a/bower.json
+++ b/bower.json
@@ -2,7 +2,7 @@
"name": "qcode-decoder",
"main": "build/main.min.js",
"description": "Decodes QRCode in the browser and node",
- "version": "0.0.6",
+ "version": "0.1.0",
"homepage": "https://github.com/cirocosta/qcode-decoder",
"authors": [
"Ciro S. Costa "
diff --git a/build/qcode-decoder.min.js b/build/qcode-decoder.min.js
index b3572bd..104f73a 100644
--- a/build/qcode-decoder.min.js
+++ b/build/qcode-decoder.min.js
@@ -1,3 +1,3 @@
-function ECB(e,t){this.count=e,this.dataCodewords=t,this.__defineGetter__("Count",function(){return this.count}),this.__defineGetter__("DataCodewords",function(){return this.dataCodewords})}function ECBlocks(e,t,r){this.ecCodewordsPerBlock=e,this.ecBlocks=r?new Array(t,r):new Array(t),this.__defineGetter__("ECCodewordsPerBlock",function(){return this.ecCodewordsPerBlock}),this.__defineGetter__("TotalECCodewords",function(){return this.ecCodewordsPerBlock*this.NumBlocks}),this.__defineGetter__("NumBlocks",function(){for(var e=0,t=0;tn;n++)for(var i=this.alignmentPatternCenters[n]-2,o=0;r>o;o++)0==n&&(0==o||o==r-1)||n==r-1&&0==o||t.setRegion(this.alignmentPatternCenters[o]-2,i,5,5);return t.setRegion(6,9,1,e-17),t.setRegion(9,6,e-17,1),this.versionNumber>6&&(t.setRegion(e-11,0,3,6),t.setRegion(0,e-11,6,3)),t},this.getECBlocksForLevel=function(e){return this.ecBlocks[e.ordinal()]}}function buildVersions(){return new Array(new Version(1,new Array,new ECBlocks(7,new ECB(1,19)),new ECBlocks(10,new ECB(1,16)),new ECBlocks(13,new ECB(1,13)),new ECBlocks(17,new ECB(1,9))),new Version(2,new Array(6,18),new ECBlocks(10,new ECB(1,34)),new ECBlocks(16,new ECB(1,28)),new ECBlocks(22,new ECB(1,22)),new ECBlocks(28,new ECB(1,16))),new Version(3,new Array(6,22),new ECBlocks(15,new ECB(1,55)),new ECBlocks(26,new ECB(1,44)),new ECBlocks(18,new ECB(2,17)),new ECBlocks(22,new ECB(2,13))),new Version(4,new Array(6,26),new ECBlocks(20,new ECB(1,80)),new ECBlocks(18,new ECB(2,32)),new ECBlocks(26,new ECB(2,24)),new ECBlocks(16,new ECB(4,9))),new Version(5,new Array(6,30),new ECBlocks(26,new ECB(1,108)),new ECBlocks(24,new ECB(2,43)),new ECBlocks(18,new ECB(2,15),new ECB(2,16)),new ECBlocks(22,new ECB(2,11),new ECB(2,12))),new Version(6,new Array(6,34),new ECBlocks(18,new ECB(2,68)),new ECBlocks(16,new ECB(4,27)),new ECBlocks(24,new ECB(4,19)),new ECBlocks(28,new ECB(4,15))),new Version(7,new Array(6,22,38),new ECBlocks(20,new ECB(2,78)),new ECBlocks(18,new ECB(4,31)),new ECBlocks(18,new ECB(2,14),new ECB(4,15)),new ECBlocks(26,new ECB(4,13),new ECB(1,14))),new Version(8,new Array(6,24,42),new ECBlocks(24,new ECB(2,97)),new ECBlocks(22,new ECB(2,38),new ECB(2,39)),new ECBlocks(22,new ECB(4,18),new ECB(2,19)),new ECBlocks(26,new ECB(4,14),new ECB(2,15))),new Version(9,new Array(6,26,46),new ECBlocks(30,new ECB(2,116)),new ECBlocks(22,new ECB(3,36),new ECB(2,37)),new ECBlocks(20,new ECB(4,16),new ECB(4,17)),new ECBlocks(24,new ECB(4,12),new ECB(4,13))),new Version(10,new Array(6,28,50),new ECBlocks(18,new ECB(2,68),new ECB(2,69)),new ECBlocks(26,new ECB(4,43),new ECB(1,44)),new ECBlocks(24,new ECB(6,19),new ECB(2,20)),new ECBlocks(28,new ECB(6,15),new ECB(2,16))),new Version(11,new Array(6,30,54),new ECBlocks(20,new ECB(4,81)),new ECBlocks(30,new ECB(1,50),new ECB(4,51)),new ECBlocks(28,new ECB(4,22),new ECB(4,23)),new ECBlocks(24,new ECB(3,12),new ECB(8,13))),new Version(12,new Array(6,32,58),new ECBlocks(24,new ECB(2,92),new ECB(2,93)),new ECBlocks(22,new ECB(6,36),new ECB(2,37)),new ECBlocks(26,new ECB(4,20),new ECB(6,21)),new ECBlocks(28,new ECB(7,14),new ECB(4,15))),new Version(13,new Array(6,34,62),new ECBlocks(26,new ECB(4,107)),new ECBlocks(22,new ECB(8,37),new ECB(1,38)),new ECBlocks(24,new ECB(8,20),new ECB(4,21)),new ECBlocks(22,new ECB(12,11),new ECB(4,12))),new Version(14,new Array(6,26,46,66),new ECBlocks(30,new ECB(3,115),new ECB(1,116)),new ECBlocks(24,new ECB(4,40),new ECB(5,41)),new ECBlocks(20,new ECB(11,16),new ECB(5,17)),new ECBlocks(24,new ECB(11,12),new ECB(5,13))),new Version(15,new Array(6,26,48,70),new ECBlocks(22,new ECB(5,87),new ECB(1,88)),new ECBlocks(24,new ECB(5,41),new ECB(5,42)),new ECBlocks(30,new ECB(5,24),new ECB(7,25)),new ECBlocks(24,new ECB(11,12),new ECB(7,13))),new Version(16,new Array(6,26,50,74),new ECBlocks(24,new ECB(5,98),new ECB(1,99)),new ECBlocks(28,new ECB(7,45),new ECB(3,46)),new ECBlocks(24,new ECB(15,19),new ECB(2,20)),new ECBlocks(30,new ECB(3,15),new ECB(13,16))),new Version(17,new Array(6,30,54,78),new ECBlocks(28,new ECB(1,107),new ECB(5,108)),new ECBlocks(28,new ECB(10,46),new ECB(1,47)),new ECBlocks(28,new ECB(1,22),new ECB(15,23)),new ECBlocks(28,new ECB(2,14),new ECB(17,15))),new Version(18,new Array(6,30,56,82),new ECBlocks(30,new ECB(5,120),new ECB(1,121)),new ECBlocks(26,new ECB(9,43),new ECB(4,44)),new ECBlocks(28,new ECB(17,22),new ECB(1,23)),new ECBlocks(28,new ECB(2,14),new ECB(19,15))),new Version(19,new Array(6,30,58,86),new ECBlocks(28,new ECB(3,113),new ECB(4,114)),new ECBlocks(26,new ECB(3,44),new ECB(11,45)),new ECBlocks(26,new ECB(17,21),new ECB(4,22)),new ECBlocks(26,new ECB(9,13),new ECB(16,14))),new Version(20,new Array(6,34,62,90),new ECBlocks(28,new ECB(3,107),new ECB(5,108)),new ECBlocks(26,new ECB(3,41),new ECB(13,42)),new ECBlocks(30,new ECB(15,24),new ECB(5,25)),new ECBlocks(28,new ECB(15,15),new ECB(10,16))),new Version(21,new Array(6,28,50,72,94),new ECBlocks(28,new ECB(4,116),new ECB(4,117)),new ECBlocks(26,new ECB(17,42)),new ECBlocks(28,new ECB(17,22),new ECB(6,23)),new ECBlocks(30,new ECB(19,16),new ECB(6,17))),new Version(22,new Array(6,26,50,74,98),new ECBlocks(28,new ECB(2,111),new ECB(7,112)),new ECBlocks(28,new ECB(17,46)),new ECBlocks(30,new ECB(7,24),new ECB(16,25)),new ECBlocks(24,new ECB(34,13))),new Version(23,new Array(6,30,54,74,102),new ECBlocks(30,new ECB(4,121),new ECB(5,122)),new ECBlocks(28,new ECB(4,47),new ECB(14,48)),new ECBlocks(30,new ECB(11,24),new ECB(14,25)),new ECBlocks(30,new ECB(16,15),new ECB(14,16))),new Version(24,new Array(6,28,54,80,106),new ECBlocks(30,new ECB(6,117),new ECB(4,118)),new ECBlocks(28,new ECB(6,45),new ECB(14,46)),new ECBlocks(30,new ECB(11,24),new ECB(16,25)),new ECBlocks(30,new ECB(30,16),new ECB(2,17))),new Version(25,new Array(6,32,58,84,110),new ECBlocks(26,new ECB(8,106),new ECB(4,107)),new ECBlocks(28,new ECB(8,47),new ECB(13,48)),new ECBlocks(30,new ECB(7,24),new ECB(22,25)),new ECBlocks(30,new ECB(22,15),new ECB(13,16))),new Version(26,new Array(6,30,58,86,114),new ECBlocks(28,new ECB(10,114),new ECB(2,115)),new ECBlocks(28,new ECB(19,46),new ECB(4,47)),new ECBlocks(28,new ECB(28,22),new ECB(6,23)),new ECBlocks(30,new ECB(33,16),new ECB(4,17))),new Version(27,new Array(6,34,62,90,118),new ECBlocks(30,new ECB(8,122),new ECB(4,123)),new ECBlocks(28,new ECB(22,45),new ECB(3,46)),new ECBlocks(30,new ECB(8,23),new ECB(26,24)),new ECBlocks(30,new ECB(12,15),new ECB(28,16))),new Version(28,new Array(6,26,50,74,98,122),new ECBlocks(30,new ECB(3,117),new ECB(10,118)),new ECBlocks(28,new ECB(3,45),new ECB(23,46)),new ECBlocks(30,new ECB(4,24),new ECB(31,25)),new ECBlocks(30,new ECB(11,15),new ECB(31,16))),new Version(29,new Array(6,30,54,78,102,126),new ECBlocks(30,new ECB(7,116),new ECB(7,117)),new ECBlocks(28,new ECB(21,45),new ECB(7,46)),new ECBlocks(30,new ECB(1,23),new ECB(37,24)),new ECBlocks(30,new ECB(19,15),new ECB(26,16))),new Version(30,new Array(6,26,52,78,104,130),new ECBlocks(30,new ECB(5,115),new ECB(10,116)),new ECBlocks(28,new ECB(19,47),new ECB(10,48)),new ECBlocks(30,new ECB(15,24),new ECB(25,25)),new ECBlocks(30,new ECB(23,15),new ECB(25,16))),new Version(31,new Array(6,30,56,82,108,134),new ECBlocks(30,new ECB(13,115),new ECB(3,116)),new ECBlocks(28,new ECB(2,46),new ECB(29,47)),new ECBlocks(30,new ECB(42,24),new ECB(1,25)),new ECBlocks(30,new ECB(23,15),new ECB(28,16))),new Version(32,new Array(6,34,60,86,112,138),new ECBlocks(30,new ECB(17,115)),new ECBlocks(28,new ECB(10,46),new ECB(23,47)),new ECBlocks(30,new ECB(10,24),new ECB(35,25)),new ECBlocks(30,new ECB(19,15),new ECB(35,16))),new Version(33,new Array(6,30,58,86,114,142),new ECBlocks(30,new ECB(17,115),new ECB(1,116)),new ECBlocks(28,new ECB(14,46),new ECB(21,47)),new ECBlocks(30,new ECB(29,24),new ECB(19,25)),new ECBlocks(30,new ECB(11,15),new ECB(46,16))),new Version(34,new Array(6,34,62,90,118,146),new ECBlocks(30,new ECB(13,115),new ECB(6,116)),new ECBlocks(28,new ECB(14,46),new ECB(23,47)),new ECBlocks(30,new ECB(44,24),new ECB(7,25)),new ECBlocks(30,new ECB(59,16),new ECB(1,17))),new Version(35,new Array(6,30,54,78,102,126,150),new ECBlocks(30,new ECB(12,121),new ECB(7,122)),new ECBlocks(28,new ECB(12,47),new ECB(26,48)),new ECBlocks(30,new ECB(39,24),new ECB(14,25)),new ECBlocks(30,new ECB(22,15),new ECB(41,16))),new Version(36,new Array(6,24,50,76,102,128,154),new ECBlocks(30,new ECB(6,121),new ECB(14,122)),new ECBlocks(28,new ECB(6,47),new ECB(34,48)),new ECBlocks(30,new ECB(46,24),new ECB(10,25)),new ECBlocks(30,new ECB(2,15),new ECB(64,16))),new Version(37,new Array(6,28,54,80,106,132,158),new ECBlocks(30,new ECB(17,122),new ECB(4,123)),new ECBlocks(28,new ECB(29,46),new ECB(14,47)),new ECBlocks(30,new ECB(49,24),new ECB(10,25)),new ECBlocks(30,new ECB(24,15),new ECB(46,16))),new Version(38,new Array(6,32,58,84,110,136,162),new ECBlocks(30,new ECB(4,122),new ECB(18,123)),new ECBlocks(28,new ECB(13,46),new ECB(32,47)),new ECBlocks(30,new ECB(48,24),new ECB(14,25)),new ECBlocks(30,new ECB(42,15),new ECB(32,16))),new Version(39,new Array(6,26,54,82,110,138,166),new ECBlocks(30,new ECB(20,117),new ECB(4,118)),new ECBlocks(28,new ECB(40,47),new ECB(7,48)),new ECBlocks(30,new ECB(43,24),new ECB(22,25)),new ECBlocks(30,new ECB(10,15),new ECB(67,16))),new Version(40,new Array(6,30,58,86,114,142,170),new ECBlocks(30,new ECB(19,118),new ECB(6,119)),new ECBlocks(28,new ECB(18,47),new ECB(31,48)),new ECBlocks(30,new ECB(34,24),new ECB(34,25)),new ECBlocks(30,new ECB(20,15),new ECB(61,16))))}function PerspectiveTransform(e,t,r,n,i,o,s,a,h){this.a11=e,this.a12=n,this.a13=s,this.a21=t,this.a22=i,this.a23=a,this.a31=r,this.a32=o,this.a33=h,this.transformPoints1=function(e){for(var t=e.length,r=this.a11,n=this.a12,i=this.a13,o=this.a21,s=this.a22,a=this.a23,h=this.a31,c=this.a32,d=this.a33,l=0;t>l;l+=2){var w=e[l],f=e[l+1],u=i*w+a*f+d;e[l]=(r*w+o*f+h)/u,e[l+1]=(n*w+s*f+c)/u}},this.transformPoints2=function(e,t){for(var r=e.length,n=0;r>n;n++){var i=e[n],o=t[n],s=this.a13*i+this.a23*o+this.a33;e[n]=(this.a11*i+this.a21*o+this.a31)/s,t[n]=(this.a12*i+this.a22*o+this.a32)/s}},this.buildAdjoint=function(){return new PerspectiveTransform(this.a22*this.a33-this.a23*this.a32,this.a23*this.a31-this.a21*this.a33,this.a21*this.a32-this.a22*this.a31,this.a13*this.a32-this.a12*this.a33,this.a11*this.a33-this.a13*this.a31,this.a12*this.a31-this.a11*this.a32,this.a12*this.a23-this.a13*this.a22,this.a13*this.a21-this.a11*this.a23,this.a11*this.a22-this.a12*this.a21)},this.times=function(e){return new PerspectiveTransform(this.a11*e.a11+this.a21*e.a12+this.a31*e.a13,this.a11*e.a21+this.a21*e.a22+this.a31*e.a23,this.a11*e.a31+this.a21*e.a32+this.a31*e.a33,this.a12*e.a11+this.a22*e.a12+this.a32*e.a13,this.a12*e.a21+this.a22*e.a22+this.a32*e.a23,this.a12*e.a31+this.a22*e.a32+this.a32*e.a33,this.a13*e.a11+this.a23*e.a12+this.a33*e.a13,this.a13*e.a21+this.a23*e.a22+this.a33*e.a23,this.a13*e.a31+this.a23*e.a32+this.a33*e.a33)}}function DetectorResult(e,t){this.bits=e,this.points=t}function Detector(e){this.image=e,this.resultPointCallback=null,this.sizeOfBlackWhiteBlackRun=function(e,t,r,n){var i=Math.abs(n-t)>Math.abs(r-e);if(i){var o=e;e=t,t=o,o=r,r=n,n=o}for(var s=Math.abs(r-e),a=Math.abs(n-t),h=-s>>1,c=n>t?1:-1,d=r>e?1:-1,l=0,w=e,f=t;w!=r;w+=d){var u=i?f:w,C=i?w:f;if(1==l?this.image[u+C*qrcode.width]&&l++:this.image[u+C*qrcode.width]||l++,3==l){var E=w-e,B=f-t;return Math.sqrt(E*E+B*B)}if(h+=a,h>0){if(f==n)break;f+=c,h-=s}}var v=r-e,m=n-t;return Math.sqrt(v*v+m*m)},this.sizeOfBlackWhiteBlackRunBothWays=function(e,t,r,n){var i=this.sizeOfBlackWhiteBlackRun(e,t,r,n),o=1,s=e-(r-e);0>s?(o=e/(e-s),s=0):s>=qrcode.width&&(o=(qrcode.width-1-e)/(s-e),s=qrcode.width-1);var a=Math.floor(t-(n-t)*o);return o=1,0>a?(o=t/(t-a),a=0):a>=qrcode.height&&(o=(qrcode.height-1-t)/(a-t),a=qrcode.height-1),s=Math.floor(e+(s-e)*o),i+=this.sizeOfBlackWhiteBlackRun(e,t,s,a),i-1},this.calculateModuleSizeOneWay=function(e,t){var r=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.X),Math.floor(e.Y),Math.floor(t.X),Math.floor(t.Y)),n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.X),Math.floor(t.Y),Math.floor(e.X),Math.floor(e.Y));return isNaN(r)?n/7:isNaN(n)?r/7:(r+n)/14},this.calculateModuleSize=function(e,t,r){return(this.calculateModuleSizeOneWay(e,t)+this.calculateModuleSizeOneWay(e,r))/2},this.distance=function(e,t){return xDiff=e.X-t.X,yDiff=e.Y-t.Y,Math.sqrt(xDiff*xDiff+yDiff*yDiff)},this.computeDimension=function(e,t,r,n){var i=Math.round(this.distance(e,t)/n),o=Math.round(this.distance(e,r)/n),s=(i+o>>1)+7;switch(3&s){case 0:s++;break;case 2:s--;break;case 3:throw"Error"}return s},this.findAlignmentInRegion=function(e,t,r,n){var i=Math.floor(n*e),o=Math.max(0,t-i),s=Math.min(qrcode.width-1,t+i);if(3*e>s-o)throw"Error";var a=Math.max(0,r-i),h=Math.min(qrcode.height-1,r+i),c=new AlignmentPatternFinder(this.image,o,a,s-o,h-a,e,this.resultPointCallback);return c.find()},this.createTransform=function(e,t,r,n,i){var o,s,a,h,c=i-3.5;null!=n?(o=n.X,s=n.Y,a=h=c-3):(o=t.X-e.X+r.X,s=t.Y-e.Y+r.Y,a=h=c);var d=PerspectiveTransform.quadrilateralToQuadrilateral(3.5,3.5,c,3.5,a,h,3.5,c,e.X,e.Y,t.X,t.Y,o,s,r.X,r.Y);return d},this.sampleGrid=function(e,t,r){var n=GridSampler;return n.sampleGrid3(e,r,t)},this.processFinderPatternInfo=function(e){var t=e.TopLeft,r=e.TopRight,n=e.BottomLeft,i=this.calculateModuleSize(t,r,n);if(1>i)throw"Error";var o=this.computeDimension(t,r,n,i),s=Version.getProvisionalVersionForDimension(o),a=s.DimensionForVersion-7,h=null;if(s.AlignmentPatternCenters.length>0)for(var c=r.X-t.X+n.X,d=r.Y-t.Y+n.Y,l=1-3/a,w=Math.floor(t.X+l*(c-t.X)),f=Math.floor(t.Y+l*(d-t.Y)),u=4;16>=u;u<<=1){h=this.findAlignmentInRegion(i,w,f,u);break}var C,E=this.createTransform(t,r,n,h,o),B=this.sampleGrid(this.image,E,o);return C=null==h?new Array(n,t,r):new Array(n,t,r,h),new DetectorResult(B,C)},this.detect=function(){var e=(new FinderPatternFinder).findFinderPattern(this.image);return this.processFinderPatternInfo(e)}}function FormatInformation(e){this.errorCorrectionLevel=ErrorCorrectionLevel.forBits(e>>3&3),this.dataMask=7&e,this.__defineGetter__("ErrorCorrectionLevel",function(){return this.errorCorrectionLevel}),this.__defineGetter__("DataMask",function(){return this.dataMask}),this.GetHashCode=function(){return this.errorCorrectionLevel.ordinal()<<3|dataMask},this.Equals=function(e){var t=e;return this.errorCorrectionLevel==t.errorCorrectionLevel&&this.dataMask==t.dataMask}}function ErrorCorrectionLevel(e,t,r){this.ordinal_Renamed_Field=e,this.bits=t,this.name=r,this.__defineGetter__("Bits",function(){return this.bits}),this.__defineGetter__("Name",function(){return this.name}),this.ordinal=function(){return this.ordinal_Renamed_Field}}function BitMatrix(e,t){if(t||(t=e),1>e||1>t)throw"Both dimensions must be greater than 0";this.width=e,this.height=t;var r=e>>5;0!=(31&e)&&r++,this.rowSize=r,this.bits=new Array(r*t);for(var n=0;n>5);return 0!=(1&URShift(this.bits[r],31&e))},this.set_Renamed=function(e,t){var r=t*this.rowSize+(e>>5);this.bits[r]|=1<<(31&e)},this.flip=function(e,t){var r=t*this.rowSize+(e>>5);this.bits[r]^=1<<(31&e)},this.clear=function(){for(var e=this.bits.length,t=0;e>t;t++)this.bits[t]=0},this.setRegion=function(e,t,r,n){if(0>t||0>e)throw"Left and top must be nonnegative";if(1>n||1>r)throw"Height and width must be at least 1";var i=e+r,o=t+n;if(o>this.height||i>this.width)throw"The region must fit inside the matrix";for(var s=t;o>s;s++)for(var a=s*this.rowSize,h=e;i>h;h++)this.bits[a+(h>>5)]|=1<<(31&h)}}function DataBlock(e,t){this.numDataCodewords=e,this.codewords=t,this.__defineGetter__("NumDataCodewords",function(){return this.numDataCodewords}),this.__defineGetter__("Codewords",function(){return this.codewords})}function BitMatrixParser(e){var t=e.Dimension;if(21>t||1!=(3&t))throw"Error BitMatrixParser";this.bitMatrix=e,this.parsedVersion=null,this.parsedFormatInfo=null,this.copyBit=function(e,t,r){return this.bitMatrix.get_Renamed(e,t)?r<<1|1:r<<1},this.readFormatInformation=function(){if(null!=this.parsedFormatInfo)return this.parsedFormatInfo;for(var e=0,t=0;6>t;t++)e=this.copyBit(t,8,e);e=this.copyBit(7,8,e),e=this.copyBit(8,8,e),e=this.copyBit(8,7,e);for(var r=5;r>=0;r--)e=this.copyBit(8,r,e);if(this.parsedFormatInfo=FormatInformation.decodeFormatInformation(e),null!=this.parsedFormatInfo)return this.parsedFormatInfo;var n=this.bitMatrix.Dimension;e=0;for(var i=n-8,t=n-1;t>=i;t--)e=this.copyBit(t,8,e);for(var r=n-7;n>r;r++)e=this.copyBit(8,r,e);if(this.parsedFormatInfo=FormatInformation.decodeFormatInformation(e),null!=this.parsedFormatInfo)return this.parsedFormatInfo;throw"Error readFormatInformation"},this.readVersion=function(){if(null!=this.parsedVersion)return this.parsedVersion;var e=this.bitMatrix.Dimension,t=e-17>>2;if(6>=t)return Version.getVersionForNumber(t);for(var r=0,n=e-11,i=5;i>=0;i--)for(var o=e-9;o>=n;o--)r=this.copyBit(o,i,r);if(this.parsedVersion=Version.decodeVersionInformation(r),null!=this.parsedVersion&&this.parsedVersion.DimensionForVersion==e)return this.parsedVersion;r=0;for(var o=5;o>=0;o--)for(var i=e-9;i>=n;i--)r=this.copyBit(o,i,r);if(this.parsedVersion=Version.decodeVersionInformation(r),null!=this.parsedVersion&&this.parsedVersion.DimensionForVersion==e)return this.parsedVersion;throw"Error readVersion"},this.readCodewords=function(){var e=this.readFormatInformation(),t=this.readVersion(),r=DataMask.forReference(e.DataMask),n=this.bitMatrix.Dimension;r.unmaskBitMatrix(this.bitMatrix,n);for(var i=t.buildFunctionPattern(),o=!0,s=new Array(t.TotalCodewords),a=0,h=0,c=0,d=n-1;d>0;d-=2){6==d&&d--;for(var l=0;n>l;l++)for(var w=o?n-1-l:l,f=0;2>f;f++)i.get_Renamed(d-f,w)||(c++,h<<=1,this.bitMatrix.get_Renamed(d-f,w)&&(h|=1),8==c&&(s[a++]=h,c=0,h=0));o^=!0}if(a!=t.TotalCodewords)throw"Error readCodewords";return s}}function DataMask000(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e,t){return 0==(e+t&1)}}function DataMask001(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e){return 0==(1&e)}}function DataMask010(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e,t){return t%3==0}}function DataMask011(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e,t){return(e+t)%3==0}}function DataMask100(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e,t){return 0==(URShift(e,1)+t/3&1)}}function DataMask101(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e,t){var r=e*t;return(1&r)+r%3==0}}function DataMask110(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e,t){var r=e*t;return 0==((1&r)+r%3&1)}}function DataMask111(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e,t){return 0==((e+t&1)+e*t%3&1)}}function ReedSolomonDecoder(e){this.field=e,this.decode=function(e,t){for(var r=new GF256Poly(this.field,e),n=new Array(t),i=0;ii;i++){var a=r.evaluateAt(this.field.exp(o?i+1:i));n[n.length-1-i]=a,0!=a&&(s=!1)}if(!s)for(var h=new GF256Poly(this.field,n),c=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),h,t),d=c[0],l=c[1],w=this.findErrorLocations(d),f=this.findErrorMagnitudes(l,w,o),i=0;iu)throw"ReedSolomonException Bad error location";e[u]=GF256.addOrSubtract(e[u],f[i])}},this.runEuclideanAlgorithm=function(e,t,r){if(e.Degree=Math.floor(r/2);){var d=i,l=s,w=h;if(i=o,s=a,h=c,i.Zero)throw"r_{i-1} was zero";o=d;for(var f=this.field.Zero,u=i.getCoefficient(i.Degree),C=this.field.inverse(u);o.Degree>=i.Degree&&!o.Zero;){var E=o.Degree-i.Degree,B=this.field.multiply(o.getCoefficient(o.Degree),C);f=f.addOrSubtract(this.field.buildMonomial(E,B)),o=o.addOrSubtract(i.multiplyByMonomial(E,B))}a=f.multiply1(s).addOrSubtract(l),c=f.multiply1(h).addOrSubtract(w)}var v=c.getCoefficient(0);if(0==v)throw"ReedSolomonException sigmaTilde(0) was zero";var m=this.field.inverse(v),g=c.multiply2(m),k=o.multiply2(m);return new Array(g,k)},this.findErrorLocations=function(e){var t=e.Degree;if(1==t)return new Array(e.getCoefficient(1));for(var r=new Array(t),n=0,i=1;256>i&&t>n;i++)0==e.evaluateAt(i)&&(r[n]=this.field.inverse(i),n++);if(n!=t)throw"Error locator degree does not match number of roots";return r},this.findErrorMagnitudes=function(e,t,r){for(var n=t.length,i=new Array(n),o=0;n>o;o++){for(var s=this.field.inverse(t[o]),a=1,h=0;n>h;h++)o!=h&&(a=this.field.multiply(a,GF256.addOrSubtract(1,this.field.multiply(t[h],s))));i[o]=this.field.multiply(e.evaluateAt(s),this.field.inverse(a)),r&&(i[o]=this.field.multiply(i[o],s))}return i}}function GF256Poly(e,t){if(null==t||0==t.length)throw"System.ArgumentException";this.field=e;var r=t.length;if(r>1&&0==t[0]){for(var n=1;r>n&&0==t[n];)n++;if(n==r)this.coefficients=e.Zero.coefficients;else{this.coefficients=new Array(r-n);for(var i=0;in;n++)r=GF256.addOrSubtract(r,this.coefficients[n]);return r}for(var i=this.coefficients[0],n=1;t>n;n++)i=GF256.addOrSubtract(this.field.multiply(e,i),this.coefficients[n]);return i},this.addOrSubtract=function(t){if(this.field!=t.field)throw"GF256Polys do not have same GF256 field";if(this.Zero)return t;if(t.Zero)return this;var r=this.coefficients,n=t.coefficients;if(r.length>n.length){var i=r;r=n,n=i}for(var o=new Array(n.length),s=n.length-r.length,a=0;s>a;a++)o[a]=n[a];for(var h=s;hs;s++)for(var a=t[s],h=0;i>h;h++)o[s+h]=GF256.addOrSubtract(o[s+h],this.field.multiply(a,n[h]));return new GF256Poly(this.field,o)},this.multiply2=function(e){if(0==e)return this.field.Zero;if(1==e)return this;for(var t=this.coefficients.length,r=new Array(t),n=0;t>n;n++)r[n]=this.field.multiply(this.coefficients[n],e);return new GF256Poly(this.field,r)},this.multiplyByMonomial=function(e,t){if(0>e)throw"System.ArgumentException";if(0==t)return this.field.Zero;for(var r=this.coefficients.length,n=new Array(r+e),i=0;ii;i++)n[i]=this.field.multiply(this.coefficients[i],t);return new GF256Poly(this.field,n)},this.divide=function(e){if(this.field!=e.field)throw"GF256Polys do not have same GF256 field";if(e.Zero)throw"Divide by 0";for(var t=this.field.Zero,r=this,n=e.getCoefficient(e.Degree),i=this.field.inverse(n);r.Degree>=e.Degree&&!r.Zero;){var o=r.Degree-e.Degree,s=this.field.multiply(r.getCoefficient(r.Degree),i),a=e.multiplyByMonomial(o,s),h=this.field.buildMonomial(o,s);t=t.addOrSubtract(h),r=r.addOrSubtract(a)}return new Array(t,r)}}function GF256(e){this.expTable=new Array(256),this.logTable=new Array(256);for(var t=1,r=0;256>r;r++)this.expTable[r]=t,t<<=1,t>=256&&(t^=e);for(var r=0;255>r;r++)this.logTable[this.expTable[r]]=r;var n=new Array(1);n[0]=0,this.zero=new GF256Poly(this,new Array(n));var i=new Array(1);i[0]=1,this.one=new GF256Poly(this,new Array(i)),this.__defineGetter__("Zero",function(){return this.zero}),this.__defineGetter__("One",function(){return this.one}),this.buildMonomial=function(e,t){if(0>e)throw"System.ArgumentException";if(0==t)return zero;for(var r=new Array(e+1),n=0;n=0?e>>t:(e>>t)+(2<<~t)}function FinderPattern(e,t,r){this.x=e,this.y=t,this.count=1,this.estimatedModuleSize=r,this.__defineGetter__("EstimatedModuleSize",function(){return this.estimatedModuleSize}),this.__defineGetter__("Count",function(){return this.count}),this.__defineGetter__("X",function(){return this.x}),this.__defineGetter__("Y",function(){return this.y}),this.incrementCount=function(){this.count++},this.aboutEquals=function(e,t,r){if(Math.abs(t-this.y)<=e&&Math.abs(r-this.x)<=e){var n=Math.abs(e-this.estimatedModuleSize);return 1>=n||n/this.estimatedModuleSize<=1}return!1}}function FinderPatternInfo(e){this.bottomLeft=e[0],this.topLeft=e[1],this.topRight=e[2],this.__defineGetter__("BottomLeft",function(){return this.bottomLeft}),this.__defineGetter__("TopLeft",function(){return this.topLeft}),this.__defineGetter__("TopRight",function(){return this.topRight})}function FinderPatternFinder(){this.image=null,this.possibleCenters=[],this.hasSkipped=!1,this.crossCheckStateCount=new Array(0,0,0,0,0),this.resultPointCallback=null,this.__defineGetter__("CrossCheckStateCount",function(){return this.crossCheckStateCount[0]=0,this.crossCheckStateCount[1]=0,this.crossCheckStateCount[2]=0,this.crossCheckStateCount[3]=0,this.crossCheckStateCount[4]=0,this.crossCheckStateCount}),this.foundPatternCross=function(e){for(var t=0,r=0;5>r;r++){var n=e[r];if(0==n)return!1;t+=n}if(7>t)return!1;var i=Math.floor((t<=0&&i[t+a*qrcode.width];)s[2]++,a--;if(0>a)return 0/0;for(;a>=0&&!i[t+a*qrcode.width]&&s[1]<=r;)s[1]++,a--;if(0>a||s[1]>r)return 0/0;for(;a>=0&&i[t+a*qrcode.width]&&s[0]<=r;)s[0]++,a--;if(s[0]>r)return 0/0;for(a=e+1;o>a&&i[t+a*qrcode.width];)s[2]++,a++;if(a==o)return 0/0;for(;o>a&&!i[t+a*qrcode.width]&&s[3]=r)return 0/0;for(;o>a&&i[t+a*qrcode.width]&&s[4]=r)return 0/0;var h=s[0]+s[1]+s[2]+s[3]+s[4];return 5*Math.abs(h-n)>=2*n?0/0:this.foundPatternCross(s)?this.centerFromEnd(s,a):0/0},this.crossCheckHorizontal=function(e,t,r,n){for(var i=this.image,o=qrcode.width,s=this.CrossCheckStateCount,a=e;a>=0&&i[a+t*qrcode.width];)s[2]++,a--;if(0>a)return 0/0;for(;a>=0&&!i[a+t*qrcode.width]&&s[1]<=r;)s[1]++,a--;if(0>a||s[1]>r)return 0/0;for(;a>=0&&i[a+t*qrcode.width]&&s[0]<=r;)s[0]++,a--;if(s[0]>r)return 0/0;for(a=e+1;o>a&&i[a+t*qrcode.width];)s[2]++,a++;if(a==o)return 0/0;for(;o>a&&!i[a+t*qrcode.width]&&s[3]=r)return 0/0;for(;o>a&&i[a+t*qrcode.width]&&s[4]=r)return 0/0;var h=s[0]+s[1]+s[2]+s[3]+s[4];return 5*Math.abs(h-n)>=n?0/0:this.foundPatternCross(s)?this.centerFromEnd(s,a):0/0},this.handlePossibleCenter=function(e,t,r){var n=e[0]+e[1]+e[2]+e[3]+e[4],i=this.centerFromEnd(e,r),o=this.crossCheckVertical(t,Math.floor(i),e[2],n);if(!isNaN(o)&&(i=this.crossCheckHorizontal(Math.floor(i),Math.floor(o),e[2],n),!isNaN(i))){for(var s=n/7,a=!1,h=this.possibleCenters.length,c=0;h>c;c++){var d=this.possibleCenters[c];if(d.aboutEquals(s,o,i)){d.incrementCount(),a=!0;break}}if(!a){var l=new FinderPattern(i,o,s);this.possibleCenters.push(l),null!=this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(l)}return!0}return!1},this.selectBestPatterns=function(){var e=this.possibleCenters.length;if(3>e)throw"Couldn't find enough finder patterns";if(e>3){for(var t=0,r=0,n=0;e>n;n++){var i=this.possibleCenters[n].EstimatedModuleSize;t+=i,r+=i*i}var o=t/e;this.possibleCenters.sort(function(e,t){var r=Math.abs(t.EstimatedModuleSize-o),n=Math.abs(e.EstimatedModuleSize-o);return n>r?-1:r==n?0:1});for(var s=Math.sqrt(r/e-o*o),a=Math.max(.2*o,s),n=0;n3;n++){var h=this.possibleCenters[n];Math.abs(h.EstimatedModuleSize-o)>a&&(this.possibleCenters.remove(n),n--)}}return this.possibleCenters.length>3&&this.possibleCenters.sort(function(e,t){return e.count>t.count?-1:e.count=e)return 0;for(var t=null,r=0;e>r;r++){var n=this.possibleCenters[r];if(n.Count>=CENTER_QUORUM){if(null!=t)return this.hasSkipped=!0,Math.floor((Math.abs(t.X-n.X)-Math.abs(t.Y-n.Y))/2);t=n}}return 0},this.haveMultiplyConfirmedCenters=function(){for(var e=0,t=0,r=this.possibleCenters.length,n=0;r>n;n++){var i=this.possibleCenters[n];i.Count>=CENTER_QUORUM&&(e++,t+=i.EstimatedModuleSize)}if(3>e)return!1;for(var o=t/r,s=0,n=0;r>n;n++)i=this.possibleCenters[n],s+=Math.abs(i.EstimatedModuleSize-o);return.05*t>=s},this.findFinderPattern=function(e){var t=!1;this.image=e;var r=qrcode.height,n=qrcode.width,i=Math.floor(3*r/(4*MAX_MODULES));(MIN_SKIP>i||t)&&(i=MIN_SKIP);for(var o=!1,s=new Array(5),a=i-1;r>a&&!o;a+=i){s[0]=0,s[1]=0,s[2]=0,s[3]=0,s[4]=0;for(var h=0,c=0;n>c;c++)if(e[c+a*qrcode.width])1==(1&h)&&h++,s[h]++;else if(0==(1&h))if(4==h)if(this.foundPatternCross(s)){var d=this.handlePossibleCenter(s,a,c);if(d)if(i=2,this.hasSkipped)o=this.haveMultiplyConfirmedCenters();else{var l=this.findRowSkip();l>s[2]&&(a+=l-s[2]-i,c=n-1)}else{do c++;while(n>c&&!e[c+a*qrcode.width]);c--}h=0,s[0]=0,s[1]=0,s[2]=0,s[3]=0,s[4]=0}else s[0]=s[2],s[1]=s[3],s[2]=s[4],s[3]=1,s[4]=0,h=3;else s[++h]++;else s[h]++;if(this.foundPatternCross(s)){var d=this.handlePossibleCenter(s,a,n);d&&(i=s[0],this.hasSkipped&&(o=haveMultiplyConfirmedCenters()))
-}}var w=this.selectBestPatterns();return qrcode.orderBestPatterns(w),new FinderPatternInfo(w)}}function AlignmentPattern(e,t,r){this.x=e,this.y=t,this.count=1,this.estimatedModuleSize=r,this.__defineGetter__("EstimatedModuleSize",function(){return this.estimatedModuleSize}),this.__defineGetter__("Count",function(){return this.count}),this.__defineGetter__("X",function(){return Math.floor(this.x)}),this.__defineGetter__("Y",function(){return Math.floor(this.y)}),this.incrementCount=function(){this.count++},this.aboutEquals=function(e,t,r){if(Math.abs(t-this.y)<=e&&Math.abs(r-this.x)<=e){var n=Math.abs(e-this.estimatedModuleSize);return 1>=n||n/this.estimatedModuleSize<=1}return!1}}function AlignmentPatternFinder(e,t,r,n,i,o,s){this.image=e,this.possibleCenters=new Array,this.startX=t,this.startY=r,this.width=n,this.height=i,this.moduleSize=o,this.crossCheckStateCount=new Array(0,0,0),this.resultPointCallback=s,this.centerFromEnd=function(e,t){return t-e[2]-e[1]/2},this.foundPatternCross=function(e){for(var t=this.moduleSize,r=t/2,n=0;3>n;n++)if(Math.abs(t-e[n])>=r)return!1;return!0},this.crossCheckVertical=function(e,t,r,n){var i=this.image,o=qrcode.height,s=this.crossCheckStateCount;s[0]=0,s[1]=0,s[2]=0;for(var a=e;a>=0&&i[t+a*qrcode.width]&&s[1]<=r;)s[1]++,a--;if(0>a||s[1]>r)return 0/0;for(;a>=0&&!i[t+a*qrcode.width]&&s[0]<=r;)s[0]++,a--;if(s[0]>r)return 0/0;for(a=e+1;o>a&&i[t+a*qrcode.width]&&s[1]<=r;)s[1]++,a++;if(a==o||s[1]>r)return 0/0;for(;o>a&&!i[t+a*qrcode.width]&&s[2]<=r;)s[2]++,a++;if(s[2]>r)return 0/0;var h=s[0]+s[1]+s[2];return 5*Math.abs(h-n)>=2*n?0/0:this.foundPatternCross(s)?this.centerFromEnd(s,a):0/0},this.handlePossibleCenter=function(e,t,r){var n=e[0]+e[1]+e[2],i=this.centerFromEnd(e,r),o=this.crossCheckVertical(t,Math.floor(i),2*e[1],n);if(!isNaN(o)){for(var s=(e[0]+e[1]+e[2])/3,a=this.possibleCenters.length,h=0;a>h;h++){var c=this.possibleCenters[h];if(c.aboutEquals(s,o,i))return new AlignmentPattern(i,o,s)}var d=new AlignmentPattern(i,o,s);this.possibleCenters.push(d),null!=this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(d)}return null},this.find=function(){for(var t=this.startX,i=this.height,o=t+n,s=r+(i>>1),a=new Array(0,0,0),h=0;i>h;h++){var c=s+(0==(1&h)?h+1>>1:-(h+1>>1));a[0]=0,a[1]=0,a[2]=0;for(var d=t;o>d&&!e[d+qrcode.width*c];)d++;for(var l=0;o>d;){if(e[d+c*qrcode.width])if(1==l)a[l]++;else if(2==l){if(this.foundPatternCross(a)){var w=this.handlePossibleCenter(a,c,d);if(null!=w)return w}a[0]=a[2],a[1]=1,a[2]=0,l=1}else a[++l]++;else 1==l&&l++,a[l]++;d++}if(this.foundPatternCross(a)){var w=this.handlePossibleCenter(a,c,o);if(null!=w)return w}}if(0!=this.possibleCenters.length)return this.possibleCenters[0];throw"Couldn't find enough alignment patterns"}}function QRCodeDataBlockReader(e,t,r){this.blockPointer=0,this.bitPointer=7,this.dataLength=0,this.blocks=e,this.numErrorCorrectionCode=r,9>=t?this.dataLengthMode=0:t>=10&&26>=t?this.dataLengthMode=1:t>=27&&40>=t&&(this.dataLengthMode=2),this.getNextBits=function(e){var t=0;if(en;n++)r+=1<>this.bitPointer-e+1,this.bitPointer-=e,t}if(e>8-(e-(this.bitPointer+1)),this.bitPointer=this.bitPointer-e%8,this.bitPointer<0&&(this.bitPointer=8+this.bitPointer),t}if(e>8-(e-(this.bitPointer+1+8));return t=s+a+h,this.bitPointer=this.bitPointer-(e-8)%8,this.bitPointer<0&&(this.bitPointer=8+this.bitPointer),t}return 0},this.NextMode=function(){return this.blockPointer>this.blocks.length-this.numErrorCorrectionCode-2?0:this.getNextBits(4)},this.getDataLength=function(e){for(var t=0;;){if(e>>t==1)break;t++}return this.getNextBits(qrcode.sizeOfDataLengthInfo[this.dataLengthMode][t])},this.getRomanAndFigureString=function(e){var t=e,r=0,n="",i=new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":");do if(t>1){r=this.getNextBits(11);var o=Math.floor(r/45),s=r%45;n+=i[o],n+=i[s],t-=2}else 1==t&&(r=this.getNextBits(6),n+=i[r],t-=1);while(t>0);return n},this.getFigureString=function(e){var t=e,r=0,n="";do t>=3?(r=this.getNextBits(10),100>r&&(n+="0"),10>r&&(n+="0"),t-=3):2==t?(r=this.getNextBits(7),10>r&&(n+="0"),t-=2):1==t&&(r=this.getNextBits(4),t-=1),n+=r;while(t>0);return n},this.get8bitByteArray=function(e){var t=e,r=0,n=new Array;do r=this.getNextBits(8),n.push(r),t--;while(t>0);return n},this.getKanjiString=function(e){var t=e,r=0,n="";do{r=getNextBits(13);var i=r%192,o=r/192,s=(o<<8)+i,a=0;a=40956>=s+33088?s+33088:s+49472,n+=String.fromCharCode(a),t--}while(t>0);return n},this.__defineGetter__("DataByte",function(){for(var e=new Array,t=1,r=2,n=4,i=8;;){var o=this.NextMode();if(0==o){if(e.length>0)break;throw"Empty data block"}if(o!=t&&o!=r&&o!=n&&o!=i)throw"Invalid mode: "+o+" in (block:"+this.blockPointer+" bit:"+this.bitPointer+")";if(dataLength=this.getDataLength(o),1>dataLength)throw"Invalid data length: "+dataLength;switch(o){case t:for(var s=this.getFigureString(dataLength),a=new Array(s.length),h=0;hs||s>r||-1>a||a>n)throw"Error.checkAndNudgePoints ";i=!1,-1==s?(t[o]=0,i=!0):s==r&&(t[o]=r-1,i=!0),-1==a?(t[o+1]=0,i=!0):a==n&&(t[o+1]=n-1,i=!0)}i=!0;for(var o=t.length-2;o>=0&&i;o-=2){var s=Math.floor(t[o]),a=Math.floor(t[o+1]);if(-1>s||s>r||-1>a||a>n)throw"Error.checkAndNudgePoints ";i=!1,-1==s?(t[o]=0,i=!0):s==r&&(t[o]=r-1,i=!0),-1==a?(t[o+1]=0,i=!0):a==n&&(t[o+1]=n-1,i=!0)}},GridSampler.sampleGrid3=function(e,t,r){for(var n=new BitMatrix(t),i=new Array(t<<1),o=0;t>o;o++){for(var s=i.length,a=o+.5,h=0;s>h;h+=2)i[h]=(h>>1)+.5,i[h+1]=a;r.transformPoints1(i),GridSampler.checkAndNudgePoints(e,i);try{for(var h=0;s>h;h+=2){var c=4*Math.floor(i[h])+Math.floor(i[h+1])*qrcode.width*4,d=e[Math.floor(i[h])+qrcode.width*Math.floor(i[h+1])];qrcode.imagedata.data[c]=d?255:0,qrcode.imagedata.data[c+1]=d?255:0,qrcode.imagedata.data[c+2]=0,qrcode.imagedata.data[c+3]=255,d&&n.set_Renamed(h>>1,o)}}catch(l){throw"Error.checkAndNudgePoints"}}return n},GridSampler.sampleGridx=function(e,t,r,n,i,o,s,a,h,c,d,l,w,f,u,C,E,B){var v=PerspectiveTransform.quadrilateralToQuadrilateral(r,n,i,o,s,a,h,c,d,l,w,f,u,C,E,B);return GridSampler.sampleGrid3(e,t,v)},Version.VERSION_DECODE_INFO=new Array(31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017),Version.VERSIONS=buildVersions(),Version.getVersionForNumber=function(e){if(1>e||e>40)throw"ArgumentException";return Version.VERSIONS[e-1]},Version.getProvisionalVersionForDimension=function(e){if(e%4!=1)throw"Error getProvisionalVersionForDimension";try{return Version.getVersionForNumber(e-17>>2)}catch(t){throw"Error getVersionForNumber"}},Version.decodeVersionInformation=function(e){for(var t=4294967295,r=0,n=0;no&&(r=n+7,t=o)}return 3>=t?this.getVersionForNumber(r):null},PerspectiveTransform.quadrilateralToQuadrilateral=function(e,t,r,n,i,o,s,a,h,c,d,l,w,f,u,C){var E=this.quadrilateralToSquare(e,t,r,n,i,o,s,a),B=this.squareToQuadrilateral(h,c,d,l,w,f,u,C);return B.times(E)},PerspectiveTransform.squareToQuadrilateral=function(e,t,r,n,i,o,s,a){return dy2=a-o,dy3=t-n+o-a,0==dy2&&0==dy3?new PerspectiveTransform(r-e,i-r,e,n-t,o-n,t,0,0,1):(dx1=r-i,dx2=s-i,dx3=e-r+i-s,dy1=n-o,denominator=dx1*dy2-dx2*dy1,a13=(dx3*dy2-dx2*dy3)/denominator,a23=(dx1*dy3-dx3*dy1)/denominator,new PerspectiveTransform(r-e+a13*r,s-e+a23*s,e,n-t+a13*n,a-t+a23*a,t,a13,a23,1))},PerspectiveTransform.quadrilateralToSquare=function(e,t,r,n,i,o,s,a){return this.squareToQuadrilateral(e,t,r,n,i,o,s,a).buildAdjoint()};var FORMAT_INFO_MASK_QR=21522,FORMAT_INFO_DECODE_LOOKUP=new Array(new Array(21522,0),new Array(20773,1),new Array(24188,2),new Array(23371,3),new Array(17913,4),new Array(16590,5),new Array(20375,6),new Array(19104,7),new Array(30660,8),new Array(29427,9),new Array(32170,10),new Array(30877,11),new Array(26159,12),new Array(25368,13),new Array(27713,14),new Array(26998,15),new Array(5769,16),new Array(5054,17),new Array(7399,18),new Array(6608,19),new Array(1890,20),new Array(597,21),new Array(3340,22),new Array(2107,23),new Array(13663,24),new Array(12392,25),new Array(16177,26),new Array(14854,27),new Array(9396,28),new Array(8579,29),new Array(11994,30),new Array(11245,31)),BITS_SET_IN_HALF_BYTE=new Array(0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4);FormatInformation.numBitsDiffering=function(e,t){return e^=t,BITS_SET_IN_HALF_BYTE[15&e]+BITS_SET_IN_HALF_BYTE[15&URShift(e,4)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,8)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,12)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,16)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,20)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,24)]+BITS_SET_IN_HALF_BYTE[15&URShift(e,28)]},FormatInformation.decodeFormatInformation=function(e){var t=FormatInformation.doDecodeFormatInformation(e);return null!=t?t:FormatInformation.doDecodeFormatInformation(e^FORMAT_INFO_MASK_QR)},FormatInformation.doDecodeFormatInformation=function(e){for(var t=4294967295,r=0,n=0;ns&&(r=i[1],t=s)}return 3>=t?new FormatInformation(r):null},ErrorCorrectionLevel.forBits=function(e){if(0>e||e>=FOR_BITS.length)throw"ArgumentException";return FOR_BITS[e]};var L=new ErrorCorrectionLevel(0,1,"L"),M=new ErrorCorrectionLevel(1,0,"M"),Q=new ErrorCorrectionLevel(2,3,"Q"),H=new ErrorCorrectionLevel(3,2,"H"),FOR_BITS=new Array(M,L,H,Q);DataBlock.getDataBlocks=function(e,t,r){if(e.length!=t.TotalCodewords)throw"ArgumentException";for(var n=t.getECBlocksForLevel(r),i=0,o=n.getECBlocks(),s=0;s=0;){var C=a[u].codewords.length;if(C==f)break;u--}u++;for(var E=f-n.ECCodewordsPerBlock,B=0,s=0;E>s;s++)for(var c=0;h>c;c++)a[c].codewords[s]=e[B++];for(var c=u;h>c;c++)a[c].codewords[E]=e[B++];for(var v=a[0].codewords.length,s=E;v>s;s++)for(var c=0;h>c;c++){var m=u>c?s:s+1;a[c].codewords[m]=e[B++]}return a},DataMask={},DataMask.forReference=function(e){if(0>e||e>7)throw"System.ArgumentException";return DataMask.DATA_MASKS[e]},DataMask.DATA_MASKS=new Array(new DataMask000,new DataMask001,new DataMask010,new DataMask011,new DataMask100,new DataMask101,new DataMask110,new DataMask111),GF256.QR_CODE_FIELD=new GF256(285),GF256.DATA_MATRIX_FIELD=new GF256(301),GF256.addOrSubtract=function(e,t){return e^t},Decoder={},Decoder.rsDecoder=new ReedSolomonDecoder(GF256.QR_CODE_FIELD),Decoder.correctErrors=function(e,t){for(var r=e.length,n=new Array(r),i=0;r>i;i++)n[i]=255&e[i];var o=e.length-t;try{Decoder.rsDecoder.decode(n,o)}catch(s){throw s}for(var i=0;t>i;i++)e[i]=n[i]},Decoder.decode=function(e){for(var t=new BitMatrixParser(e),r=t.readVersion(),n=t.readFormatInformation().ErrorCorrectionLevel,i=t.readCodewords(),o=DataBlock.getDataBlocks(i,r,n),s=0,a=0;aa;a++)h[c++]=w[a]}var u=new QRCodeDataBlockReader(h,r.VersionNumber,n.Bits);return u},qrcode={},qrcode.imagedata=null,qrcode.width=0,qrcode.height=0,qrcode.qrCodeSymbol=null,qrcode.debug=!1,qrcode.maxImgSize=1048576,qrcode.canvasElement=null,qrcode.sizeOfDataLengthInfo=[[10,9,8,8],[12,11,16,10],[14,13,16,12]],qrcode.callback=null,qrcode.setCanvasElement=function(e){qrcode.canvasElement=e},qrcode.decode=function(e){if(0==arguments.length){var t=qrcode.canvasElement,r=t.getContext("2d");return qrcode.width=t.width,qrcode.height=t.height,qrcode.imagedata=r.getImageData(0,0,qrcode.width,qrcode.height),qrcode.result=qrcode.process(r),null!=qrcode.callback&&qrcode.callback(qrcode.result),qrcode.result}var n=new Image;n.onload=function(){var e=document.createElement("canvas"),t=e.getContext("2d"),r=n.height,i=n.width;if(n.width*n.height>qrcode.maxImgSize){var o=n.width/n.height;r=Math.sqrt(qrcode.maxImgSize/o),i=o*r}e.width=i,e.height=r,t.drawImage(n,0,0,e.width,e.height),qrcode.width=e.width,qrcode.height=e.height;try{qrcode.imagedata=t.getImageData(0,0,e.width,e.height)}catch(s){return qrcode.result="Cross domain image reading not supported in your browser! Save it to your computer then drag and drop the file!",null!=qrcode.callback&&qrcode.callback(qrcode.result),void 0}try{qrcode.result=qrcode.process(t)}catch(s){console.log(s),qrcode.result="error decoding QR Code"}null!=qrcode.callback&&qrcode.callback(qrcode.result)},n.src=e},qrcode.isUrl=function(e){var t=/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;return t.test(e)},qrcode.decode_url=function(e){var t="";try{t=escape(e)}catch(r){console.log(r),t=e}var n="";try{n=decodeURIComponent(t)}catch(r){console.log(r),n=t}return n},qrcode.decode_utf8=function(e){return qrcode.isUrl(e)?qrcode.decode_url(e):e},qrcode.process=function(e){var t=(new Date).getTime(),r=qrcode.grayScaleToBitmap(qrcode.grayscale());if(qrcode.debug){for(var n=0;n=i?!0:!1}return t},qrcode.getMiddleBrightnessPerArea=function(e){for(var t=4,r=Math.floor(qrcode.width/t),n=Math.floor(qrcode.height/t),i=new Array(t),o=0;t>o;o++){i[o]=new Array(t);for(var s=0;t>s;s++)i[o][s]=new Array(0,0)}for(var a=0;t>a;a++)for(var h=0;t>h;h++){i[h][a][0]=255;for(var c=0;n>c;c++)for(var d=0;r>d;d++){var l=e[r*h+d+(n*a+c)*qrcode.width];li[h][a][1]&&(i[h][a][1]=l)}}for(var w=new Array(t),f=0;t>f;f++)w[f]=new Array(t);for(var a=0;t>a;a++)for(var h=0;t>h;h++)w[h][a]=Math.floor((i[h][a][0]+i[h][a][1])/2);return w},qrcode.grayScaleToBitmap=function(e){for(var t=qrcode.getMiddleBrightnessPerArea(e),r=t.length,n=Math.floor(qrcode.width/r),i=Math.floor(qrcode.height/r),o=new Array(qrcode.height*qrcode.width),s=0;r>s;s++)for(var a=0;r>a;a++)for(var h=0;i>h;h++)for(var c=0;n>c;c++)o[n*a+c+(i*s+h)*qrcode.width]=e[n*a+c+(i*s+h)*qrcode.width]e?this.length+e:e,this.push.apply(this,r)};var MIN_SKIP=3,MAX_MODULES=57,INTEGER_MATH_SHIFT=8,CENTER_QUORUM=2;qrcode.orderBestPatterns=function(e){function t(e,t){return xDiff=e.X-t.X,yDiff=e.Y-t.Y,Math.sqrt(xDiff*xDiff+yDiff*yDiff)}function r(e,t,r){var n=t.x,i=t.y;return(r.x-n)*(e.y-i)-(r.y-i)*(e.x-n)}var n,i,o,s=t(e[0],e[1]),a=t(e[1],e[2]),h=t(e[0],e[2]);if(a>=s&&a>=h?(i=e[0],n=e[1],o=e[2]):h>=a&&h>=s?(i=e[1],n=e[0],o=e[2]):(i=e[2],n=e[0],o=e[1]),r(n,i,o)<0){var c=n;n=o,o=c}e[0]=n,e[1]=i,e[2]=o},QRCodeDecoder.prototype.prepareCanvas=function(e,t,r){return t&&r&&(e.style.width=t+"px",e.style.height=r+"px",e.width=t,e.height=r),qrcode.setCanvasElement(e),this.canvasElem=e,e},QRCodeDecoder.prototype._captureToCanvas=function(){var e=this;if(this.tmrCapture&&clearTimeout(this.tmrCapture),!this.videoDimensions&&this.videoElem.videoWidth&&this.videoElem.videoHeight&&(this.videoDimensions={w:this.videoElem.videoWidth,h:this.videoElem.videoHeight},this.prepareCanvas(this.canvasElem,this.videoDimensions.w,this.videoDimensions.h)),this.videoDimensions){var t=this.canvasElem.getContext("2d");t.clearRect(0,0,this.videoElem.videoWidth,this.videoElem.videoHeight);try{return t.drawImage(this.videoElem,0,0,this.videoDimensions.w,this.videoDimensions.h),qrcode.decode(),void 0}catch(r){console.log(r)}}this.tmrCapture=setTimeout(function(){e._captureToCanvas.apply(e,null)},500)},QRCodeDecoder.prototype.hasGetUserMedia=function(){return!!(navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia)},QRCodeDecoder.prototype.isCanvasSupported=function(){var e=document.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))},QRCodeDecoder.prototype.prepareVideo=function(e,t){var r=this;this.stop(),navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia,navigator.getUserMedia?navigator.getUserMedia(this.videoConstraints,function(t){e.src=window.URL.createObjectURL(t),r.videoElem=e,r.stream=t,r.videoDimensions=!1,setTimeout(function(){r._captureToCanvas.apply(r,null)},500)},t):console.log("Couldn't get video from camera")},QRCodeDecoder.prototype.stop=function(){this.stream&&(this.stream.stop(),delete this.stream),this.tmrCapture&&(clearTimeout(this.tmrCapture),delete this.tmrCapture)},QRCodeDecoder.prototype.setSourceId=function(e){this.videoConstraints.video=e?{optional:[{sourceId:e}]}:!0},QRCodeDecoder.prototype.setDecoderCallback=function(e){qrcode.callback=e},QRCodeDecoder.prototype.getVideoSources=function(e){var t=[];MediaStreamTrack&&MediaStreamTrack.getSources?MediaStreamTrack.getSources(function(r){r.forEach(function(e){"video"===e.kind&&t.push(e)}),e(t)}):(console.log("Your browser doesn't support MediaStreamTrack.getSources"),e(t))},QRCodeDecoder.prototype.decodeFromSrc=function(e){qrcode.decode(e)};
+!function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?module.exports=t():e.qrcode=t()}(this,function(){function e(e,t){this.count=e,this.dataCodewords=t,this.__defineGetter__("Count",function(){return this.count}),this.__defineGetter__("DataCodewords",function(){return this.dataCodewords})}function t(e,t,r){this.ecCodewordsPerBlock=e,this.ecBlocks=r?new Array(t,r):new Array(t),this.__defineGetter__("ECCodewordsPerBlock",function(){return this.ecCodewordsPerBlock}),this.__defineGetter__("TotalECCodewords",function(){return this.ecCodewordsPerBlock*this.NumBlocks}),this.__defineGetter__("NumBlocks",function(){for(var e=0,t=0;tn;n++)for(var i=this.alignmentPatternCenters[n]-2,o=0;r>o;o++)0==n&&(0==o||o==r-1)||n==r-1&&0==o||t.setRegion(this.alignmentPatternCenters[o]-2,i,5,5);return t.setRegion(6,9,1,e-17),t.setRegion(9,6,e-17,1),this.versionNumber>6&&(t.setRegion(e-11,0,3,6),t.setRegion(0,e-11,6,3)),t},this.getECBlocksForLevel=function(e){return this.ecBlocks[e.ordinal()]}}function n(){return new Array(new r(1,new Array,new t(7,new e(1,19)),new t(10,new e(1,16)),new t(13,new e(1,13)),new t(17,new e(1,9))),new r(2,new Array(6,18),new t(10,new e(1,34)),new t(16,new e(1,28)),new t(22,new e(1,22)),new t(28,new e(1,16))),new r(3,new Array(6,22),new t(15,new e(1,55)),new t(26,new e(1,44)),new t(18,new e(2,17)),new t(22,new e(2,13))),new r(4,new Array(6,26),new t(20,new e(1,80)),new t(18,new e(2,32)),new t(26,new e(2,24)),new t(16,new e(4,9))),new r(5,new Array(6,30),new t(26,new e(1,108)),new t(24,new e(2,43)),new t(18,new e(2,15),new e(2,16)),new t(22,new e(2,11),new e(2,12))),new r(6,new Array(6,34),new t(18,new e(2,68)),new t(16,new e(4,27)),new t(24,new e(4,19)),new t(28,new e(4,15))),new r(7,new Array(6,22,38),new t(20,new e(2,78)),new t(18,new e(4,31)),new t(18,new e(2,14),new e(4,15)),new t(26,new e(4,13),new e(1,14))),new r(8,new Array(6,24,42),new t(24,new e(2,97)),new t(22,new e(2,38),new e(2,39)),new t(22,new e(4,18),new e(2,19)),new t(26,new e(4,14),new e(2,15))),new r(9,new Array(6,26,46),new t(30,new e(2,116)),new t(22,new e(3,36),new e(2,37)),new t(20,new e(4,16),new e(4,17)),new t(24,new e(4,12),new e(4,13))),new r(10,new Array(6,28,50),new t(18,new e(2,68),new e(2,69)),new t(26,new e(4,43),new e(1,44)),new t(24,new e(6,19),new e(2,20)),new t(28,new e(6,15),new e(2,16))),new r(11,new Array(6,30,54),new t(20,new e(4,81)),new t(30,new e(1,50),new e(4,51)),new t(28,new e(4,22),new e(4,23)),new t(24,new e(3,12),new e(8,13))),new r(12,new Array(6,32,58),new t(24,new e(2,92),new e(2,93)),new t(22,new e(6,36),new e(2,37)),new t(26,new e(4,20),new e(6,21)),new t(28,new e(7,14),new e(4,15))),new r(13,new Array(6,34,62),new t(26,new e(4,107)),new t(22,new e(8,37),new e(1,38)),new t(24,new e(8,20),new e(4,21)),new t(22,new e(12,11),new e(4,12))),new r(14,new Array(6,26,46,66),new t(30,new e(3,115),new e(1,116)),new t(24,new e(4,40),new e(5,41)),new t(20,new e(11,16),new e(5,17)),new t(24,new e(11,12),new e(5,13))),new r(15,new Array(6,26,48,70),new t(22,new e(5,87),new e(1,88)),new t(24,new e(5,41),new e(5,42)),new t(30,new e(5,24),new e(7,25)),new t(24,new e(11,12),new e(7,13))),new r(16,new Array(6,26,50,74),new t(24,new e(5,98),new e(1,99)),new t(28,new e(7,45),new e(3,46)),new t(24,new e(15,19),new e(2,20)),new t(30,new e(3,15),new e(13,16))),new r(17,new Array(6,30,54,78),new t(28,new e(1,107),new e(5,108)),new t(28,new e(10,46),new e(1,47)),new t(28,new e(1,22),new e(15,23)),new t(28,new e(2,14),new e(17,15))),new r(18,new Array(6,30,56,82),new t(30,new e(5,120),new e(1,121)),new t(26,new e(9,43),new e(4,44)),new t(28,new e(17,22),new e(1,23)),new t(28,new e(2,14),new e(19,15))),new r(19,new Array(6,30,58,86),new t(28,new e(3,113),new e(4,114)),new t(26,new e(3,44),new e(11,45)),new t(26,new e(17,21),new e(4,22)),new t(26,new e(9,13),new e(16,14))),new r(20,new Array(6,34,62,90),new t(28,new e(3,107),new e(5,108)),new t(26,new e(3,41),new e(13,42)),new t(30,new e(15,24),new e(5,25)),new t(28,new e(15,15),new e(10,16))),new r(21,new Array(6,28,50,72,94),new t(28,new e(4,116),new e(4,117)),new t(26,new e(17,42)),new t(28,new e(17,22),new e(6,23)),new t(30,new e(19,16),new e(6,17))),new r(22,new Array(6,26,50,74,98),new t(28,new e(2,111),new e(7,112)),new t(28,new e(17,46)),new t(30,new e(7,24),new e(16,25)),new t(24,new e(34,13))),new r(23,new Array(6,30,54,74,102),new t(30,new e(4,121),new e(5,122)),new t(28,new e(4,47),new e(14,48)),new t(30,new e(11,24),new e(14,25)),new t(30,new e(16,15),new e(14,16))),new r(24,new Array(6,28,54,80,106),new t(30,new e(6,117),new e(4,118)),new t(28,new e(6,45),new e(14,46)),new t(30,new e(11,24),new e(16,25)),new t(30,new e(30,16),new e(2,17))),new r(25,new Array(6,32,58,84,110),new t(26,new e(8,106),new e(4,107)),new t(28,new e(8,47),new e(13,48)),new t(30,new e(7,24),new e(22,25)),new t(30,new e(22,15),new e(13,16))),new r(26,new Array(6,30,58,86,114),new t(28,new e(10,114),new e(2,115)),new t(28,new e(19,46),new e(4,47)),new t(28,new e(28,22),new e(6,23)),new t(30,new e(33,16),new e(4,17))),new r(27,new Array(6,34,62,90,118),new t(30,new e(8,122),new e(4,123)),new t(28,new e(22,45),new e(3,46)),new t(30,new e(8,23),new e(26,24)),new t(30,new e(12,15),new e(28,16))),new r(28,new Array(6,26,50,74,98,122),new t(30,new e(3,117),new e(10,118)),new t(28,new e(3,45),new e(23,46)),new t(30,new e(4,24),new e(31,25)),new t(30,new e(11,15),new e(31,16))),new r(29,new Array(6,30,54,78,102,126),new t(30,new e(7,116),new e(7,117)),new t(28,new e(21,45),new e(7,46)),new t(30,new e(1,23),new e(37,24)),new t(30,new e(19,15),new e(26,16))),new r(30,new Array(6,26,52,78,104,130),new t(30,new e(5,115),new e(10,116)),new t(28,new e(19,47),new e(10,48)),new t(30,new e(15,24),new e(25,25)),new t(30,new e(23,15),new e(25,16))),new r(31,new Array(6,30,56,82,108,134),new t(30,new e(13,115),new e(3,116)),new t(28,new e(2,46),new e(29,47)),new t(30,new e(42,24),new e(1,25)),new t(30,new e(23,15),new e(28,16))),new r(32,new Array(6,34,60,86,112,138),new t(30,new e(17,115)),new t(28,new e(10,46),new e(23,47)),new t(30,new e(10,24),new e(35,25)),new t(30,new e(19,15),new e(35,16))),new r(33,new Array(6,30,58,86,114,142),new t(30,new e(17,115),new e(1,116)),new t(28,new e(14,46),new e(21,47)),new t(30,new e(29,24),new e(19,25)),new t(30,new e(11,15),new e(46,16))),new r(34,new Array(6,34,62,90,118,146),new t(30,new e(13,115),new e(6,116)),new t(28,new e(14,46),new e(23,47)),new t(30,new e(44,24),new e(7,25)),new t(30,new e(59,16),new e(1,17))),new r(35,new Array(6,30,54,78,102,126,150),new t(30,new e(12,121),new e(7,122)),new t(28,new e(12,47),new e(26,48)),new t(30,new e(39,24),new e(14,25)),new t(30,new e(22,15),new e(41,16))),new r(36,new Array(6,24,50,76,102,128,154),new t(30,new e(6,121),new e(14,122)),new t(28,new e(6,47),new e(34,48)),new t(30,new e(46,24),new e(10,25)),new t(30,new e(2,15),new e(64,16))),new r(37,new Array(6,28,54,80,106,132,158),new t(30,new e(17,122),new e(4,123)),new t(28,new e(29,46),new e(14,47)),new t(30,new e(49,24),new e(10,25)),new t(30,new e(24,15),new e(46,16))),new r(38,new Array(6,32,58,84,110,136,162),new t(30,new e(4,122),new e(18,123)),new t(28,new e(13,46),new e(32,47)),new t(30,new e(48,24),new e(14,25)),new t(30,new e(42,15),new e(32,16))),new r(39,new Array(6,26,54,82,110,138,166),new t(30,new e(20,117),new e(4,118)),new t(28,new e(40,47),new e(7,48)),new t(30,new e(43,24),new e(22,25)),new t(30,new e(10,15),new e(67,16))),new r(40,new Array(6,30,58,86,114,142,170),new t(30,new e(19,118),new e(6,119)),new t(28,new e(18,47),new e(31,48)),new t(30,new e(34,24),new e(34,25)),new t(30,new e(20,15),new e(61,16))))}function i(e,t,r,n,o,a,s,h,d){this.a11=e,this.a12=n,this.a13=s,this.a21=t,this.a22=o,this.a23=h,this.a31=r,this.a32=a,this.a33=d,this.transformPoints1=function(e){for(var t=e.length,r=this.a11,n=this.a12,i=this.a13,o=this.a21,a=this.a22,s=this.a23,h=this.a31,d=this.a32,w=this.a33,f=0;t>f;f+=2){var c=e[f],u=e[f+1],l=i*c+s*u+w;e[f]=(r*c+o*u+h)/l,e[f+1]=(n*c+a*u+d)/l}},this.transformPoints2=function(e,t){for(var r=e.length,n=0;r>n;n++){var i=e[n],o=t[n],a=this.a13*i+this.a23*o+this.a33;e[n]=(this.a11*i+this.a21*o+this.a31)/a,t[n]=(this.a12*i+this.a22*o+this.a32)/a}},this.buildAdjoint=function(){return new i(this.a22*this.a33-this.a23*this.a32,this.a23*this.a31-this.a21*this.a33,this.a21*this.a32-this.a22*this.a31,this.a13*this.a32-this.a12*this.a33,this.a11*this.a33-this.a13*this.a31,this.a12*this.a31-this.a11*this.a32,this.a12*this.a23-this.a13*this.a22,this.a13*this.a21-this.a11*this.a23,this.a11*this.a22-this.a12*this.a21)},this.times=function(e){return new i(this.a11*e.a11+this.a21*e.a12+this.a31*e.a13,this.a11*e.a21+this.a21*e.a22+this.a31*e.a23,this.a11*e.a31+this.a21*e.a32+this.a31*e.a33,this.a12*e.a11+this.a22*e.a12+this.a32*e.a13,this.a12*e.a21+this.a22*e.a22+this.a32*e.a23,this.a12*e.a31+this.a22*e.a32+this.a32*e.a33,this.a13*e.a11+this.a23*e.a12+this.a33*e.a13,this.a13*e.a21+this.a23*e.a22+this.a33*e.a23,this.a13*e.a31+this.a23*e.a32+this.a33*e.a33)}}function o(e,t){this.bits=e,this.points=t}function a(e){this.image=e,this.resultPointCallback=null,this.sizeOfBlackWhiteBlackRun=function(e,t,r,n){var i=Math.abs(n-t)>Math.abs(r-e);if(i){var o=e;e=t,t=o,o=r,r=n,n=o}for(var a=Math.abs(r-e),s=Math.abs(n-t),h=-a>>1,d=n>t?1:-1,w=r>e?1:-1,f=0,c=e,u=t;c!=r;c+=w){var l=i?u:c,v=i?c:u;if(1==f?this.image[l+v*qrcode.width]&&f++:this.image[l+v*qrcode.width]||f++,3==f){var g=c-e,m=u-t;return Math.sqrt(g*g+m*m)}if(h+=s,h>0){if(u==n)break;u+=d,h-=a}}var y=r-e,p=n-t;return Math.sqrt(y*y+p*p)},this.sizeOfBlackWhiteBlackRunBothWays=function(e,t,r,n){var i=this.sizeOfBlackWhiteBlackRun(e,t,r,n),o=1,a=e-(r-e);0>a?(o=e/(e-a),a=0):a>=qrcode.width&&(o=(qrcode.width-1-e)/(a-e),a=qrcode.width-1);var s=Math.floor(t-(n-t)*o);return o=1,0>s?(o=t/(t-s),s=0):s>=qrcode.height&&(o=(qrcode.height-1-t)/(s-t),s=qrcode.height-1),a=Math.floor(e+(a-e)*o),i+=this.sizeOfBlackWhiteBlackRun(e,t,a,s),i-1},this.calculateModuleSizeOneWay=function(e,t){var r=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.X),Math.floor(e.Y),Math.floor(t.X),Math.floor(t.Y)),n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.X),Math.floor(t.Y),Math.floor(e.X),Math.floor(e.Y));return isNaN(r)?n/7:isNaN(n)?r/7:(r+n)/14},this.calculateModuleSize=function(e,t,r){return(this.calculateModuleSizeOneWay(e,t)+this.calculateModuleSizeOneWay(e,r))/2},this.distance=function(e,t){return xDiff=e.X-t.X,yDiff=e.Y-t.Y,Math.sqrt(xDiff*xDiff+yDiff*yDiff)},this.computeDimension=function(e,t,r,n){var i=Math.round(this.distance(e,t)/n),o=Math.round(this.distance(e,r)/n),a=(i+o>>1)+7;switch(3&a){case 0:a++;break;case 2:a--;break;case 3:throw"Error"}return a},this.findAlignmentInRegion=function(e,t,r,n){var i=Math.floor(n*e),o=Math.max(0,t-i),a=Math.min(qrcode.width-1,t+i);if(3*e>a-o)throw"Error";var s=Math.max(0,r-i),h=Math.min(qrcode.height-1,r+i),d=new P(this.image,o,s,a-o,h-s,e,this.resultPointCallback);return d.find()},this.createTransform=function(e,t,r,n,o){var a,s,h,d,w=o-3.5;null!=n?(a=n.X,s=n.Y,h=d=w-3):(a=t.X-e.X+r.X,s=t.Y-e.Y+r.Y,h=d=w);var f=i.quadrilateralToQuadrilateral(3.5,3.5,w,3.5,h,d,3.5,w,e.X,e.Y,t.X,t.Y,a,s,r.X,r.Y);return f},this.sampleGrid=function(e,t,r){var n=GridSampler;return n.sampleGrid3(e,r,t)},this.processFinderPatternInfo=function(e){var t=e.TopLeft,n=e.TopRight,i=e.BottomLeft,a=this.calculateModuleSize(t,n,i);if(1>a)throw"Error";var s=this.computeDimension(t,n,i,a),h=r.getProvisionalVersionForDimension(s),d=h.DimensionForVersion-7,w=null;if(h.AlignmentPatternCenters.length>0)for(var f=n.X-t.X+i.X,c=n.Y-t.Y+i.Y,u=1-3/d,l=Math.floor(t.X+u*(f-t.X)),v=Math.floor(t.Y+u*(c-t.Y)),g=4;16>=g;g<<=1){w=this.findAlignmentInRegion(a,l,v,g);break}var m,y=this.createTransform(t,n,i,w,s),p=this.sampleGrid(this.image,y,s);return m=null==w?new Array(i,t,n):new Array(i,t,n,w),new o(p,m)},this.detect=function(){var e=(new S).findFinderPattern(this.image);return this.processFinderPatternInfo(e)}}function s(e){this.errorCorrectionLevel=h.forBits(e>>3&3),this.dataMask=7&e,this.__defineGetter__("ErrorCorrectionLevel",function(){return this.errorCorrectionLevel}),this.__defineGetter__("DataMask",function(){return this.dataMask}),this.GetHashCode=function(){return this.errorCorrectionLevel.ordinal()<<3|dataMask},this.Equals=function(e){var t=e;return this.errorCorrectionLevel==t.errorCorrectionLevel&&this.dataMask==t.dataMask}}function h(e,t,r){this.ordinal_Renamed_Field=e,this.bits=t,this.name=r,this.__defineGetter__("Bits",function(){return this.bits}),this.__defineGetter__("Name",function(){return this.name}),this.ordinal=function(){return this.ordinal_Renamed_Field}}function d(e,t){if(t||(t=e),1>e||1>t)throw"Both dimensions must be greater than 0";this.width=e,this.height=t;var r=e>>5;0!=(31&e)&&r++,this.rowSize=r,this.bits=new Array(r*t);for(var n=0;n>5);return 0!=(1&A(this.bits[r],31&e))},this.set_Renamed=function(e,t){var r=t*this.rowSize+(e>>5);this.bits[r]|=1<<(31&e)},this.flip=function(e,t){var r=t*this.rowSize+(e>>5);this.bits[r]^=1<<(31&e)},this.clear=function(){for(var e=this.bits.length,t=0;e>t;t++)this.bits[t]=0},this.setRegion=function(e,t,r,n){if(0>t||0>e)throw"Left and top must be nonnegative";if(1>n||1>r)throw"Height and width must be at least 1";var i=e+r,o=t+n;if(o>this.height||i>this.width)throw"The region must fit inside the matrix";for(var a=t;o>a;a++)for(var s=a*this.rowSize,h=e;i>h;h++)this.bits[s+(h>>5)]|=1<<(31&h)}}function w(e,t){this.numDataCodewords=e,this.codewords=t,this.__defineGetter__("NumDataCodewords",function(){return this.numDataCodewords}),this.__defineGetter__("Codewords",function(){return this.codewords})}function f(e){var t=e.Dimension;if(21>t||1!=(3&t))throw"Error BitMatrixParser";this.bitMatrix=e,this.parsedVersion=null,this.parsedFormatInfo=null,this.copyBit=function(e,t,r){return this.bitMatrix.get_Renamed(e,t)?r<<1|1:r<<1},this.readFormatInformation=function(){if(null!=this.parsedFormatInfo)return this.parsedFormatInfo;for(var e=0,t=0;6>t;t++)e=this.copyBit(t,8,e);e=this.copyBit(7,8,e),e=this.copyBit(8,8,e),e=this.copyBit(8,7,e);for(var r=5;r>=0;r--)e=this.copyBit(8,r,e);if(this.parsedFormatInfo=s.decodeFormatInformation(e),null!=this.parsedFormatInfo)return this.parsedFormatInfo;var n=this.bitMatrix.Dimension;e=0;for(var i=n-8,t=n-1;t>=i;t--)e=this.copyBit(t,8,e);for(var r=n-7;n>r;r++)e=this.copyBit(8,r,e);if(this.parsedFormatInfo=s.decodeFormatInformation(e),null!=this.parsedFormatInfo)return this.parsedFormatInfo;throw"Error readFormatInformation"},this.readVersion=function(){if(null!=this.parsedVersion)return this.parsedVersion;var e=this.bitMatrix.Dimension,t=e-17>>2;if(6>=t)return r.getVersionForNumber(t);for(var n=0,i=e-11,o=5;o>=0;o--)for(var a=e-9;a>=i;a--)n=this.copyBit(a,o,n);if(this.parsedVersion=r.decodeVersionInformation(n),null!=this.parsedVersion&&this.parsedVersion.DimensionForVersion==e)return this.parsedVersion;n=0;for(var a=5;a>=0;a--)for(var o=e-9;o>=i;o--)n=this.copyBit(a,o,n);if(this.parsedVersion=r.decodeVersionInformation(n),null!=this.parsedVersion&&this.parsedVersion.DimensionForVersion==e)return this.parsedVersion;throw"Error readVersion"},this.readCodewords=function(){var e=this.readFormatInformation(),t=this.readVersion(),r=DataMask.forReference(e.DataMask),n=this.bitMatrix.Dimension;r.unmaskBitMatrix(this.bitMatrix,n);for(var i=t.buildFunctionPattern(),o=!0,a=new Array(t.TotalCodewords),s=0,h=0,d=0,w=n-1;w>0;w-=2){6==w&&w--;for(var f=0;n>f;f++)for(var c=o?n-1-f:f,u=0;2>u;u++)i.get_Renamed(w-u,c)||(d++,h<<=1,this.bitMatrix.get_Renamed(w-u,c)&&(h|=1),8==d&&(a[s++]=h,d=0,h=0));o^=!0}if(s!=t.TotalCodewords)throw"Error readCodewords";return a}}function c(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e,t){return 0==(e+t&1)}}function u(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e){return 0==(1&e)}}function l(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e,t){return t%3==0}}function v(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e,t){return(e+t)%3==0}}function g(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e,t){return 0==(A(e,1)+t/3&1)}}function m(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e,t){var r=e*t;return(1&r)+r%3==0}}function y(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e,t){var r=e*t;return 0==((1&r)+r%3&1)}}function b(){this.unmaskBitMatrix=function(e,t){for(var r=0;t>r;r++)for(var n=0;t>n;n++)this.isMasked(r,n)&&e.flip(n,r)},this.isMasked=function(e,t){return 0==((e+t&1)+e*t%3&1)}}function C(e){this.field=e,this.decode=function(e,t){for(var r=new M(this.field,e),n=new Array(t),i=0;ii;i++){var s=r.evaluateAt(this.field.exp(o?i+1:i));n[n.length-1-i]=s,0!=s&&(a=!1)}if(!a)for(var h=new M(this.field,n),d=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),h,t),w=d[0],f=d[1],c=this.findErrorLocations(w),u=this.findErrorMagnitudes(f,c,o),i=0;il)throw"ReedSolomonException Bad error location";e[l]=_.addOrSubtract(e[l],u[i])}},this.runEuclideanAlgorithm=function(e,t,r){if(e.Degree=Math.floor(r/2);){var w=i,f=a,c=h;if(i=o,a=s,h=d,i.Zero)throw"r_{i-1} was zero";o=w;for(var u=this.field.Zero,l=i.getCoefficient(i.Degree),v=this.field.inverse(l);o.Degree>=i.Degree&&!o.Zero;){var g=o.Degree-i.Degree,m=this.field.multiply(o.getCoefficient(o.Degree),v);u=u.addOrSubtract(this.field.buildMonomial(g,m)),o=o.addOrSubtract(i.multiplyByMonomial(g,m))}s=u.multiply1(a).addOrSubtract(f),d=u.multiply1(h).addOrSubtract(c)}var y=d.getCoefficient(0);if(0==y)throw"ReedSolomonException sigmaTilde(0) was zero";var p=this.field.inverse(y),b=d.multiply2(p),C=o.multiply2(p);return new Array(b,C)},this.findErrorLocations=function(e){var t=e.Degree;if(1==t)return new Array(e.getCoefficient(1));for(var r=new Array(t),n=0,i=1;256>i&&t>n;i++)0==e.evaluateAt(i)&&(r[n]=this.field.inverse(i),n++);if(n!=t)throw"Error locator degree does not match number of roots";return r},this.findErrorMagnitudes=function(e,t,r){for(var n=t.length,i=new Array(n),o=0;n>o;o++){for(var a=this.field.inverse(t[o]),s=1,h=0;n>h;h++)o!=h&&(s=this.field.multiply(s,_.addOrSubtract(1,this.field.multiply(t[h],a))));i[o]=this.field.multiply(e.evaluateAt(a),this.field.inverse(s)),r&&(i[o]=this.field.multiply(i[o],a))}return i}}function M(e,t){if(null==t||0==t.length)throw"System.ArgumentException";this.field=e;var r=t.length;if(r>1&&0==t[0]){for(var n=1;r>n&&0==t[n];)n++;if(n==r)this.coefficients=e.Zero.coefficients;else{this.coefficients=new Array(r-n);for(var i=0;in;n++)r=_.addOrSubtract(r,this.coefficients[n]);return r}for(var i=this.coefficients[0],n=1;t>n;n++)i=_.addOrSubtract(this.field.multiply(e,i),this.coefficients[n]);return i},this.addOrSubtract=function(t){if(this.field!=t.field)throw"GF256Polys do not have same GF256 field";if(this.Zero)return t;if(t.Zero)return this;var r=this.coefficients,n=t.coefficients;if(r.length>n.length){var i=r;r=n,n=i}for(var o=new Array(n.length),a=n.length-r.length,s=0;a>s;s++)o[s]=n[s];for(var h=a;ha;a++)for(var s=t[a],h=0;i>h;h++)o[a+h]=_.addOrSubtract(o[a+h],this.field.multiply(s,n[h]));return new M(this.field,o)},this.multiply2=function(e){if(0==e)return this.field.Zero;if(1==e)return this;for(var t=this.coefficients.length,r=new Array(t),n=0;t>n;n++)r[n]=this.field.multiply(this.coefficients[n],e);return new M(this.field,r)},this.multiplyByMonomial=function(e,t){if(0>e)throw"System.ArgumentException";if(0==t)return this.field.Zero;for(var r=this.coefficients.length,n=new Array(r+e),i=0;ii;i++)n[i]=this.field.multiply(this.coefficients[i],t);return new M(this.field,n)},this.divide=function(e){if(this.field!=e.field)throw"GF256Polys do not have same GF256 field";if(e.Zero)throw"Divide by 0";for(var t=this.field.Zero,r=this,n=e.getCoefficient(e.Degree),i=this.field.inverse(n);r.Degree>=e.Degree&&!r.Zero;){var o=r.Degree-e.Degree,a=this.field.multiply(r.getCoefficient(r.Degree),i),s=e.multiplyByMonomial(o,a),h=this.field.buildMonomial(o,a);t=t.addOrSubtract(h),r=r.addOrSubtract(s)}return new Array(t,r)}}function _(e){this.expTable=new Array(256),this.logTable=new Array(256);for(var t=1,r=0;256>r;r++)this.expTable[r]=t,t<<=1,t>=256&&(t^=e);for(var r=0;255>r;r++)this.logTable[this.expTable[r]]=r;var n=new Array(1);n[0]=0,this.zero=new M(this,new Array(n));var i=new Array(1);i[0]=1,this.one=new M(this,new Array(i)),this.__defineGetter__("Zero",function(){return this.zero}),this.__defineGetter__("One",function(){return this.one}),this.buildMonomial=function(e,t){if(0>e)throw"System.ArgumentException";if(0==t)return zero;for(var r=new Array(e+1),n=0;n=0?e>>t:(e>>t)+(2<<~t)}function q(e,t,r){this.x=e,this.y=t,this.count=1,this.estimatedModuleSize=r,this.__defineGetter__("EstimatedModuleSize",function(){return this.estimatedModuleSize}),this.__defineGetter__("Count",function(){return this.count}),this.__defineGetter__("X",function(){return this.x}),this.__defineGetter__("Y",function(){return this.y}),this.incrementCount=function(){this.count++},this.aboutEquals=function(e,t,r){if(Math.abs(t-this.y)<=e&&Math.abs(r-this.x)<=e){var n=Math.abs(e-this.estimatedModuleSize);return 1>=n||n/this.estimatedModuleSize<=1}return!1}}function k(e){this.bottomLeft=e[0],this.topLeft=e[1],this.topRight=e[2],this.__defineGetter__("BottomLeft",function(){return this.bottomLeft}),this.__defineGetter__("TopLeft",function(){return this.topLeft}),this.__defineGetter__("TopRight",function(){return this.topRight})}function S(){this.image=null,this.possibleCenters=[],this.hasSkipped=!1,this.crossCheckStateCount=new Array(0,0,0,0,0),this.resultPointCallback=null,this.__defineGetter__("CrossCheckStateCount",function(){return this.crossCheckStateCount[0]=0,this.crossCheckStateCount[1]=0,this.crossCheckStateCount[2]=0,this.crossCheckStateCount[3]=0,this.crossCheckStateCount[4]=0,this.crossCheckStateCount}),this.foundPatternCross=function(e){for(var t=0,r=0;5>r;r++){var n=e[r];if(0==n)return!1;t+=n}if(7>t)return!1;var i=Math.floor((t<=0&&i[t+s*qrcode.width];)a[2]++,s--;if(0>s)return 0/0;for(;s>=0&&!i[t+s*qrcode.width]&&a[1]<=r;)a[1]++,s--;if(0>s||a[1]>r)return 0/0;for(;s>=0&&i[t+s*qrcode.width]&&a[0]<=r;)a[0]++,s--;if(a[0]>r)return 0/0;for(s=e+1;o>s&&i[t+s*qrcode.width];)a[2]++,s++;if(s==o)return 0/0;for(;o>s&&!i[t+s*qrcode.width]&&a[3]=r)return 0/0;for(;o>s&&i[t+s*qrcode.width]&&a[4]=r)return 0/0;var h=a[0]+a[1]+a[2]+a[3]+a[4];return 5*Math.abs(h-n)>=2*n?0/0:this.foundPatternCross(a)?this.centerFromEnd(a,s):0/0},this.crossCheckHorizontal=function(e,t,r,n){for(var i=this.image,o=qrcode.width,a=this.CrossCheckStateCount,s=e;s>=0&&i[s+t*qrcode.width];)a[2]++,s--;if(0>s)return 0/0;for(;s>=0&&!i[s+t*qrcode.width]&&a[1]<=r;)a[1]++,s--;if(0>s||a[1]>r)return 0/0;for(;s>=0&&i[s+t*qrcode.width]&&a[0]<=r;)a[0]++,s--;if(a[0]>r)return 0/0;for(s=e+1;o>s&&i[s+t*qrcode.width];)a[2]++,s++;if(s==o)return 0/0;for(;o>s&&!i[s+t*qrcode.width]&&a[3]=r)return 0/0;for(;o>s&&i[s+t*qrcode.width]&&a[4]=r)return 0/0;var h=a[0]+a[1]+a[2]+a[3]+a[4];return 5*Math.abs(h-n)>=n?0/0:this.foundPatternCross(a)?this.centerFromEnd(a,s):0/0},this.handlePossibleCenter=function(e,t,r){var n=e[0]+e[1]+e[2]+e[3]+e[4],i=this.centerFromEnd(e,r),o=this.crossCheckVertical(t,Math.floor(i),e[2],n);if(!isNaN(o)&&(i=this.crossCheckHorizontal(Math.floor(i),Math.floor(o),e[2],n),!isNaN(i))){for(var a=n/7,s=!1,h=this.possibleCenters.length,d=0;h>d;d++){var w=this.possibleCenters[d];if(w.aboutEquals(a,o,i)){w.incrementCount(),s=!0;break}}if(!s){var f=new q(i,o,a);this.possibleCenters.push(f),null!=this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(f)}return!0}return!1},this.selectBestPatterns=function(){var e=this.possibleCenters.length;if(3>e)throw"Couldn't find enough finder patterns";if(e>3){for(var t=0,r=0,n=0;e>n;n++){var i=this.possibleCenters[n].EstimatedModuleSize;t+=i,r+=i*i}var o=t/e;this.possibleCenters.sort(function(e,t){var r=Math.abs(t.EstimatedModuleSize-o),n=Math.abs(e.EstimatedModuleSize-o);return n>r?-1:r==n?0:1});for(var a=Math.sqrt(r/e-o*o),s=Math.max(.2*o,a),n=0;n3;n++){var h=this.possibleCenters[n];Math.abs(h.EstimatedModuleSize-o)>s&&(this.possibleCenters.remove(n),n--)}}return this.possibleCenters.length>3&&this.possibleCenters.sort(function(e,t){return e.count>t.count?-1:e.count=e)return 0;for(var t=null,r=0;e>r;r++){var n=this.possibleCenters[r];if(n.Count>=O){if(null!=t)return this.hasSkipped=!0,Math.floor((Math.abs(t.X-n.X)-Math.abs(t.Y-n.Y))/2);t=n}}return 0},this.haveMultiplyConfirmedCenters=function(){for(var e=0,t=0,r=this.possibleCenters.length,n=0;r>n;n++){var i=this.possibleCenters[n];i.Count>=O&&(e++,t+=i.EstimatedModuleSize)}if(3>e)return!1;for(var o=t/r,a=0,n=0;r>n;n++)i=this.possibleCenters[n],a+=Math.abs(i.EstimatedModuleSize-o);return.05*t>=a},this.findFinderPattern=function(e){var t=!1;this.image=e;var r=qrcode.height,n=qrcode.width,i=Math.floor(3*r/(4*V));(z>i||t)&&(i=z);for(var o=!1,a=new Array(5),s=i-1;r>s&&!o;s+=i){a[0]=0,a[1]=0,a[2]=0,a[3]=0,a[4]=0;for(var h=0,d=0;n>d;d++)if(e[d+s*qrcode.width])1==(1&h)&&h++,a[h]++;else if(0==(1&h))if(4==h)if(this.foundPatternCross(a)){var w=this.handlePossibleCenter(a,s,d);if(w)if(i=2,this.hasSkipped)o=this.haveMultiplyConfirmedCenters();else{var f=this.findRowSkip();f>a[2]&&(s+=f-a[2]-i,d=n-1)}else{do d++;while(n>d&&!e[d+s*qrcode.width]);d--}h=0,a[0]=0,a[1]=0,a[2]=0,a[3]=0,a[4]=0}else a[0]=a[2],a[1]=a[3],a[2]=a[4],a[3]=1,a[4]=0,h=3;else a[++h]++;else a[h]++;if(this.foundPatternCross(a)){var w=this.handlePossibleCenter(a,s,n);w&&(i=a[0],this.hasSkipped&&(o=haveMultiplyConfirmedCenters()))}}var c=this.selectBestPatterns();return qrcode.orderBestPatterns(c),new k(c)}}function E(e,t,r){this.x=e,this.y=t,this.count=1,this.estimatedModuleSize=r,this.__defineGetter__("EstimatedModuleSize",function(){return this.estimatedModuleSize}),this.__defineGetter__("Count",function(){return this.count}),this.__defineGetter__("X",function(){return Math.floor(this.x)}),this.__defineGetter__("Y",function(){return Math.floor(this.y)}),this.incrementCount=function(){this.count++},this.aboutEquals=function(e,t,r){if(Math.abs(t-this.y)<=e&&Math.abs(r-this.x)<=e){var n=Math.abs(e-this.estimatedModuleSize);return 1>=n||n/this.estimatedModuleSize<=1}return!1}}function P(e,t,r,n,i,o,a){this.image=e,this.possibleCenters=new Array,this.startX=t,this.startY=r,this.width=n,this.height=i,this.moduleSize=o,this.crossCheckStateCount=new Array(0,0,0),this.resultPointCallback=a,this.centerFromEnd=function(e,t){return t-e[2]-e[1]/2},this.foundPatternCross=function(e){for(var t=this.moduleSize,r=t/2,n=0;3>n;n++)if(Math.abs(t-e[n])>=r)return!1;return!0},this.crossCheckVertical=function(e,t,r,n){var i=this.image,o=qrcode.height,a=this.crossCheckStateCount;a[0]=0,a[1]=0,a[2]=0;for(var s=e;s>=0&&i[t+s*qrcode.width]&&a[1]<=r;)a[1]++,s--;if(0>s||a[1]>r)return 0/0;for(;s>=0&&!i[t+s*qrcode.width]&&a[0]<=r;)a[0]++,s--;if(a[0]>r)return 0/0;for(s=e+1;o>s&&i[t+s*qrcode.width]&&a[1]<=r;)a[1]++,s++;if(s==o||a[1]>r)return 0/0;for(;o>s&&!i[t+s*qrcode.width]&&a[2]<=r;)a[2]++,s++;if(a[2]>r)return 0/0;var h=a[0]+a[1]+a[2];return 5*Math.abs(h-n)>=2*n?0/0:this.foundPatternCross(a)?this.centerFromEnd(a,s):0/0},this.handlePossibleCenter=function(e,t,r){var n=e[0]+e[1]+e[2],i=this.centerFromEnd(e,r),o=this.crossCheckVertical(t,Math.floor(i),2*e[1],n);if(!isNaN(o)){for(var a=(e[0]+e[1]+e[2])/3,s=this.possibleCenters.length,h=0;s>h;h++){var d=this.possibleCenters[h];if(d.aboutEquals(a,o,i))return new E(i,o,a)}var w=new E(i,o,a);this.possibleCenters.push(w),null!=this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(w)}return null},this.find=function(){for(var t=this.startX,i=this.height,o=t+n,a=r+(i>>1),s=new Array(0,0,0),h=0;i>h;h++){var d=a+(0==(1&h)?h+1>>1:-(h+1>>1));s[0]=0,s[1]=0,s[2]=0;for(var w=t;o>w&&!e[w+qrcode.width*d];)w++;for(var f=0;o>w;){if(e[w+d*qrcode.width])if(1==f)s[f]++;else if(2==f){if(this.foundPatternCross(s)){var c=this.handlePossibleCenter(s,d,w);if(null!=c)return c}s[0]=s[2],s[1]=1,s[2]=0,f=1}else s[++f]++;else 1==f&&f++,s[f]++;w++}if(this.foundPatternCross(s)){var c=this.handlePossibleCenter(s,d,o);
+if(null!=c)return c}}if(0!=this.possibleCenters.length)return this.possibleCenters[0];throw"Couldn't find enough alignment patterns"}}function D(e,t,r){this.blockPointer=0,this.bitPointer=7,this.dataLength=0,this.blocks=e,this.numErrorCorrectionCode=r,9>=t?this.dataLengthMode=0:t>=10&&26>=t?this.dataLengthMode=1:t>=27&&40>=t&&(this.dataLengthMode=2),this.getNextBits=function(e){var t=0;if(en;n++)r+=1<>this.bitPointer-e+1,this.bitPointer-=e,t}if(e>8-(e-(this.bitPointer+1)),this.bitPointer=this.bitPointer-e%8,this.bitPointer<0&&(this.bitPointer=8+this.bitPointer),t}if(e>8-(e-(this.bitPointer+1+8));return t=a+s+h,this.bitPointer=this.bitPointer-(e-8)%8,this.bitPointer<0&&(this.bitPointer=8+this.bitPointer),t}return 0},this.NextMode=function(){return this.blockPointer>this.blocks.length-this.numErrorCorrectionCode-2?0:this.getNextBits(4)},this.getDataLength=function(e){for(var t=0;;){if(e>>t==1)break;t++}return this.getNextBits(qrcode.sizeOfDataLengthInfo[this.dataLengthMode][t])},this.getRomanAndFigureString=function(e){var t=e,r=0,n="",i=new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":");do if(t>1){r=this.getNextBits(11);var o=Math.floor(r/45),a=r%45;n+=i[o],n+=i[a],t-=2}else 1==t&&(r=this.getNextBits(6),n+=i[r],t-=1);while(t>0);return n},this.getFigureString=function(e){var t=e,r=0,n="";do t>=3?(r=this.getNextBits(10),100>r&&(n+="0"),10>r&&(n+="0"),t-=3):2==t?(r=this.getNextBits(7),10>r&&(n+="0"),t-=2):1==t&&(r=this.getNextBits(4),t-=1),n+=r;while(t>0);return n},this.get8bitByteArray=function(e){var t=e,r=0,n=new Array;do r=this.getNextBits(8),n.push(r),t--;while(t>0);return n},this.getKanjiString=function(e){var t=e,r=0,n="";do{r=getNextBits(13);var i=r%192,o=r/192,a=(o<<8)+i,s=0;s=40956>=a+33088?a+33088:a+49472,n+=String.fromCharCode(s),t--}while(t>0);return n},this.__defineGetter__("DataByte",function(){for(var e=new Array,t=1,r=2,n=4,i=8;;){var o=this.NextMode();if(0==o){if(e.length>0)break;throw"Empty data block"}if(o!=t&&o!=r&&o!=n&&o!=i)throw"Invalid mode: "+o+" in (block:"+this.blockPointer+" bit:"+this.bitPointer+")";if(dataLength=this.getDataLength(o),1>dataLength)throw"Invalid data length: "+dataLength;switch(o){case t:for(var a=this.getFigureString(dataLength),s=new Array(a.length),h=0;ha||a>r||-1>s||s>n)throw"Error.checkAndNudgePoints ";i=!1,-1==a?(t[o]=0,i=!0):a==r&&(t[o]=r-1,i=!0),-1==s?(t[o+1]=0,i=!0):s==n&&(t[o+1]=n-1,i=!0)}i=!0;for(var o=t.length-2;o>=0&&i;o-=2){var a=Math.floor(t[o]),s=Math.floor(t[o+1]);if(-1>a||a>r||-1>s||s>n)throw"Error.checkAndNudgePoints ";i=!1,-1==a?(t[o]=0,i=!0):a==r&&(t[o]=r-1,i=!0),-1==s?(t[o+1]=0,i=!0):s==n&&(t[o+1]=n-1,i=!0)}},GridSampler.sampleGrid3=function(e,t,r){for(var n=new d(t),i=new Array(t<<1),o=0;t>o;o++){for(var a=i.length,s=o+.5,h=0;a>h;h+=2)i[h]=(h>>1)+.5,i[h+1]=s;r.transformPoints1(i),GridSampler.checkAndNudgePoints(e,i);try{for(var h=0;a>h;h+=2){var w=4*Math.floor(i[h])+Math.floor(i[h+1])*qrcode.width*4,f=e[Math.floor(i[h])+qrcode.width*Math.floor(i[h+1])];qrcode.imagedata.data[w]=f?255:0,qrcode.imagedata.data[w+1]=f?255:0,qrcode.imagedata.data[w+2]=0,qrcode.imagedata.data[w+3]=255,f&&n.set_Renamed(h>>1,o)}}catch(c){throw"Error.checkAndNudgePoints"}}return n},GridSampler.sampleGridx=function(e,t,r,n,o,a,s,h,d,w,f,c,u,l,v,g,m,y){var p=i.quadrilateralToQuadrilateral(r,n,o,a,s,h,d,w,f,c,u,l,v,g,m,y);return GridSampler.sampleGrid3(e,t,p)},r.VERSION_DECODE_INFO=new Array(31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017),r.VERSIONS=n(),r.getVersionForNumber=function(e){if(1>e||e>40)throw"ArgumentException";return r.VERSIONS[e-1]},r.getProvisionalVersionForDimension=function(e){if(e%4!=1)throw"Error getProvisionalVersionForDimension";try{return r.getVersionForNumber(e-17>>2)}catch(t){throw"Error getVersionForNumber"}},r.decodeVersionInformation=function(e){for(var t=4294967295,n=0,i=0;ia&&(n=i+7,t=a)}return 3>=t?this.getVersionForNumber(n):null},i.quadrilateralToQuadrilateral=function(e,t,r,n,i,o,a,s,h,d,w,f,c,u,l,v){var g=this.quadrilateralToSquare(e,t,r,n,i,o,a,s),m=this.squareToQuadrilateral(h,d,w,f,c,u,l,v);return m.times(g)},i.squareToQuadrilateral=function(e,t,r,n,o,a,s,h){return dy2=h-a,dy3=t-n+a-h,0==dy2&&0==dy3?new i(r-e,o-r,e,n-t,a-n,t,0,0,1):(dx1=r-o,dx2=s-o,dx3=e-r+o-s,dy1=n-a,denominator=dx1*dy2-dx2*dy1,a13=(dx3*dy2-dx2*dy3)/denominator,a23=(dx1*dy3-dx3*dy1)/denominator,new i(r-e+a13*r,s-e+a23*s,e,n-t+a13*n,h-t+a23*h,t,a13,a23,1))},i.quadrilateralToSquare=function(e,t,r,n,i,o,a,s){return this.squareToQuadrilateral(e,t,r,n,i,o,a,s).buildAdjoint()};var x=21522,B=new Array(new Array(21522,0),new Array(20773,1),new Array(24188,2),new Array(23371,3),new Array(17913,4),new Array(16590,5),new Array(20375,6),new Array(19104,7),new Array(30660,8),new Array(29427,9),new Array(32170,10),new Array(30877,11),new Array(26159,12),new Array(25368,13),new Array(27713,14),new Array(26998,15),new Array(5769,16),new Array(5054,17),new Array(7399,18),new Array(6608,19),new Array(1890,20),new Array(597,21),new Array(3340,22),new Array(2107,23),new Array(13663,24),new Array(12392,25),new Array(16177,26),new Array(14854,27),new Array(9396,28),new Array(8579,29),new Array(11994,30),new Array(11245,31)),F=new Array(0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4);s.numBitsDiffering=function(e,t){return e^=t,F[15&e]+F[15&A(e,4)]+F[15&A(e,8)]+F[15&A(e,12)]+F[15&A(e,16)]+F[15&A(e,20)]+F[15&A(e,24)]+F[15&A(e,28)]},s.decodeFormatInformation=function(e){var t=s.doDecodeFormatInformation(e);return null!=t?t:s.doDecodeFormatInformation(e^x)},s.doDecodeFormatInformation=function(e){for(var t=4294967295,r=0,n=0;na&&(r=i[1],t=a)}return 3>=t?new s(r):null},h.forBits=function(e){if(0>e||e>=R.length)throw"ArgumentException";return R[e]};var G=new h(0,1,"L"),I=new h(1,0,"M"),T=new h(2,3,"Q"),N=new h(3,2,"H"),R=new Array(I,G,N,T);w.getDataBlocks=function(e,t,r){if(e.length!=t.TotalCodewords)throw"ArgumentException";for(var n=t.getECBlocksForLevel(r),i=0,o=n.getECBlocks(),a=0;a=0;){var g=s[v].codewords.length;if(g==l)break;v--}v++;for(var m=l-n.ECCodewordsPerBlock,y=0,a=0;m>a;a++)for(var d=0;h>d;d++)s[d].codewords[a]=e[y++];for(var d=v;h>d;d++)s[d].codewords[m]=e[y++];for(var p=s[0].codewords.length,a=m;p>a;a++)for(var d=0;h>d;d++){var b=v>d?a:a+1;s[d].codewords[b]=e[y++]}return s},DataMask={},DataMask.forReference=function(e){if(0>e||e>7)throw"System.ArgumentException";return DataMask.DATA_MASKS[e]},DataMask.DATA_MASKS=new Array(new c,new u,new l,new v,new g,new m,new y,new b),_.QR_CODE_FIELD=new _(285),_.DATA_MATRIX_FIELD=new _(301),_.addOrSubtract=function(e,t){return e^t},Decoder={},Decoder.rsDecoder=new C(_.QR_CODE_FIELD),Decoder.correctErrors=function(e,t){for(var r=e.length,n=new Array(r),i=0;r>i;i++)n[i]=255&e[i];var o=e.length-t;try{Decoder.rsDecoder.decode(n,o)}catch(a){throw a}for(var i=0;t>i;i++)e[i]=n[i]},Decoder.decode=function(e){for(var t=new f(e),r=t.readVersion(),n=t.readFormatInformation().ErrorCorrectionLevel,i=t.readCodewords(),o=w.getDataBlocks(i,r,n),a=0,s=0;ss;s++)h[d++]=l[s]}var g=new D(h,r.VersionNumber,n.Bits);return g},qrcode={},qrcode.imagedata=null,qrcode.width=0,qrcode.height=0,qrcode.qrCodeSymbol=null,qrcode.debug=!1,qrcode.maxImgSize=1048576,qrcode.canvasElement=null,qrcode.sizeOfDataLengthInfo=[[10,9,8,8],[12,11,16,10],[14,13,16,12]],qrcode.callback=null,qrcode.setCanvasElement=function(e){qrcode.canvasElement=e},qrcode.decode=function(e,t){if(0==arguments.length){var r=qrcode.canvasElement,n=r.getContext("2d");return qrcode.width=r.width,qrcode.height=r.height,qrcode.imagedata=n.getImageData(0,0,qrcode.width,qrcode.height),qrcode.result=qrcode.process(n),null!=qrcode.callback&&qrcode.callback(qrcode.result),qrcode.result}var i=new Image;i.onload=function(){var e=document.createElement("canvas"),r=e.getContext("2d"),n=i.height,o=i.width;if(i.width*i.height>qrcode.maxImgSize){var a=i.width/i.height;n=Math.sqrt(qrcode.maxImgSize/a),o=a*n}e.width=o,e.height=n,r.drawImage(i,0,0,e.width,e.height),qrcode.width=e.width,qrcode.height=e.height;try{qrcode.imagedata=r.getImageData(0,0,e.width,e.height)}catch(s){return qrcode.result="Cross domain Error",null!=qrcode.callback&&qrcode.callback(qrcode.result),void 0}try{qrcode.result=qrcode.process(r),t(null,qrcode.result)}catch(s){qrcode.result="Error decoding QR Code from Image",t(new Error("Error decoding QR Code from Image"))}null!=qrcode.callback&&qrcode.callback(qrcode.result)},i.src=e},qrcode.isUrl=function(e){var t=/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;return t.test(e)},qrcode.decode_url=function(e){var t="";try{t=escape(e)}catch(r){t=e}var n="";try{n=decodeURIComponent(t)}catch(r){n=t}return n},qrcode.decode_utf8=function(e){return qrcode.isUrl(e)?qrcode.decode_url(e):e},qrcode.process=function(e){var t=((new Date).getTime(),qrcode.grayScaleToBitmap(qrcode.grayscale()));if(qrcode.debug){for(var r=0;r=i?!0:!1}return t},qrcode.getMiddleBrightnessPerArea=function(e){for(var t=4,r=Math.floor(qrcode.width/t),n=Math.floor(qrcode.height/t),i=new Array(t),o=0;t>o;o++){i[o]=new Array(t);for(var a=0;t>a;a++)i[o][a]=new Array(0,0)}for(var s=0;t>s;s++)for(var h=0;t>h;h++){i[h][s][0]=255;for(var d=0;n>d;d++)for(var w=0;r>w;w++){var f=e[r*h+w+(n*s+d)*qrcode.width];fi[h][s][1]&&(i[h][s][1]=f)}}for(var c=new Array(t),u=0;t>u;u++)c[u]=new Array(t);for(var s=0;t>s;s++)for(var h=0;t>h;h++)c[h][s]=Math.floor((i[h][s][0]+i[h][s][1])/2);return c},qrcode.grayScaleToBitmap=function(e){for(var t=qrcode.getMiddleBrightnessPerArea(e),r=t.length,n=Math.floor(qrcode.width/r),i=Math.floor(qrcode.height/r),o=new Array(qrcode.height*qrcode.width),a=0;r>a;a++)for(var s=0;r>s;s++)for(var h=0;i>h;h++)for(var d=0;n>d;d++)o[n*s+d+(i*a+h)*qrcode.width]=e[n*s+d+(i*a+h)*qrcode.width]e?this.length+e:e,this.push.apply(this,r)};var z=3,V=57,L=8,O=2;return qrcode.orderBestPatterns=function(e){function t(e,t){return xDiff=e.X-t.X,yDiff=e.Y-t.Y,Math.sqrt(xDiff*xDiff+yDiff*yDiff)}function r(e,t,r){var n=t.x,i=t.y;return(r.x-n)*(e.y-i)-(r.y-i)*(e.x-n)}var n,i,o,a=t(e[0],e[1]),s=t(e[1],e[2]),h=t(e[0],e[2]);if(s>=a&&s>=h?(i=e[0],n=e[1],o=e[2]):h>=s&&h>=a?(i=e[1],n=e[0],o=e[2]):(i=e[2],n=e[0],o=e[1]),r(n,i,o)<0){var d=n;n=o,o=d}e[0]=n,e[1]=i,e[2]=o},qrcode}),function(e,t){"function"==typeof define&&define.amd?define(["qrcode"],t):"object"==typeof exports?module.exports=t(require("../build/qrcode")):e.QCodeDecoder=t(qrcode)}(this,function(e){"use strict";function t(){return this instanceof t?(this.timerCapture=null,this.canvasElem=null,this.stream=null,this.videoConstraints={video:!0,audio:!1},void 0):new t}return t.prototype.isCanvasSupported=function(){var e=document.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))},t.prototype.hasGetUserMedia=function(){return navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia,!!navigator.getUserMedia},t.prototype._prepareCanvas=function(t){return this.canvasElem||(this.canvasElem=document.createElement("canvas"),this.canvasElem.style.width=t.videoWidth+"px",this.canvasElem.style.height=t.videoHeight+"px",this.canvasElem.width=t.videoWidth,this.canvasElem.height=t.videoHeight),e.setCanvasElement(this.canvasElem),this},t.prototype._captureToCanvas=function(t,r,n){if(this.timerCapture&&clearTimeout(this.timerCapture),t.videoWidth&&t.videoHeight){this.canvasElem||this._prepareCanvas(t);var i=this.canvasElem.getContext("2d");i.clearRect(0,0,t.videoWidth,t.videoHeight),i.drawImage(t,0,0,t.videoWidth,t.videoHeight);try{if(r(null,e.decode()),n)return}catch(o){"Couldn't find enough finder patterns"!==o&&r(new Error(o))}}this.timerCapture=setTimeout(function(){this._captureToCanvas.call(this,t,r,n)}.bind(this),500)},t.prototype.decodeFromCamera=function(e,t,r){var n=(this.stop(),this);return this.hasGetUserMedia()||t(new Error("Couldn't get video from camera")),navigator.getUserMedia(this.videoConstraints,function(i){e.src=window.URL.createObjectURL(i),n.videoElem=e,n.stream=i,n.videoDimensions=!1,setTimeout(function(){n._captureToCanvas.call(n,e,t,r)},500)},t),this},t.prototype.decodeFromVideo=function(e,t,r){return setTimeout(function(){this._captureToCanvas.call(this,e,t,r)}.bind(this),500),this},t.prototype.decodeFromImage=function(t,r){if(+t.nodeType>0&&!t.src)throw new Error("The ImageElement must contain a src");return t=t.src?t.src:t,e.decode(t,r),this},t.prototype.stop=function(){return this.stream&&(this.stream.stop(),this.stream=void 0),this.timerCapture&&(clearTimeout(this.timerCapture),this.timerCapture=void 0),this},t.prototype.setSourceId=function(e){return this.videoConstraints.video=e?{optional:[{sourceId:e}]}:!0,this},t.prototype.getVideoSources=function(e){var t=[];return MediaStreamTrack&&MediaStreamTrack.getSources?MediaStreamTrack.getSources(function(r){r.forEach(function(e){"video"===e.kind&&t.push(e)}),e(null,t)}):e(new Error("Current browser doest not support MediaStreamTrack.getSources")),this},t});
//# sourceMappingURL=qcode-decoder.min.js.map
\ No newline at end of file
diff --git a/build/qcode-decoder.min.js.map b/build/qcode-decoder.min.js.map
index a87d28a..63e00f7 100755
--- a/build/qcode-decoder.min.js.map
+++ b/build/qcode-decoder.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["grid.js","version.js","detector.js","formatinf.js","errorlevel.js","bitmat.js","datablock.js","bmparser.js","datamask.js","rsdecoder.js","gf256poly.js","gf256.js","decoder.js","qrcode.js","findpat.js","alignpat.js","databr.js","qcode-decoder.js"],"names":[],"mappings":"AA0BA,QAAA,KAAA,EAAA,GAEA,KAAA,MAAA,EACA,KAAA,cAAA,EAEA,KAAA,iBAAA,QAAA,WAEA,MAAA,MAAA,QAEA,KAAA,iBAAA,gBAAA,WAEA,MAAA,MAAA,gBAIA,QAAA,UAAA,EAAA,EAAA,GAEA,KAAA,oBAAA,EAEA,KAAA,SADA,EACA,GAAA,OAAA,EAAA,GAEA,GAAA,OAAA,GAEA,KAAA,iBAAA,sBAAA,WAEA,MAAA,MAAA,sBAGA,KAAA,iBAAA,mBAAA,WAEA,MAAA,MAAA,oBAAA,KAAA,YAGA,KAAA,iBAAA,YAAA,WAGA,IAAA,GADA,GAAA,EACA,EAAA,EAAA,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OAAA,IAAA,gBAAA,GACA,EAAA,UAAA,EACA,EAAA,OAAA,EACA,EAAA,iBAAA,EACA,WAAA,WACA,EAAA,iBAAA,MAAA,EAAA,OACA,MACA,GAEA,QAAA,IAAA,mCAQA,cAAA,UAAA,KAAA,WACA,KAAA,SACA,KAAA,OAAA,aACA,MAAA,QAEA,KAAA,aACA,aAAA,KAAA,kBACA,MAAA,aAgBA,cAAA,UAAA,YAAA,SAAA,GAEA,KAAA,iBAAA,MADA,GAEA,WACA,SAAA,MAIA,GAQA,cAAA,UAAA,mBAAA,SAAA,GACA,OAAA,SAAA,GAOA,cAAA,UAAA,gBAAA,SAAA,GACA,GAAA,KACA,mBAAA,iBAAA,WACA,iBAAA,WAAA,SAAA,GACA,EAAA,QAAA,SAAA,GACA,UAAA,EAAA,MACA,EAAA,KAAA,KAGA,EAAA,MAGA,QAAA,IAAA,4DACA,EAAA,KAIA,cAAA,UAAA,cAAA,SAAA,GACA,OAAA,OAAA","file":"qcode-decoder.min.js","sourcesContent":["/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nGridSampler = {};\r\n\r\nGridSampler.checkAndNudgePoints=function( image, points)\r\n\t\t{\r\n\t\t\tvar width = qrcode.width;\r\n\t\t\tvar height = qrcode.height;\r\n\t\t\t// Check and nudge points from start until we see some that are OK:\r\n\t\t\tvar nudged = true;\r\n\t\t\tfor (var offset = 0; offset < points.length && nudged; offset += 2)\r\n\t\t\t{\r\n\t\t\t\tvar x = Math.floor (points[offset]);\r\n\t\t\t\tvar y = Math.floor( points[offset + 1]);\r\n\t\t\t\tif (x < - 1 || x > width || y < - 1 || y > height)\r\n\t\t\t\t{\r\n\t\t\t\t\tthrow \"Error.checkAndNudgePoints \";\r\n\t\t\t\t}\r\n\t\t\t\tnudged = false;\r\n\t\t\t\tif (x == - 1)\r\n\t\t\t\t{\r\n\t\t\t\t\tpoints[offset] = 0.0;\r\n\t\t\t\t\tnudged = true;\r\n\t\t\t\t}\r\n\t\t\t\telse if (x == width)\r\n\t\t\t\t{\r\n\t\t\t\t\tpoints[offset] = width - 1;\r\n\t\t\t\t\tnudged = true;\r\n\t\t\t\t}\r\n\t\t\t\tif (y == - 1)\r\n\t\t\t\t{\r\n\t\t\t\t\tpoints[offset + 1] = 0.0;\r\n\t\t\t\t\tnudged = true;\r\n\t\t\t\t}\r\n\t\t\t\telse if (y == height)\r\n\t\t\t\t{\r\n\t\t\t\t\tpoints[offset + 1] = height - 1;\r\n\t\t\t\t\tnudged = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// Check and nudge points from end:\r\n\t\t\tnudged = true;\r\n\t\t\tfor (var offset = points.length - 2; offset >= 0 && nudged; offset -= 2)\r\n\t\t\t{\r\n\t\t\t\tvar x = Math.floor( points[offset]);\r\n\t\t\t\tvar y = Math.floor( points[offset + 1]);\r\n\t\t\t\tif (x < - 1 || x > width || y < - 1 || y > height)\r\n\t\t\t\t{\r\n\t\t\t\t\tthrow \"Error.checkAndNudgePoints \";\r\n\t\t\t\t}\r\n\t\t\t\tnudged = false;\r\n\t\t\t\tif (x == - 1)\r\n\t\t\t\t{\r\n\t\t\t\t\tpoints[offset] = 0.0;\r\n\t\t\t\t\tnudged = true;\r\n\t\t\t\t}\r\n\t\t\t\telse if (x == width)\r\n\t\t\t\t{\r\n\t\t\t\t\tpoints[offset] = width - 1;\r\n\t\t\t\t\tnudged = true;\r\n\t\t\t\t}\r\n\t\t\t\tif (y == - 1)\r\n\t\t\t\t{\r\n\t\t\t\t\tpoints[offset + 1] = 0.0;\r\n\t\t\t\t\tnudged = true;\r\n\t\t\t\t}\r\n\t\t\t\telse if (y == height)\r\n\t\t\t\t{\r\n\t\t\t\t\tpoints[offset + 1] = height - 1;\r\n\t\t\t\t\tnudged = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\r\n\r\n\r\nGridSampler.sampleGrid3=function( image, dimension, transform)\r\n\t\t{\r\n\t\t\tvar bits = new BitMatrix(dimension);\r\n\t\t\tvar points = new Array(dimension << 1);\r\n\t\t\tfor (var y = 0; y < dimension; y++)\r\n\t\t\t{\r\n\t\t\t\tvar max = points.length;\r\n\t\t\t\tvar iValue = y + 0.5;\r\n\t\t\t\tfor (var x = 0; x < max; x += 2)\r\n\t\t\t\t{\r\n\t\t\t\t\tpoints[x] = (x >> 1) + 0.5;\r\n\t\t\t\t\tpoints[x + 1] = iValue;\r\n\t\t\t\t}\r\n\t\t\t\ttransform.transformPoints1(points);\r\n\t\t\t\t// Quick check to see if points transformed to something inside the image;\r\n\t\t\t\t// sufficient to check the endpoints\r\n\t\t\t\tGridSampler.checkAndNudgePoints(image, points);\r\n\t\t\t\ttry\r\n\t\t\t\t{\r\n\t\t\t\t\tfor (var x = 0; x < max; x += 2)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar xpoint = (Math.floor( points[x]) * 4) + (Math.floor( points[x + 1]) * qrcode.width * 4);\r\n var bit = image[Math.floor( points[x])+ qrcode.width* Math.floor( points[x + 1])];\r\n\t\t\t\t\t\tqrcode.imagedata.data[xpoint] = bit?255:0;\r\n\t\t\t\t\t\tqrcode.imagedata.data[xpoint+1] = bit?255:0;\r\n\t\t\t\t\t\tqrcode.imagedata.data[xpoint+2] = 0;\r\n\t\t\t\t\t\tqrcode.imagedata.data[xpoint+3] = 255;\r\n\t\t\t\t\t\t//bits[x >> 1][ y]=bit;\r\n\t\t\t\t\t\tif(bit)\r\n\t\t\t\t\t\t\tbits.set_Renamed(x >> 1, y);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tcatch ( aioobe)\r\n\t\t\t\t{\r\n\t\t\t\t\t// This feels wrong, but, sometimes if the finder patterns are misidentified, the resulting\r\n\t\t\t\t\t// transform gets \"twisted\" such that it maps a straight line of points to a set of points\r\n\t\t\t\t\t// whose endpoints are in bounds, but others are not. There is probably some mathematical\r\n\t\t\t\t\t// way to detect this about the transformation that I don't know yet.\r\n\t\t\t\t\t// This results in an ugly runtime exception despite our clever checks above -- can't have\r\n\t\t\t\t\t// that. We could check each point's coordinates but that feels duplicative. We settle for\r\n\t\t\t\t\t// catching and wrapping ArrayIndexOutOfBoundsException.\r\n\t\t\t\t\tthrow \"Error.checkAndNudgePoints\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn bits;\r\n\t\t}\r\n\r\nGridSampler.sampleGridx=function( image, dimension, p1ToX, p1ToY, p2ToX, p2ToY, p3ToX, p3ToY, p4ToX, p4ToY, p1FromX, p1FromY, p2FromX, p2FromY, p3FromX, p3FromY, p4FromX, p4FromY)\r\n{\r\n\tvar transform = PerspectiveTransform.quadrilateralToQuadrilateral(p1ToX, p1ToY, p2ToX, p2ToY, p3ToX, p3ToY, p4ToX, p4ToY, p1FromX, p1FromY, p2FromX, p2FromY, p3FromX, p3FromY, p4FromX, p4FromY);\r\n\t\t\t\r\n\treturn GridSampler.sampleGrid3(image, dimension, transform);\r\n}\r\n","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\n\r\nfunction ECB(count, dataCodewords)\r\n{\r\n\tthis.count = count;\r\n\tthis.dataCodewords = dataCodewords;\r\n\t\r\n\tthis.__defineGetter__(\"Count\", function()\r\n\t{\r\n\t\treturn this.count;\r\n\t});\r\n\tthis.__defineGetter__(\"DataCodewords\", function()\r\n\t{\r\n\t\treturn this.dataCodewords;\r\n\t});\r\n}\r\n\r\nfunction ECBlocks( ecCodewordsPerBlock, ecBlocks1, ecBlocks2)\r\n{\r\n\tthis.ecCodewordsPerBlock = ecCodewordsPerBlock;\r\n\tif(ecBlocks2)\r\n\t\tthis.ecBlocks = new Array(ecBlocks1, ecBlocks2);\r\n\telse\r\n\t\tthis.ecBlocks = new Array(ecBlocks1);\r\n\t\r\n\tthis.__defineGetter__(\"ECCodewordsPerBlock\", function()\r\n\t{\r\n\t\treturn this.ecCodewordsPerBlock;\r\n\t});\r\n\t\r\n\tthis.__defineGetter__(\"TotalECCodewords\", function()\r\n\t{\r\n\t\treturn this.ecCodewordsPerBlock * this.NumBlocks;\r\n\t});\r\n\t\r\n\tthis.__defineGetter__(\"NumBlocks\", function()\r\n\t{\r\n\t\tvar total = 0;\r\n\t\tfor (var i = 0; i < this.ecBlocks.length; i++)\r\n\t\t{\r\n\t\t\ttotal += this.ecBlocks[i].length;\r\n\t\t}\r\n\t\treturn total;\r\n\t});\r\n\t\r\n\tthis.getECBlocks=function()\r\n\t\t\t{\r\n\t\t\t\treturn this.ecBlocks;\r\n\t\t\t}\r\n}\r\n\r\nfunction Version( versionNumber, alignmentPatternCenters, ecBlocks1, ecBlocks2, ecBlocks3, ecBlocks4)\r\n{\r\n\tthis.versionNumber = versionNumber;\r\n\tthis.alignmentPatternCenters = alignmentPatternCenters;\r\n\tthis.ecBlocks = new Array(ecBlocks1, ecBlocks2, ecBlocks3, ecBlocks4);\r\n\t\r\n\tvar total = 0;\r\n\tvar ecCodewords = ecBlocks1.ECCodewordsPerBlock;\r\n\tvar ecbArray = ecBlocks1.getECBlocks();\r\n\tfor (var i = 0; i < ecbArray.length; i++)\r\n\t{\r\n\t\tvar ecBlock = ecbArray[i];\r\n\t\ttotal += ecBlock.Count * (ecBlock.DataCodewords + ecCodewords);\r\n\t}\r\n\tthis.totalCodewords = total;\r\n\t\r\n\tthis.__defineGetter__(\"VersionNumber\", function()\r\n\t{\r\n\t\treturn this.versionNumber;\r\n\t});\r\n\t\r\n\tthis.__defineGetter__(\"AlignmentPatternCenters\", function()\r\n\t{\r\n\t\treturn this.alignmentPatternCenters;\r\n\t});\r\n\tthis.__defineGetter__(\"TotalCodewords\", function()\r\n\t{\r\n\t\treturn this.totalCodewords;\r\n\t});\r\n\tthis.__defineGetter__(\"DimensionForVersion\", function()\r\n\t{\r\n\t\treturn 17 + 4 * this.versionNumber;\r\n\t});\r\n\t\r\n\tthis.buildFunctionPattern=function()\r\n\t\t{\r\n\t\t\tvar dimension = this.DimensionForVersion;\r\n\t\t\tvar bitMatrix = new BitMatrix(dimension);\r\n\t\t\t\r\n\t\t\t// Top left finder pattern + separator + format\r\n\t\t\tbitMatrix.setRegion(0, 0, 9, 9);\r\n\t\t\t// Top right finder pattern + separator + format\r\n\t\t\tbitMatrix.setRegion(dimension - 8, 0, 8, 9);\r\n\t\t\t// Bottom left finder pattern + separator + format\r\n\t\t\tbitMatrix.setRegion(0, dimension - 8, 9, 8);\r\n\t\t\t\r\n\t\t\t// Alignment patterns\r\n\t\t\tvar max = this.alignmentPatternCenters.length;\r\n\t\t\tfor (var x = 0; x < max; x++)\r\n\t\t\t{\r\n\t\t\t\tvar i = this.alignmentPatternCenters[x] - 2;\r\n\t\t\t\tfor (var y = 0; y < max; y++)\r\n\t\t\t\t{\r\n\t\t\t\t\tif ((x == 0 && (y == 0 || y == max - 1)) || (x == max - 1 && y == 0))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// No alignment patterns near the three finder paterns\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbitMatrix.setRegion(this.alignmentPatternCenters[y] - 2, i, 5, 5);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Vertical timing pattern\r\n\t\t\tbitMatrix.setRegion(6, 9, 1, dimension - 17);\r\n\t\t\t// Horizontal timing pattern\r\n\t\t\tbitMatrix.setRegion(9, 6, dimension - 17, 1);\r\n\t\t\t\r\n\t\t\tif (this.versionNumber > 6)\r\n\t\t\t{\r\n\t\t\t\t// Version info, top right\r\n\t\t\t\tbitMatrix.setRegion(dimension - 11, 0, 3, 6);\r\n\t\t\t\t// Version info, bottom left\r\n\t\t\t\tbitMatrix.setRegion(0, dimension - 11, 6, 3);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn bitMatrix;\r\n\t\t}\r\n\tthis.getECBlocksForLevel=function( ecLevel)\r\n\t{\r\n\t\treturn this.ecBlocks[ecLevel.ordinal()];\r\n\t}\r\n}\r\n\r\nVersion.VERSION_DECODE_INFO = new Array(0x07C94, 0x085BC, 0x09A99, 0x0A4D3, 0x0BBF6, 0x0C762, 0x0D847, 0x0E60D, 0x0F928, 0x10B78, 0x1145D, 0x12A17, 0x13532, 0x149A6, 0x15683, 0x168C9, 0x177EC, 0x18EC4, 0x191E1, 0x1AFAB, 0x1B08E, 0x1CC1A, 0x1D33F, 0x1ED75, 0x1F250, 0x209D5, 0x216F0, 0x228BA, 0x2379F, 0x24B0B, 0x2542E, 0x26A64, 0x27541, 0x28C69);\r\n\r\nVersion.VERSIONS = buildVersions();\r\n\r\nVersion.getVersionForNumber=function( versionNumber)\r\n{\r\n\tif (versionNumber < 1 || versionNumber > 40)\r\n\t{\r\n\t\tthrow \"ArgumentException\";\r\n\t}\r\n\treturn Version.VERSIONS[versionNumber - 1];\r\n}\r\n\r\nVersion.getProvisionalVersionForDimension=function(dimension)\r\n{\r\n\tif (dimension % 4 != 1)\r\n\t{\r\n\t\tthrow \"Error getProvisionalVersionForDimension\";\r\n\t}\r\n\ttry\r\n\t{\r\n\t\treturn Version.getVersionForNumber((dimension - 17) >> 2);\r\n\t}\r\n\tcatch ( iae)\r\n\t{\r\n\t\tthrow \"Error getVersionForNumber\";\r\n\t}\r\n}\r\n\r\nVersion.decodeVersionInformation=function( versionBits)\r\n{\r\n\tvar bestDifference = 0xffffffff;\r\n\tvar bestVersion = 0;\r\n\tfor (var i = 0; i < Version.VERSION_DECODE_INFO.length; i++)\r\n\t{\r\n\t\tvar targetVersion = Version.VERSION_DECODE_INFO[i];\r\n\t\t// Do the version info bits match exactly? done.\r\n\t\tif (targetVersion == versionBits)\r\n\t\t{\r\n\t\t\treturn this.getVersionForNumber(i + 7);\r\n\t\t}\r\n\t\t// Otherwise see if this is the closest to a real version info bit string\r\n\t\t// we have seen so far\r\n\t\tvar bitsDifference = FormatInformation.numBitsDiffering(versionBits, targetVersion);\r\n\t\tif (bitsDifference < bestDifference)\r\n\t\t{\r\n\t\t\tbestVersion = i + 7;\r\n\t\t\tbestDifference = bitsDifference;\r\n\t\t}\r\n\t}\r\n\t// We can tolerate up to 3 bits of error since no two version info codewords will\r\n\t// differ in less than 4 bits.\r\n\tif (bestDifference <= 3)\r\n\t{\r\n\t\treturn this.getVersionForNumber(bestVersion);\r\n\t}\r\n\t// If we didn't find a close enough match, fail\r\n\treturn null;\r\n}\r\n\r\nfunction buildVersions()\r\n{\r\n\treturn new Array(new Version(1, new Array(), new ECBlocks(7, new ECB(1, 19)), new ECBlocks(10, new ECB(1, 16)), new ECBlocks(13, new ECB(1, 13)), new ECBlocks(17, new ECB(1, 9))), \r\n\tnew Version(2, new Array(6, 18), new ECBlocks(10, new ECB(1, 34)), new ECBlocks(16, new ECB(1, 28)), new ECBlocks(22, new ECB(1, 22)), new ECBlocks(28, new ECB(1, 16))), \r\n\tnew Version(3, new Array(6, 22), new ECBlocks(15, new ECB(1, 55)), new ECBlocks(26, new ECB(1, 44)), new ECBlocks(18, new ECB(2, 17)), new ECBlocks(22, new ECB(2, 13))), \r\n\tnew Version(4, new Array(6, 26), new ECBlocks(20, new ECB(1, 80)), new ECBlocks(18, new ECB(2, 32)), new ECBlocks(26, new ECB(2, 24)), new ECBlocks(16, new ECB(4, 9))), \r\n\tnew Version(5, new Array(6, 30), new ECBlocks(26, new ECB(1, 108)), new ECBlocks(24, new ECB(2, 43)), new ECBlocks(18, new ECB(2, 15), new ECB(2, 16)), new ECBlocks(22, new ECB(2, 11), new ECB(2, 12))), \r\n\tnew Version(6, new Array(6, 34), new ECBlocks(18, new ECB(2, 68)), new ECBlocks(16, new ECB(4, 27)), new ECBlocks(24, new ECB(4, 19)), new ECBlocks(28, new ECB(4, 15))), \r\n\tnew Version(7, new Array(6, 22, 38), new ECBlocks(20, new ECB(2, 78)), new ECBlocks(18, new ECB(4, 31)), new ECBlocks(18, new ECB(2, 14), new ECB(4, 15)), new ECBlocks(26, new ECB(4, 13), new ECB(1, 14))), \r\n\tnew Version(8, new Array(6, 24, 42), new ECBlocks(24, new ECB(2, 97)), new ECBlocks(22, new ECB(2, 38), new ECB(2, 39)), new ECBlocks(22, new ECB(4, 18), new ECB(2, 19)), new ECBlocks(26, new ECB(4, 14), new ECB(2, 15))), \r\n\tnew Version(9, new Array(6, 26, 46), new ECBlocks(30, new ECB(2, 116)), new ECBlocks(22, new ECB(3, 36), new ECB(2, 37)), new ECBlocks(20, new ECB(4, 16), new ECB(4, 17)), new ECBlocks(24, new ECB(4, 12), new ECB(4, 13))), \r\n\tnew Version(10, new Array(6, 28, 50), new ECBlocks(18, new ECB(2, 68), new ECB(2, 69)), new ECBlocks(26, new ECB(4, 43), new ECB(1, 44)), new ECBlocks(24, new ECB(6, 19), new ECB(2, 20)), new ECBlocks(28, new ECB(6, 15), new ECB(2, 16))), \r\n\tnew Version(11, new Array(6, 30, 54), new ECBlocks(20, new ECB(4, 81)), new ECBlocks(30, new ECB(1, 50), new ECB(4, 51)), new ECBlocks(28, new ECB(4, 22), new ECB(4, 23)), new ECBlocks(24, new ECB(3, 12), new ECB(8, 13))), \r\n\tnew Version(12, new Array(6, 32, 58), new ECBlocks(24, new ECB(2, 92), new ECB(2, 93)), new ECBlocks(22, new ECB(6, 36), new ECB(2, 37)), new ECBlocks(26, new ECB(4, 20), new ECB(6, 21)), new ECBlocks(28, new ECB(7, 14), new ECB(4, 15))), \r\n\tnew Version(13, new Array(6, 34, 62), new ECBlocks(26, new ECB(4, 107)), new ECBlocks(22, new ECB(8, 37), new ECB(1, 38)), new ECBlocks(24, new ECB(8, 20), new ECB(4, 21)), new ECBlocks(22, new ECB(12, 11), new ECB(4, 12))), \r\n\tnew Version(14, new Array(6, 26, 46, 66), new ECBlocks(30, new ECB(3, 115), new ECB(1, 116)), new ECBlocks(24, new ECB(4, 40), new ECB(5, 41)), new ECBlocks(20, new ECB(11, 16), new ECB(5, 17)), new ECBlocks(24, new ECB(11, 12), new ECB(5, 13))), \r\n\tnew Version(15, new Array(6, 26, 48, 70), new ECBlocks(22, new ECB(5, 87), new ECB(1, 88)), new ECBlocks(24, new ECB(5, 41), new ECB(5, 42)), new ECBlocks(30, new ECB(5, 24), new ECB(7, 25)), new ECBlocks(24, new ECB(11, 12), new ECB(7, 13))), \r\n\tnew Version(16, new Array(6, 26, 50, 74), new ECBlocks(24, new ECB(5, 98), new ECB(1, 99)), new ECBlocks(28, new ECB(7, 45), new ECB(3, 46)), new ECBlocks(24, new ECB(15, 19), new ECB(2, 20)), new ECBlocks(30, new ECB(3, 15), new ECB(13, 16))), \r\n\tnew Version(17, new Array(6, 30, 54, 78), new ECBlocks(28, new ECB(1, 107), new ECB(5, 108)), new ECBlocks(28, new ECB(10, 46), new ECB(1, 47)), new ECBlocks(28, new ECB(1, 22), new ECB(15, 23)), new ECBlocks(28, new ECB(2, 14), new ECB(17, 15))), \r\n\tnew Version(18, new Array(6, 30, 56, 82), new ECBlocks(30, new ECB(5, 120), new ECB(1, 121)), new ECBlocks(26, new ECB(9, 43), new ECB(4, 44)), new ECBlocks(28, new ECB(17, 22), new ECB(1, 23)), new ECBlocks(28, new ECB(2, 14), new ECB(19, 15))), \r\n\tnew Version(19, new Array(6, 30, 58, 86), new ECBlocks(28, new ECB(3, 113), new ECB(4, 114)), new ECBlocks(26, new ECB(3, 44), new ECB(11, 45)), new ECBlocks(26, new ECB(17, 21), new ECB(4, 22)), new ECBlocks(26, new ECB(9, 13), new ECB(16, 14))), \r\n\tnew Version(20, new Array(6, 34, 62, 90), new ECBlocks(28, new ECB(3, 107), new ECB(5, 108)), new ECBlocks(26, new ECB(3, 41), new ECB(13, 42)), new ECBlocks(30, new ECB(15, 24), new ECB(5, 25)), new ECBlocks(28, new ECB(15, 15), new ECB(10, 16))), \r\n\tnew Version(21, new Array(6, 28, 50, 72, 94), new ECBlocks(28, new ECB(4, 116), new ECB(4, 117)), new ECBlocks(26, new ECB(17, 42)), new ECBlocks(28, new ECB(17, 22), new ECB(6, 23)), new ECBlocks(30, new ECB(19, 16), new ECB(6, 17))), \r\n\tnew Version(22, new Array(6, 26, 50, 74, 98), new ECBlocks(28, new ECB(2, 111), new ECB(7, 112)), new ECBlocks(28, new ECB(17, 46)), new ECBlocks(30, new ECB(7, 24), new ECB(16, 25)), new ECBlocks(24, new ECB(34, 13))), \r\n\tnew Version(23, new Array(6, 30, 54, 74, 102), new ECBlocks(30, new ECB(4, 121), new ECB(5, 122)), new ECBlocks(28, new ECB(4, 47), new ECB(14, 48)), new ECBlocks(30, new ECB(11, 24), new ECB(14, 25)), new ECBlocks(30, new ECB(16, 15), new ECB(14, 16))), \r\n\tnew Version(24, new Array(6, 28, 54, 80, 106), new ECBlocks(30, new ECB(6, 117), new ECB(4, 118)), new ECBlocks(28, new ECB(6, 45), new ECB(14, 46)), new ECBlocks(30, new ECB(11, 24), new ECB(16, 25)), new ECBlocks(30, new ECB(30, 16), new ECB(2, 17))), \r\n\tnew Version(25, new Array(6, 32, 58, 84, 110), new ECBlocks(26, new ECB(8, 106), new ECB(4, 107)), new ECBlocks(28, new ECB(8, 47), new ECB(13, 48)), new ECBlocks(30, new ECB(7, 24), new ECB(22, 25)), new ECBlocks(30, new ECB(22, 15), new ECB(13, 16))), \r\n\tnew Version(26, new Array(6, 30, 58, 86, 114), new ECBlocks(28, new ECB(10, 114), new ECB(2, 115)), new ECBlocks(28, new ECB(19, 46), new ECB(4, 47)), new ECBlocks(28, new ECB(28, 22), new ECB(6, 23)), new ECBlocks(30, new ECB(33, 16), new ECB(4, 17))), \r\n\tnew Version(27, new Array(6, 34, 62, 90, 118), new ECBlocks(30, new ECB(8, 122), new ECB(4, 123)), new ECBlocks(28, new ECB(22, 45), new ECB(3, 46)), new ECBlocks(30, new ECB(8, 23), new ECB(26, 24)), new ECBlocks(30, new ECB(12, 15), \t\tnew ECB(28, 16))),\r\n\tnew Version(28, new Array(6, 26, 50, 74, 98, 122), new ECBlocks(30, new ECB(3, 117), new ECB(10, 118)), new ECBlocks(28, new ECB(3, 45), new ECB(23, 46)), new ECBlocks(30, new ECB(4, 24), new ECB(31, 25)), new ECBlocks(30, new ECB(11, 15), new ECB(31, 16))), \r\n\tnew Version(29, new Array(6, 30, 54, 78, 102, 126), new ECBlocks(30, new ECB(7, 116), new ECB(7, 117)), new ECBlocks(28, new ECB(21, 45), new ECB(7, 46)), new ECBlocks(30, new ECB(1, 23), new ECB(37, 24)), new ECBlocks(30, new ECB(19, 15), new ECB(26, 16))), \r\n\tnew Version(30, new Array(6, 26, 52, 78, 104, 130), new ECBlocks(30, new ECB(5, 115), new ECB(10, 116)), new ECBlocks(28, new ECB(19, 47), new ECB(10, 48)), new ECBlocks(30, new ECB(15, 24), new ECB(25, 25)), new ECBlocks(30, new ECB(23, 15), new ECB(25, 16))), \r\n\tnew Version(31, new Array(6, 30, 56, 82, 108, 134), new ECBlocks(30, new ECB(13, 115), new ECB(3, 116)), new ECBlocks(28, new ECB(2, 46), new ECB(29, 47)), new ECBlocks(30, new ECB(42, 24), new ECB(1, 25)), new ECBlocks(30, new ECB(23, 15), new ECB(28, 16))), \r\n\tnew Version(32, new Array(6, 34, 60, 86, 112, 138), new ECBlocks(30, new ECB(17, 115)), new ECBlocks(28, new ECB(10, 46), new ECB(23, 47)), new ECBlocks(30, new ECB(10, 24), new ECB(35, 25)), new ECBlocks(30, new ECB(19, 15), new ECB(35, 16))), \r\n\tnew Version(33, new Array(6, 30, 58, 86, 114, 142), new ECBlocks(30, new ECB(17, 115), new ECB(1, 116)), new ECBlocks(28, new ECB(14, 46), new ECB(21, 47)), new ECBlocks(30, new ECB(29, 24), new ECB(19, 25)), new ECBlocks(30, new ECB(11, 15), new ECB(46, 16))), \r\n\tnew Version(34, new Array(6, 34, 62, 90, 118, 146), new ECBlocks(30, new ECB(13, 115), new ECB(6, 116)), new ECBlocks(28, new ECB(14, 46), new ECB(23, 47)), new ECBlocks(30, new ECB(44, 24), new ECB(7, 25)), new ECBlocks(30, new ECB(59, 16), new ECB(1, 17))), \r\n\tnew Version(35, new Array(6, 30, 54, 78, 102, 126, 150), new ECBlocks(30, new ECB(12, 121), new ECB(7, 122)), new ECBlocks(28, new ECB(12, 47), new ECB(26, 48)), new ECBlocks(30, new ECB(39, 24), new ECB(14, 25)),new ECBlocks(30, new ECB(22, 15), new ECB(41, 16))), \r\n\tnew Version(36, new Array(6, 24, 50, 76, 102, 128, 154), new ECBlocks(30, new ECB(6, 121), new ECB(14, 122)), new ECBlocks(28, new ECB(6, 47), new ECB(34, 48)), new ECBlocks(30, new ECB(46, 24), new ECB(10, 25)), new ECBlocks(30, new ECB(2, 15), new ECB(64, 16))), \r\n\tnew Version(37, new Array(6, 28, 54, 80, 106, 132, 158), new ECBlocks(30, new ECB(17, 122), new ECB(4, 123)), new ECBlocks(28, new ECB(29, 46), new ECB(14, 47)), new ECBlocks(30, new ECB(49, 24), new ECB(10, 25)), new ECBlocks(30, new ECB(24, 15), new ECB(46, 16))), \r\n\tnew Version(38, new Array(6, 32, 58, 84, 110, 136, 162), new ECBlocks(30, new ECB(4, 122), new ECB(18, 123)), new ECBlocks(28, new ECB(13, 46), new ECB(32, 47)), new ECBlocks(30, new ECB(48, 24), new ECB(14, 25)), new ECBlocks(30, new ECB(42, 15), new ECB(32, 16))), \r\n\tnew Version(39, new Array(6, 26, 54, 82, 110, 138, 166), new ECBlocks(30, new ECB(20, 117), new ECB(4, 118)), new ECBlocks(28, new ECB(40, 47), new ECB(7, 48)), new ECBlocks(30, new ECB(43, 24), new ECB(22, 25)), new ECBlocks(30, new ECB(10, 15), new ECB(67, 16))), \r\n\tnew Version(40, new Array(6, 30, 58, 86, 114, 142, 170), new ECBlocks(30, new ECB(19, 118), new ECB(6, 119)), new ECBlocks(28, new ECB(18, 47), new ECB(31, 48)), new ECBlocks(30, new ECB(34, 24), new ECB(34, 25)), new ECBlocks(30, new ECB(20, 15), new ECB(61, 16))));\r\n}","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction PerspectiveTransform( a11, a21, a31, a12, a22, a32, a13, a23, a33)\r\n{\r\n\tthis.a11 = a11;\r\n\tthis.a12 = a12;\r\n\tthis.a13 = a13;\r\n\tthis.a21 = a21;\r\n\tthis.a22 = a22;\r\n\tthis.a23 = a23;\r\n\tthis.a31 = a31;\r\n\tthis.a32 = a32;\r\n\tthis.a33 = a33;\r\n\tthis.transformPoints1=function( points)\r\n\t\t{\r\n\t\t\tvar max = points.length;\r\n\t\t\tvar a11 = this.a11;\r\n\t\t\tvar a12 = this.a12;\r\n\t\t\tvar a13 = this.a13;\r\n\t\t\tvar a21 = this.a21;\r\n\t\t\tvar a22 = this.a22;\r\n\t\t\tvar a23 = this.a23;\r\n\t\t\tvar a31 = this.a31;\r\n\t\t\tvar a32 = this.a32;\r\n\t\t\tvar a33 = this.a33;\r\n\t\t\tfor (var i = 0; i < max; i += 2)\r\n\t\t\t{\r\n\t\t\t\tvar x = points[i];\r\n\t\t\t\tvar y = points[i + 1];\r\n\t\t\t\tvar denominator = a13 * x + a23 * y + a33;\r\n\t\t\t\tpoints[i] = (a11 * x + a21 * y + a31) / denominator;\r\n\t\t\t\tpoints[i + 1] = (a12 * x + a22 * y + a32) / denominator;\r\n\t\t\t}\r\n\t\t}\r\n\tthis. transformPoints2=function(xValues, yValues)\r\n\t\t{\r\n\t\t\tvar n = xValues.length;\r\n\t\t\tfor (var i = 0; i < n; i++)\r\n\t\t\t{\r\n\t\t\t\tvar x = xValues[i];\r\n\t\t\t\tvar y = yValues[i];\r\n\t\t\t\tvar denominator = this.a13 * x + this.a23 * y + this.a33;\r\n\t\t\t\txValues[i] = (this.a11 * x + this.a21 * y + this.a31) / denominator;\r\n\t\t\t\tyValues[i] = (this.a12 * x + this.a22 * y + this.a32) / denominator;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\tthis.buildAdjoint=function()\r\n\t\t{\r\n\t\t\t// Adjoint is the transpose of the cofactor matrix:\r\n\t\t\treturn new PerspectiveTransform(this.a22 * this.a33 - this.a23 * this.a32, this.a23 * this.a31 - this.a21 * this.a33, this.a21 * this.a32 - this.a22 * this.a31, this.a13 * this.a32 - this.a12 * this.a33, this.a11 * this.a33 - this.a13 * this.a31, this.a12 * this.a31 - this.a11 * this.a32, this.a12 * this.a23 - this.a13 * this.a22, this.a13 * this.a21 - this.a11 * this.a23, this.a11 * this.a22 - this.a12 * this.a21);\r\n\t\t}\r\n\tthis.times=function( other)\r\n\t\t{\r\n\t\t\treturn new PerspectiveTransform(this.a11 * other.a11 + this.a21 * other.a12 + this.a31 * other.a13, this.a11 * other.a21 + this.a21 * other.a22 + this.a31 * other.a23, this.a11 * other.a31 + this.a21 * other.a32 + this.a31 * other.a33, this.a12 * other.a11 + this.a22 * other.a12 + this.a32 * other.a13, this.a12 * other.a21 + this.a22 * other.a22 + this.a32 * other.a23, this.a12 * other.a31 + this.a22 * other.a32 + this.a32 * other.a33, this.a13 * other.a11 + this.a23 * other.a12 +this.a33 * other.a13, this.a13 * other.a21 + this.a23 * other.a22 + this.a33 * other.a23, this.a13 * other.a31 + this.a23 * other.a32 + this.a33 * other.a33);\r\n\t\t}\r\n\r\n}\r\n\r\nPerspectiveTransform.quadrilateralToQuadrilateral=function( x0, y0, x1, y1, x2, y2, x3, y3, x0p, y0p, x1p, y1p, x2p, y2p, x3p, y3p)\r\n{\r\n\t\r\n\tvar qToS = this.quadrilateralToSquare(x0, y0, x1, y1, x2, y2, x3, y3);\r\n\tvar sToQ = this.squareToQuadrilateral(x0p, y0p, x1p, y1p, x2p, y2p, x3p, y3p);\r\n\treturn sToQ.times(qToS);\r\n}\r\n\r\nPerspectiveTransform.squareToQuadrilateral=function( x0, y0, x1, y1, x2, y2, x3, y3)\r\n{\r\n\t dy2 = y3 - y2;\r\n\t dy3 = y0 - y1 + y2 - y3;\r\n\tif (dy2 == 0.0 && dy3 == 0.0)\r\n\t{\r\n\t\treturn new PerspectiveTransform(x1 - x0, x2 - x1, x0, y1 - y0, y2 - y1, y0, 0.0, 0.0, 1.0);\r\n\t}\r\n\telse\r\n\t{\r\n\t\t dx1 = x1 - x2;\r\n\t\t dx2 = x3 - x2;\r\n\t\t dx3 = x0 - x1 + x2 - x3;\r\n\t\t dy1 = y1 - y2;\r\n\t\t denominator = dx1 * dy2 - dx2 * dy1;\r\n\t\t a13 = (dx3 * dy2 - dx2 * dy3) / denominator;\r\n\t\t a23 = (dx1 * dy3 - dx3 * dy1) / denominator;\r\n\t\treturn new PerspectiveTransform(x1 - x0 + a13 * x1, x3 - x0 + a23 * x3, x0, y1 - y0 + a13 * y1, y3 - y0 + a23 * y3, y0, a13, a23, 1.0);\r\n\t}\r\n}\r\n\r\nPerspectiveTransform.quadrilateralToSquare=function( x0, y0, x1, y1, x2, y2, x3, y3)\r\n{\r\n\t// Here, the adjoint serves as the inverse:\r\n\treturn this.squareToQuadrilateral(x0, y0, x1, y1, x2, y2, x3, y3).buildAdjoint();\r\n}\r\n\r\nfunction DetectorResult(bits, points)\r\n{\r\n\tthis.bits = bits;\r\n\tthis.points = points;\r\n}\r\n\r\n\r\nfunction Detector(image)\r\n{\r\n\tthis.image=image;\r\n\tthis.resultPointCallback = null;\r\n\t\r\n\tthis.sizeOfBlackWhiteBlackRun=function( fromX, fromY, toX, toY)\r\n\t\t{\r\n\t\t\t// Mild variant of Bresenham's algorithm;\r\n\t\t\t// see http://en.wikipedia.org/wiki/Bresenham's_line_algorithm\r\n\t\t\tvar steep = Math.abs(toY - fromY) > Math.abs(toX - fromX);\r\n\t\t\tif (steep)\r\n\t\t\t{\r\n\t\t\t\tvar temp = fromX;\r\n\t\t\t\tfromX = fromY;\r\n\t\t\t\tfromY = temp;\r\n\t\t\t\ttemp = toX;\r\n\t\t\t\ttoX = toY;\r\n\t\t\t\ttoY = temp;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar dx = Math.abs(toX - fromX);\r\n\t\t\tvar dy = Math.abs(toY - fromY);\r\n\t\t\tvar error = - dx >> 1;\r\n\t\t\tvar ystep = fromY < toY?1:- 1;\r\n\t\t\tvar xstep = fromX < toX?1:- 1;\r\n\t\t\tvar state = 0; // In black pixels, looking for white, first or second time\r\n\t\t\tfor (var x = fromX, y = fromY; x != toX; x += xstep)\r\n\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\tvar realX = steep?y:x;\r\n\t\t\t\tvar realY = steep?x:y;\r\n\t\t\t\tif (state == 1)\r\n\t\t\t\t{\r\n\t\t\t\t\t// In white pixels, looking for black\r\n\t\t\t\t\tif (this.image[realX + realY*qrcode.width])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tstate++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tif (!this.image[realX + realY*qrcode.width])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tstate++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tif (state == 3)\r\n\t\t\t\t{\r\n\t\t\t\t\t// Found black, white, black, and stumbled back onto white; done\r\n\t\t\t\t\tvar diffX = x - fromX;\r\n\t\t\t\t\tvar diffY = y - fromY;\r\n\t\t\t\t\treturn Math.sqrt( (diffX * diffX + diffY * diffY));\r\n\t\t\t\t}\r\n\t\t\t\terror += dy;\r\n\t\t\t\tif (error > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tif (y == toY)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\ty += ystep;\r\n\t\t\t\t\terror -= dx;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tvar diffX2 = toX - fromX;\r\n\t\t\tvar diffY2 = toY - fromY;\r\n\t\t\treturn Math.sqrt( (diffX2 * diffX2 + diffY2 * diffY2));\r\n\t\t}\r\n\r\n\t\r\n\tthis.sizeOfBlackWhiteBlackRunBothWays=function( fromX, fromY, toX, toY)\r\n\t\t{\r\n\t\t\t\r\n\t\t\tvar result = this.sizeOfBlackWhiteBlackRun(fromX, fromY, toX, toY);\r\n\t\t\t\r\n\t\t\t// Now count other way -- don't run off image though of course\r\n\t\t\tvar scale = 1.0;\r\n\t\t\tvar otherToX = fromX - (toX - fromX);\r\n\t\t\tif (otherToX < 0)\r\n\t\t\t{\r\n\t\t\t\tscale = fromX / (fromX - otherToX);\r\n\t\t\t\totherToX = 0;\r\n\t\t\t}\r\n\t\t\telse if (otherToX >= qrcode.width)\r\n\t\t\t{\r\n\t\t\t\tscale = (qrcode.width - 1 - fromX) / (otherToX - fromX);\r\n\t\t\t\totherToX = qrcode.width - 1;\r\n\t\t\t}\r\n\t\t\tvar otherToY = Math.floor (fromY - (toY - fromY) * scale);\r\n\t\t\t\r\n\t\t\tscale = 1.0;\r\n\t\t\tif (otherToY < 0)\r\n\t\t\t{\r\n\t\t\t\tscale = fromY / (fromY - otherToY);\r\n\t\t\t\totherToY = 0;\r\n\t\t\t}\r\n\t\t\telse if (otherToY >= qrcode.height)\r\n\t\t\t{\r\n\t\t\t\tscale = (qrcode.height - 1 - fromY) / (otherToY - fromY);\r\n\t\t\t\totherToY = qrcode.height - 1;\r\n\t\t\t}\r\n\t\t\totherToX = Math.floor (fromX + (otherToX - fromX) * scale);\r\n\t\t\t\r\n\t\t\tresult += this.sizeOfBlackWhiteBlackRun(fromX, fromY, otherToX, otherToY);\r\n\t\t\treturn result - 1.0; // -1 because we counted the middle pixel twice\r\n\t\t}\r\n\t\t\r\n\r\n\t\r\n\tthis.calculateModuleSizeOneWay=function( pattern, otherPattern)\r\n\t\t{\r\n\t\t\tvar moduleSizeEst1 = this.sizeOfBlackWhiteBlackRunBothWays(Math.floor( pattern.X), Math.floor( pattern.Y), Math.floor( otherPattern.X), Math.floor(otherPattern.Y));\r\n\t\t\tvar moduleSizeEst2 = this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(otherPattern.X), Math.floor(otherPattern.Y), Math.floor( pattern.X), Math.floor(pattern.Y));\r\n\t\t\tif (isNaN(moduleSizeEst1))\r\n\t\t\t{\r\n\t\t\t\treturn moduleSizeEst2 / 7.0;\r\n\t\t\t}\r\n\t\t\tif (isNaN(moduleSizeEst2))\r\n\t\t\t{\r\n\t\t\t\treturn moduleSizeEst1 / 7.0;\r\n\t\t\t}\r\n\t\t\t// Average them, and divide by 7 since we've counted the width of 3 black modules,\r\n\t\t\t// and 1 white and 1 black module on either side. Ergo, divide sum by 14.\r\n\t\t\treturn (moduleSizeEst1 + moduleSizeEst2) / 14.0;\r\n\t\t}\r\n\r\n\t\r\n\tthis.calculateModuleSize=function( topLeft, topRight, bottomLeft)\r\n\t\t{\r\n\t\t\t// Take the average\r\n\t\t\treturn (this.calculateModuleSizeOneWay(topLeft, topRight) + this.calculateModuleSizeOneWay(topLeft, bottomLeft)) / 2.0;\r\n\t\t}\r\n\r\n\tthis.distance=function( pattern1, pattern2)\r\n\t{\r\n\t\txDiff = pattern1.X - pattern2.X;\r\n\t\tyDiff = pattern1.Y - pattern2.Y;\r\n\t\treturn Math.sqrt( (xDiff * xDiff + yDiff * yDiff));\r\n\t}\r\n\tthis.computeDimension=function( topLeft, topRight, bottomLeft, moduleSize)\r\n\t\t{\r\n\t\t\t\r\n\t\t\tvar tltrCentersDimension = Math.round(this.distance(topLeft, topRight) / moduleSize);\r\n\t\t\tvar tlblCentersDimension = Math.round(this.distance(topLeft, bottomLeft) / moduleSize);\r\n\t\t\tvar dimension = ((tltrCentersDimension + tlblCentersDimension) >> 1) + 7;\r\n\t\t\tswitch (dimension & 0x03)\r\n\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\t// mod 4\r\n\t\t\t\tcase 0: \r\n\t\t\t\t\tdimension++;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t// 1? do nothing\r\n\t\t\t\t\r\n\t\t\t\tcase 2: \r\n\t\t\t\t\tdimension--;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\t\tcase 3: \r\n\t\t\t\t\tthrow \"Error\";\r\n\t\t\t\t}\r\n\t\t\treturn dimension;\r\n\t\t}\r\n\r\n\tthis.findAlignmentInRegion=function( overallEstModuleSize, estAlignmentX, estAlignmentY, allowanceFactor)\r\n\t\t{\r\n\t\t\t// Look for an alignment pattern (3 modules in size) around where it\r\n\t\t\t// should be\r\n\t\t\tvar allowance = Math.floor (allowanceFactor * overallEstModuleSize);\r\n\t\t\tvar alignmentAreaLeftX = Math.max(0, estAlignmentX - allowance);\r\n\t\t\tvar alignmentAreaRightX = Math.min(qrcode.width - 1, estAlignmentX + allowance);\r\n\t\t\tif (alignmentAreaRightX - alignmentAreaLeftX < overallEstModuleSize * 3)\r\n\t\t\t{\r\n\t\t\t\tthrow \"Error\";\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar alignmentAreaTopY = Math.max(0, estAlignmentY - allowance);\r\n\t\t\tvar alignmentAreaBottomY = Math.min(qrcode.height - 1, estAlignmentY + allowance);\r\n\t\t\t\r\n\t\t\tvar alignmentFinder = new AlignmentPatternFinder(this.image, alignmentAreaLeftX, alignmentAreaTopY, alignmentAreaRightX - alignmentAreaLeftX, alignmentAreaBottomY - alignmentAreaTopY, overallEstModuleSize, this.resultPointCallback);\r\n\t\t\treturn alignmentFinder.find();\r\n\t\t}\r\n\t\t\r\n\tthis.createTransform=function( topLeft, topRight, bottomLeft, alignmentPattern, dimension)\r\n\t\t{\r\n\t\t\tvar dimMinusThree = dimension - 3.5;\r\n\t\t\tvar bottomRightX;\r\n\t\t\tvar bottomRightY;\r\n\t\t\tvar sourceBottomRightX;\r\n\t\t\tvar sourceBottomRightY;\r\n\t\t\tif (alignmentPattern != null)\r\n\t\t\t{\r\n\t\t\t\tbottomRightX = alignmentPattern.X;\r\n\t\t\t\tbottomRightY = alignmentPattern.Y;\r\n\t\t\t\tsourceBottomRightX = sourceBottomRightY = dimMinusThree - 3.0;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t// Don't have an alignment pattern, just make up the bottom-right point\r\n\t\t\t\tbottomRightX = (topRight.X - topLeft.X) + bottomLeft.X;\r\n\t\t\t\tbottomRightY = (topRight.Y - topLeft.Y) + bottomLeft.Y;\r\n\t\t\t\tsourceBottomRightX = sourceBottomRightY = dimMinusThree;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar transform = PerspectiveTransform.quadrilateralToQuadrilateral(3.5, 3.5, dimMinusThree, 3.5, sourceBottomRightX, sourceBottomRightY, 3.5, dimMinusThree, topLeft.X, topLeft.Y, topRight.X, topRight.Y, bottomRightX, bottomRightY, bottomLeft.X, bottomLeft.Y);\r\n\t\t\t\r\n\t\t\treturn transform;\r\n\t\t}\t\t\r\n\t\r\n\tthis.sampleGrid=function( image, transform, dimension)\r\n\t\t{\r\n\t\t\t\r\n\t\t\tvar sampler = GridSampler;\r\n\t\t\treturn sampler.sampleGrid3(image, dimension, transform);\r\n\t\t}\r\n\t\r\n\tthis.processFinderPatternInfo = function( info)\r\n\t\t{\r\n\t\t\t\r\n\t\t\tvar topLeft = info.TopLeft;\r\n\t\t\tvar topRight = info.TopRight;\r\n\t\t\tvar bottomLeft = info.BottomLeft;\r\n\t\t\t\r\n\t\t\tvar moduleSize = this.calculateModuleSize(topLeft, topRight, bottomLeft);\r\n\t\t\tif (moduleSize < 1.0)\r\n\t\t\t{\r\n\t\t\t\tthrow \"Error\";\r\n\t\t\t}\r\n\t\t\tvar dimension = this.computeDimension(topLeft, topRight, bottomLeft, moduleSize);\r\n\t\t\tvar provisionalVersion = Version.getProvisionalVersionForDimension(dimension);\r\n\t\t\tvar modulesBetweenFPCenters = provisionalVersion.DimensionForVersion - 7;\r\n\t\t\t\r\n\t\t\tvar alignmentPattern = null;\r\n\t\t\t// Anything above version 1 has an alignment pattern\r\n\t\t\tif (provisionalVersion.AlignmentPatternCenters.length > 0)\r\n\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\t// Guess where a \"bottom right\" finder pattern would have been\r\n\t\t\t\tvar bottomRightX = topRight.X - topLeft.X + bottomLeft.X;\r\n\t\t\t\tvar bottomRightY = topRight.Y - topLeft.Y + bottomLeft.Y;\r\n\t\t\t\t\r\n\t\t\t\t// Estimate that alignment pattern is closer by 3 modules\r\n\t\t\t\t// from \"bottom right\" to known top left location\r\n\t\t\t\tvar correctionToTopLeft = 1.0 - 3.0 / modulesBetweenFPCenters;\r\n\t\t\t\tvar estAlignmentX = Math.floor (topLeft.X + correctionToTopLeft * (bottomRightX - topLeft.X));\r\n\t\t\t\tvar estAlignmentY = Math.floor (topLeft.Y + correctionToTopLeft * (bottomRightY - topLeft.Y));\r\n\t\t\t\t\r\n\t\t\t\t// Kind of arbitrary -- expand search radius before giving up\r\n\t\t\t\tfor (var i = 4; i <= 16; i <<= 1)\r\n\t\t\t\t{\r\n\t\t\t\t\t//try\r\n\t\t\t\t\t//{\r\n\t\t\t\t\t\talignmentPattern = this.findAlignmentInRegion(moduleSize, estAlignmentX, estAlignmentY, i);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t//}\r\n\t\t\t\t\t//catch (re)\r\n\t\t\t\t\t//{\r\n\t\t\t\t\t\t// try next round\r\n\t\t\t\t\t//}\r\n\t\t\t\t}\r\n\t\t\t\t// If we didn't find alignment pattern... well try anyway without it\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar transform = this.createTransform(topLeft, topRight, bottomLeft, alignmentPattern, dimension);\r\n\t\t\t\r\n\t\t\tvar bits = this.sampleGrid(this.image, transform, dimension);\r\n\t\t\t\r\n\t\t\tvar points;\r\n\t\t\tif (alignmentPattern == null)\r\n\t\t\t{\r\n\t\t\t\tpoints = new Array(bottomLeft, topLeft, topRight);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tpoints = new Array(bottomLeft, topLeft, topRight, alignmentPattern);\r\n\t\t\t}\r\n\t\t\treturn new DetectorResult(bits, points);\r\n\t\t}\r\n\t\t\r\n\r\n\t\r\n\tthis.detect=function()\r\n\t{\r\n\t\tvar info = new FinderPatternFinder().findFinderPattern(this.image);\r\n\t\t\t\r\n\t\treturn this.processFinderPatternInfo(info); \r\n\t}\r\n}","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nvar FORMAT_INFO_MASK_QR = 0x5412;\r\nvar FORMAT_INFO_DECODE_LOOKUP = new Array(new Array(0x5412, 0x00), new Array(0x5125, 0x01), new Array(0x5E7C, 0x02), new Array(0x5B4B, 0x03), new Array(0x45F9, 0x04), new Array(0x40CE, 0x05), new Array(0x4F97, 0x06), new Array(0x4AA0, 0x07), new Array(0x77C4, 0x08), new Array(0x72F3, 0x09), new Array(0x7DAA, 0x0A), new Array(0x789D, 0x0B), new Array(0x662F, 0x0C), new Array(0x6318, 0x0D), new Array(0x6C41, 0x0E), new Array(0x6976, 0x0F), new Array(0x1689, 0x10), new Array(0x13BE, 0x11), new Array(0x1CE7, 0x12), new Array(0x19D0, 0x13), new Array(0x0762, 0x14), new Array(0x0255, 0x15), new Array(0x0D0C, 0x16), new Array(0x083B, 0x17), new Array(0x355F, 0x18), new Array(0x3068, 0x19), new Array(0x3F31, 0x1A), new Array(0x3A06, 0x1B), new Array(0x24B4, 0x1C), new Array(0x2183, 0x1D), new Array(0x2EDA, 0x1E), new Array(0x2BED, 0x1F));\r\nvar BITS_SET_IN_HALF_BYTE = new Array(0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4);\r\n\r\n\r\nfunction FormatInformation(formatInfo)\r\n{\r\n\tthis.errorCorrectionLevel = ErrorCorrectionLevel.forBits((formatInfo >> 3) & 0x03);\r\n\tthis.dataMask = (formatInfo & 0x07);\r\n\r\n\tthis.__defineGetter__(\"ErrorCorrectionLevel\", function()\r\n\t{\r\n\t\treturn this.errorCorrectionLevel;\r\n\t});\r\n\tthis.__defineGetter__(\"DataMask\", function()\r\n\t{\r\n\t\treturn this.dataMask;\r\n\t});\r\n\tthis.GetHashCode=function()\r\n\t{\r\n\t\treturn (this.errorCorrectionLevel.ordinal() << 3) | dataMask;\r\n\t}\r\n\tthis.Equals=function( o)\r\n\t{\r\n\t\tvar other = o;\r\n\t\treturn this.errorCorrectionLevel == other.errorCorrectionLevel && this.dataMask == other.dataMask;\r\n\t}\r\n}\r\n\r\nFormatInformation.numBitsDiffering=function( a, b)\r\n{\r\n\ta ^= b; // a now has a 1 bit exactly where its bit differs with b's\r\n\t// Count bits set quickly with a series of lookups:\r\n\treturn BITS_SET_IN_HALF_BYTE[a & 0x0F] + BITS_SET_IN_HALF_BYTE[(URShift(a, 4) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 8) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 12) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 16) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 20) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 24) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 28) & 0x0F)];\r\n}\r\n\r\nFormatInformation.decodeFormatInformation=function( maskedFormatInfo)\r\n{\r\n\tvar formatInfo = FormatInformation.doDecodeFormatInformation(maskedFormatInfo);\r\n\tif (formatInfo != null)\r\n\t{\r\n\t\treturn formatInfo;\r\n\t}\r\n\t// Should return null, but, some QR codes apparently\r\n\t// do not mask this info. Try again by actually masking the pattern\r\n\t// first\r\n\treturn FormatInformation.doDecodeFormatInformation(maskedFormatInfo ^ FORMAT_INFO_MASK_QR);\r\n}\r\nFormatInformation.doDecodeFormatInformation=function( maskedFormatInfo)\r\n{\r\n\t// Find the int in FORMAT_INFO_DECODE_LOOKUP with fewest bits differing\r\n\tvar bestDifference = 0xffffffff;\r\n\tvar bestFormatInfo = 0;\r\n\tfor (var i = 0; i < FORMAT_INFO_DECODE_LOOKUP.length; i++)\r\n\t{\r\n\t\tvar decodeInfo = FORMAT_INFO_DECODE_LOOKUP[i];\r\n\t\tvar targetInfo = decodeInfo[0];\r\n\t\tif (targetInfo == maskedFormatInfo)\r\n\t\t{\r\n\t\t\t// Found an exact match\r\n\t\t\treturn new FormatInformation(decodeInfo[1]);\r\n\t\t}\r\n\t\tvar bitsDifference = this.numBitsDiffering(maskedFormatInfo, targetInfo);\r\n\t\tif (bitsDifference < bestDifference)\r\n\t\t{\r\n\t\t\tbestFormatInfo = decodeInfo[1];\r\n\t\t\tbestDifference = bitsDifference;\r\n\t\t}\r\n\t}\r\n\t// Hamming distance of the 32 masked codes is 7, by construction, so <= 3 bits\r\n\t// differing means we found a match\r\n\tif (bestDifference <= 3)\r\n\t{\r\n\t\treturn new FormatInformation(bestFormatInfo);\r\n\t}\r\n\treturn null;\r\n}\r\n\r\n\t\t","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction ErrorCorrectionLevel(ordinal, bits, name)\r\n{\r\n\tthis.ordinal_Renamed_Field = ordinal;\r\n\tthis.bits = bits;\r\n\tthis.name = name;\r\n\tthis.__defineGetter__(\"Bits\", function()\r\n\t{\r\n\t\treturn this.bits;\r\n\t});\r\n\tthis.__defineGetter__(\"Name\", function()\r\n\t{\r\n\t\treturn this.name;\r\n\t});\r\n\tthis.ordinal=function()\r\n\t{\r\n\t\treturn this.ordinal_Renamed_Field;\r\n\t}\r\n}\r\n\r\nErrorCorrectionLevel.forBits=function( bits)\r\n{\r\n\tif (bits < 0 || bits >= FOR_BITS.length)\r\n\t{\r\n\t\tthrow \"ArgumentException\";\r\n\t}\r\n\treturn FOR_BITS[bits];\r\n}\r\n\r\nvar L = new ErrorCorrectionLevel(0, 0x01, \"L\");\r\nvar M = new ErrorCorrectionLevel(1, 0x00, \"M\");\r\nvar Q = new ErrorCorrectionLevel(2, 0x03, \"Q\");\r\nvar H = new ErrorCorrectionLevel(3, 0x02, \"H\");\r\nvar FOR_BITS = new Array( M, L, H, Q);\r\n","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction BitMatrix( width, height)\r\n{\r\n\tif(!height)\r\n\t\theight=width;\r\n\tif (width < 1 || height < 1)\r\n\t{\r\n\t\tthrow \"Both dimensions must be greater than 0\";\r\n\t}\r\n\tthis.width = width;\r\n\tthis.height = height;\r\n\tvar rowSize = width >> 5;\r\n\tif ((width & 0x1f) != 0)\r\n\t{\r\n\t\trowSize++;\r\n\t}\r\n\tthis.rowSize = rowSize;\r\n\tthis.bits = new Array(rowSize * height);\r\n\tfor(var i=0;i> 5);\r\n\t\t\treturn ((URShift(this.bits[offset], (x & 0x1f))) & 1) != 0;\r\n\t\t}\r\n\tthis.set_Renamed=function( x, y)\r\n\t\t{\r\n\t\t\tvar offset = y * this.rowSize + (x >> 5);\r\n\t\t\tthis.bits[offset] |= 1 << (x & 0x1f);\r\n\t\t}\r\n\tthis.flip=function( x, y)\r\n\t\t{\r\n\t\t\tvar offset = y * this.rowSize + (x >> 5);\r\n\t\t\tthis.bits[offset] ^= 1 << (x & 0x1f);\r\n\t\t}\r\n\tthis.clear=function()\r\n\t\t{\r\n\t\t\tvar max = this.bits.length;\r\n\t\t\tfor (var i = 0; i < max; i++)\r\n\t\t\t{\r\n\t\t\t\tthis.bits[i] = 0;\r\n\t\t\t}\r\n\t\t}\r\n\tthis.setRegion=function( left, top, width, height)\r\n\t\t{\r\n\t\t\tif (top < 0 || left < 0)\r\n\t\t\t{\r\n\t\t\t\tthrow \"Left and top must be nonnegative\";\r\n\t\t\t}\r\n\t\t\tif (height < 1 || width < 1)\r\n\t\t\t{\r\n\t\t\t\tthrow \"Height and width must be at least 1\";\r\n\t\t\t}\r\n\t\t\tvar right = left + width;\r\n\t\t\tvar bottom = top + height;\r\n\t\t\tif (bottom > this.height || right > this.width)\r\n\t\t\t{\r\n\t\t\t\tthrow \"The region must fit inside the matrix\";\r\n\t\t\t}\r\n\t\t\tfor (var y = top; y < bottom; y++)\r\n\t\t\t{\r\n\t\t\t\tvar offset = y * this.rowSize;\r\n\t\t\t\tfor (var x = left; x < right; x++)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.bits[offset + (x >> 5)] |= 1 << (x & 0x1f);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n}","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction DataBlock(numDataCodewords, codewords)\r\n{\r\n\tthis.numDataCodewords = numDataCodewords;\r\n\tthis.codewords = codewords;\r\n\t\r\n\tthis.__defineGetter__(\"NumDataCodewords\", function()\r\n\t{\r\n\t\treturn this.numDataCodewords;\r\n\t});\r\n\tthis.__defineGetter__(\"Codewords\", function()\r\n\t{\r\n\t\treturn this.codewords;\r\n\t});\r\n}\t\r\n\t\r\nDataBlock.getDataBlocks=function(rawCodewords, version, ecLevel)\r\n{\r\n\t\r\n\tif (rawCodewords.length != version.TotalCodewords)\r\n\t{\r\n\t\tthrow \"ArgumentException\";\r\n\t}\r\n\t\r\n\t// Figure out the number and size of data blocks used by this version and\r\n\t// error correction level\r\n\tvar ecBlocks = version.getECBlocksForLevel(ecLevel);\r\n\t\r\n\t// First count the total number of data blocks\r\n\tvar totalBlocks = 0;\r\n\tvar ecBlockArray = ecBlocks.getECBlocks();\r\n\tfor (var i = 0; i < ecBlockArray.length; i++)\r\n\t{\r\n\t\ttotalBlocks += ecBlockArray[i].Count;\r\n\t}\r\n\t\r\n\t// Now establish DataBlocks of the appropriate size and number of data codewords\r\n\tvar result = new Array(totalBlocks);\r\n\tvar numResultBlocks = 0;\r\n\tfor (var j = 0; j < ecBlockArray.length; j++)\r\n\t{\r\n\t\tvar ecBlock = ecBlockArray[j];\r\n\t\tfor (var i = 0; i < ecBlock.Count; i++)\r\n\t\t{\r\n\t\t\tvar numDataCodewords = ecBlock.DataCodewords;\r\n\t\t\tvar numBlockCodewords = ecBlocks.ECCodewordsPerBlock + numDataCodewords;\r\n\t\t\tresult[numResultBlocks++] = new DataBlock(numDataCodewords, new Array(numBlockCodewords));\r\n\t\t}\r\n\t}\r\n\t\r\n\t// All blocks have the same amount of data, except that the last n\r\n\t// (where n may be 0) have 1 more byte. Figure out where these start.\r\n\tvar shorterBlocksTotalCodewords = result[0].codewords.length;\r\n\tvar longerBlocksStartAt = result.length - 1;\r\n\twhile (longerBlocksStartAt >= 0)\r\n\t{\r\n\t\tvar numCodewords = result[longerBlocksStartAt].codewords.length;\r\n\t\tif (numCodewords == shorterBlocksTotalCodewords)\r\n\t\t{\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tlongerBlocksStartAt--;\r\n\t}\r\n\tlongerBlocksStartAt++;\r\n\t\r\n\tvar shorterBlocksNumDataCodewords = shorterBlocksTotalCodewords - ecBlocks.ECCodewordsPerBlock;\r\n\t// The last elements of result may be 1 element longer;\r\n\t// first fill out as many elements as all of them have\r\n\tvar rawCodewordsOffset = 0;\r\n\tfor (var i = 0; i < shorterBlocksNumDataCodewords; i++)\r\n\t{\r\n\t\tfor (var j = 0; j < numResultBlocks; j++)\r\n\t\t{\r\n\t\t\tresult[j].codewords[i] = rawCodewords[rawCodewordsOffset++];\r\n\t\t}\r\n\t}\r\n\t// Fill out the last data block in the longer ones\r\n\tfor (var j = longerBlocksStartAt; j < numResultBlocks; j++)\r\n\t{\r\n\t\tresult[j].codewords[shorterBlocksNumDataCodewords] = rawCodewords[rawCodewordsOffset++];\r\n\t}\r\n\t// Now add in error correction blocks\r\n\tvar max = result[0].codewords.length;\r\n\tfor (var i = shorterBlocksNumDataCodewords; i < max; i++)\r\n\t{\r\n\t\tfor (var j = 0; j < numResultBlocks; j++)\r\n\t\t{\r\n\t\t\tvar iOffset = j < longerBlocksStartAt?i:i + 1;\r\n\t\t\tresult[j].codewords[iOffset] = rawCodewords[rawCodewordsOffset++];\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n}\r\n","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction BitMatrixParser(bitMatrix)\r\n{\r\n\tvar dimension = bitMatrix.Dimension;\r\n\tif (dimension < 21 || (dimension & 0x03) != 1)\r\n\t{\r\n\t\tthrow \"Error BitMatrixParser\";\r\n\t}\r\n\tthis.bitMatrix = bitMatrix;\r\n\tthis.parsedVersion = null;\r\n\tthis.parsedFormatInfo = null;\r\n\t\r\n\tthis.copyBit=function( i, j, versionBits)\r\n\t{\r\n\t\treturn this.bitMatrix.get_Renamed(i, j)?(versionBits << 1) | 0x1:versionBits << 1;\r\n\t}\r\n\t\r\n\tthis.readFormatInformation=function()\r\n\t{\r\n\t\t\tif (this.parsedFormatInfo != null)\r\n\t\t\t{\r\n\t\t\t\treturn this.parsedFormatInfo;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Read top-left format info bits\r\n\t\t\tvar formatInfoBits = 0;\r\n\t\t\tfor (var i = 0; i < 6; i++)\r\n\t\t\t{\r\n\t\t\t\tformatInfoBits = this.copyBit(i, 8, formatInfoBits);\r\n\t\t\t}\r\n\t\t\t// .. and skip a bit in the timing pattern ...\r\n\t\t\tformatInfoBits = this.copyBit(7, 8, formatInfoBits);\r\n\t\t\tformatInfoBits = this.copyBit(8, 8, formatInfoBits);\r\n\t\t\tformatInfoBits = this.copyBit(8, 7, formatInfoBits);\r\n\t\t\t// .. and skip a bit in the timing pattern ...\r\n\t\t\tfor (var j = 5; j >= 0; j--)\r\n\t\t\t{\r\n\t\t\t\tformatInfoBits = this.copyBit(8, j, formatInfoBits);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tthis.parsedFormatInfo = FormatInformation.decodeFormatInformation(formatInfoBits);\r\n\t\t\tif (this.parsedFormatInfo != null)\r\n\t\t\t{\r\n\t\t\t\treturn this.parsedFormatInfo;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Hmm, failed. Try the top-right/bottom-left pattern\r\n\t\t\tvar dimension = this.bitMatrix.Dimension;\r\n\t\t\tformatInfoBits = 0;\r\n\t\t\tvar iMin = dimension - 8;\r\n\t\t\tfor (var i = dimension - 1; i >= iMin; i--)\r\n\t\t\t{\r\n\t\t\t\tformatInfoBits = this.copyBit(i, 8, formatInfoBits);\r\n\t\t\t}\r\n\t\t\tfor (var j = dimension - 7; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tformatInfoBits = this.copyBit(8, j, formatInfoBits);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tthis.parsedFormatInfo = FormatInformation.decodeFormatInformation(formatInfoBits);\r\n\t\t\tif (this.parsedFormatInfo != null)\r\n\t\t\t{\r\n\t\t\t\treturn this.parsedFormatInfo;\r\n\t\t\t}\r\n\t\t\tthrow \"Error readFormatInformation\";\t\r\n\t}\r\n\tthis.readVersion=function()\r\n\t\t{\r\n\t\t\t\r\n\t\t\tif (this.parsedVersion != null)\r\n\t\t\t{\r\n\t\t\t\treturn this.parsedVersion;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar dimension = this.bitMatrix.Dimension;\r\n\t\t\t\r\n\t\t\tvar provisionalVersion = (dimension - 17) >> 2;\r\n\t\t\tif (provisionalVersion <= 6)\r\n\t\t\t{\r\n\t\t\t\treturn Version.getVersionForNumber(provisionalVersion);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Read top-right version info: 3 wide by 6 tall\r\n\t\t\tvar versionBits = 0;\r\n\t\t\tvar ijMin = dimension - 11;\r\n\t\t\tfor (var j = 5; j >= 0; j--)\r\n\t\t\t{\r\n\t\t\t\tfor (var i = dimension - 9; i >= ijMin; i--)\r\n\t\t\t\t{\r\n\t\t\t\t\tversionBits = this.copyBit(i, j, versionBits);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tthis.parsedVersion = Version.decodeVersionInformation(versionBits);\r\n\t\t\tif (this.parsedVersion != null && this.parsedVersion.DimensionForVersion == dimension)\r\n\t\t\t{\r\n\t\t\t\treturn this.parsedVersion;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Hmm, failed. Try bottom left: 6 wide by 3 tall\r\n\t\t\tversionBits = 0;\r\n\t\t\tfor (var i = 5; i >= 0; i--)\r\n\t\t\t{\r\n\t\t\t\tfor (var j = dimension - 9; j >= ijMin; j--)\r\n\t\t\t\t{\r\n\t\t\t\t\tversionBits = this.copyBit(i, j, versionBits);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tthis.parsedVersion = Version.decodeVersionInformation(versionBits);\r\n\t\t\tif (this.parsedVersion != null && this.parsedVersion.DimensionForVersion == dimension)\r\n\t\t\t{\r\n\t\t\t\treturn this.parsedVersion;\r\n\t\t\t}\r\n\t\t\tthrow \"Error readVersion\";\r\n\t\t}\r\n\tthis.readCodewords=function()\r\n\t\t{\r\n\t\t\t\r\n\t\t\tvar formatInfo = this.readFormatInformation();\r\n\t\t\tvar version = this.readVersion();\r\n\t\t\t\r\n\t\t\t// Get the data mask for the format used in this QR Code. This will exclude\r\n\t\t\t// some bits from reading as we wind through the bit matrix.\r\n\t\t\tvar dataMask = DataMask.forReference( formatInfo.DataMask);\r\n\t\t\tvar dimension = this.bitMatrix.Dimension;\r\n\t\t\tdataMask.unmaskBitMatrix(this.bitMatrix, dimension);\r\n\t\t\t\r\n\t\t\tvar functionPattern = version.buildFunctionPattern();\r\n\t\t\t\r\n\t\t\tvar readingUp = true;\r\n\t\t\tvar result = new Array(version.TotalCodewords);\r\n\t\t\tvar resultOffset = 0;\r\n\t\t\tvar currentByte = 0;\r\n\t\t\tvar bitsRead = 0;\r\n\t\t\t// Read columns in pairs, from right to left\r\n\t\t\tfor (var j = dimension - 1; j > 0; j -= 2)\r\n\t\t\t{\r\n\t\t\t\tif (j == 6)\r\n\t\t\t\t{\r\n\t\t\t\t\t// Skip whole column with vertical alignment pattern;\r\n\t\t\t\t\t// saves time and makes the other code proceed more cleanly\r\n\t\t\t\t\tj--;\r\n\t\t\t\t}\r\n\t\t\t\t// Read alternatingly from bottom to top then top to bottom\r\n\t\t\t\tfor (var count = 0; count < dimension; count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar i = readingUp?dimension - 1 - count:count;\r\n\t\t\t\t\tfor (var col = 0; col < 2; col++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// Ignore bits covered by the function pattern\r\n\t\t\t\t\t\tif (!functionPattern.get_Renamed(j - col, i))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t// Read a bit\r\n\t\t\t\t\t\t\tbitsRead++;\r\n\t\t\t\t\t\t\tcurrentByte <<= 1;\r\n\t\t\t\t\t\t\tif (this.bitMatrix.get_Renamed(j - col, i))\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tcurrentByte |= 1;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t// If we've made a whole byte, save it off\r\n\t\t\t\t\t\t\tif (bitsRead == 8)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tresult[resultOffset++] = currentByte;\r\n\t\t\t\t\t\t\t\tbitsRead = 0;\r\n\t\t\t\t\t\t\t\tcurrentByte = 0;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\treadingUp ^= true; // readingUp = !readingUp; // switch directions\r\n\t\t\t}\r\n\t\t\tif (resultOffset != version.TotalCodewords)\r\n\t\t\t{\r\n\t\t\t\tthrow \"Error readCodewords\";\r\n\t\t\t}\r\n\t\t\treturn result;\r\n\t\t}\r\n}","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nDataMask = {};\r\n\r\nDataMask.forReference = function(reference)\r\n{\r\n\tif (reference < 0 || reference > 7)\r\n\t{\r\n\t\tthrow \"System.ArgumentException\";\r\n\t}\r\n\treturn DataMask.DATA_MASKS[reference];\r\n}\r\n\r\nfunction DataMask000()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\treturn ((i + j) & 0x01) == 0;\r\n\t}\r\n}\r\n\r\nfunction DataMask001()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\treturn (i & 0x01) == 0;\r\n\t}\r\n}\r\n\r\nfunction DataMask010()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\treturn j % 3 == 0;\r\n\t}\r\n}\r\n\r\nfunction DataMask011()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\treturn (i + j) % 3 == 0;\r\n\t}\r\n}\r\n\r\nfunction DataMask100()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\treturn (((URShift(i, 1)) + (j / 3)) & 0x01) == 0;\r\n\t}\r\n}\r\n\r\nfunction DataMask101()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\tvar temp = i * j;\r\n\t\treturn (temp & 0x01) + (temp % 3) == 0;\r\n\t}\r\n}\r\n\r\nfunction DataMask110()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\tvar temp = i * j;\r\n\t\treturn (((temp & 0x01) + (temp % 3)) & 0x01) == 0;\r\n\t}\r\n}\r\nfunction DataMask111()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\treturn ((((i + j) & 0x01) + ((i * j) % 3)) & 0x01) == 0;\r\n\t}\r\n}\r\n\r\nDataMask.DATA_MASKS = new Array(new DataMask000(), new DataMask001(), new DataMask010(), new DataMask011(), new DataMask100(), new DataMask101(), new DataMask110(), new DataMask111());\r\n\r\n","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction ReedSolomonDecoder(field)\r\n{\r\n\tthis.field = field;\r\n\tthis.decode=function(received, twoS)\r\n\t{\r\n\t\t\tvar poly = new GF256Poly(this.field, received);\r\n\t\t\tvar syndromeCoefficients = new Array(twoS);\r\n\t\t\tfor(var i=0;i= b's\r\n\t\t\tif (a.Degree < b.Degree)\r\n\t\t\t{\r\n\t\t\t\tvar temp = a;\r\n\t\t\t\ta = b;\r\n\t\t\t\tb = temp;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar rLast = a;\r\n\t\t\tvar r = b;\r\n\t\t\tvar sLast = this.field.One;\r\n\t\t\tvar s = this.field.Zero;\r\n\t\t\tvar tLast = this.field.Zero;\r\n\t\t\tvar t = this.field.One;\r\n\t\t\t\r\n\t\t\t// Run Euclidean algorithm until r's degree is less than R/2\r\n\t\t\twhile (r.Degree >= Math.floor(R / 2))\r\n\t\t\t{\r\n\t\t\t\tvar rLastLast = rLast;\r\n\t\t\t\tvar sLastLast = sLast;\r\n\t\t\t\tvar tLastLast = tLast;\r\n\t\t\t\trLast = r;\r\n\t\t\t\tsLast = s;\r\n\t\t\t\ttLast = t;\r\n\t\t\t\t\r\n\t\t\t\t// Divide rLastLast by rLast, with quotient in q and remainder in r\r\n\t\t\t\tif (rLast.Zero)\r\n\t\t\t\t{\r\n\t\t\t\t\t// Oops, Euclidean algorithm already terminated?\r\n\t\t\t\t\tthrow \"r_{i-1} was zero\";\r\n\t\t\t\t}\r\n\t\t\t\tr = rLastLast;\r\n\t\t\t\tvar q = this.field.Zero;\r\n\t\t\t\tvar denominatorLeadingTerm = rLast.getCoefficient(rLast.Degree);\r\n\t\t\t\tvar dltInverse = this.field.inverse(denominatorLeadingTerm);\r\n\t\t\t\twhile (r.Degree >= rLast.Degree && !r.Zero)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar degreeDiff = r.Degree - rLast.Degree;\r\n\t\t\t\t\tvar scale = this.field.multiply(r.getCoefficient(r.Degree), dltInverse);\r\n\t\t\t\t\tq = q.addOrSubtract(this.field.buildMonomial(degreeDiff, scale));\r\n\t\t\t\t\tr = r.addOrSubtract(rLast.multiplyByMonomial(degreeDiff, scale));\r\n\t\t\t\t\t//r.EXE();\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\ts = q.multiply1(sLast).addOrSubtract(sLastLast);\r\n\t\t\t\tt = q.multiply1(tLast).addOrSubtract(tLastLast);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar sigmaTildeAtZero = t.getCoefficient(0);\r\n\t\t\tif (sigmaTildeAtZero == 0)\r\n\t\t\t{\r\n\t\t\t\tthrow \"ReedSolomonException sigmaTilde(0) was zero\";\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar inverse = this.field.inverse(sigmaTildeAtZero);\r\n\t\t\tvar sigma = t.multiply2(inverse);\r\n\t\t\tvar omega = r.multiply2(inverse);\r\n\t\t\treturn new Array(sigma, omega);\r\n\t\t}\r\n\tthis.findErrorLocations=function( errorLocator)\r\n\t\t{\r\n\t\t\t// This is a direct application of Chien's search\r\n\t\t\tvar numErrors = errorLocator.Degree;\r\n\t\t\tif (numErrors == 1)\r\n\t\t\t{\r\n\t\t\t\t// shortcut\r\n\t\t\t\treturn new Array(errorLocator.getCoefficient(1));\r\n\t\t\t}\r\n\t\t\tvar result = new Array(numErrors);\r\n\t\t\tvar e = 0;\r\n\t\t\tfor (var i = 1; i < 256 && e < numErrors; i++)\r\n\t\t\t{\r\n\t\t\t\tif (errorLocator.evaluateAt(i) == 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tresult[e] = this.field.inverse(i);\r\n\t\t\t\t\te++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (e != numErrors)\r\n\t\t\t{\r\n\t\t\t\tthrow \"Error locator degree does not match number of roots\";\r\n\t\t\t}\r\n\t\t\treturn result;\r\n\t\t}\r\n\tthis.findErrorMagnitudes=function( errorEvaluator, errorLocations, dataMatrix)\r\n\t\t{\r\n\t\t\t// This is directly applying Forney's Formula\r\n\t\t\tvar s = errorLocations.length;\r\n\t\t\tvar result = new Array(s);\r\n\t\t\tfor (var i = 0; i < s; i++)\r\n\t\t\t{\r\n\t\t\t\tvar xiInverse = this.field.inverse(errorLocations[i]);\r\n\t\t\t\tvar denominator = 1;\r\n\t\t\t\tfor (var j = 0; j < s; j++)\r\n\t\t\t\t{\r\n\t\t\t\t\tif (i != j)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tdenominator = this.field.multiply(denominator, GF256.addOrSubtract(1, this.field.multiply(errorLocations[j], xiInverse)));\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tresult[i] = this.field.multiply(errorEvaluator.evaluateAt(xiInverse), this.field.inverse(denominator));\r\n\t\t\t\t// Thanks to sanfordsquires for this fix:\r\n\t\t\t\tif (dataMatrix)\r\n\t\t\t\t{\r\n\t\t\t\t\tresult[i] = this.field.multiply(result[i], xiInverse);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn result;\r\n\t\t}\r\n}","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction GF256Poly(field, coefficients)\r\n{\r\n\tif (coefficients == null || coefficients.length == 0)\r\n\t{\r\n\t\tthrow \"System.ArgumentException\";\r\n\t}\r\n\tthis.field = field;\r\n\tvar coefficientsLength = coefficients.length;\r\n\tif (coefficientsLength > 1 && coefficients[0] == 0)\r\n\t{\r\n\t\t// Leading term must be non-zero for anything except the constant polynomial \"0\"\r\n\t\tvar firstNonZero = 1;\r\n\t\twhile (firstNonZero < coefficientsLength && coefficients[firstNonZero] == 0)\r\n\t\t{\r\n\t\t\tfirstNonZero++;\r\n\t\t}\r\n\t\tif (firstNonZero == coefficientsLength)\r\n\t\t{\r\n\t\t\tthis.coefficients = field.Zero.coefficients;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.coefficients = new Array(coefficientsLength - firstNonZero);\r\n\t\t\tfor(var i=0;i largerCoefficients.length)\r\n\t\t\t{\r\n\t\t\t\tvar temp = smallerCoefficients;\r\n\t\t\t\tsmallerCoefficients = largerCoefficients;\r\n\t\t\t\tlargerCoefficients = temp;\r\n\t\t\t}\r\n\t\t\tvar sumDiff = new Array(largerCoefficients.length);\r\n\t\t\tvar lengthDiff = largerCoefficients.length - smallerCoefficients.length;\r\n\t\t\t// Copy high-order terms only found in higher-degree polynomial's coefficients\r\n\t\t\t//Array.Copy(largerCoefficients, 0, sumDiff, 0, lengthDiff);\r\n\t\t\tfor(var ci=0;ci= other.Degree && !remainder.Zero)\r\n\t\t\t{\r\n\t\t\t\tvar degreeDifference = remainder.Degree - other.Degree;\r\n\t\t\t\tvar scale = this.field.multiply(remainder.getCoefficient(remainder.Degree), inverseDenominatorLeadingTerm);\r\n\t\t\t\tvar term = other.multiplyByMonomial(degreeDifference, scale);\r\n\t\t\t\tvar iterationQuotient = this.field.buildMonomial(degreeDifference, scale);\r\n\t\t\t\tquotient = quotient.addOrSubtract(iterationQuotient);\r\n\t\t\t\tremainder = remainder.addOrSubtract(term);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn new Array(quotient, remainder);\r\n\t\t}\r\n}","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction GF256( primitive)\r\n{\r\n\tthis.expTable = new Array(256);\r\n\tthis.logTable = new Array(256);\r\n\tvar x = 1;\r\n\tfor (var i = 0; i < 256; i++)\r\n\t{\r\n\t\tthis.expTable[i] = x;\r\n\t\tx <<= 1; // x = x * 2; we're assuming the generator alpha is 2\r\n\t\tif (x >= 0x100)\r\n\t\t{\r\n\t\t\tx ^= primitive;\r\n\t\t}\r\n\t}\r\n\tfor (var i = 0; i < 255; i++)\r\n\t{\r\n\t\tthis.logTable[this.expTable[i]] = i;\r\n\t}\r\n\t// logTable[0] == 0 but this should never be used\r\n\tvar at0=new Array(1);at0[0]=0;\r\n\tthis.zero = new GF256Poly(this, new Array(at0));\r\n\tvar at1=new Array(1);at1[0]=1;\r\n\tthis.one = new GF256Poly(this, new Array(at1));\r\n\t\r\n\tthis.__defineGetter__(\"Zero\", function()\r\n\t{\r\n\t\treturn this.zero;\r\n\t});\r\n\tthis.__defineGetter__(\"One\", function()\r\n\t{\r\n\t\treturn this.one;\r\n\t});\r\n\tthis.buildMonomial=function( degree, coefficient)\r\n\t\t{\r\n\t\t\tif (degree < 0)\r\n\t\t\t{\r\n\t\t\t\tthrow \"System.ArgumentException\";\r\n\t\t\t}\r\n\t\t\tif (coefficient == 0)\r\n\t\t\t{\r\n\t\t\t\treturn zero;\r\n\t\t\t}\r\n\t\t\tvar coefficients = new Array(degree + 1);\r\n\t\t\tfor(var i=0;iqrcode.maxImgSize)\r\n {\r\n var ir = image.width / image.height;\r\n nheight = Math.sqrt(qrcode.maxImgSize/ir);\r\n nwidth=ir*nheight;\r\n }\r\n\r\n canvas_qr.width = nwidth;\r\n canvas_qr.height = nheight;\r\n\r\n context.drawImage(image, 0, 0, canvas_qr.width, canvas_qr.height );\r\n qrcode.width = canvas_qr.width;\r\n qrcode.height = canvas_qr.height;\r\n try{\r\n qrcode.imagedata = context.getImageData(0, 0, canvas_qr.width, canvas_qr.height);\r\n }catch(e){\r\n qrcode.result = \"Cross domain image reading not supported in your browser! Save it to your computer then drag and drop the file!\";\r\n if(qrcode.callback!=null)\r\n qrcode.callback(qrcode.result);\r\n return;\r\n }\r\n\r\n try\r\n {\r\n qrcode.result = qrcode.process(context);\r\n }\r\n catch(e)\r\n {\r\n console.log(e);\r\n qrcode.result = \"error decoding QR Code\";\r\n }\r\n if(qrcode.callback!=null)\r\n qrcode.callback(qrcode.result);\r\n }\r\n image.src = src;\r\n }\r\n}\r\n\r\nqrcode.isUrl = function(s)\r\n{\r\n var regexp = /(ftp|http|https):\\/\\/(\\w+:{0,1}\\w*@)?(\\S+)(:[0-9]+)?(\\/|\\/([\\w#!:.?+=&%@!\\-\\/]))?/;\r\n return regexp.test(s);\r\n}\r\n\r\nqrcode.decode_url = function (s)\r\n{\r\n var escaped = \"\";\r\n try{\r\n escaped = escape( s );\r\n }\r\n catch(e)\r\n {\r\n console.log(e);\r\n escaped = s;\r\n }\r\n var ret = \"\";\r\n try{\r\n ret = decodeURIComponent( escaped );\r\n }\r\n catch(e)\r\n {\r\n console.log(e);\r\n ret = escaped;\r\n }\r\n return ret;\r\n}\r\n\r\nqrcode.decode_utf8 = function ( s )\r\n{\r\n if(qrcode.isUrl(s))\r\n return qrcode.decode_url(s);\r\n else\r\n return s;\r\n}\r\n\r\nqrcode.process = function(ctx){\r\n\r\n var start = new Date().getTime();\r\n\r\n var image = qrcode.grayScaleToBitmap(qrcode.grayscale());\r\n //var image = qrcode.binarize(128);\r\n\r\n if(qrcode.debug)\r\n {\r\n for (var y = 0; y < qrcode.height; y++)\r\n {\r\n for (var x = 0; x < qrcode.width; x++)\r\n {\r\n var point = (x * 4) + (y * qrcode.width * 4);\r\n qrcode.imagedata.data[point] = image[x+y*qrcode.width]?0:0;\r\n qrcode.imagedata.data[point+1] = image[x+y*qrcode.width]?0:0;\r\n qrcode.imagedata.data[point+2] = image[x+y*qrcode.width]?255:0;\r\n }\r\n }\r\n ctx.putImageData(qrcode.imagedata, 0, 0);\r\n }\r\n\r\n //var finderPatternInfo = new FinderPatternFinder().findFinderPattern(image);\r\n\r\n var detector = new Detector(image);\r\n\r\n var qRCodeMatrix = detector.detect();\r\n\r\n /*for (var y = 0; y < qRCodeMatrix.bits.Height; y++)\r\n {\r\n for (var x = 0; x < qRCodeMatrix.bits.Width; x++)\r\n {\r\n var point = (x * 4*2) + (y*2 * qrcode.width * 4);\r\n qrcode.imagedata.data[point] = qRCodeMatrix.bits.get_Renamed(x,y)?0:0;\r\n qrcode.imagedata.data[point+1] = qRCodeMatrix.bits.get_Renamed(x,y)?0:0;\r\n qrcode.imagedata.data[point+2] = qRCodeMatrix.bits.get_Renamed(x,y)?255:0;\r\n }\r\n }*/\r\n if(qrcode.debug)\r\n ctx.putImageData(qrcode.imagedata, 0, 0);\r\n\r\n var reader = Decoder.decode(qRCodeMatrix.bits);\r\n var data = reader.DataByte;\r\n var str=\"\";\r\n for(var i=0;i minmax[ax][ay][1])\r\n minmax[ax][ay][1] = target;\r\n }\r\n }\r\n //minmax[ax][ay][0] = (minmax[ax][ay][0] + minmax[ax][ay][1]) / 2;\r\n }\r\n }\r\n var middle = new Array(numSqrtArea);\r\n for (var i3 = 0; i3 < numSqrtArea; i3++)\r\n {\r\n middle[i3] = new Array(numSqrtArea);\r\n }\r\n for (var ay = 0; ay < numSqrtArea; ay++)\r\n {\r\n for (var ax = 0; ax < numSqrtArea; ax++)\r\n {\r\n middle[ax][ay] = Math.floor((minmax[ax][ay][0] + minmax[ax][ay][1]) / 2);\r\n //Console.out.print(middle[ax][ay] + \",\");\r\n }\r\n //Console.out.println(\"\");\r\n }\r\n //Console.out.println(\"\");\r\n\r\n return middle;\r\n}\r\n\r\nqrcode.grayScaleToBitmap=function(grayScale)\r\n{\r\n var middle = qrcode.getMiddleBrightnessPerArea(grayScale);\r\n var sqrtNumArea = middle.length;\r\n var areaWidth = Math.floor(qrcode.width / sqrtNumArea);\r\n var areaHeight = Math.floor(qrcode.height / sqrtNumArea);\r\n var bitmap = new Array(qrcode.height*qrcode.width);\r\n\r\n for (var ay = 0; ay < sqrtNumArea; ay++)\r\n {\r\n for (var ax = 0; ax < sqrtNumArea; ax++)\r\n {\r\n for (var dy = 0; dy < areaHeight; dy++)\r\n {\r\n for (var dx = 0; dx < areaWidth; dx++)\r\n {\r\n bitmap[areaWidth * ax + dx+ (areaHeight * ay + dy)*qrcode.width] = (grayScale[areaWidth * ax + dx+ (areaHeight * ay + dy)*qrcode.width] < middle[ax][ay])?true:false;\r\n }\r\n }\r\n }\r\n }\r\n return bitmap;\r\n}\r\n\r\nqrcode.grayscale = function(){\r\n var ret = new Array(qrcode.width*qrcode.height);\r\n for (var y = 0; y < qrcode.height; y++)\r\n {\r\n for (var x = 0; x < qrcode.width; x++)\r\n {\r\n var gray = qrcode.getPixel(x, y);\r\n\r\n ret[x+y*qrcode.width] = gray;\r\n }\r\n }\r\n return ret;\r\n}\r\n\r\n\r\n\r\n\r\nfunction URShift( number, bits)\r\n{\r\n if (number >= 0)\r\n return number >> bits;\r\n else\r\n return (number >> bits) + (2 << ~bits);\r\n}\r\n\r\n\r\nArray.prototype.remove = function(from, to) {\r\n var rest = this.slice((to || from) + 1 || this.length);\r\n this.length = from < 0 ? this.length + from : from;\r\n return this.push.apply(this, rest);\r\n};\r\n","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nvar MIN_SKIP = 3;\r\nvar MAX_MODULES = 57;\r\nvar INTEGER_MATH_SHIFT = 8;\r\nvar CENTER_QUORUM = 2;\r\n\r\nqrcode.orderBestPatterns=function(patterns)\r\n\t\t{\r\n\t\t\t\r\n\t\t\tfunction distance( pattern1, pattern2)\r\n\t\t\t{\r\n\t\t\t\txDiff = pattern1.X - pattern2.X;\r\n\t\t\t\tyDiff = pattern1.Y - pattern2.Y;\r\n\t\t\t\treturn Math.sqrt( (xDiff * xDiff + yDiff * yDiff));\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t/// Returns the z component of the cross product between vectors BC and BA.\r\n\t\t\tfunction crossProductZ( pointA, pointB, pointC)\r\n\t\t\t{\r\n\t\t\t\tvar bX = pointB.x;\r\n\t\t\t\tvar bY = pointB.y;\r\n\t\t\t\treturn ((pointC.x - bX) * (pointA.y - bY)) - ((pointC.y - bY) * (pointA.x - bX));\r\n\t\t\t}\r\n\r\n\t\t\t\r\n\t\t\t// Find distances between pattern centers\r\n\t\t\tvar zeroOneDistance = distance(patterns[0], patterns[1]);\r\n\t\t\tvar oneTwoDistance = distance(patterns[1], patterns[2]);\r\n\t\t\tvar zeroTwoDistance = distance(patterns[0], patterns[2]);\r\n\t\t\t\r\n\t\t\tvar pointA, pointB, pointC;\r\n\t\t\t// Assume one closest to other two is B; A and C will just be guesses at first\r\n\t\t\tif (oneTwoDistance >= zeroOneDistance && oneTwoDistance >= zeroTwoDistance)\r\n\t\t\t{\r\n\t\t\t\tpointB = patterns[0];\r\n\t\t\t\tpointA = patterns[1];\r\n\t\t\t\tpointC = patterns[2];\r\n\t\t\t}\r\n\t\t\telse if (zeroTwoDistance >= oneTwoDistance && zeroTwoDistance >= zeroOneDistance)\r\n\t\t\t{\r\n\t\t\t\tpointB = patterns[1];\r\n\t\t\t\tpointA = patterns[0];\r\n\t\t\t\tpointC = patterns[2];\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tpointB = patterns[2];\r\n\t\t\t\tpointA = patterns[0];\r\n\t\t\t\tpointC = patterns[1];\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Use cross product to figure out whether A and C are correct or flipped.\r\n\t\t\t// This asks whether BC x BA has a positive z component, which is the arrangement\r\n\t\t\t// we want for A, B, C. If it's negative, then we've got it flipped around and\r\n\t\t\t// should swap A and C.\r\n\t\t\tif (crossProductZ(pointA, pointB, pointC) < 0.0)\r\n\t\t\t{\r\n\t\t\t\tvar temp = pointA;\r\n\t\t\t\tpointA = pointC;\r\n\t\t\t\tpointC = temp;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tpatterns[0] = pointA;\r\n\t\t\tpatterns[1] = pointB;\r\n\t\t\tpatterns[2] = pointC;\r\n\t\t}\r\n\r\n\r\nfunction FinderPattern(posX, posY, estimatedModuleSize)\r\n{\r\n\tthis.x=posX;\r\n\tthis.y=posY;\r\n\tthis.count = 1;\r\n\tthis.estimatedModuleSize = estimatedModuleSize;\r\n\t\r\n\tthis.__defineGetter__(\"EstimatedModuleSize\", function()\r\n\t{\r\n\t\treturn this.estimatedModuleSize;\r\n\t}); \r\n\tthis.__defineGetter__(\"Count\", function()\r\n\t{\r\n\t\treturn this.count;\r\n\t});\r\n\tthis.__defineGetter__(\"X\", function()\r\n\t{\r\n\t\treturn this.x;\r\n\t});\r\n\tthis.__defineGetter__(\"Y\", function()\r\n\t{\r\n\t\treturn this.y;\r\n\t});\r\n\tthis.incrementCount = function()\r\n\t{\r\n\t\tthis.count++;\r\n\t}\r\n\tthis.aboutEquals=function( moduleSize, i, j)\r\n\t\t{\r\n\t\t\tif (Math.abs(i - this.y) <= moduleSize && Math.abs(j - this.x) <= moduleSize)\r\n\t\t\t{\r\n\t\t\t\tvar moduleSizeDiff = Math.abs(moduleSize - this.estimatedModuleSize);\r\n\t\t\t\treturn moduleSizeDiff <= 1.0 || moduleSizeDiff / this.estimatedModuleSize <= 1.0;\r\n\t\t\t}\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\r\n}\r\n\r\nfunction FinderPatternInfo(patternCenters)\r\n{\r\n\tthis.bottomLeft = patternCenters[0];\r\n\tthis.topLeft = patternCenters[1];\r\n\tthis.topRight = patternCenters[2];\r\n\tthis.__defineGetter__(\"BottomLeft\", function()\r\n\t{\r\n\t\treturn this.bottomLeft;\r\n\t}); \r\n\tthis.__defineGetter__(\"TopLeft\", function()\r\n\t{\r\n\t\treturn this.topLeft;\r\n\t}); \r\n\tthis.__defineGetter__(\"TopRight\", function()\r\n\t{\r\n\t\treturn this.topRight;\r\n\t}); \r\n}\r\n\r\nfunction FinderPatternFinder()\r\n{\r\n\tthis.image=null;\r\n\tthis.possibleCenters = [];\r\n\tthis.hasSkipped = false;\r\n\tthis.crossCheckStateCount = new Array(0,0,0,0,0);\r\n\tthis.resultPointCallback = null;\r\n\t\r\n\tthis.__defineGetter__(\"CrossCheckStateCount\", function()\r\n\t{\r\n\t\tthis.crossCheckStateCount[0] = 0;\r\n\t\tthis.crossCheckStateCount[1] = 0;\r\n\t\tthis.crossCheckStateCount[2] = 0;\r\n\t\tthis.crossCheckStateCount[3] = 0;\r\n\t\tthis.crossCheckStateCount[4] = 0;\r\n\t\treturn this.crossCheckStateCount;\r\n\t}); \r\n\t\r\n\tthis.foundPatternCross=function( stateCount)\r\n\t\t{\r\n\t\t\tvar totalModuleSize = 0;\r\n\t\t\tfor (var i = 0; i < 5; i++)\r\n\t\t\t{\r\n\t\t\t\tvar count = stateCount[i];\r\n\t\t\t\tif (count == 0)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t\ttotalModuleSize += count;\r\n\t\t\t}\r\n\t\t\tif (totalModuleSize < 7)\r\n\t\t\t{\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\tvar moduleSize = Math.floor((totalModuleSize << INTEGER_MATH_SHIFT) / 7);\r\n\t\t\tvar maxVariance = Math.floor(moduleSize / 2);\r\n\t\t\t// Allow less than 50% variance from 1-1-3-1-1 proportions\r\n\t\t\treturn Math.abs(moduleSize - (stateCount[0] << INTEGER_MATH_SHIFT)) < maxVariance && Math.abs(moduleSize - (stateCount[1] << INTEGER_MATH_SHIFT)) < maxVariance && Math.abs(3 * moduleSize - (stateCount[2] << INTEGER_MATH_SHIFT)) < 3 * maxVariance && Math.abs(moduleSize - (stateCount[3] << INTEGER_MATH_SHIFT)) < maxVariance && Math.abs(moduleSize - (stateCount[4] << INTEGER_MATH_SHIFT)) < maxVariance;\r\n\t\t}\r\n\tthis.centerFromEnd=function( stateCount, end)\r\n\t\t{\r\n\t\t\treturn (end - stateCount[4] - stateCount[3]) - stateCount[2] / 2.0;\r\n\t\t}\r\n\tthis.crossCheckVertical=function( startI, centerJ, maxCount, originalStateCountTotal)\r\n\t\t{\r\n\t\t\tvar image = this.image;\r\n\t\t\t\r\n\t\t\tvar maxI = qrcode.height;\r\n\t\t\tvar stateCount = this.CrossCheckStateCount;\r\n\t\t\t\r\n\t\t\t// Start counting up from center\r\n\t\t\tvar i = startI;\r\n\t\t\twhile (i >= 0 && image[centerJ + i*qrcode.width])\r\n\t\t\t{\r\n\t\t\t\tstateCount[2]++;\r\n\t\t\t\ti--;\r\n\t\t\t}\r\n\t\t\tif (i < 0)\r\n\t\t\t{\r\n\t\t\t\treturn NaN;\r\n\t\t\t}\r\n\t\t\twhile (i >= 0 && !image[centerJ +i*qrcode.width] && stateCount[1] <= maxCount)\r\n\t\t\t{\r\n\t\t\t\tstateCount[1]++;\r\n\t\t\t\ti--;\r\n\t\t\t}\r\n\t\t\t// If already too many modules in this state or ran off the edge:\r\n\t\t\tif (i < 0 || stateCount[1] > maxCount)\r\n\t\t\t{\r\n\t\t\t\treturn NaN;\r\n\t\t\t}\r\n\t\t\twhile (i >= 0 && image[centerJ + i*qrcode.width] && stateCount[0] <= maxCount)\r\n\t\t\t{\r\n\t\t\t\tstateCount[0]++;\r\n\t\t\t\ti--;\r\n\t\t\t}\r\n\t\t\tif (stateCount[0] > maxCount)\r\n\t\t\t{\r\n\t\t\t\treturn NaN;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Now also count down from center\r\n\t\t\ti = startI + 1;\r\n\t\t\twhile (i < maxI && image[centerJ +i*qrcode.width])\r\n\t\t\t{\r\n\t\t\t\tstateCount[2]++;\r\n\t\t\t\ti++;\r\n\t\t\t}\r\n\t\t\tif (i == maxI)\r\n\t\t\t{\r\n\t\t\t\treturn NaN;\r\n\t\t\t}\r\n\t\t\twhile (i < maxI && !image[centerJ + i*qrcode.width] && stateCount[3] < maxCount)\r\n\t\t\t{\r\n\t\t\t\tstateCount[3]++;\r\n\t\t\t\ti++;\r\n\t\t\t}\r\n\t\t\tif (i == maxI || stateCount[3] >= maxCount)\r\n\t\t\t{\r\n\t\t\t\treturn NaN;\r\n\t\t\t}\r\n\t\t\twhile (i < maxI && image[centerJ + i*qrcode.width] && stateCount[4] < maxCount)\r\n\t\t\t{\r\n\t\t\t\tstateCount[4]++;\r\n\t\t\t\ti++;\r\n\t\t\t}\r\n\t\t\tif (stateCount[4] >= maxCount)\r\n\t\t\t{\r\n\t\t\t\treturn NaN;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// If we found a finder-pattern-like section, but its size is more than 40% different than\r\n\t\t\t// the original, assume it's a false positive\r\n\t\t\tvar stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];\r\n\t\t\tif (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= 2 * originalStateCountTotal)\r\n\t\t\t{\r\n\t\t\t\treturn NaN;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn this.foundPatternCross(stateCount)?this.centerFromEnd(stateCount, i):NaN;\r\n\t\t}\r\n\tthis.crossCheckHorizontal=function( startJ, centerI, maxCount, originalStateCountTotal)\r\n\t\t{\r\n\t\t\tvar image = this.image;\r\n\t\t\t\r\n\t\t\tvar maxJ = qrcode.width;\r\n\t\t\tvar stateCount = this.CrossCheckStateCount;\r\n\t\t\t\r\n\t\t\tvar j = startJ;\r\n\t\t\twhile (j >= 0 && image[j+ centerI*qrcode.width])\r\n\t\t\t{\r\n\t\t\t\tstateCount[2]++;\r\n\t\t\t\tj--;\r\n\t\t\t}\r\n\t\t\tif (j < 0)\r\n\t\t\t{\r\n\t\t\t\treturn NaN;\r\n\t\t\t}\r\n\t\t\twhile (j >= 0 && !image[j+ centerI*qrcode.width] && stateCount[1] <= maxCount)\r\n\t\t\t{\r\n\t\t\t\tstateCount[1]++;\r\n\t\t\t\tj--;\r\n\t\t\t}\r\n\t\t\tif (j < 0 || stateCount[1] > maxCount)\r\n\t\t\t{\r\n\t\t\t\treturn NaN;\r\n\t\t\t}\r\n\t\t\twhile (j >= 0 && image[j+ centerI*qrcode.width] && stateCount[0] <= maxCount)\r\n\t\t\t{\r\n\t\t\t\tstateCount[0]++;\r\n\t\t\t\tj--;\r\n\t\t\t}\r\n\t\t\tif (stateCount[0] > maxCount)\r\n\t\t\t{\r\n\t\t\t\treturn NaN;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tj = startJ + 1;\r\n\t\t\twhile (j < maxJ && image[j+ centerI*qrcode.width])\r\n\t\t\t{\r\n\t\t\t\tstateCount[2]++;\r\n\t\t\t\tj++;\r\n\t\t\t}\r\n\t\t\tif (j == maxJ)\r\n\t\t\t{\r\n\t\t\t\treturn NaN;\r\n\t\t\t}\r\n\t\t\twhile (j < maxJ && !image[j+ centerI*qrcode.width] && stateCount[3] < maxCount)\r\n\t\t\t{\r\n\t\t\t\tstateCount[3]++;\r\n\t\t\t\tj++;\r\n\t\t\t}\r\n\t\t\tif (j == maxJ || stateCount[3] >= maxCount)\r\n\t\t\t{\r\n\t\t\t\treturn NaN;\r\n\t\t\t}\r\n\t\t\twhile (j < maxJ && image[j+ centerI*qrcode.width] && stateCount[4] < maxCount)\r\n\t\t\t{\r\n\t\t\t\tstateCount[4]++;\r\n\t\t\t\tj++;\r\n\t\t\t}\r\n\t\t\tif (stateCount[4] >= maxCount)\r\n\t\t\t{\r\n\t\t\t\treturn NaN;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// If we found a finder-pattern-like section, but its size is significantly different than\r\n\t\t\t// the original, assume it's a false positive\r\n\t\t\tvar stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];\r\n\t\t\tif (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= originalStateCountTotal)\r\n\t\t\t{\r\n\t\t\t\treturn NaN;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn this.foundPatternCross(stateCount)?this.centerFromEnd(stateCount, j):NaN;\r\n\t\t}\r\n\tthis.handlePossibleCenter=function( stateCount, i, j)\r\n\t\t{\r\n\t\t\tvar stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];\r\n\t\t\tvar centerJ = this.centerFromEnd(stateCount, j); //float\r\n\t\t\tvar centerI = this.crossCheckVertical(i, Math.floor( centerJ), stateCount[2], stateCountTotal); //float\r\n\t\t\tif (!isNaN(centerI))\r\n\t\t\t{\r\n\t\t\t\t// Re-cross check\r\n\t\t\t\tcenterJ = this.crossCheckHorizontal(Math.floor( centerJ), Math.floor( centerI), stateCount[2], stateCountTotal);\r\n\t\t\t\tif (!isNaN(centerJ))\r\n\t\t\t\t{\r\n\t\t\t\t\tvar estimatedModuleSize = stateCountTotal / 7.0;\r\n\t\t\t\t\tvar found = false;\r\n\t\t\t\t\tvar max = this.possibleCenters.length;\r\n\t\t\t\t\tfor (var index = 0; index < max; index++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar center = this.possibleCenters[index];\r\n\t\t\t\t\t\t// Look for about the same center and module size:\r\n\t\t\t\t\t\tif (center.aboutEquals(estimatedModuleSize, centerI, centerJ))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tcenter.incrementCount();\r\n\t\t\t\t\t\t\tfound = true;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (!found)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar point = new FinderPattern(centerJ, centerI, estimatedModuleSize);\r\n\t\t\t\t\t\tthis.possibleCenters.push(point);\r\n\t\t\t\t\t\tif (this.resultPointCallback != null)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tthis.resultPointCallback.foundPossibleResultPoint(point);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\tthis.selectBestPatterns=function()\r\n\t\t{\r\n\t\t\t\r\n\t\t\tvar startSize = this.possibleCenters.length;\r\n\t\t\tif (startSize < 3)\r\n\t\t\t{\r\n\t\t\t\t// Couldn't find enough finder patterns\r\n\t\t\t\tthrow \"Couldn't find enough finder patterns\";\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Filter outlier possibilities whose module size is too different\r\n\t\t\tif (startSize > 3)\r\n\t\t\t{\r\n\t\t\t\t// But we can only afford to do so if we have at least 4 possibilities to choose from\r\n\t\t\t\tvar totalModuleSize = 0.0;\r\n var square = 0.0;\r\n\t\t\t\tfor (var i = 0; i < startSize; i++)\r\n\t\t\t\t{\r\n\t\t\t\t\t//totalModuleSize += this.possibleCenters[i].EstimatedModuleSize;\r\n var\tcenterValue=this.possibleCenters[i].EstimatedModuleSize;\r\n\t\t\t\t\ttotalModuleSize += centerValue;\r\n\t\t\t\t\tsquare += (centerValue * centerValue);\r\n\t\t\t\t}\r\n\t\t\t\tvar average = totalModuleSize / startSize;\r\n this.possibleCenters.sort(function(center1,center2) {\r\n\t\t\t\t var dA=Math.abs(center2.EstimatedModuleSize - average);\r\n\t\t\t\t var dB=Math.abs(center1.EstimatedModuleSize - average);\r\n\t\t\t\t if (dA < dB) {\r\n\t\t\t\t \t return (-1);\r\n\t\t\t\t } else if (dA == dB) {\r\n\t\t\t\t \t return 0;\r\n\t\t\t\t } else {\r\n\t\t\t\t \t return 1;\r\n\t\t\t\t }\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\tvar stdDev = Math.sqrt(square / startSize - average * average);\r\n\t\t\t\tvar limit = Math.max(0.2 * average, stdDev);\r\n\t\t\t\tfor (var i = 0; i < this.possibleCenters.length && this.possibleCenters.length > 3; i++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar pattern = this.possibleCenters[i];\r\n\t\t\t\t\t//if (Math.abs(pattern.EstimatedModuleSize - average) > 0.2 * average)\r\n if (Math.abs(pattern.EstimatedModuleSize - average) > limit)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.possibleCenters.remove(i);\r\n\t\t\t\t\t\ti--;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (this.possibleCenters.length > 3)\r\n\t\t\t{\r\n\t\t\t\t// Throw away all but those first size candidate points we found.\r\n\t\t\t\tthis.possibleCenters.sort(function(a, b){\r\n\t\t\t\t\tif (a.count > b.count){return -1;}\r\n\t\t\t\t\tif (a.count < b.count){return 1;}\r\n\t\t\t\t\treturn 0;\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn new Array( this.possibleCenters[0], this.possibleCenters[1], this.possibleCenters[2]);\r\n\t\t}\r\n\t\t\r\n\tthis.findRowSkip=function()\r\n\t\t{\r\n\t\t\tvar max = this.possibleCenters.length;\r\n\t\t\tif (max <= 1)\r\n\t\t\t{\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\t\t\tvar firstConfirmedCenter = null;\r\n\t\t\tfor (var i = 0; i < max; i++)\r\n\t\t\t{\r\n\t\t\t\tvar center = this.possibleCenters[i];\r\n\t\t\t\tif (center.Count >= CENTER_QUORUM)\r\n\t\t\t\t{\r\n\t\t\t\t\tif (firstConfirmedCenter == null)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tfirstConfirmedCenter = center;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// We have two confirmed centers\r\n\t\t\t\t\t\t// How far down can we skip before resuming looking for the next\r\n\t\t\t\t\t\t// pattern? In the worst case, only the difference between the\r\n\t\t\t\t\t\t// difference in the x / y coordinates of the two centers.\r\n\t\t\t\t\t\t// This is the case where you find top left last.\r\n\t\t\t\t\t\tthis.hasSkipped = true;\r\n\t\t\t\t\t\treturn Math.floor ((Math.abs(firstConfirmedCenter.X - center.X) - Math.abs(firstConfirmedCenter.Y - center.Y)) / 2);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t\r\n\tthis.haveMultiplyConfirmedCenters=function()\r\n\t\t{\r\n\t\t\tvar confirmedCount = 0;\r\n\t\t\tvar totalModuleSize = 0.0;\r\n\t\t\tvar max = this.possibleCenters.length;\r\n\t\t\tfor (var i = 0; i < max; i++)\r\n\t\t\t{\r\n\t\t\t\tvar pattern = this.possibleCenters[i];\r\n\t\t\t\tif (pattern.Count >= CENTER_QUORUM)\r\n\t\t\t\t{\r\n\t\t\t\t\tconfirmedCount++;\r\n\t\t\t\t\ttotalModuleSize += pattern.EstimatedModuleSize;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (confirmedCount < 3)\r\n\t\t\t{\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\t// OK, we have at least 3 confirmed centers, but, it's possible that one is a \"false positive\"\r\n\t\t\t// and that we need to keep looking. We detect this by asking if the estimated module sizes\r\n\t\t\t// vary too much. We arbitrarily say that when the total deviation from average exceeds\r\n\t\t\t// 5% of the total module size estimates, it's too much.\r\n\t\t\tvar average = totalModuleSize / max;\r\n\t\t\tvar totalDeviation = 0.0;\r\n\t\t\tfor (var i = 0; i < max; i++)\r\n\t\t\t{\r\n\t\t\t\tpattern = this.possibleCenters[i];\r\n\t\t\t\ttotalDeviation += Math.abs(pattern.EstimatedModuleSize - average);\r\n\t\t\t}\r\n\t\t\treturn totalDeviation <= 0.05 * totalModuleSize;\r\n\t\t}\r\n\t\t\r\n\tthis.findFinderPattern = function(image){\r\n\t\tvar tryHarder = false;\r\n\t\tthis.image=image;\r\n\t\tvar maxI = qrcode.height;\r\n\t\tvar maxJ = qrcode.width;\r\n\t\tvar iSkip = Math.floor((3 * maxI) / (4 * MAX_MODULES));\r\n\t\tif (iSkip < MIN_SKIP || tryHarder)\r\n\t\t{\r\n\t\t\t\tiSkip = MIN_SKIP;\r\n\t\t}\r\n\t\t\r\n\t\tvar done = false;\r\n\t\tvar stateCount = new Array(5);\r\n\t\tfor (var i = iSkip - 1; i < maxI && !done; i += iSkip)\r\n\t\t{\r\n\t\t\t// Get a row of black/white values\r\n\t\t\tstateCount[0] = 0;\r\n\t\t\tstateCount[1] = 0;\r\n\t\t\tstateCount[2] = 0;\r\n\t\t\tstateCount[3] = 0;\r\n\t\t\tstateCount[4] = 0;\r\n\t\t\tvar currentState = 0;\r\n\t\t\tfor (var j = 0; j < maxJ; j++)\r\n\t\t\t{\r\n\t\t\t\tif (image[j+i*qrcode.width] )\r\n\t\t\t\t{\r\n\t\t\t\t\t// Black pixel\r\n\t\t\t\t\tif ((currentState & 1) == 1)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// Counting white pixels\r\n\t\t\t\t\t\tcurrentState++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tstateCount[currentState]++;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\t// White pixel\r\n\t\t\t\t\tif ((currentState & 1) == 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// Counting black pixels\r\n\t\t\t\t\t\tif (currentState == 4)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t// A winner?\r\n\t\t\t\t\t\t\tif (this.foundPatternCross(stateCount))\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t// Yes\r\n\t\t\t\t\t\t\t\tvar confirmed = this.handlePossibleCenter(stateCount, i, j);\r\n\t\t\t\t\t\t\t\tif (confirmed)\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t// Start examining every other line. Checking each line turned out to be too\r\n\t\t\t\t\t\t\t\t\t// expensive and didn't improve performance.\r\n\t\t\t\t\t\t\t\t\tiSkip = 2;\r\n\t\t\t\t\t\t\t\t\tif (this.hasSkipped)\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\tdone = this.haveMultiplyConfirmedCenters();\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\tvar rowSkip = this.findRowSkip();\r\n\t\t\t\t\t\t\t\t\t\tif (rowSkip > stateCount[2])\r\n\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\t// Skip rows between row of lower confirmed center\r\n\t\t\t\t\t\t\t\t\t\t\t// and top of presumed third confirmed center\r\n\t\t\t\t\t\t\t\t\t\t\t// but back up a bit to get a full chance of detecting\r\n\t\t\t\t\t\t\t\t\t\t\t// it, entire width of center of finder pattern\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t// Skip by rowSkip, but back off by stateCount[2] (size of last center\r\n\t\t\t\t\t\t\t\t\t\t\t// of pattern we saw) to be conservative, and also back off by iSkip which\r\n\t\t\t\t\t\t\t\t\t\t\t// is about to be re-added\r\n\t\t\t\t\t\t\t\t\t\t\ti += rowSkip - stateCount[2] - iSkip;\r\n\t\t\t\t\t\t\t\t\t\t\tj = maxJ - 1;\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t// Advance to next black pixel\r\n\t\t\t\t\t\t\t\t\tdo \r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\tj++;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\twhile (j < maxJ && !image[j + i*qrcode.width]);\r\n\t\t\t\t\t\t\t\t\tj--; // back up to that last white pixel\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t// Clear state to start looking again\r\n\t\t\t\t\t\t\t\tcurrentState = 0;\r\n\t\t\t\t\t\t\t\tstateCount[0] = 0;\r\n\t\t\t\t\t\t\t\tstateCount[1] = 0;\r\n\t\t\t\t\t\t\t\tstateCount[2] = 0;\r\n\t\t\t\t\t\t\t\tstateCount[3] = 0;\r\n\t\t\t\t\t\t\t\tstateCount[4] = 0;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t// No, shift counts back by two\r\n\t\t\t\t\t\t\t\tstateCount[0] = stateCount[2];\r\n\t\t\t\t\t\t\t\tstateCount[1] = stateCount[3];\r\n\t\t\t\t\t\t\t\tstateCount[2] = stateCount[4];\r\n\t\t\t\t\t\t\t\tstateCount[3] = 1;\r\n\t\t\t\t\t\t\t\tstateCount[4] = 0;\r\n\t\t\t\t\t\t\t\tcurrentState = 3;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tstateCount[++currentState]++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// Counting white pixels\r\n\t\t\t\t\t\tstateCount[currentState]++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (this.foundPatternCross(stateCount))\r\n\t\t\t{\r\n\t\t\t\tvar confirmed = this.handlePossibleCenter(stateCount, i, maxJ);\r\n\t\t\t\tif (confirmed)\r\n\t\t\t\t{\r\n\t\t\t\t\tiSkip = stateCount[0];\r\n\t\t\t\t\tif (this.hasSkipped)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// Found a third one\r\n\t\t\t\t\t\tdone = haveMultiplyConfirmedCenters();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tvar patternInfo = this.selectBestPatterns();\r\n\t\tqrcode.orderBestPatterns(patternInfo);\r\n\t\t\r\n\t\treturn new FinderPatternInfo(patternInfo);\r\n\t};\r\n}\r\n","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction AlignmentPattern(posX, posY, estimatedModuleSize)\r\n{\r\n\tthis.x=posX;\r\n\tthis.y=posY;\r\n\tthis.count = 1;\r\n\tthis.estimatedModuleSize = estimatedModuleSize;\r\n\t\r\n\tthis.__defineGetter__(\"EstimatedModuleSize\", function()\r\n\t{\r\n\t\treturn this.estimatedModuleSize;\r\n\t}); \r\n\tthis.__defineGetter__(\"Count\", function()\r\n\t{\r\n\t\treturn this.count;\r\n\t});\r\n\tthis.__defineGetter__(\"X\", function()\r\n\t{\r\n\t\treturn Math.floor(this.x);\r\n\t});\r\n\tthis.__defineGetter__(\"Y\", function()\r\n\t{\r\n\t\treturn Math.floor(this.y);\r\n\t});\r\n\tthis.incrementCount = function()\r\n\t{\r\n\t\tthis.count++;\r\n\t}\r\n\tthis.aboutEquals=function( moduleSize, i, j)\r\n\t\t{\r\n\t\t\tif (Math.abs(i - this.y) <= moduleSize && Math.abs(j - this.x) <= moduleSize)\r\n\t\t\t{\r\n\t\t\t\tvar moduleSizeDiff = Math.abs(moduleSize - this.estimatedModuleSize);\r\n\t\t\t\treturn moduleSizeDiff <= 1.0 || moduleSizeDiff / this.estimatedModuleSize <= 1.0;\r\n\t\t\t}\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\r\n}\r\n\r\nfunction AlignmentPatternFinder( image, startX, startY, width, height, moduleSize, resultPointCallback)\r\n{\r\n\tthis.image = image;\r\n\tthis.possibleCenters = new Array();\r\n\tthis.startX = startX;\r\n\tthis.startY = startY;\r\n\tthis.width = width;\r\n\tthis.height = height;\r\n\tthis.moduleSize = moduleSize;\r\n\tthis.crossCheckStateCount = new Array(0,0,0);\r\n\tthis.resultPointCallback = resultPointCallback;\r\n\t\r\n\tthis.centerFromEnd=function(stateCount, end)\r\n\t\t{\r\n\t\t\treturn (end - stateCount[2]) - stateCount[1] / 2.0;\r\n\t\t}\r\n\tthis.foundPatternCross = function(stateCount)\r\n\t\t{\r\n\t\t\tvar moduleSize = this.moduleSize;\r\n\t\t\tvar maxVariance = moduleSize / 2.0;\r\n\t\t\tfor (var i = 0; i < 3; i++)\r\n\t\t\t{\r\n\t\t\t\tif (Math.abs(moduleSize - stateCount[i]) >= maxVariance)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\tthis.crossCheckVertical=function( startI, centerJ, maxCount, originalStateCountTotal)\r\n\t\t{\r\n\t\t\tvar image = this.image;\r\n\t\t\t\r\n\t\t\tvar maxI = qrcode.height;\r\n\t\t\tvar stateCount = this.crossCheckStateCount;\r\n\t\t\tstateCount[0] = 0;\r\n\t\t\tstateCount[1] = 0;\r\n\t\t\tstateCount[2] = 0;\r\n\t\t\t\r\n\t\t\t// Start counting up from center\r\n\t\t\tvar i = startI;\r\n\t\t\twhile (i >= 0 && image[centerJ + i*qrcode.width] && stateCount[1] <= maxCount)\r\n\t\t\t{\r\n\t\t\t\tstateCount[1]++;\r\n\t\t\t\ti--;\r\n\t\t\t}\r\n\t\t\t// If already too many modules in this state or ran off the edge:\r\n\t\t\tif (i < 0 || stateCount[1] > maxCount)\r\n\t\t\t{\r\n\t\t\t\treturn NaN;\r\n\t\t\t}\r\n\t\t\twhile (i >= 0 && !image[centerJ + i*qrcode.width] && stateCount[0] <= maxCount)\r\n\t\t\t{\r\n\t\t\t\tstateCount[0]++;\r\n\t\t\t\ti--;\r\n\t\t\t}\r\n\t\t\tif (stateCount[0] > maxCount)\r\n\t\t\t{\r\n\t\t\t\treturn NaN;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Now also count down from center\r\n\t\t\ti = startI + 1;\r\n\t\t\twhile (i < maxI && image[centerJ + i*qrcode.width] && stateCount[1] <= maxCount)\r\n\t\t\t{\r\n\t\t\t\tstateCount[1]++;\r\n\t\t\t\ti++;\r\n\t\t\t}\r\n\t\t\tif (i == maxI || stateCount[1] > maxCount)\r\n\t\t\t{\r\n\t\t\t\treturn NaN;\r\n\t\t\t}\r\n\t\t\twhile (i < maxI && !image[centerJ + i*qrcode.width] && stateCount[2] <= maxCount)\r\n\t\t\t{\r\n\t\t\t\tstateCount[2]++;\r\n\t\t\t\ti++;\r\n\t\t\t}\r\n\t\t\tif (stateCount[2] > maxCount)\r\n\t\t\t{\r\n\t\t\t\treturn NaN;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2];\r\n\t\t\tif (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= 2 * originalStateCountTotal)\r\n\t\t\t{\r\n\t\t\t\treturn NaN;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn this.foundPatternCross(stateCount)?this.centerFromEnd(stateCount, i):NaN;\r\n\t\t}\r\n\t\t\r\n\tthis.handlePossibleCenter=function( stateCount, i, j)\r\n\t\t{\r\n\t\t\tvar stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2];\r\n\t\t\tvar centerJ = this.centerFromEnd(stateCount, j);\r\n\t\t\tvar centerI = this.crossCheckVertical(i, Math.floor (centerJ), 2 * stateCount[1], stateCountTotal);\r\n\t\t\tif (!isNaN(centerI))\r\n\t\t\t{\r\n\t\t\t\tvar estimatedModuleSize = (stateCount[0] + stateCount[1] + stateCount[2]) / 3.0;\r\n\t\t\t\tvar max = this.possibleCenters.length;\r\n\t\t\t\tfor (var index = 0; index < max; index++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar center = this.possibleCenters[index];\r\n\t\t\t\t\t// Look for about the same center and module size:\r\n\t\t\t\t\tif (center.aboutEquals(estimatedModuleSize, centerI, centerJ))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\treturn new AlignmentPattern(centerJ, centerI, estimatedModuleSize);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t// Hadn't found this before; save it\r\n\t\t\t\tvar point = new AlignmentPattern(centerJ, centerI, estimatedModuleSize);\r\n\t\t\t\tthis.possibleCenters.push(point);\r\n\t\t\t\tif (this.resultPointCallback != null)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.resultPointCallback.foundPossibleResultPoint(point);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\t\r\n\tthis.find = function()\r\n\t{\r\n\t\t\tvar startX = this.startX;\r\n\t\t\tvar height = this.height;\r\n\t\t\tvar maxJ = startX + width;\r\n\t\t\tvar middleI = startY + (height >> 1);\r\n\t\t\t// We are looking for black/white/black modules in 1:1:1 ratio;\r\n\t\t\t// this tracks the number of black/white/black modules seen so far\r\n\t\t\tvar stateCount = new Array(0,0,0);\r\n\t\t\tfor (var iGen = 0; iGen < height; iGen++)\r\n\t\t\t{\r\n\t\t\t\t// Search from middle outwards\r\n\t\t\t\tvar i = middleI + ((iGen & 0x01) == 0?((iGen + 1) >> 1):- ((iGen + 1) >> 1));\r\n\t\t\t\tstateCount[0] = 0;\r\n\t\t\t\tstateCount[1] = 0;\r\n\t\t\t\tstateCount[2] = 0;\r\n\t\t\t\tvar j = startX;\r\n\t\t\t\t// Burn off leading white pixels before anything else; if we start in the middle of\r\n\t\t\t\t// a white run, it doesn't make sense to count its length, since we don't know if the\r\n\t\t\t\t// white run continued to the left of the start point\r\n\t\t\t\twhile (j < maxJ && !image[j + qrcode.width* i])\r\n\t\t\t\t{\r\n\t\t\t\t\tj++;\r\n\t\t\t\t}\r\n\t\t\t\tvar currentState = 0;\r\n\t\t\t\twhile (j < maxJ)\r\n\t\t\t\t{\r\n\t\t\t\t\tif (image[j + i*qrcode.width])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// Black pixel\r\n\t\t\t\t\t\tif (currentState == 1)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t// Counting black pixels\r\n\t\t\t\t\t\t\tstateCount[currentState]++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t// Counting white pixels\r\n\t\t\t\t\t\t\tif (currentState == 2)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t// A winner?\r\n\t\t\t\t\t\t\t\tif (this.foundPatternCross(stateCount))\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t// Yes\r\n\t\t\t\t\t\t\t\t\tvar confirmed = this.handlePossibleCenter(stateCount, i, j);\r\n\t\t\t\t\t\t\t\t\tif (confirmed != null)\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\treturn confirmed;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tstateCount[0] = stateCount[2];\r\n\t\t\t\t\t\t\t\tstateCount[1] = 1;\r\n\t\t\t\t\t\t\t\tstateCount[2] = 0;\r\n\t\t\t\t\t\t\t\tcurrentState = 1;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tstateCount[++currentState]++;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// White pixel\r\n\t\t\t\t\t\tif (currentState == 1)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t// Counting black pixels\r\n\t\t\t\t\t\t\tcurrentState++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tstateCount[currentState]++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tj++;\r\n\t\t\t\t}\r\n\t\t\t\tif (this.foundPatternCross(stateCount))\r\n\t\t\t\t{\r\n\t\t\t\t\tvar confirmed = this.handlePossibleCenter(stateCount, i, maxJ);\r\n\t\t\t\t\tif (confirmed != null)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\treturn confirmed;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Hmm, nothing we saw was observed and confirmed twice. If we had\r\n\t\t\t// any guess at all, return it.\r\n\t\t\tif (!(this.possibleCenters.length == 0))\r\n\t\t\t{\r\n\t\t\t\treturn this.possibleCenters[0];\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tthrow \"Couldn't find enough alignment patterns\";\r\n\t\t}\r\n\t\r\n}","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction QRCodeDataBlockReader(blocks, version, numErrorCorrectionCode)\r\n{\r\n\tthis.blockPointer = 0;\r\n\tthis.bitPointer = 7;\r\n\tthis.dataLength = 0;\r\n\tthis.blocks = blocks;\r\n\tthis.numErrorCorrectionCode = numErrorCorrectionCode;\r\n\tif (version <= 9)\r\n\t\tthis.dataLengthMode = 0;\r\n\telse if (version >= 10 && version <= 26)\r\n\t\tthis.dataLengthMode = 1;\r\n\telse if (version >= 27 && version <= 40)\r\n\t\tthis.dataLengthMode = 2;\r\n\t\t\r\n\tthis.getNextBits = function( numBits)\r\n\t\t{\t\t\t\r\n\t\t\tvar bits = 0;\r\n\t\t\tif (numBits < this.bitPointer + 1)\r\n\t\t\t{\r\n\t\t\t\t// next word fits into current data block\r\n\t\t\t\tvar mask = 0;\r\n\t\t\t\tfor (var i = 0; i < numBits; i++)\r\n\t\t\t\t{\r\n\t\t\t\t\tmask += (1 << i);\r\n\t\t\t\t}\r\n\t\t\t\tmask <<= (this.bitPointer - numBits + 1);\r\n\t\t\t\t\r\n\t\t\t\tbits = (this.blocks[this.blockPointer] & mask) >> (this.bitPointer - numBits + 1);\r\n\t\t\t\tthis.bitPointer -= numBits;\r\n\t\t\t\treturn bits;\r\n\t\t\t}\r\n\t\t\telse if (numBits < this.bitPointer + 1 + 8)\r\n\t\t\t{\r\n\t\t\t\t// next word crosses 2 data blocks\r\n\t\t\t\tvar mask1 = 0;\r\n\t\t\t\tfor (var i = 0; i < this.bitPointer + 1; i++)\r\n\t\t\t\t{\r\n\t\t\t\t\tmask1 += (1 << i);\r\n\t\t\t\t}\r\n\t\t\t\tbits = (this.blocks[this.blockPointer] & mask1) << (numBits - (this.bitPointer + 1));\r\n this.blockPointer++;\r\n\t\t\t\tbits += ((this.blocks[this.blockPointer]) >> (8 - (numBits - (this.bitPointer + 1))));\r\n\t\t\t\t\r\n\t\t\t\tthis.bitPointer = this.bitPointer - numBits % 8;\r\n\t\t\t\tif (this.bitPointer < 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.bitPointer = 8 + this.bitPointer;\r\n\t\t\t\t}\r\n\t\t\t\treturn bits;\r\n\t\t\t}\r\n\t\t\telse if (numBits < this.bitPointer + 1 + 16)\r\n\t\t\t{\r\n\t\t\t\t// next word crosses 3 data blocks\r\n\t\t\t\tvar mask1 = 0; // mask of first block\r\n\t\t\t\tvar mask3 = 0; // mask of 3rd block\r\n\t\t\t\t//bitPointer + 1 : number of bits of the 1st block\r\n\t\t\t\t//8 : number of the 2nd block (note that use already 8bits because next word uses 3 data blocks)\r\n\t\t\t\t//numBits - (bitPointer + 1 + 8) : number of bits of the 3rd block \r\n\t\t\t\tfor (var i = 0; i < this.bitPointer + 1; i++)\r\n\t\t\t\t{\r\n\t\t\t\t\tmask1 += (1 << i);\r\n\t\t\t\t}\r\n\t\t\t\tvar bitsFirstBlock = (this.blocks[this.blockPointer] & mask1) << (numBits - (this.bitPointer + 1));\r\n\t\t\t\tthis.blockPointer++;\r\n\t\t\t\t\r\n\t\t\t\tvar bitsSecondBlock = this.blocks[this.blockPointer] << (numBits - (this.bitPointer + 1 + 8));\r\n\t\t\t\tthis.blockPointer++;\r\n\t\t\t\t\r\n\t\t\t\tfor (var i = 0; i < numBits - (this.bitPointer + 1 + 8); i++)\r\n\t\t\t\t{\r\n\t\t\t\t\tmask3 += (1 << i);\r\n\t\t\t\t}\r\n\t\t\t\tmask3 <<= 8 - (numBits - (this.bitPointer + 1 + 8));\r\n\t\t\t\tvar bitsThirdBlock = (this.blocks[this.blockPointer] & mask3) >> (8 - (numBits - (this.bitPointer + 1 + 8)));\r\n\t\t\t\t\r\n\t\t\t\tbits = bitsFirstBlock + bitsSecondBlock + bitsThirdBlock;\r\n\t\t\t\tthis.bitPointer = this.bitPointer - (numBits - 8) % 8;\r\n\t\t\t\tif (this.bitPointer < 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.bitPointer = 8 + this.bitPointer;\r\n\t\t\t\t}\r\n\t\t\t\treturn bits;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\t\t}\r\n\tthis.NextMode=function()\r\n\t{\r\n\t\tif ((this.blockPointer > this.blocks.length - this.numErrorCorrectionCode - 2))\r\n\t\t\treturn 0;\r\n\t\telse\r\n\t\t\treturn this.getNextBits(4);\r\n\t}\r\n\tthis.getDataLength=function( modeIndicator)\r\n\t\t{\r\n\t\t\tvar index = 0;\r\n\t\t\twhile (true)\r\n\t\t\t{\r\n\t\t\t\tif ((modeIndicator >> index) == 1)\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tindex++;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn this.getNextBits(qrcode.sizeOfDataLengthInfo[this.dataLengthMode][index]);\r\n\t\t}\r\n\tthis.getRomanAndFigureString=function( dataLength)\r\n\t\t{\r\n\t\t\tvar length = dataLength;\r\n\t\t\tvar intData = 0;\r\n\t\t\tvar strData = \"\";\r\n\t\t\tvar tableRomanAndFigure = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', '$', '%', '*', '+', '-', '.', '/', ':');\r\n\t\t\tdo \r\n\t\t\t{\r\n\t\t\t\tif (length > 1)\r\n\t\t\t\t{\r\n\t\t\t\t\tintData = this.getNextBits(11);\r\n\t\t\t\t\tvar firstLetter = Math.floor(intData / 45);\r\n\t\t\t\t\tvar secondLetter = intData % 45;\r\n\t\t\t\t\tstrData += tableRomanAndFigure[firstLetter];\r\n\t\t\t\t\tstrData += tableRomanAndFigure[secondLetter];\r\n\t\t\t\t\tlength -= 2;\r\n\t\t\t\t}\r\n\t\t\t\telse if (length == 1)\r\n\t\t\t\t{\r\n\t\t\t\t\tintData = this.getNextBits(6);\r\n\t\t\t\t\tstrData += tableRomanAndFigure[intData];\r\n\t\t\t\t\tlength -= 1;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\twhile (length > 0);\r\n\t\t\t\r\n\t\t\treturn strData;\r\n\t\t}\r\n\tthis.getFigureString=function( dataLength)\r\n\t\t{\r\n\t\t\tvar length = dataLength;\r\n\t\t\tvar intData = 0;\r\n\t\t\tvar strData = \"\";\r\n\t\t\tdo \r\n\t\t\t{\r\n\t\t\t\tif (length >= 3)\r\n\t\t\t\t{\r\n\t\t\t\t\tintData = this.getNextBits(10);\r\n\t\t\t\t\tif (intData < 100)\r\n\t\t\t\t\t\tstrData += \"0\";\r\n\t\t\t\t\tif (intData < 10)\r\n\t\t\t\t\t\tstrData += \"0\";\r\n\t\t\t\t\tlength -= 3;\r\n\t\t\t\t}\r\n\t\t\t\telse if (length == 2)\r\n\t\t\t\t{\r\n\t\t\t\t\tintData = this.getNextBits(7);\r\n\t\t\t\t\tif (intData < 10)\r\n\t\t\t\t\t\tstrData += \"0\";\r\n\t\t\t\t\tlength -= 2;\r\n\t\t\t\t}\r\n\t\t\t\telse if (length == 1)\r\n\t\t\t\t{\r\n\t\t\t\t\tintData = this.getNextBits(4);\r\n\t\t\t\t\tlength -= 1;\r\n\t\t\t\t}\r\n\t\t\t\tstrData += intData;\r\n\t\t\t}\r\n\t\t\twhile (length > 0);\r\n\t\t\t\r\n\t\t\treturn strData;\r\n\t\t}\r\n\tthis.get8bitByteArray=function( dataLength)\r\n\t\t{\r\n\t\t\tvar length = dataLength;\r\n\t\t\tvar intData = 0;\r\n\t\t\tvar output = new Array();\r\n\t\t\t\r\n\t\t\tdo \r\n\t\t\t{\r\n\t\t\t\tintData = this.getNextBits(8);\r\n\t\t\t\toutput.push( intData);\r\n\t\t\t\tlength--;\r\n\t\t\t}\r\n\t\t\twhile (length > 0);\r\n\t\t\treturn output;\r\n\t\t}\r\n this.getKanjiString=function( dataLength)\r\n\t\t{\r\n\t\t\tvar length = dataLength;\r\n\t\t\tvar intData = 0;\r\n\t\t\tvar unicodeString = \"\";\r\n\t\t\tdo \r\n\t\t\t{\r\n\t\t\t\tintData = getNextBits(13);\r\n\t\t\t\tvar lowerByte = intData % 0xC0;\r\n\t\t\t\tvar higherByte = intData / 0xC0;\r\n\t\t\t\t\r\n\t\t\t\tvar tempWord = (higherByte << 8) + lowerByte;\r\n\t\t\t\tvar shiftjisWord = 0;\r\n\t\t\t\tif (tempWord + 0x8140 <= 0x9FFC)\r\n\t\t\t\t{\r\n\t\t\t\t\t// between 8140 - 9FFC on Shift_JIS character set\r\n\t\t\t\t\tshiftjisWord = tempWord + 0x8140;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\t// between E040 - EBBF on Shift_JIS character set\r\n\t\t\t\t\tshiftjisWord = tempWord + 0xC140;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t//var tempByte = new Array(0,0);\r\n\t\t\t\t//tempByte[0] = (sbyte) (shiftjisWord >> 8);\r\n\t\t\t\t//tempByte[1] = (sbyte) (shiftjisWord & 0xFF);\r\n\t\t\t\t//unicodeString += new String(SystemUtils.ToCharArray(SystemUtils.ToByteArray(tempByte)));\r\n unicodeString += String.fromCharCode(shiftjisWord);\r\n\t\t\t\tlength--;\r\n\t\t\t}\r\n\t\t\twhile (length > 0);\r\n\t\t\t\r\n\t\t\t\r\n\t\t\treturn unicodeString;\r\n\t\t}\r\n\r\n\tthis.__defineGetter__(\"DataByte\", function()\r\n\t{\r\n\t\tvar output = new Array();\r\n\t\tvar MODE_NUMBER = 1;\r\n\t var MODE_ROMAN_AND_NUMBER = 2;\r\n\t var MODE_8BIT_BYTE = 4;\r\n\t var MODE_KANJI = 8;\r\n\t\tdo \r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar mode = this.NextMode();\r\n\t\t\t\t\t\t//canvas.println(\"mode: \" + mode);\r\n\t\t\t\t\t\tif (mode == 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tif (output.length > 0)\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\tthrow \"Empty data block\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t//if (mode != 1 && mode != 2 && mode != 4 && mode != 8)\r\n\t\t\t\t\t\t//\tbreak;\r\n\t\t\t\t\t\t//}\r\n\t\t\t\t\t\tif (mode != MODE_NUMBER && mode != MODE_ROMAN_AND_NUMBER && mode != MODE_8BIT_BYTE && mode != MODE_KANJI)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t/*\t\t\t\t\tcanvas.println(\"Invalid mode: \" + mode);\r\n\t\t\t\t\t\t\tmode = guessMode(mode);\r\n\t\t\t\t\t\t\tcanvas.println(\"Guessed mode: \" + mode); */\r\n\t\t\t\t\t\t\tthrow \"Invalid mode: \" + mode + \" in (block:\" + this.blockPointer + \" bit:\" + this.bitPointer + \")\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tdataLength = this.getDataLength(mode);\r\n\t\t\t\t\t\tif (dataLength < 1)\r\n\t\t\t\t\t\t\tthrow \"Invalid data length: \" + dataLength;\r\n\t\t\t\t\t\t//canvas.println(\"length: \" + dataLength);\r\n\t\t\t\t\t\tswitch (mode)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tcase MODE_NUMBER: \r\n\t\t\t\t\t\t\t\t//canvas.println(\"Mode: Figure\");\r\n\t\t\t\t\t\t\t\tvar temp_str = this.getFigureString(dataLength);\r\n\t\t\t\t\t\t\t\tvar ta = new Array(temp_str.length);\r\n\t\t\t\t\t\t\t\tfor(var j=0;j dom\n * element\n * @param {Function} errcb callback\n * function to be called in case of error\n */\nQRCodeDecoder.prototype.prepareVideo = function(videoElem, errcb) {\n var scope = this;\n\n this.stop();\n\n navigator.getUserMedia = navigator.getUserMedia ||\n navigator.webkitGetUserMedia ||\n navigator.mozGetUserMedia ||\n navigator.msGetUserMedia;\n\n if (navigator.getUserMedia) {\n navigator.getUserMedia(this.videoConstraints, function (stream) {\n videoElem.src = window.URL.createObjectURL(stream);\n scope.videoElem = videoElem;\n scope.stream = stream;\n scope.videoDimensions = false;\n setTimeout(function () {\n scope._captureToCanvas.apply(scope, null);\n }, 500);\n }, errcb);\n } else {\n console.log('Couldn\\'t get video from camera');\n }\n};\n\n/**\n * Releases a video stream that was being\n * captured by prepareToVideo\n */\nQRCodeDecoder.prototype.stop = function() {\n if (this.stream) {\n this.stream.stop();\n delete this.stream;\n }\n if (this.tmrCapture) {\n clearTimeout(this.tmrCapture);\n delete this.tmrCapture;\n }\n};\n\n\n/**\n * Sets the sourceId for the camera to use.\n *\n * The sourceId can be found using the\n * getVideoSources function on a browser that\n * supports it (currently only Chrome).\n *\n * @param {String} sourceId The id of the\n * video source you want to use (or false to use\n * the current default)\n */\nQRCodeDecoder.prototype.setSourceId = function (sourceId) {\n if (sourceId) {\n this.videoConstraints.video = {\n optional: [{\n sourceId: sourceId\n }]\n };\n } else {\n this.videoConstraints.video = true;\n }\n};\n\n\n/**\n * Sets the callback for the decode event\n */\nQRCodeDecoder.prototype.setDecoderCallback = function (cb) {\n qrcode.callback = cb;\n};\n\n/**\n * Gets a list of all available video sources on\n * the device\n */\nQRCodeDecoder.prototype.getVideoSources = function(cb) {\n var sources = [];\n if (MediaStreamTrack && MediaStreamTrack.getSources) {\n MediaStreamTrack.getSources(function (sourceInfos) {\n sourceInfos.forEach(function(sourceInfo) {\n if (sourceInfo.kind === 'video') {\n sources.push(sourceInfo);\n }\n });\n cb(sources);\n });\n } else {\n console.log('Your browser doesn\\'t support MediaStreamTrack.getSources');\n cb(sources);\n }\n};\n\nQRCodeDecoder.prototype.decodeFromSrc = function(src) {\n qrcode.decode(src);\n};\n"],"sourceRoot":"/source/"}
\ No newline at end of file
+{"version":3,"sources":["qrcode.js","qcode-decoder.js"],"names":[],"mappings":"CAAA,SAAA,EAAA,GACA,kBAAA,SAAA,OAAA,IACA,UAAA,GACA,gBAAA,SACA,OAAA,QAAA,IACA,EAAA,OAAA,KACA,KAAA,WAoLA,QAAA,GAAA,EAAA,GAEA,KAAA,MAAA,EACA,KAAA,cAAA,EAEA,KAAA,iBAAA,QAAA,WAEA,MAAA,MAAA,QAEA,KAAA,iBAAA,gBAAA,WAEA,MAAA,MAAA,gBAIA,QAAA,GAAA,EAAA,EAAA,GAEA,KAAA,oBAAA,EAEA,KAAA,SADA,EACA,GAAA,OAAA,EAAA,GAEA,GAAA,OAAA,GAEA,KAAA,iBAAA,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KAAA,EAAA,EAAA,IACA,KAAA,MAAA,MAeA,EAAA,UAAA,iBAAA,SAAA,EAAA,EAAA,GACA,GAAA,IAAA,KAAA,OAAA,KAgBA,OAdA,MAAA,mBACA,EAAA,GAAA,OAAA,mCAEA,UAAA,aAAA,KAAA,iBAAA,SAAA,GACA,EAAA,IAAA,OAAA,IAAA,gBAAA,GACA,EAAA,UAAA,EACA,EAAA,OAAA,EACA,EAAA,iBAAA,EAEA,WAAA,WACA,EAAA,iBAAA,KAAA,EAAA,EAAA,EAAA,IACA,MACA,GAEA,MAGA,EAAA,UAAA,gBAAA,SAAA,EAAA,EAAA,GAKA,MAJA,YAAA,WACA,KAAA,iBAAA,KAAA,KAAA,EAAA,EAAA,IACA,KAAA,MAAA,KAEA,MASA,EAAA,UAAA,gBAAA,SAAA,EAAA,GACA,IAAA,EAAA,SAAA,IAAA,EAAA,IACA,KAAA,IAAA,OAAA,sCAIA,OAFA,GAAA,EAAA,IAAA,EAAA,IAAA,EAEA,EAAA,OAAA,EAAA,GAAA,MASA,EAAA,UAAA,KAAA,WAWA,MAVA,MAAA,SACA,KAAA,OAAA,OACA,KAAA,OAAA,QAGA,KAAA,eACA,aAAA,KAAA,cACA,KAAA,aAAA,QAGA,MAcA,EAAA,UAAA,YAAA,SAAA,GAMA,MAJA,MAAA,iBAAA,MADA,GACA,WAAA,SAAA,MAEA,EAEA,MAQA,EAAA,UAAA,gBAAA,SAAA,GACA,GAAA,KAcA,OAZA,mBAAA,iBAAA,WACA,iBAAA,WAAA,SAAA,GACA,EAAA,QAAA,SAAA,GACA,UAAA,EAAA,MACA,EAAA,KAAA,KAEA,EAAA,KAAA,KAGA,EAAA,GAAA,OAAA,kEAGA,MAIA","file":"qcode-decoder.min.js","sourcesContent":["(function (root, factory) {\n if (typeof define === 'function' && define.amd)\n define([], factory);\n else if (typeof exports === 'object')\n module.exports = factory();\n else root.qrcode = factory();\n}(this, function () {\n/*\n Ported to JavaScript by Lazar Laszlo 2011\n\n lazarsoft@gmail.com, www.lazarsoft.info\n\n*/\n\n/*\n*\n* Copyright 2007 ZXing authors\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n\nGridSampler = {};\n\nGridSampler.checkAndNudgePoints=function( image, points)\n\t\t{\n\t\t\tvar width = qrcode.width;\n\t\t\tvar height = qrcode.height;\n\t\t\t// Check and nudge points from start until we see some that are OK:\n\t\t\tvar nudged = true;\n\t\t\tfor (var offset = 0; offset < points.length && nudged; offset += 2)\n\t\t\t{\n\t\t\t\tvar x = Math.floor (points[offset]);\n\t\t\t\tvar y = Math.floor( points[offset + 1]);\n\t\t\t\tif (x < - 1 || x > width || y < - 1 || y > height)\n\t\t\t\t{\n\t\t\t\t\tthrow \"Error.checkAndNudgePoints \";\n\t\t\t\t}\n\t\t\t\tnudged = false;\n\t\t\t\tif (x == - 1)\n\t\t\t\t{\n\t\t\t\t\tpoints[offset] = 0.0;\n\t\t\t\t\tnudged = true;\n\t\t\t\t}\n\t\t\t\telse if (x == width)\n\t\t\t\t{\n\t\t\t\t\tpoints[offset] = width - 1;\n\t\t\t\t\tnudged = true;\n\t\t\t\t}\n\t\t\t\tif (y == - 1)\n\t\t\t\t{\n\t\t\t\t\tpoints[offset + 1] = 0.0;\n\t\t\t\t\tnudged = true;\n\t\t\t\t}\n\t\t\t\telse if (y == height)\n\t\t\t\t{\n\t\t\t\t\tpoints[offset + 1] = height - 1;\n\t\t\t\t\tnudged = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Check and nudge points from end:\n\t\t\tnudged = true;\n\t\t\tfor (var offset = points.length - 2; offset >= 0 && nudged; offset -= 2)\n\t\t\t{\n\t\t\t\tvar x = Math.floor( points[offset]);\n\t\t\t\tvar y = Math.floor( points[offset + 1]);\n\t\t\t\tif (x < - 1 || x > width || y < - 1 || y > height)\n\t\t\t\t{\n\t\t\t\t\tthrow \"Error.checkAndNudgePoints \";\n\t\t\t\t}\n\t\t\t\tnudged = false;\n\t\t\t\tif (x == - 1)\n\t\t\t\t{\n\t\t\t\t\tpoints[offset] = 0.0;\n\t\t\t\t\tnudged = true;\n\t\t\t\t}\n\t\t\t\telse if (x == width)\n\t\t\t\t{\n\t\t\t\t\tpoints[offset] = width - 1;\n\t\t\t\t\tnudged = true;\n\t\t\t\t}\n\t\t\t\tif (y == - 1)\n\t\t\t\t{\n\t\t\t\t\tpoints[offset + 1] = 0.0;\n\t\t\t\t\tnudged = true;\n\t\t\t\t}\n\t\t\t\telse if (y == height)\n\t\t\t\t{\n\t\t\t\t\tpoints[offset + 1] = height - 1;\n\t\t\t\t\tnudged = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\n\nGridSampler.sampleGrid3=function( image, dimension, transform)\n\t\t{\n\t\t\tvar bits = new BitMatrix(dimension);\n\t\t\tvar points = new Array(dimension << 1);\n\t\t\tfor (var y = 0; y < dimension; y++)\n\t\t\t{\n\t\t\t\tvar max = points.length;\n\t\t\t\tvar iValue = y + 0.5;\n\t\t\t\tfor (var x = 0; x < max; x += 2)\n\t\t\t\t{\n\t\t\t\t\tpoints[x] = (x >> 1) + 0.5;\n\t\t\t\t\tpoints[x + 1] = iValue;\n\t\t\t\t}\n\t\t\t\ttransform.transformPoints1(points);\n\t\t\t\t// Quick check to see if points transformed to something inside the image;\n\t\t\t\t// sufficient to check the endpoints\n\t\t\t\tGridSampler.checkAndNudgePoints(image, points);\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tfor (var x = 0; x < max; x += 2)\n\t\t\t\t\t{\n\t\t\t\t\t\tvar xpoint = (Math.floor( points[x]) * 4) + (Math.floor( points[x + 1]) * qrcode.width * 4);\n var bit = image[Math.floor( points[x])+ qrcode.width* Math.floor( points[x + 1])];\n\t\t\t\t\t\tqrcode.imagedata.data[xpoint] = bit?255:0;\n\t\t\t\t\t\tqrcode.imagedata.data[xpoint+1] = bit?255:0;\n\t\t\t\t\t\tqrcode.imagedata.data[xpoint+2] = 0;\n\t\t\t\t\t\tqrcode.imagedata.data[xpoint+3] = 255;\n\t\t\t\t\t\t//bits[x >> 1][ y]=bit;\n\t\t\t\t\t\tif(bit)\n\t\t\t\t\t\t\tbits.set_Renamed(x >> 1, y);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch ( aioobe)\n\t\t\t\t{\n\t\t\t\t\t// This feels wrong, but, sometimes if the finder patterns are misidentified, the resulting\n\t\t\t\t\t// transform gets \"twisted\" such that it maps a straight line of points to a set of points\n\t\t\t\t\t// whose endpoints are in bounds, but others are not. There is probably some mathematical\n\t\t\t\t\t// way to detect this about the transformation that I don't know yet.\n\t\t\t\t\t// This results in an ugly runtime exception despite our clever checks above -- can't have\n\t\t\t\t\t// that. We could check each point's coordinates but that feels duplicative. We settle for\n\t\t\t\t\t// catching and wrapping ArrayIndexOutOfBoundsException.\n\t\t\t\t\tthrow \"Error.checkAndNudgePoints\";\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn bits;\n\t\t}\n\nGridSampler.sampleGridx=function( image, dimension, p1ToX, p1ToY, p2ToX, p2ToY, p3ToX, p3ToY, p4ToX, p4ToY, p1FromX, p1FromY, p2FromX, p2FromY, p3FromX, p3FromY, p4FromX, p4FromY)\n{\n\tvar transform = PerspectiveTransform.quadrilateralToQuadrilateral(p1ToX, p1ToY, p2ToX, p2ToY, p3ToX, p3ToY, p4ToX, p4ToY, p1FromX, p1FromY, p2FromX, p2FromY, p3FromX, p3FromY, p4FromX, p4FromY);\n\n\treturn GridSampler.sampleGrid3(image, dimension, transform);\n}\n\n/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\n\r\nfunction ECB(count, dataCodewords)\r\n{\r\n\tthis.count = count;\r\n\tthis.dataCodewords = dataCodewords;\r\n\t\r\n\tthis.__defineGetter__(\"Count\", function()\r\n\t{\r\n\t\treturn this.count;\r\n\t});\r\n\tthis.__defineGetter__(\"DataCodewords\", function()\r\n\t{\r\n\t\treturn this.dataCodewords;\r\n\t});\r\n}\r\n\r\nfunction ECBlocks( ecCodewordsPerBlock, ecBlocks1, ecBlocks2)\r\n{\r\n\tthis.ecCodewordsPerBlock = ecCodewordsPerBlock;\r\n\tif(ecBlocks2)\r\n\t\tthis.ecBlocks = new Array(ecBlocks1, ecBlocks2);\r\n\telse\r\n\t\tthis.ecBlocks = new Array(ecBlocks1);\r\n\t\r\n\tthis.__defineGetter__(\"ECCodewordsPerBlock\", function()\r\n\t{\r\n\t\treturn this.ecCodewordsPerBlock;\r\n\t});\r\n\t\r\n\tthis.__defineGetter__(\"TotalECCodewords\", function()\r\n\t{\r\n\t\treturn this.ecCodewordsPerBlock * this.NumBlocks;\r\n\t});\r\n\t\r\n\tthis.__defineGetter__(\"NumBlocks\", function()\r\n\t{\r\n\t\tvar total = 0;\r\n\t\tfor (var i = 0; i < this.ecBlocks.length; i++)\r\n\t\t{\r\n\t\t\ttotal += this.ecBlocks[i].length;\r\n\t\t}\r\n\t\treturn total;\r\n\t});\r\n\t\r\n\tthis.getECBlocks=function()\r\n\t\t\t{\r\n\t\t\t\treturn this.ecBlocks;\r\n\t\t\t}\r\n}\r\n\r\nfunction Version( versionNumber, alignmentPatternCenters, ecBlocks1, ecBlocks2, ecBlocks3, ecBlocks4)\r\n{\r\n\tthis.versionNumber = versionNumber;\r\n\tthis.alignmentPatternCenters = alignmentPatternCenters;\r\n\tthis.ecBlocks = new Array(ecBlocks1, ecBlocks2, ecBlocks3, ecBlocks4);\r\n\t\r\n\tvar total = 0;\r\n\tvar ecCodewords = ecBlocks1.ECCodewordsPerBlock;\r\n\tvar ecbArray = ecBlocks1.getECBlocks();\r\n\tfor (var i = 0; i < ecbArray.length; i++)\r\n\t{\r\n\t\tvar ecBlock = ecbArray[i];\r\n\t\ttotal += ecBlock.Count * (ecBlock.DataCodewords + ecCodewords);\r\n\t}\r\n\tthis.totalCodewords = total;\r\n\t\r\n\tthis.__defineGetter__(\"VersionNumber\", function()\r\n\t{\r\n\t\treturn this.versionNumber;\r\n\t});\r\n\t\r\n\tthis.__defineGetter__(\"AlignmentPatternCenters\", function()\r\n\t{\r\n\t\treturn this.alignmentPatternCenters;\r\n\t});\r\n\tthis.__defineGetter__(\"TotalCodewords\", function()\r\n\t{\r\n\t\treturn this.totalCodewords;\r\n\t});\r\n\tthis.__defineGetter__(\"DimensionForVersion\", function()\r\n\t{\r\n\t\treturn 17 + 4 * this.versionNumber;\r\n\t});\r\n\t\r\n\tthis.buildFunctionPattern=function()\r\n\t\t{\r\n\t\t\tvar dimension = this.DimensionForVersion;\r\n\t\t\tvar bitMatrix = new BitMatrix(dimension);\r\n\t\t\t\r\n\t\t\t// Top left finder pattern + separator + format\r\n\t\t\tbitMatrix.setRegion(0, 0, 9, 9);\r\n\t\t\t// Top right finder pattern + separator + format\r\n\t\t\tbitMatrix.setRegion(dimension - 8, 0, 8, 9);\r\n\t\t\t// Bottom left finder pattern + separator + format\r\n\t\t\tbitMatrix.setRegion(0, dimension - 8, 9, 8);\r\n\t\t\t\r\n\t\t\t// Alignment patterns\r\n\t\t\tvar max = this.alignmentPatternCenters.length;\r\n\t\t\tfor (var x = 0; x < max; x++)\r\n\t\t\t{\r\n\t\t\t\tvar i = this.alignmentPatternCenters[x] - 2;\r\n\t\t\t\tfor (var y = 0; y < max; y++)\r\n\t\t\t\t{\r\n\t\t\t\t\tif ((x == 0 && (y == 0 || y == max - 1)) || (x == max - 1 && y == 0))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// No alignment patterns near the three finder paterns\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbitMatrix.setRegion(this.alignmentPatternCenters[y] - 2, i, 5, 5);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Vertical timing pattern\r\n\t\t\tbitMatrix.setRegion(6, 9, 1, dimension - 17);\r\n\t\t\t// Horizontal timing pattern\r\n\t\t\tbitMatrix.setRegion(9, 6, dimension - 17, 1);\r\n\t\t\t\r\n\t\t\tif (this.versionNumber > 6)\r\n\t\t\t{\r\n\t\t\t\t// Version info, top right\r\n\t\t\t\tbitMatrix.setRegion(dimension - 11, 0, 3, 6);\r\n\t\t\t\t// Version info, bottom left\r\n\t\t\t\tbitMatrix.setRegion(0, dimension - 11, 6, 3);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn bitMatrix;\r\n\t\t}\r\n\tthis.getECBlocksForLevel=function( ecLevel)\r\n\t{\r\n\t\treturn this.ecBlocks[ecLevel.ordinal()];\r\n\t}\r\n}\r\n\r\nVersion.VERSION_DECODE_INFO = new Array(0x07C94, 0x085BC, 0x09A99, 0x0A4D3, 0x0BBF6, 0x0C762, 0x0D847, 0x0E60D, 0x0F928, 0x10B78, 0x1145D, 0x12A17, 0x13532, 0x149A6, 0x15683, 0x168C9, 0x177EC, 0x18EC4, 0x191E1, 0x1AFAB, 0x1B08E, 0x1CC1A, 0x1D33F, 0x1ED75, 0x1F250, 0x209D5, 0x216F0, 0x228BA, 0x2379F, 0x24B0B, 0x2542E, 0x26A64, 0x27541, 0x28C69);\r\n\r\nVersion.VERSIONS = buildVersions();\r\n\r\nVersion.getVersionForNumber=function( versionNumber)\r\n{\r\n\tif (versionNumber < 1 || versionNumber > 40)\r\n\t{\r\n\t\tthrow \"ArgumentException\";\r\n\t}\r\n\treturn Version.VERSIONS[versionNumber - 1];\r\n}\r\n\r\nVersion.getProvisionalVersionForDimension=function(dimension)\r\n{\r\n\tif (dimension % 4 != 1)\r\n\t{\r\n\t\tthrow \"Error getProvisionalVersionForDimension\";\r\n\t}\r\n\ttry\r\n\t{\r\n\t\treturn Version.getVersionForNumber((dimension - 17) >> 2);\r\n\t}\r\n\tcatch ( iae)\r\n\t{\r\n\t\tthrow \"Error getVersionForNumber\";\r\n\t}\r\n}\r\n\r\nVersion.decodeVersionInformation=function( versionBits)\r\n{\r\n\tvar bestDifference = 0xffffffff;\r\n\tvar bestVersion = 0;\r\n\tfor (var i = 0; i < Version.VERSION_DECODE_INFO.length; i++)\r\n\t{\r\n\t\tvar targetVersion = Version.VERSION_DECODE_INFO[i];\r\n\t\t// Do the version info bits match exactly? done.\r\n\t\tif (targetVersion == versionBits)\r\n\t\t{\r\n\t\t\treturn this.getVersionForNumber(i + 7);\r\n\t\t}\r\n\t\t// Otherwise see if this is the closest to a real version info bit string\r\n\t\t// we have seen so far\r\n\t\tvar bitsDifference = FormatInformation.numBitsDiffering(versionBits, targetVersion);\r\n\t\tif (bitsDifference < bestDifference)\r\n\t\t{\r\n\t\t\tbestVersion = i + 7;\r\n\t\t\tbestDifference = bitsDifference;\r\n\t\t}\r\n\t}\r\n\t// We can tolerate up to 3 bits of error since no two version info codewords will\r\n\t// differ in less than 4 bits.\r\n\tif (bestDifference <= 3)\r\n\t{\r\n\t\treturn this.getVersionForNumber(bestVersion);\r\n\t}\r\n\t// If we didn't find a close enough match, fail\r\n\treturn null;\r\n}\r\n\r\nfunction buildVersions()\r\n{\r\n\treturn new Array(new Version(1, new Array(), new ECBlocks(7, new ECB(1, 19)), new ECBlocks(10, new ECB(1, 16)), new ECBlocks(13, new ECB(1, 13)), new ECBlocks(17, new ECB(1, 9))), \r\n\tnew Version(2, new Array(6, 18), new ECBlocks(10, new ECB(1, 34)), new ECBlocks(16, new ECB(1, 28)), new ECBlocks(22, new ECB(1, 22)), new ECBlocks(28, new ECB(1, 16))), \r\n\tnew Version(3, new Array(6, 22), new ECBlocks(15, new ECB(1, 55)), new ECBlocks(26, new ECB(1, 44)), new ECBlocks(18, new ECB(2, 17)), new ECBlocks(22, new ECB(2, 13))), \r\n\tnew Version(4, new Array(6, 26), new ECBlocks(20, new ECB(1, 80)), new ECBlocks(18, new ECB(2, 32)), new ECBlocks(26, new ECB(2, 24)), new ECBlocks(16, new ECB(4, 9))), \r\n\tnew Version(5, new Array(6, 30), new ECBlocks(26, new ECB(1, 108)), new ECBlocks(24, new ECB(2, 43)), new ECBlocks(18, new ECB(2, 15), new ECB(2, 16)), new ECBlocks(22, new ECB(2, 11), new ECB(2, 12))), \r\n\tnew Version(6, new Array(6, 34), new ECBlocks(18, new ECB(2, 68)), new ECBlocks(16, new ECB(4, 27)), new ECBlocks(24, new ECB(4, 19)), new ECBlocks(28, new ECB(4, 15))), \r\n\tnew Version(7, new Array(6, 22, 38), new ECBlocks(20, new ECB(2, 78)), new ECBlocks(18, new ECB(4, 31)), new ECBlocks(18, new ECB(2, 14), new ECB(4, 15)), new ECBlocks(26, new ECB(4, 13), new ECB(1, 14))), \r\n\tnew Version(8, new Array(6, 24, 42), new ECBlocks(24, new ECB(2, 97)), new ECBlocks(22, new ECB(2, 38), new ECB(2, 39)), new ECBlocks(22, new ECB(4, 18), new ECB(2, 19)), new ECBlocks(26, new ECB(4, 14), new ECB(2, 15))), \r\n\tnew Version(9, new Array(6, 26, 46), new ECBlocks(30, new ECB(2, 116)), new ECBlocks(22, new ECB(3, 36), new ECB(2, 37)), new ECBlocks(20, new ECB(4, 16), new ECB(4, 17)), new ECBlocks(24, new ECB(4, 12), new ECB(4, 13))), \r\n\tnew Version(10, new Array(6, 28, 50), new ECBlocks(18, new ECB(2, 68), new ECB(2, 69)), new ECBlocks(26, new ECB(4, 43), new ECB(1, 44)), new ECBlocks(24, new ECB(6, 19), new ECB(2, 20)), new ECBlocks(28, new ECB(6, 15), new ECB(2, 16))), \r\n\tnew Version(11, new Array(6, 30, 54), new ECBlocks(20, new ECB(4, 81)), new ECBlocks(30, new ECB(1, 50), new ECB(4, 51)), new ECBlocks(28, new ECB(4, 22), new ECB(4, 23)), new ECBlocks(24, new ECB(3, 12), new ECB(8, 13))), \r\n\tnew Version(12, new Array(6, 32, 58), new ECBlocks(24, new ECB(2, 92), new ECB(2, 93)), new ECBlocks(22, new ECB(6, 36), new ECB(2, 37)), new ECBlocks(26, new ECB(4, 20), new ECB(6, 21)), new ECBlocks(28, new ECB(7, 14), new ECB(4, 15))), \r\n\tnew Version(13, new Array(6, 34, 62), new ECBlocks(26, new ECB(4, 107)), new ECBlocks(22, new ECB(8, 37), new ECB(1, 38)), new ECBlocks(24, new ECB(8, 20), new ECB(4, 21)), new ECBlocks(22, new ECB(12, 11), new ECB(4, 12))), \r\n\tnew Version(14, new Array(6, 26, 46, 66), new ECBlocks(30, new ECB(3, 115), new ECB(1, 116)), new ECBlocks(24, new ECB(4, 40), new ECB(5, 41)), new ECBlocks(20, new ECB(11, 16), new ECB(5, 17)), new ECBlocks(24, new ECB(11, 12), new ECB(5, 13))), \r\n\tnew Version(15, new Array(6, 26, 48, 70), new ECBlocks(22, new ECB(5, 87), new ECB(1, 88)), new ECBlocks(24, new ECB(5, 41), new ECB(5, 42)), new ECBlocks(30, new ECB(5, 24), new ECB(7, 25)), new ECBlocks(24, new ECB(11, 12), new ECB(7, 13))), \r\n\tnew Version(16, new Array(6, 26, 50, 74), new ECBlocks(24, new ECB(5, 98), new ECB(1, 99)), new ECBlocks(28, new ECB(7, 45), new ECB(3, 46)), new ECBlocks(24, new ECB(15, 19), new ECB(2, 20)), new ECBlocks(30, new ECB(3, 15), new ECB(13, 16))), \r\n\tnew Version(17, new Array(6, 30, 54, 78), new ECBlocks(28, new ECB(1, 107), new ECB(5, 108)), new ECBlocks(28, new ECB(10, 46), new ECB(1, 47)), new ECBlocks(28, new ECB(1, 22), new ECB(15, 23)), new ECBlocks(28, new ECB(2, 14), new ECB(17, 15))), \r\n\tnew Version(18, new Array(6, 30, 56, 82), new ECBlocks(30, new ECB(5, 120), new ECB(1, 121)), new ECBlocks(26, new ECB(9, 43), new ECB(4, 44)), new ECBlocks(28, new ECB(17, 22), new ECB(1, 23)), new ECBlocks(28, new ECB(2, 14), new ECB(19, 15))), \r\n\tnew Version(19, new Array(6, 30, 58, 86), new ECBlocks(28, new ECB(3, 113), new ECB(4, 114)), new ECBlocks(26, new ECB(3, 44), new ECB(11, 45)), new ECBlocks(26, new ECB(17, 21), new ECB(4, 22)), new ECBlocks(26, new ECB(9, 13), new ECB(16, 14))), \r\n\tnew Version(20, new Array(6, 34, 62, 90), new ECBlocks(28, new ECB(3, 107), new ECB(5, 108)), new ECBlocks(26, new ECB(3, 41), new ECB(13, 42)), new ECBlocks(30, new ECB(15, 24), new ECB(5, 25)), new ECBlocks(28, new ECB(15, 15), new ECB(10, 16))), \r\n\tnew Version(21, new Array(6, 28, 50, 72, 94), new ECBlocks(28, new ECB(4, 116), new ECB(4, 117)), new ECBlocks(26, new ECB(17, 42)), new ECBlocks(28, new ECB(17, 22), new ECB(6, 23)), new ECBlocks(30, new ECB(19, 16), new ECB(6, 17))), \r\n\tnew Version(22, new Array(6, 26, 50, 74, 98), new ECBlocks(28, new ECB(2, 111), new ECB(7, 112)), new ECBlocks(28, new ECB(17, 46)), new ECBlocks(30, new ECB(7, 24), new ECB(16, 25)), new ECBlocks(24, new ECB(34, 13))), \r\n\tnew Version(23, new Array(6, 30, 54, 74, 102), new ECBlocks(30, new ECB(4, 121), new ECB(5, 122)), new ECBlocks(28, new ECB(4, 47), new ECB(14, 48)), new ECBlocks(30, new ECB(11, 24), new ECB(14, 25)), new ECBlocks(30, new ECB(16, 15), new ECB(14, 16))), \r\n\tnew Version(24, new Array(6, 28, 54, 80, 106), new ECBlocks(30, new ECB(6, 117), new ECB(4, 118)), new ECBlocks(28, new ECB(6, 45), new ECB(14, 46)), new ECBlocks(30, new ECB(11, 24), new ECB(16, 25)), new ECBlocks(30, new ECB(30, 16), new ECB(2, 17))), \r\n\tnew Version(25, new Array(6, 32, 58, 84, 110), new ECBlocks(26, new ECB(8, 106), new ECB(4, 107)), new ECBlocks(28, new ECB(8, 47), new ECB(13, 48)), new ECBlocks(30, new ECB(7, 24), new ECB(22, 25)), new ECBlocks(30, new ECB(22, 15), new ECB(13, 16))), \r\n\tnew Version(26, new Array(6, 30, 58, 86, 114), new ECBlocks(28, new ECB(10, 114), new ECB(2, 115)), new ECBlocks(28, new ECB(19, 46), new ECB(4, 47)), new ECBlocks(28, new ECB(28, 22), new ECB(6, 23)), new ECBlocks(30, new ECB(33, 16), new ECB(4, 17))), \r\n\tnew Version(27, new Array(6, 34, 62, 90, 118), new ECBlocks(30, new ECB(8, 122), new ECB(4, 123)), new ECBlocks(28, new ECB(22, 45), new ECB(3, 46)), new ECBlocks(30, new ECB(8, 23), new ECB(26, 24)), new ECBlocks(30, new ECB(12, 15), \t\tnew ECB(28, 16))),\r\n\tnew Version(28, new Array(6, 26, 50, 74, 98, 122), new ECBlocks(30, new ECB(3, 117), new ECB(10, 118)), new ECBlocks(28, new ECB(3, 45), new ECB(23, 46)), new ECBlocks(30, new ECB(4, 24), new ECB(31, 25)), new ECBlocks(30, new ECB(11, 15), new ECB(31, 16))), \r\n\tnew Version(29, new Array(6, 30, 54, 78, 102, 126), new ECBlocks(30, new ECB(7, 116), new ECB(7, 117)), new ECBlocks(28, new ECB(21, 45), new ECB(7, 46)), new ECBlocks(30, new ECB(1, 23), new ECB(37, 24)), new ECBlocks(30, new ECB(19, 15), new ECB(26, 16))), \r\n\tnew Version(30, new Array(6, 26, 52, 78, 104, 130), new ECBlocks(30, new ECB(5, 115), new ECB(10, 116)), new ECBlocks(28, new ECB(19, 47), new ECB(10, 48)), new ECBlocks(30, new ECB(15, 24), new ECB(25, 25)), new ECBlocks(30, new ECB(23, 15), new ECB(25, 16))), \r\n\tnew Version(31, new Array(6, 30, 56, 82, 108, 134), new ECBlocks(30, new ECB(13, 115), new ECB(3, 116)), new ECBlocks(28, new ECB(2, 46), new ECB(29, 47)), new ECBlocks(30, new ECB(42, 24), new ECB(1, 25)), new ECBlocks(30, new ECB(23, 15), new ECB(28, 16))), \r\n\tnew Version(32, new Array(6, 34, 60, 86, 112, 138), new ECBlocks(30, new ECB(17, 115)), new ECBlocks(28, new ECB(10, 46), new ECB(23, 47)), new ECBlocks(30, new ECB(10, 24), new ECB(35, 25)), new ECBlocks(30, new ECB(19, 15), new ECB(35, 16))), \r\n\tnew Version(33, new Array(6, 30, 58, 86, 114, 142), new ECBlocks(30, new ECB(17, 115), new ECB(1, 116)), new ECBlocks(28, new ECB(14, 46), new ECB(21, 47)), new ECBlocks(30, new ECB(29, 24), new ECB(19, 25)), new ECBlocks(30, new ECB(11, 15), new ECB(46, 16))), \r\n\tnew Version(34, new Array(6, 34, 62, 90, 118, 146), new ECBlocks(30, new ECB(13, 115), new ECB(6, 116)), new ECBlocks(28, new ECB(14, 46), new ECB(23, 47)), new ECBlocks(30, new ECB(44, 24), new ECB(7, 25)), new ECBlocks(30, new ECB(59, 16), new ECB(1, 17))), \r\n\tnew Version(35, new Array(6, 30, 54, 78, 102, 126, 150), new ECBlocks(30, new ECB(12, 121), new ECB(7, 122)), new ECBlocks(28, new ECB(12, 47), new ECB(26, 48)), new ECBlocks(30, new ECB(39, 24), new ECB(14, 25)),new ECBlocks(30, new ECB(22, 15), new ECB(41, 16))), \r\n\tnew Version(36, new Array(6, 24, 50, 76, 102, 128, 154), new ECBlocks(30, new ECB(6, 121), new ECB(14, 122)), new ECBlocks(28, new ECB(6, 47), new ECB(34, 48)), new ECBlocks(30, new ECB(46, 24), new ECB(10, 25)), new ECBlocks(30, new ECB(2, 15), new ECB(64, 16))), \r\n\tnew Version(37, new Array(6, 28, 54, 80, 106, 132, 158), new ECBlocks(30, new ECB(17, 122), new ECB(4, 123)), new ECBlocks(28, new ECB(29, 46), new ECB(14, 47)), new ECBlocks(30, new ECB(49, 24), new ECB(10, 25)), new ECBlocks(30, new ECB(24, 15), new ECB(46, 16))), \r\n\tnew Version(38, new Array(6, 32, 58, 84, 110, 136, 162), new ECBlocks(30, new ECB(4, 122), new ECB(18, 123)), new ECBlocks(28, new ECB(13, 46), new ECB(32, 47)), new ECBlocks(30, new ECB(48, 24), new ECB(14, 25)), new ECBlocks(30, new ECB(42, 15), new ECB(32, 16))), \r\n\tnew Version(39, new Array(6, 26, 54, 82, 110, 138, 166), new ECBlocks(30, new ECB(20, 117), new ECB(4, 118)), new ECBlocks(28, new ECB(40, 47), new ECB(7, 48)), new ECBlocks(30, new ECB(43, 24), new ECB(22, 25)), new ECBlocks(30, new ECB(10, 15), new ECB(67, 16))), \r\n\tnew Version(40, new Array(6, 30, 58, 86, 114, 142, 170), new ECBlocks(30, new ECB(19, 118), new ECB(6, 119)), new ECBlocks(28, new ECB(18, 47), new ECB(31, 48)), new ECBlocks(30, new ECB(34, 24), new ECB(34, 25)), new ECBlocks(30, new ECB(20, 15), new ECB(61, 16))));\r\n}\n/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction PerspectiveTransform( a11, a21, a31, a12, a22, a32, a13, a23, a33)\r\n{\r\n\tthis.a11 = a11;\r\n\tthis.a12 = a12;\r\n\tthis.a13 = a13;\r\n\tthis.a21 = a21;\r\n\tthis.a22 = a22;\r\n\tthis.a23 = a23;\r\n\tthis.a31 = a31;\r\n\tthis.a32 = a32;\r\n\tthis.a33 = a33;\r\n\tthis.transformPoints1=function( points)\r\n\t\t{\r\n\t\t\tvar max = points.length;\r\n\t\t\tvar a11 = this.a11;\r\n\t\t\tvar a12 = this.a12;\r\n\t\t\tvar a13 = this.a13;\r\n\t\t\tvar a21 = this.a21;\r\n\t\t\tvar a22 = this.a22;\r\n\t\t\tvar a23 = this.a23;\r\n\t\t\tvar a31 = this.a31;\r\n\t\t\tvar a32 = this.a32;\r\n\t\t\tvar a33 = this.a33;\r\n\t\t\tfor (var i = 0; i < max; i += 2)\r\n\t\t\t{\r\n\t\t\t\tvar x = points[i];\r\n\t\t\t\tvar y = points[i + 1];\r\n\t\t\t\tvar denominator = a13 * x + a23 * y + a33;\r\n\t\t\t\tpoints[i] = (a11 * x + a21 * y + a31) / denominator;\r\n\t\t\t\tpoints[i + 1] = (a12 * x + a22 * y + a32) / denominator;\r\n\t\t\t}\r\n\t\t}\r\n\tthis. transformPoints2=function(xValues, yValues)\r\n\t\t{\r\n\t\t\tvar n = xValues.length;\r\n\t\t\tfor (var i = 0; i < n; i++)\r\n\t\t\t{\r\n\t\t\t\tvar x = xValues[i];\r\n\t\t\t\tvar y = yValues[i];\r\n\t\t\t\tvar denominator = this.a13 * x + this.a23 * y + this.a33;\r\n\t\t\t\txValues[i] = (this.a11 * x + this.a21 * y + this.a31) / denominator;\r\n\t\t\t\tyValues[i] = (this.a12 * x + this.a22 * y + this.a32) / denominator;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\tthis.buildAdjoint=function()\r\n\t\t{\r\n\t\t\t// Adjoint is the transpose of the cofactor matrix:\r\n\t\t\treturn new PerspectiveTransform(this.a22 * this.a33 - this.a23 * this.a32, this.a23 * this.a31 - this.a21 * this.a33, this.a21 * this.a32 - this.a22 * this.a31, this.a13 * this.a32 - this.a12 * this.a33, this.a11 * this.a33 - this.a13 * this.a31, this.a12 * this.a31 - this.a11 * this.a32, this.a12 * this.a23 - this.a13 * this.a22, this.a13 * this.a21 - this.a11 * this.a23, this.a11 * this.a22 - this.a12 * this.a21);\r\n\t\t}\r\n\tthis.times=function( other)\r\n\t\t{\r\n\t\t\treturn new PerspectiveTransform(this.a11 * other.a11 + this.a21 * other.a12 + this.a31 * other.a13, this.a11 * other.a21 + this.a21 * other.a22 + this.a31 * other.a23, this.a11 * other.a31 + this.a21 * other.a32 + this.a31 * other.a33, this.a12 * other.a11 + this.a22 * other.a12 + this.a32 * other.a13, this.a12 * other.a21 + this.a22 * other.a22 + this.a32 * other.a23, this.a12 * other.a31 + this.a22 * other.a32 + this.a32 * other.a33, this.a13 * other.a11 + this.a23 * other.a12 +this.a33 * other.a13, this.a13 * other.a21 + this.a23 * other.a22 + this.a33 * other.a23, this.a13 * other.a31 + this.a23 * other.a32 + this.a33 * other.a33);\r\n\t\t}\r\n\r\n}\r\n\r\nPerspectiveTransform.quadrilateralToQuadrilateral=function( x0, y0, x1, y1, x2, y2, x3, y3, x0p, y0p, x1p, y1p, x2p, y2p, x3p, y3p)\r\n{\r\n\t\r\n\tvar qToS = this.quadrilateralToSquare(x0, y0, x1, y1, x2, y2, x3, y3);\r\n\tvar sToQ = this.squareToQuadrilateral(x0p, y0p, x1p, y1p, x2p, y2p, x3p, y3p);\r\n\treturn sToQ.times(qToS);\r\n}\r\n\r\nPerspectiveTransform.squareToQuadrilateral=function( x0, y0, x1, y1, x2, y2, x3, y3)\r\n{\r\n\t dy2 = y3 - y2;\r\n\t dy3 = y0 - y1 + y2 - y3;\r\n\tif (dy2 == 0.0 && dy3 == 0.0)\r\n\t{\r\n\t\treturn new PerspectiveTransform(x1 - x0, x2 - x1, x0, y1 - y0, y2 - y1, y0, 0.0, 0.0, 1.0);\r\n\t}\r\n\telse\r\n\t{\r\n\t\t dx1 = x1 - x2;\r\n\t\t dx2 = x3 - x2;\r\n\t\t dx3 = x0 - x1 + x2 - x3;\r\n\t\t dy1 = y1 - y2;\r\n\t\t denominator = dx1 * dy2 - dx2 * dy1;\r\n\t\t a13 = (dx3 * dy2 - dx2 * dy3) / denominator;\r\n\t\t a23 = (dx1 * dy3 - dx3 * dy1) / denominator;\r\n\t\treturn new PerspectiveTransform(x1 - x0 + a13 * x1, x3 - x0 + a23 * x3, x0, y1 - y0 + a13 * y1, y3 - y0 + a23 * y3, y0, a13, a23, 1.0);\r\n\t}\r\n}\r\n\r\nPerspectiveTransform.quadrilateralToSquare=function( x0, y0, x1, y1, x2, y2, x3, y3)\r\n{\r\n\t// Here, the adjoint serves as the inverse:\r\n\treturn this.squareToQuadrilateral(x0, y0, x1, y1, x2, y2, x3, y3).buildAdjoint();\r\n}\r\n\r\nfunction DetectorResult(bits, points)\r\n{\r\n\tthis.bits = bits;\r\n\tthis.points = points;\r\n}\r\n\r\n\r\nfunction Detector(image)\r\n{\r\n\tthis.image=image;\r\n\tthis.resultPointCallback = null;\r\n\t\r\n\tthis.sizeOfBlackWhiteBlackRun=function( fromX, fromY, toX, toY)\r\n\t\t{\r\n\t\t\t// Mild variant of Bresenham's algorithm;\r\n\t\t\t// see http://en.wikipedia.org/wiki/Bresenham's_line_algorithm\r\n\t\t\tvar steep = Math.abs(toY - fromY) > Math.abs(toX - fromX);\r\n\t\t\tif (steep)\r\n\t\t\t{\r\n\t\t\t\tvar temp = fromX;\r\n\t\t\t\tfromX = fromY;\r\n\t\t\t\tfromY = temp;\r\n\t\t\t\ttemp = toX;\r\n\t\t\t\ttoX = toY;\r\n\t\t\t\ttoY = temp;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar dx = Math.abs(toX - fromX);\r\n\t\t\tvar dy = Math.abs(toY - fromY);\r\n\t\t\tvar error = - dx >> 1;\r\n\t\t\tvar ystep = fromY < toY?1:- 1;\r\n\t\t\tvar xstep = fromX < toX?1:- 1;\r\n\t\t\tvar state = 0; // In black pixels, looking for white, first or second time\r\n\t\t\tfor (var x = fromX, y = fromY; x != toX; x += xstep)\r\n\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\tvar realX = steep?y:x;\r\n\t\t\t\tvar realY = steep?x:y;\r\n\t\t\t\tif (state == 1)\r\n\t\t\t\t{\r\n\t\t\t\t\t// In white pixels, looking for black\r\n\t\t\t\t\tif (this.image[realX + realY*qrcode.width])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tstate++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tif (!this.image[realX + realY*qrcode.width])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tstate++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tif (state == 3)\r\n\t\t\t\t{\r\n\t\t\t\t\t// Found black, white, black, and stumbled back onto white; done\r\n\t\t\t\t\tvar diffX = x - fromX;\r\n\t\t\t\t\tvar diffY = y - fromY;\r\n\t\t\t\t\treturn Math.sqrt( (diffX * diffX + diffY * diffY));\r\n\t\t\t\t}\r\n\t\t\t\terror += dy;\r\n\t\t\t\tif (error > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tif (y == toY)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\ty += ystep;\r\n\t\t\t\t\terror -= dx;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tvar diffX2 = toX - fromX;\r\n\t\t\tvar diffY2 = toY - fromY;\r\n\t\t\treturn Math.sqrt( (diffX2 * diffX2 + diffY2 * diffY2));\r\n\t\t}\r\n\r\n\t\r\n\tthis.sizeOfBlackWhiteBlackRunBothWays=function( fromX, fromY, toX, toY)\r\n\t\t{\r\n\t\t\t\r\n\t\t\tvar result = this.sizeOfBlackWhiteBlackRun(fromX, fromY, toX, toY);\r\n\t\t\t\r\n\t\t\t// Now count other way -- don't run off image though of course\r\n\t\t\tvar scale = 1.0;\r\n\t\t\tvar otherToX = fromX - (toX - fromX);\r\n\t\t\tif (otherToX < 0)\r\n\t\t\t{\r\n\t\t\t\tscale = fromX / (fromX - otherToX);\r\n\t\t\t\totherToX = 0;\r\n\t\t\t}\r\n\t\t\telse if (otherToX >= qrcode.width)\r\n\t\t\t{\r\n\t\t\t\tscale = (qrcode.width - 1 - fromX) / (otherToX - fromX);\r\n\t\t\t\totherToX = qrcode.width - 1;\r\n\t\t\t}\r\n\t\t\tvar otherToY = Math.floor (fromY - (toY - fromY) * scale);\r\n\t\t\t\r\n\t\t\tscale = 1.0;\r\n\t\t\tif (otherToY < 0)\r\n\t\t\t{\r\n\t\t\t\tscale = fromY / (fromY - otherToY);\r\n\t\t\t\totherToY = 0;\r\n\t\t\t}\r\n\t\t\telse if (otherToY >= qrcode.height)\r\n\t\t\t{\r\n\t\t\t\tscale = (qrcode.height - 1 - fromY) / (otherToY - fromY);\r\n\t\t\t\totherToY = qrcode.height - 1;\r\n\t\t\t}\r\n\t\t\totherToX = Math.floor (fromX + (otherToX - fromX) * scale);\r\n\t\t\t\r\n\t\t\tresult += this.sizeOfBlackWhiteBlackRun(fromX, fromY, otherToX, otherToY);\r\n\t\t\treturn result - 1.0; // -1 because we counted the middle pixel twice\r\n\t\t}\r\n\t\t\r\n\r\n\t\r\n\tthis.calculateModuleSizeOneWay=function( pattern, otherPattern)\r\n\t\t{\r\n\t\t\tvar moduleSizeEst1 = this.sizeOfBlackWhiteBlackRunBothWays(Math.floor( pattern.X), Math.floor( pattern.Y), Math.floor( otherPattern.X), Math.floor(otherPattern.Y));\r\n\t\t\tvar moduleSizeEst2 = this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(otherPattern.X), Math.floor(otherPattern.Y), Math.floor( pattern.X), Math.floor(pattern.Y));\r\n\t\t\tif (isNaN(moduleSizeEst1))\r\n\t\t\t{\r\n\t\t\t\treturn moduleSizeEst2 / 7.0;\r\n\t\t\t}\r\n\t\t\tif (isNaN(moduleSizeEst2))\r\n\t\t\t{\r\n\t\t\t\treturn moduleSizeEst1 / 7.0;\r\n\t\t\t}\r\n\t\t\t// Average them, and divide by 7 since we've counted the width of 3 black modules,\r\n\t\t\t// and 1 white and 1 black module on either side. Ergo, divide sum by 14.\r\n\t\t\treturn (moduleSizeEst1 + moduleSizeEst2) / 14.0;\r\n\t\t}\r\n\r\n\t\r\n\tthis.calculateModuleSize=function( topLeft, topRight, bottomLeft)\r\n\t\t{\r\n\t\t\t// Take the average\r\n\t\t\treturn (this.calculateModuleSizeOneWay(topLeft, topRight) + this.calculateModuleSizeOneWay(topLeft, bottomLeft)) / 2.0;\r\n\t\t}\r\n\r\n\tthis.distance=function( pattern1, pattern2)\r\n\t{\r\n\t\txDiff = pattern1.X - pattern2.X;\r\n\t\tyDiff = pattern1.Y - pattern2.Y;\r\n\t\treturn Math.sqrt( (xDiff * xDiff + yDiff * yDiff));\r\n\t}\r\n\tthis.computeDimension=function( topLeft, topRight, bottomLeft, moduleSize)\r\n\t\t{\r\n\t\t\t\r\n\t\t\tvar tltrCentersDimension = Math.round(this.distance(topLeft, topRight) / moduleSize);\r\n\t\t\tvar tlblCentersDimension = Math.round(this.distance(topLeft, bottomLeft) / moduleSize);\r\n\t\t\tvar dimension = ((tltrCentersDimension + tlblCentersDimension) >> 1) + 7;\r\n\t\t\tswitch (dimension & 0x03)\r\n\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\t// mod 4\r\n\t\t\t\tcase 0: \r\n\t\t\t\t\tdimension++;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t// 1? do nothing\r\n\t\t\t\t\r\n\t\t\t\tcase 2: \r\n\t\t\t\t\tdimension--;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\t\tcase 3: \r\n\t\t\t\t\tthrow \"Error\";\r\n\t\t\t\t}\r\n\t\t\treturn dimension;\r\n\t\t}\r\n\r\n\tthis.findAlignmentInRegion=function( overallEstModuleSize, estAlignmentX, estAlignmentY, allowanceFactor)\r\n\t\t{\r\n\t\t\t// Look for an alignment pattern (3 modules in size) around where it\r\n\t\t\t// should be\r\n\t\t\tvar allowance = Math.floor (allowanceFactor * overallEstModuleSize);\r\n\t\t\tvar alignmentAreaLeftX = Math.max(0, estAlignmentX - allowance);\r\n\t\t\tvar alignmentAreaRightX = Math.min(qrcode.width - 1, estAlignmentX + allowance);\r\n\t\t\tif (alignmentAreaRightX - alignmentAreaLeftX < overallEstModuleSize * 3)\r\n\t\t\t{\r\n\t\t\t\tthrow \"Error\";\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar alignmentAreaTopY = Math.max(0, estAlignmentY - allowance);\r\n\t\t\tvar alignmentAreaBottomY = Math.min(qrcode.height - 1, estAlignmentY + allowance);\r\n\t\t\t\r\n\t\t\tvar alignmentFinder = new AlignmentPatternFinder(this.image, alignmentAreaLeftX, alignmentAreaTopY, alignmentAreaRightX - alignmentAreaLeftX, alignmentAreaBottomY - alignmentAreaTopY, overallEstModuleSize, this.resultPointCallback);\r\n\t\t\treturn alignmentFinder.find();\r\n\t\t}\r\n\t\t\r\n\tthis.createTransform=function( topLeft, topRight, bottomLeft, alignmentPattern, dimension)\r\n\t\t{\r\n\t\t\tvar dimMinusThree = dimension - 3.5;\r\n\t\t\tvar bottomRightX;\r\n\t\t\tvar bottomRightY;\r\n\t\t\tvar sourceBottomRightX;\r\n\t\t\tvar sourceBottomRightY;\r\n\t\t\tif (alignmentPattern != null)\r\n\t\t\t{\r\n\t\t\t\tbottomRightX = alignmentPattern.X;\r\n\t\t\t\tbottomRightY = alignmentPattern.Y;\r\n\t\t\t\tsourceBottomRightX = sourceBottomRightY = dimMinusThree - 3.0;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t// Don't have an alignment pattern, just make up the bottom-right point\r\n\t\t\t\tbottomRightX = (topRight.X - topLeft.X) + bottomLeft.X;\r\n\t\t\t\tbottomRightY = (topRight.Y - topLeft.Y) + bottomLeft.Y;\r\n\t\t\t\tsourceBottomRightX = sourceBottomRightY = dimMinusThree;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar transform = PerspectiveTransform.quadrilateralToQuadrilateral(3.5, 3.5, dimMinusThree, 3.5, sourceBottomRightX, sourceBottomRightY, 3.5, dimMinusThree, topLeft.X, topLeft.Y, topRight.X, topRight.Y, bottomRightX, bottomRightY, bottomLeft.X, bottomLeft.Y);\r\n\t\t\t\r\n\t\t\treturn transform;\r\n\t\t}\t\t\r\n\t\r\n\tthis.sampleGrid=function( image, transform, dimension)\r\n\t\t{\r\n\t\t\t\r\n\t\t\tvar sampler = GridSampler;\r\n\t\t\treturn sampler.sampleGrid3(image, dimension, transform);\r\n\t\t}\r\n\t\r\n\tthis.processFinderPatternInfo = function( info)\r\n\t\t{\r\n\t\t\t\r\n\t\t\tvar topLeft = info.TopLeft;\r\n\t\t\tvar topRight = info.TopRight;\r\n\t\t\tvar bottomLeft = info.BottomLeft;\r\n\t\t\t\r\n\t\t\tvar moduleSize = this.calculateModuleSize(topLeft, topRight, bottomLeft);\r\n\t\t\tif (moduleSize < 1.0)\r\n\t\t\t{\r\n\t\t\t\tthrow \"Error\";\r\n\t\t\t}\r\n\t\t\tvar dimension = this.computeDimension(topLeft, topRight, bottomLeft, moduleSize);\r\n\t\t\tvar provisionalVersion = Version.getProvisionalVersionForDimension(dimension);\r\n\t\t\tvar modulesBetweenFPCenters = provisionalVersion.DimensionForVersion - 7;\r\n\t\t\t\r\n\t\t\tvar alignmentPattern = null;\r\n\t\t\t// Anything above version 1 has an alignment pattern\r\n\t\t\tif (provisionalVersion.AlignmentPatternCenters.length > 0)\r\n\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\t// Guess where a \"bottom right\" finder pattern would have been\r\n\t\t\t\tvar bottomRightX = topRight.X - topLeft.X + bottomLeft.X;\r\n\t\t\t\tvar bottomRightY = topRight.Y - topLeft.Y + bottomLeft.Y;\r\n\t\t\t\t\r\n\t\t\t\t// Estimate that alignment pattern is closer by 3 modules\r\n\t\t\t\t// from \"bottom right\" to known top left location\r\n\t\t\t\tvar correctionToTopLeft = 1.0 - 3.0 / modulesBetweenFPCenters;\r\n\t\t\t\tvar estAlignmentX = Math.floor (topLeft.X + correctionToTopLeft * (bottomRightX - topLeft.X));\r\n\t\t\t\tvar estAlignmentY = Math.floor (topLeft.Y + correctionToTopLeft * (bottomRightY - topLeft.Y));\r\n\t\t\t\t\r\n\t\t\t\t// Kind of arbitrary -- expand search radius before giving up\r\n\t\t\t\tfor (var i = 4; i <= 16; i <<= 1)\r\n\t\t\t\t{\r\n\t\t\t\t\t//try\r\n\t\t\t\t\t//{\r\n\t\t\t\t\t\talignmentPattern = this.findAlignmentInRegion(moduleSize, estAlignmentX, estAlignmentY, i);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t//}\r\n\t\t\t\t\t//catch (re)\r\n\t\t\t\t\t//{\r\n\t\t\t\t\t\t// try next round\r\n\t\t\t\t\t//}\r\n\t\t\t\t}\r\n\t\t\t\t// If we didn't find alignment pattern... well try anyway without it\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar transform = this.createTransform(topLeft, topRight, bottomLeft, alignmentPattern, dimension);\r\n\t\t\t\r\n\t\t\tvar bits = this.sampleGrid(this.image, transform, dimension);\r\n\t\t\t\r\n\t\t\tvar points;\r\n\t\t\tif (alignmentPattern == null)\r\n\t\t\t{\r\n\t\t\t\tpoints = new Array(bottomLeft, topLeft, topRight);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tpoints = new Array(bottomLeft, topLeft, topRight, alignmentPattern);\r\n\t\t\t}\r\n\t\t\treturn new DetectorResult(bits, points);\r\n\t\t}\r\n\t\t\r\n\r\n\t\r\n\tthis.detect=function()\r\n\t{\r\n\t\tvar info = new FinderPatternFinder().findFinderPattern(this.image);\r\n\t\t\t\r\n\t\treturn this.processFinderPatternInfo(info); \r\n\t}\r\n}\n/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nvar FORMAT_INFO_MASK_QR = 0x5412;\r\nvar FORMAT_INFO_DECODE_LOOKUP = new Array(new Array(0x5412, 0x00), new Array(0x5125, 0x01), new Array(0x5E7C, 0x02), new Array(0x5B4B, 0x03), new Array(0x45F9, 0x04), new Array(0x40CE, 0x05), new Array(0x4F97, 0x06), new Array(0x4AA0, 0x07), new Array(0x77C4, 0x08), new Array(0x72F3, 0x09), new Array(0x7DAA, 0x0A), new Array(0x789D, 0x0B), new Array(0x662F, 0x0C), new Array(0x6318, 0x0D), new Array(0x6C41, 0x0E), new Array(0x6976, 0x0F), new Array(0x1689, 0x10), new Array(0x13BE, 0x11), new Array(0x1CE7, 0x12), new Array(0x19D0, 0x13), new Array(0x0762, 0x14), new Array(0x0255, 0x15), new Array(0x0D0C, 0x16), new Array(0x083B, 0x17), new Array(0x355F, 0x18), new Array(0x3068, 0x19), new Array(0x3F31, 0x1A), new Array(0x3A06, 0x1B), new Array(0x24B4, 0x1C), new Array(0x2183, 0x1D), new Array(0x2EDA, 0x1E), new Array(0x2BED, 0x1F));\r\nvar BITS_SET_IN_HALF_BYTE = new Array(0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4);\r\n\r\n\r\nfunction FormatInformation(formatInfo)\r\n{\r\n\tthis.errorCorrectionLevel = ErrorCorrectionLevel.forBits((formatInfo >> 3) & 0x03);\r\n\tthis.dataMask = (formatInfo & 0x07);\r\n\r\n\tthis.__defineGetter__(\"ErrorCorrectionLevel\", function()\r\n\t{\r\n\t\treturn this.errorCorrectionLevel;\r\n\t});\r\n\tthis.__defineGetter__(\"DataMask\", function()\r\n\t{\r\n\t\treturn this.dataMask;\r\n\t});\r\n\tthis.GetHashCode=function()\r\n\t{\r\n\t\treturn (this.errorCorrectionLevel.ordinal() << 3) | dataMask;\r\n\t}\r\n\tthis.Equals=function( o)\r\n\t{\r\n\t\tvar other = o;\r\n\t\treturn this.errorCorrectionLevel == other.errorCorrectionLevel && this.dataMask == other.dataMask;\r\n\t}\r\n}\r\n\r\nFormatInformation.numBitsDiffering=function( a, b)\r\n{\r\n\ta ^= b; // a now has a 1 bit exactly where its bit differs with b's\r\n\t// Count bits set quickly with a series of lookups:\r\n\treturn BITS_SET_IN_HALF_BYTE[a & 0x0F] + BITS_SET_IN_HALF_BYTE[(URShift(a, 4) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 8) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 12) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 16) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 20) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 24) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 28) & 0x0F)];\r\n}\r\n\r\nFormatInformation.decodeFormatInformation=function( maskedFormatInfo)\r\n{\r\n\tvar formatInfo = FormatInformation.doDecodeFormatInformation(maskedFormatInfo);\r\n\tif (formatInfo != null)\r\n\t{\r\n\t\treturn formatInfo;\r\n\t}\r\n\t// Should return null, but, some QR codes apparently\r\n\t// do not mask this info. Try again by actually masking the pattern\r\n\t// first\r\n\treturn FormatInformation.doDecodeFormatInformation(maskedFormatInfo ^ FORMAT_INFO_MASK_QR);\r\n}\r\nFormatInformation.doDecodeFormatInformation=function( maskedFormatInfo)\r\n{\r\n\t// Find the int in FORMAT_INFO_DECODE_LOOKUP with fewest bits differing\r\n\tvar bestDifference = 0xffffffff;\r\n\tvar bestFormatInfo = 0;\r\n\tfor (var i = 0; i < FORMAT_INFO_DECODE_LOOKUP.length; i++)\r\n\t{\r\n\t\tvar decodeInfo = FORMAT_INFO_DECODE_LOOKUP[i];\r\n\t\tvar targetInfo = decodeInfo[0];\r\n\t\tif (targetInfo == maskedFormatInfo)\r\n\t\t{\r\n\t\t\t// Found an exact match\r\n\t\t\treturn new FormatInformation(decodeInfo[1]);\r\n\t\t}\r\n\t\tvar bitsDifference = this.numBitsDiffering(maskedFormatInfo, targetInfo);\r\n\t\tif (bitsDifference < bestDifference)\r\n\t\t{\r\n\t\t\tbestFormatInfo = decodeInfo[1];\r\n\t\t\tbestDifference = bitsDifference;\r\n\t\t}\r\n\t}\r\n\t// Hamming distance of the 32 masked codes is 7, by construction, so <= 3 bits\r\n\t// differing means we found a match\r\n\tif (bestDifference <= 3)\r\n\t{\r\n\t\treturn new FormatInformation(bestFormatInfo);\r\n\t}\r\n\treturn null;\r\n}\r\n\r\n\t\t\n/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction ErrorCorrectionLevel(ordinal, bits, name)\r\n{\r\n\tthis.ordinal_Renamed_Field = ordinal;\r\n\tthis.bits = bits;\r\n\tthis.name = name;\r\n\tthis.__defineGetter__(\"Bits\", function()\r\n\t{\r\n\t\treturn this.bits;\r\n\t});\r\n\tthis.__defineGetter__(\"Name\", function()\r\n\t{\r\n\t\treturn this.name;\r\n\t});\r\n\tthis.ordinal=function()\r\n\t{\r\n\t\treturn this.ordinal_Renamed_Field;\r\n\t}\r\n}\r\n\r\nErrorCorrectionLevel.forBits=function( bits)\r\n{\r\n\tif (bits < 0 || bits >= FOR_BITS.length)\r\n\t{\r\n\t\tthrow \"ArgumentException\";\r\n\t}\r\n\treturn FOR_BITS[bits];\r\n}\r\n\r\nvar L = new ErrorCorrectionLevel(0, 0x01, \"L\");\r\nvar M = new ErrorCorrectionLevel(1, 0x00, \"M\");\r\nvar Q = new ErrorCorrectionLevel(2, 0x03, \"Q\");\r\nvar H = new ErrorCorrectionLevel(3, 0x02, \"H\");\r\nvar FOR_BITS = new Array( M, L, H, Q);\r\n\n/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction BitMatrix( width, height)\r\n{\r\n\tif(!height)\r\n\t\theight=width;\r\n\tif (width < 1 || height < 1)\r\n\t{\r\n\t\tthrow \"Both dimensions must be greater than 0\";\r\n\t}\r\n\tthis.width = width;\r\n\tthis.height = height;\r\n\tvar rowSize = width >> 5;\r\n\tif ((width & 0x1f) != 0)\r\n\t{\r\n\t\trowSize++;\r\n\t}\r\n\tthis.rowSize = rowSize;\r\n\tthis.bits = new Array(rowSize * height);\r\n\tfor(var i=0;i> 5);\r\n\t\t\treturn ((URShift(this.bits[offset], (x & 0x1f))) & 1) != 0;\r\n\t\t}\r\n\tthis.set_Renamed=function( x, y)\r\n\t\t{\r\n\t\t\tvar offset = y * this.rowSize + (x >> 5);\r\n\t\t\tthis.bits[offset] |= 1 << (x & 0x1f);\r\n\t\t}\r\n\tthis.flip=function( x, y)\r\n\t\t{\r\n\t\t\tvar offset = y * this.rowSize + (x >> 5);\r\n\t\t\tthis.bits[offset] ^= 1 << (x & 0x1f);\r\n\t\t}\r\n\tthis.clear=function()\r\n\t\t{\r\n\t\t\tvar max = this.bits.length;\r\n\t\t\tfor (var i = 0; i < max; i++)\r\n\t\t\t{\r\n\t\t\t\tthis.bits[i] = 0;\r\n\t\t\t}\r\n\t\t}\r\n\tthis.setRegion=function( left, top, width, height)\r\n\t\t{\r\n\t\t\tif (top < 0 || left < 0)\r\n\t\t\t{\r\n\t\t\t\tthrow \"Left and top must be nonnegative\";\r\n\t\t\t}\r\n\t\t\tif (height < 1 || width < 1)\r\n\t\t\t{\r\n\t\t\t\tthrow \"Height and width must be at least 1\";\r\n\t\t\t}\r\n\t\t\tvar right = left + width;\r\n\t\t\tvar bottom = top + height;\r\n\t\t\tif (bottom > this.height || right > this.width)\r\n\t\t\t{\r\n\t\t\t\tthrow \"The region must fit inside the matrix\";\r\n\t\t\t}\r\n\t\t\tfor (var y = top; y < bottom; y++)\r\n\t\t\t{\r\n\t\t\t\tvar offset = y * this.rowSize;\r\n\t\t\t\tfor (var x = left; x < right; x++)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.bits[offset + (x >> 5)] |= 1 << (x & 0x1f);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n}\n/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction DataBlock(numDataCodewords, codewords)\r\n{\r\n\tthis.numDataCodewords = numDataCodewords;\r\n\tthis.codewords = codewords;\r\n\t\r\n\tthis.__defineGetter__(\"NumDataCodewords\", function()\r\n\t{\r\n\t\treturn this.numDataCodewords;\r\n\t});\r\n\tthis.__defineGetter__(\"Codewords\", function()\r\n\t{\r\n\t\treturn this.codewords;\r\n\t});\r\n}\t\r\n\t\r\nDataBlock.getDataBlocks=function(rawCodewords, version, ecLevel)\r\n{\r\n\t\r\n\tif (rawCodewords.length != version.TotalCodewords)\r\n\t{\r\n\t\tthrow \"ArgumentException\";\r\n\t}\r\n\t\r\n\t// Figure out the number and size of data blocks used by this version and\r\n\t// error correction level\r\n\tvar ecBlocks = version.getECBlocksForLevel(ecLevel);\r\n\t\r\n\t// First count the total number of data blocks\r\n\tvar totalBlocks = 0;\r\n\tvar ecBlockArray = ecBlocks.getECBlocks();\r\n\tfor (var i = 0; i < ecBlockArray.length; i++)\r\n\t{\r\n\t\ttotalBlocks += ecBlockArray[i].Count;\r\n\t}\r\n\t\r\n\t// Now establish DataBlocks of the appropriate size and number of data codewords\r\n\tvar result = new Array(totalBlocks);\r\n\tvar numResultBlocks = 0;\r\n\tfor (var j = 0; j < ecBlockArray.length; j++)\r\n\t{\r\n\t\tvar ecBlock = ecBlockArray[j];\r\n\t\tfor (var i = 0; i < ecBlock.Count; i++)\r\n\t\t{\r\n\t\t\tvar numDataCodewords = ecBlock.DataCodewords;\r\n\t\t\tvar numBlockCodewords = ecBlocks.ECCodewordsPerBlock + numDataCodewords;\r\n\t\t\tresult[numResultBlocks++] = new DataBlock(numDataCodewords, new Array(numBlockCodewords));\r\n\t\t}\r\n\t}\r\n\t\r\n\t// All blocks have the same amount of data, except that the last n\r\n\t// (where n may be 0) have 1 more byte. Figure out where these start.\r\n\tvar shorterBlocksTotalCodewords = result[0].codewords.length;\r\n\tvar longerBlocksStartAt = result.length - 1;\r\n\twhile (longerBlocksStartAt >= 0)\r\n\t{\r\n\t\tvar numCodewords = result[longerBlocksStartAt].codewords.length;\r\n\t\tif (numCodewords == shorterBlocksTotalCodewords)\r\n\t\t{\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tlongerBlocksStartAt--;\r\n\t}\r\n\tlongerBlocksStartAt++;\r\n\t\r\n\tvar shorterBlocksNumDataCodewords = shorterBlocksTotalCodewords - ecBlocks.ECCodewordsPerBlock;\r\n\t// The last elements of result may be 1 element longer;\r\n\t// first fill out as many elements as all of them have\r\n\tvar rawCodewordsOffset = 0;\r\n\tfor (var i = 0; i < shorterBlocksNumDataCodewords; i++)\r\n\t{\r\n\t\tfor (var j = 0; j < numResultBlocks; j++)\r\n\t\t{\r\n\t\t\tresult[j].codewords[i] = rawCodewords[rawCodewordsOffset++];\r\n\t\t}\r\n\t}\r\n\t// Fill out the last data block in the longer ones\r\n\tfor (var j = longerBlocksStartAt; j < numResultBlocks; j++)\r\n\t{\r\n\t\tresult[j].codewords[shorterBlocksNumDataCodewords] = rawCodewords[rawCodewordsOffset++];\r\n\t}\r\n\t// Now add in error correction blocks\r\n\tvar max = result[0].codewords.length;\r\n\tfor (var i = shorterBlocksNumDataCodewords; i < max; i++)\r\n\t{\r\n\t\tfor (var j = 0; j < numResultBlocks; j++)\r\n\t\t{\r\n\t\t\tvar iOffset = j < longerBlocksStartAt?i:i + 1;\r\n\t\t\tresult[j].codewords[iOffset] = rawCodewords[rawCodewordsOffset++];\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n}\r\n\n/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction BitMatrixParser(bitMatrix)\r\n{\r\n\tvar dimension = bitMatrix.Dimension;\r\n\tif (dimension < 21 || (dimension & 0x03) != 1)\r\n\t{\r\n\t\tthrow \"Error BitMatrixParser\";\r\n\t}\r\n\tthis.bitMatrix = bitMatrix;\r\n\tthis.parsedVersion = null;\r\n\tthis.parsedFormatInfo = null;\r\n\t\r\n\tthis.copyBit=function( i, j, versionBits)\r\n\t{\r\n\t\treturn this.bitMatrix.get_Renamed(i, j)?(versionBits << 1) | 0x1:versionBits << 1;\r\n\t}\r\n\t\r\n\tthis.readFormatInformation=function()\r\n\t{\r\n\t\t\tif (this.parsedFormatInfo != null)\r\n\t\t\t{\r\n\t\t\t\treturn this.parsedFormatInfo;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Read top-left format info bits\r\n\t\t\tvar formatInfoBits = 0;\r\n\t\t\tfor (var i = 0; i < 6; i++)\r\n\t\t\t{\r\n\t\t\t\tformatInfoBits = this.copyBit(i, 8, formatInfoBits);\r\n\t\t\t}\r\n\t\t\t// .. and skip a bit in the timing pattern ...\r\n\t\t\tformatInfoBits = this.copyBit(7, 8, formatInfoBits);\r\n\t\t\tformatInfoBits = this.copyBit(8, 8, formatInfoBits);\r\n\t\t\tformatInfoBits = this.copyBit(8, 7, formatInfoBits);\r\n\t\t\t// .. and skip a bit in the timing pattern ...\r\n\t\t\tfor (var j = 5; j >= 0; j--)\r\n\t\t\t{\r\n\t\t\t\tformatInfoBits = this.copyBit(8, j, formatInfoBits);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tthis.parsedFormatInfo = FormatInformation.decodeFormatInformation(formatInfoBits);\r\n\t\t\tif (this.parsedFormatInfo != null)\r\n\t\t\t{\r\n\t\t\t\treturn this.parsedFormatInfo;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Hmm, failed. Try the top-right/bottom-left pattern\r\n\t\t\tvar dimension = this.bitMatrix.Dimension;\r\n\t\t\tformatInfoBits = 0;\r\n\t\t\tvar iMin = dimension - 8;\r\n\t\t\tfor (var i = dimension - 1; i >= iMin; i--)\r\n\t\t\t{\r\n\t\t\t\tformatInfoBits = this.copyBit(i, 8, formatInfoBits);\r\n\t\t\t}\r\n\t\t\tfor (var j = dimension - 7; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tformatInfoBits = this.copyBit(8, j, formatInfoBits);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tthis.parsedFormatInfo = FormatInformation.decodeFormatInformation(formatInfoBits);\r\n\t\t\tif (this.parsedFormatInfo != null)\r\n\t\t\t{\r\n\t\t\t\treturn this.parsedFormatInfo;\r\n\t\t\t}\r\n\t\t\tthrow \"Error readFormatInformation\";\t\r\n\t}\r\n\tthis.readVersion=function()\r\n\t\t{\r\n\t\t\t\r\n\t\t\tif (this.parsedVersion != null)\r\n\t\t\t{\r\n\t\t\t\treturn this.parsedVersion;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar dimension = this.bitMatrix.Dimension;\r\n\t\t\t\r\n\t\t\tvar provisionalVersion = (dimension - 17) >> 2;\r\n\t\t\tif (provisionalVersion <= 6)\r\n\t\t\t{\r\n\t\t\t\treturn Version.getVersionForNumber(provisionalVersion);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Read top-right version info: 3 wide by 6 tall\r\n\t\t\tvar versionBits = 0;\r\n\t\t\tvar ijMin = dimension - 11;\r\n\t\t\tfor (var j = 5; j >= 0; j--)\r\n\t\t\t{\r\n\t\t\t\tfor (var i = dimension - 9; i >= ijMin; i--)\r\n\t\t\t\t{\r\n\t\t\t\t\tversionBits = this.copyBit(i, j, versionBits);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tthis.parsedVersion = Version.decodeVersionInformation(versionBits);\r\n\t\t\tif (this.parsedVersion != null && this.parsedVersion.DimensionForVersion == dimension)\r\n\t\t\t{\r\n\t\t\t\treturn this.parsedVersion;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Hmm, failed. Try bottom left: 6 wide by 3 tall\r\n\t\t\tversionBits = 0;\r\n\t\t\tfor (var i = 5; i >= 0; i--)\r\n\t\t\t{\r\n\t\t\t\tfor (var j = dimension - 9; j >= ijMin; j--)\r\n\t\t\t\t{\r\n\t\t\t\t\tversionBits = this.copyBit(i, j, versionBits);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tthis.parsedVersion = Version.decodeVersionInformation(versionBits);\r\n\t\t\tif (this.parsedVersion != null && this.parsedVersion.DimensionForVersion == dimension)\r\n\t\t\t{\r\n\t\t\t\treturn this.parsedVersion;\r\n\t\t\t}\r\n\t\t\tthrow \"Error readVersion\";\r\n\t\t}\r\n\tthis.readCodewords=function()\r\n\t\t{\r\n\t\t\t\r\n\t\t\tvar formatInfo = this.readFormatInformation();\r\n\t\t\tvar version = this.readVersion();\r\n\t\t\t\r\n\t\t\t// Get the data mask for the format used in this QR Code. This will exclude\r\n\t\t\t// some bits from reading as we wind through the bit matrix.\r\n\t\t\tvar dataMask = DataMask.forReference( formatInfo.DataMask);\r\n\t\t\tvar dimension = this.bitMatrix.Dimension;\r\n\t\t\tdataMask.unmaskBitMatrix(this.bitMatrix, dimension);\r\n\t\t\t\r\n\t\t\tvar functionPattern = version.buildFunctionPattern();\r\n\t\t\t\r\n\t\t\tvar readingUp = true;\r\n\t\t\tvar result = new Array(version.TotalCodewords);\r\n\t\t\tvar resultOffset = 0;\r\n\t\t\tvar currentByte = 0;\r\n\t\t\tvar bitsRead = 0;\r\n\t\t\t// Read columns in pairs, from right to left\r\n\t\t\tfor (var j = dimension - 1; j > 0; j -= 2)\r\n\t\t\t{\r\n\t\t\t\tif (j == 6)\r\n\t\t\t\t{\r\n\t\t\t\t\t// Skip whole column with vertical alignment pattern;\r\n\t\t\t\t\t// saves time and makes the other code proceed more cleanly\r\n\t\t\t\t\tj--;\r\n\t\t\t\t}\r\n\t\t\t\t// Read alternatingly from bottom to top then top to bottom\r\n\t\t\t\tfor (var count = 0; count < dimension; count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar i = readingUp?dimension - 1 - count:count;\r\n\t\t\t\t\tfor (var col = 0; col < 2; col++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// Ignore bits covered by the function pattern\r\n\t\t\t\t\t\tif (!functionPattern.get_Renamed(j - col, i))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t// Read a bit\r\n\t\t\t\t\t\t\tbitsRead++;\r\n\t\t\t\t\t\t\tcurrentByte <<= 1;\r\n\t\t\t\t\t\t\tif (this.bitMatrix.get_Renamed(j - col, i))\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tcurrentByte |= 1;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t// If we've made a whole byte, save it off\r\n\t\t\t\t\t\t\tif (bitsRead == 8)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tresult[resultOffset++] = currentByte;\r\n\t\t\t\t\t\t\t\tbitsRead = 0;\r\n\t\t\t\t\t\t\t\tcurrentByte = 0;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\treadingUp ^= true; // readingUp = !readingUp; // switch directions\r\n\t\t\t}\r\n\t\t\tif (resultOffset != version.TotalCodewords)\r\n\t\t\t{\r\n\t\t\t\tthrow \"Error readCodewords\";\r\n\t\t\t}\r\n\t\t\treturn result;\r\n\t\t}\r\n}\n/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nDataMask = {};\r\n\r\nDataMask.forReference = function(reference)\r\n{\r\n\tif (reference < 0 || reference > 7)\r\n\t{\r\n\t\tthrow \"System.ArgumentException\";\r\n\t}\r\n\treturn DataMask.DATA_MASKS[reference];\r\n}\r\n\r\nfunction DataMask000()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\treturn ((i + j) & 0x01) == 0;\r\n\t}\r\n}\r\n\r\nfunction DataMask001()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\treturn (i & 0x01) == 0;\r\n\t}\r\n}\r\n\r\nfunction DataMask010()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\treturn j % 3 == 0;\r\n\t}\r\n}\r\n\r\nfunction DataMask011()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\treturn (i + j) % 3 == 0;\r\n\t}\r\n}\r\n\r\nfunction DataMask100()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\treturn (((URShift(i, 1)) + (j / 3)) & 0x01) == 0;\r\n\t}\r\n}\r\n\r\nfunction DataMask101()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\tvar temp = i * j;\r\n\t\treturn (temp & 0x01) + (temp % 3) == 0;\r\n\t}\r\n}\r\n\r\nfunction DataMask110()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\tvar temp = i * j;\r\n\t\treturn (((temp & 0x01) + (temp % 3)) & 0x01) == 0;\r\n\t}\r\n}\r\nfunction DataMask111()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\treturn ((((i + j) & 0x01) + ((i * j) % 3)) & 0x01) == 0;\r\n\t}\r\n}\r\n\r\nDataMask.DATA_MASKS = new Array(new DataMask000(), new DataMask001(), new DataMask010(), new DataMask011(), new DataMask100(), new DataMask101(), new DataMask110(), new DataMask111());\r\n\r\n\n/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction ReedSolomonDecoder(field)\r\n{\r\n\tthis.field = field;\r\n\tthis.decode=function(received, twoS)\r\n\t{\r\n\t\t\tvar poly = new GF256Poly(this.field, received);\r\n\t\t\tvar syndromeCoefficients = new Array(twoS);\r\n\t\t\tfor(var i=0;i= b's\r\n\t\t\tif (a.Degree < b.Degree)\r\n\t\t\t{\r\n\t\t\t\tvar temp = a;\r\n\t\t\t\ta = b;\r\n\t\t\t\tb = temp;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar rLast = a;\r\n\t\t\tvar r = b;\r\n\t\t\tvar sLast = this.field.One;\r\n\t\t\tvar s = this.field.Zero;\r\n\t\t\tvar tLast = this.field.Zero;\r\n\t\t\tvar t = this.field.One;\r\n\t\t\t\r\n\t\t\t// Run Euclidean algorithm until r's degree is less than R/2\r\n\t\t\twhile (r.Degree >= Math.floor(R / 2))\r\n\t\t\t{\r\n\t\t\t\tvar rLastLast = rLast;\r\n\t\t\t\tvar sLastLast = sLast;\r\n\t\t\t\tvar tLastLast = tLast;\r\n\t\t\t\trLast = r;\r\n\t\t\t\tsLast = s;\r\n\t\t\t\ttLast = t;\r\n\t\t\t\t\r\n\t\t\t\t// Divide rLastLast by rLast, with quotient in q and remainder in r\r\n\t\t\t\tif (rLast.Zero)\r\n\t\t\t\t{\r\n\t\t\t\t\t// Oops, Euclidean algorithm already terminated?\r\n\t\t\t\t\tthrow \"r_{i-1} was zero\";\r\n\t\t\t\t}\r\n\t\t\t\tr = rLastLast;\r\n\t\t\t\tvar q = this.field.Zero;\r\n\t\t\t\tvar denominatorLeadingTerm = rLast.getCoefficient(rLast.Degree);\r\n\t\t\t\tvar dltInverse = this.field.inverse(denominatorLeadingTerm);\r\n\t\t\t\twhile (r.Degree >= rLast.Degree && !r.Zero)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar degreeDiff = r.Degree - rLast.Degree;\r\n\t\t\t\t\tvar scale = this.field.multiply(r.getCoefficient(r.Degree), dltInverse);\r\n\t\t\t\t\tq = q.addOrSubtract(this.field.buildMonomial(degreeDiff, scale));\r\n\t\t\t\t\tr = r.addOrSubtract(rLast.multiplyByMonomial(degreeDiff, scale));\r\n\t\t\t\t\t//r.EXE();\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\ts = q.multiply1(sLast).addOrSubtract(sLastLast);\r\n\t\t\t\tt = q.multiply1(tLast).addOrSubtract(tLastLast);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar sigmaTildeAtZero = t.getCoefficient(0);\r\n\t\t\tif (sigmaTildeAtZero == 0)\r\n\t\t\t{\r\n\t\t\t\tthrow \"ReedSolomonException sigmaTilde(0) was zero\";\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar inverse = this.field.inverse(sigmaTildeAtZero);\r\n\t\t\tvar sigma = t.multiply2(inverse);\r\n\t\t\tvar omega = r.multiply2(inverse);\r\n\t\t\treturn new Array(sigma, omega);\r\n\t\t}\r\n\tthis.findErrorLocations=function( errorLocator)\r\n\t\t{\r\n\t\t\t// This is a direct application of Chien's search\r\n\t\t\tvar numErrors = errorLocator.Degree;\r\n\t\t\tif (numErrors == 1)\r\n\t\t\t{\r\n\t\t\t\t// shortcut\r\n\t\t\t\treturn new Array(errorLocator.getCoefficient(1));\r\n\t\t\t}\r\n\t\t\tvar result = new Array(numErrors);\r\n\t\t\tvar e = 0;\r\n\t\t\tfor (var i = 1; i < 256 && e < numErrors; i++)\r\n\t\t\t{\r\n\t\t\t\tif (errorLocator.evaluateAt(i) == 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tresult[e] = this.field.inverse(i);\r\n\t\t\t\t\te++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (e != numErrors)\r\n\t\t\t{\r\n\t\t\t\tthrow \"Error locator degree does not match number of roots\";\r\n\t\t\t}\r\n\t\t\treturn result;\r\n\t\t}\r\n\tthis.findErrorMagnitudes=function( errorEvaluator, errorLocations, dataMatrix)\r\n\t\t{\r\n\t\t\t// This is directly applying Forney's Formula\r\n\t\t\tvar s = errorLocations.length;\r\n\t\t\tvar result = new Array(s);\r\n\t\t\tfor (var i = 0; i < s; i++)\r\n\t\t\t{\r\n\t\t\t\tvar xiInverse = this.field.inverse(errorLocations[i]);\r\n\t\t\t\tvar denominator = 1;\r\n\t\t\t\tfor (var j = 0; j < s; j++)\r\n\t\t\t\t{\r\n\t\t\t\t\tif (i != j)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tdenominator = this.field.multiply(denominator, GF256.addOrSubtract(1, this.field.multiply(errorLocations[j], xiInverse)));\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tresult[i] = this.field.multiply(errorEvaluator.evaluateAt(xiInverse), this.field.inverse(denominator));\r\n\t\t\t\t// Thanks to sanfordsquires for this fix:\r\n\t\t\t\tif (dataMatrix)\r\n\t\t\t\t{\r\n\t\t\t\t\tresult[i] = this.field.multiply(result[i], xiInverse);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn result;\r\n\t\t}\r\n}\n/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction GF256Poly(field, coefficients)\r\n{\r\n\tif (coefficients == null || coefficients.length == 0)\r\n\t{\r\n\t\tthrow \"System.ArgumentException\";\r\n\t}\r\n\tthis.field = field;\r\n\tvar coefficientsLength = coefficients.length;\r\n\tif (coefficientsLength > 1 && coefficients[0] == 0)\r\n\t{\r\n\t\t// Leading term must be non-zero for anything except the constant polynomial \"0\"\r\n\t\tvar firstNonZero = 1;\r\n\t\twhile (firstNonZero < coefficientsLength && coefficients[firstNonZero] == 0)\r\n\t\t{\r\n\t\t\tfirstNonZero++;\r\n\t\t}\r\n\t\tif (firstNonZero == coefficientsLength)\r\n\t\t{\r\n\t\t\tthis.coefficients = field.Zero.coefficients;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.coefficients = new Array(coefficientsLength - firstNonZero);\r\n\t\t\tfor(var i=0;i largerCoefficients.length)\r\n\t\t\t{\r\n\t\t\t\tvar temp = smallerCoefficients;\r\n\t\t\t\tsmallerCoefficients = largerCoefficients;\r\n\t\t\t\tlargerCoefficients = temp;\r\n\t\t\t}\r\n\t\t\tvar sumDiff = new Array(largerCoefficients.length);\r\n\t\t\tvar lengthDiff = largerCoefficients.length - smallerCoefficients.length;\r\n\t\t\t// Copy high-order terms only found in higher-degree polynomial's coefficients\r\n\t\t\t//Array.Copy(largerCoefficients, 0, sumDiff, 0, lengthDiff);\r\n\t\t\tfor(var ci=0;ci= other.Degree && !remainder.Zero)\r\n\t\t\t{\r\n\t\t\t\tvar degreeDifference = remainder.Degree - other.Degree;\r\n\t\t\t\tvar scale = this.field.multiply(remainder.getCoefficient(remainder.Degree), inverseDenominatorLeadingTerm);\r\n\t\t\t\tvar term = other.multiplyByMonomial(degreeDifference, scale);\r\n\t\t\t\tvar iterationQuotient = this.field.buildMonomial(degreeDifference, scale);\r\n\t\t\t\tquotient = quotient.addOrSubtract(iterationQuotient);\r\n\t\t\t\tremainder = remainder.addOrSubtract(term);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn new Array(quotient, remainder);\r\n\t\t}\r\n}\n/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction GF256( primitive)\r\n{\r\n\tthis.expTable = new Array(256);\r\n\tthis.logTable = new Array(256);\r\n\tvar x = 1;\r\n\tfor (var i = 0; i < 256; i++)\r\n\t{\r\n\t\tthis.expTable[i] = x;\r\n\t\tx <<= 1; // x = x * 2; we're assuming the generator alpha is 2\r\n\t\tif (x >= 0x100)\r\n\t\t{\r\n\t\t\tx ^= primitive;\r\n\t\t}\r\n\t}\r\n\tfor (var i = 0; i < 255; i++)\r\n\t{\r\n\t\tthis.logTable[this.expTable[i]] = i;\r\n\t}\r\n\t// logTable[0] == 0 but this should never be used\r\n\tvar at0=new Array(1);at0[0]=0;\r\n\tthis.zero = new GF256Poly(this, new Array(at0));\r\n\tvar at1=new Array(1);at1[0]=1;\r\n\tthis.one = new GF256Poly(this, new Array(at1));\r\n\t\r\n\tthis.__defineGetter__(\"Zero\", function()\r\n\t{\r\n\t\treturn this.zero;\r\n\t});\r\n\tthis.__defineGetter__(\"One\", function()\r\n\t{\r\n\t\treturn this.one;\r\n\t});\r\n\tthis.buildMonomial=function( degree, coefficient)\r\n\t\t{\r\n\t\t\tif (degree < 0)\r\n\t\t\t{\r\n\t\t\t\tthrow \"System.ArgumentException\";\r\n\t\t\t}\r\n\t\t\tif (coefficient == 0)\r\n\t\t\t{\r\n\t\t\t\treturn zero;\r\n\t\t\t}\r\n\t\t\tvar coefficients = new Array(degree + 1);\r\n\t\t\tfor(var i=0;iqrcode.maxImgSize)\n {\n var ir = image.width / image.height;\n nheight = Math.sqrt(qrcode.maxImgSize/ir);\n nwidth=ir*nheight;\n }\n\n canvas_qr.width = nwidth;\n canvas_qr.height = nheight;\n\n context.drawImage(image, 0, 0, canvas_qr.width, canvas_qr.height );\n qrcode.width = canvas_qr.width;\n qrcode.height = canvas_qr.height;\n try{\n qrcode.imagedata = context.getImageData(0, 0, canvas_qr.width, canvas_qr.height);\n }catch(e){\n qrcode.result = \"Cross domain Error\";\n if(qrcode.callback!=null)\n qrcode.callback(qrcode.result);\n return;\n }\n\n try\n {\n qrcode.result = qrcode.process(context);\n cb(null, qrcode.result);\n }\n catch(e)\n {\n // console.log(e);\n qrcode.result = \"Error decoding QR Code from Image\";\n cb(new Error(\"Error decoding QR Code from Image\"));\n }\n if(qrcode.callback!=null)\n qrcode.callback(qrcode.result);\n }\n image.src = src;\n }\n}\n\nqrcode.isUrl = function(s)\n{\n var regexp = /(ftp|http|https):\\/\\/(\\w+:{0,1}\\w*@)?(\\S+)(:[0-9]+)?(\\/|\\/([\\w#!:.?+=&%@!\\-\\/]))?/;\n return regexp.test(s);\n}\n\nqrcode.decode_url = function (s)\n{\n var escaped = \"\";\n try{\n escaped = escape( s );\n }\n catch(e)\n {\n // console.log(e);\n escaped = s;\n }\n var ret = \"\";\n try{\n ret = decodeURIComponent( escaped );\n }\n catch(e)\n {\n // console.log(e);\n ret = escaped;\n }\n return ret;\n}\n\nqrcode.decode_utf8 = function ( s )\n{\n if(qrcode.isUrl(s))\n return qrcode.decode_url(s);\n else\n return s;\n}\n\nqrcode.process = function(ctx){\n\n var start = new Date().getTime();\n\n var image = qrcode.grayScaleToBitmap(qrcode.grayscale());\n //var image = qrcode.binarize(128);\n\n if(qrcode.debug)\n {\n for (var y = 0; y < qrcode.height; y++)\n {\n for (var x = 0; x < qrcode.width; x++)\n {\n var point = (x * 4) + (y * qrcode.width * 4);\n qrcode.imagedata.data[point] = image[x+y*qrcode.width]?0:0;\n qrcode.imagedata.data[point+1] = image[x+y*qrcode.width]?0:0;\n qrcode.imagedata.data[point+2] = image[x+y*qrcode.width]?255:0;\n }\n }\n ctx.putImageData(qrcode.imagedata, 0, 0);\n }\n\n //var finderPatternInfo = new FinderPatternFinder().findFinderPattern(image);\n\n var detector = new Detector(image);\n\n var qRCodeMatrix = detector.detect();\n\n /*for (var y = 0; y < qRCodeMatrix.bits.Height; y++)\n {\n for (var x = 0; x < qRCodeMatrix.bits.Width; x++)\n {\n var point = (x * 4*2) + (y*2 * qrcode.width * 4);\n qrcode.imagedata.data[point] = qRCodeMatrix.bits.get_Renamed(x,y)?0:0;\n qrcode.imagedata.data[point+1] = qRCodeMatrix.bits.get_Renamed(x,y)?0:0;\n qrcode.imagedata.data[point+2] = qRCodeMatrix.bits.get_Renamed(x,y)?255:0;\n }\n }*/\n if(qrcode.debug)\n ctx.putImageData(qrcode.imagedata, 0, 0);\n\n var reader = Decoder.decode(qRCodeMatrix.bits);\n var data = reader.DataByte;\n var str=\"\";\n for(var i=0;i minmax[ax][ay][1])\n minmax[ax][ay][1] = target;\n }\n }\n //minmax[ax][ay][0] = (minmax[ax][ay][0] + minmax[ax][ay][1]) / 2;\n }\n }\n var middle = new Array(numSqrtArea);\n for (var i3 = 0; i3 < numSqrtArea; i3++)\n {\n middle[i3] = new Array(numSqrtArea);\n }\n for (var ay = 0; ay < numSqrtArea; ay++)\n {\n for (var ax = 0; ax < numSqrtArea; ax++)\n {\n middle[ax][ay] = Math.floor((minmax[ax][ay][0] + minmax[ax][ay][1]) / 2);\n //Console.out.print(middle[ax][ay] + \",\");\n }\n //Console.out.println(\"\");\n }\n //Console.out.println(\"\");\n\n return middle;\n}\n\nqrcode.grayScaleToBitmap=function(grayScale)\n{\n var middle = qrcode.getMiddleBrightnessPerArea(grayScale);\n var sqrtNumArea = middle.length;\n var areaWidth = Math.floor(qrcode.width / sqrtNumArea);\n var areaHeight = Math.floor(qrcode.height / sqrtNumArea);\n var bitmap = new Array(qrcode.height*qrcode.width);\n\n for (var ay = 0; ay < sqrtNumArea; ay++)\n {\n for (var ax = 0; ax < sqrtNumArea; ax++)\n {\n for (var dy = 0; dy < areaHeight; dy++)\n {\n for (var dx = 0; dx < areaWidth; dx++)\n {\n bitmap[areaWidth * ax + dx+ (areaHeight * ay + dy)*qrcode.width] = (grayScale[areaWidth * ax + dx+ (areaHeight * ay + dy)*qrcode.width] < middle[ax][ay])?true:false;\n }\n }\n }\n }\n return bitmap;\n}\n\nqrcode.grayscale = function(){\n var ret = new Array(qrcode.width*qrcode.height);\n for (var y = 0; y < qrcode.height; y++)\n {\n for (var x = 0; x < qrcode.width; x++)\n {\n var gray = qrcode.getPixel(x, y);\n\n ret[x+y*qrcode.width] = gray;\n }\n }\n return ret;\n}\n\n\n\n\nfunction URShift( number, bits)\n{\n if (number >= 0)\n return number >> bits;\n else\n return (number >> bits) + (2 << ~bits);\n}\n\n\nArray.prototype.remove = function(from, to) {\n var rest = this.slice((to || from) + 1 || this.length);\n this.length = from < 0 ? this.length + from : from;\n return this.push.apply(this, rest);\n};\n\n/*\n Ported to JavaScript by Lazar Laszlo 2011\n\n lazarsoft@gmail.com, www.lazarsoft.info\n\n*/\n\n/*\n*\n* Copyright 2007 ZXing authors\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n\nvar MIN_SKIP = 3;\nvar MAX_MODULES = 57;\nvar INTEGER_MATH_SHIFT = 8;\nvar CENTER_QUORUM = 2;\n\nqrcode.orderBestPatterns=function(patterns)\n\t\t{\n\n\t\t\tfunction distance( pattern1, pattern2)\n\t\t\t{\n\t\t\t\txDiff = pattern1.X - pattern2.X;\n\t\t\t\tyDiff = pattern1.Y - pattern2.Y;\n\t\t\t\treturn Math.sqrt( (xDiff * xDiff + yDiff * yDiff));\n\t\t\t}\n\n\t\t\t/// Returns the z component of the cross product between vectors BC and BA.\n\t\t\tfunction crossProductZ( pointA, pointB, pointC)\n\t\t\t{\n\t\t\t\tvar bX = pointB.x;\n\t\t\t\tvar bY = pointB.y;\n\t\t\t\treturn ((pointC.x - bX) * (pointA.y - bY)) - ((pointC.y - bY) * (pointA.x - bX));\n\t\t\t}\n\n\n\t\t\t// Find distances between pattern centers\n\t\t\tvar zeroOneDistance = distance(patterns[0], patterns[1]);\n\t\t\tvar oneTwoDistance = distance(patterns[1], patterns[2]);\n\t\t\tvar zeroTwoDistance = distance(patterns[0], patterns[2]);\n\n\t\t\tvar pointA, pointB, pointC;\n\t\t\t// Assume one closest to other two is B; A and C will just be guesses at first\n\t\t\tif (oneTwoDistance >= zeroOneDistance && oneTwoDistance >= zeroTwoDistance)\n\t\t\t{\n\t\t\t\tpointB = patterns[0];\n\t\t\t\tpointA = patterns[1];\n\t\t\t\tpointC = patterns[2];\n\t\t\t}\n\t\t\telse if (zeroTwoDistance >= oneTwoDistance && zeroTwoDistance >= zeroOneDistance)\n\t\t\t{\n\t\t\t\tpointB = patterns[1];\n\t\t\t\tpointA = patterns[0];\n\t\t\t\tpointC = patterns[2];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tpointB = patterns[2];\n\t\t\t\tpointA = patterns[0];\n\t\t\t\tpointC = patterns[1];\n\t\t\t}\n\n\t\t\t// Use cross product to figure out whether A and C are correct or flipped.\n\t\t\t// This asks whether BC x BA has a positive z component, which is the arrangement\n\t\t\t// we want for A, B, C. If it's negative, then we've got it flipped around and\n\t\t\t// should swap A and C.\n\t\t\tif (crossProductZ(pointA, pointB, pointC) < 0.0)\n\t\t\t{\n\t\t\t\tvar temp = pointA;\n\t\t\t\tpointA = pointC;\n\t\t\t\tpointC = temp;\n\t\t\t}\n\n\t\t\tpatterns[0] = pointA;\n\t\t\tpatterns[1] = pointB;\n\t\t\tpatterns[2] = pointC;\n\t\t}\n\n\nfunction FinderPattern(posX, posY, estimatedModuleSize)\n{\n\tthis.x=posX;\n\tthis.y=posY;\n\tthis.count = 1;\n\tthis.estimatedModuleSize = estimatedModuleSize;\n\n\tthis.__defineGetter__(\"EstimatedModuleSize\", function()\n\t{\n\t\treturn this.estimatedModuleSize;\n\t});\n\tthis.__defineGetter__(\"Count\", function()\n\t{\n\t\treturn this.count;\n\t});\n\tthis.__defineGetter__(\"X\", function()\n\t{\n\t\treturn this.x;\n\t});\n\tthis.__defineGetter__(\"Y\", function()\n\t{\n\t\treturn this.y;\n\t});\n\tthis.incrementCount = function()\n\t{\n\t\tthis.count++;\n\t}\n\tthis.aboutEquals=function( moduleSize, i, j)\n\t\t{\n\t\t\tif (Math.abs(i - this.y) <= moduleSize && Math.abs(j - this.x) <= moduleSize)\n\t\t\t{\n\t\t\t\tvar moduleSizeDiff = Math.abs(moduleSize - this.estimatedModuleSize);\n\t\t\t\treturn moduleSizeDiff <= 1.0 || moduleSizeDiff / this.estimatedModuleSize <= 1.0;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n}\n\nfunction FinderPatternInfo(patternCenters)\n{\n\tthis.bottomLeft = patternCenters[0];\n\tthis.topLeft = patternCenters[1];\n\tthis.topRight = patternCenters[2];\n\tthis.__defineGetter__(\"BottomLeft\", function()\n\t{\n\t\treturn this.bottomLeft;\n\t});\n\tthis.__defineGetter__(\"TopLeft\", function()\n\t{\n\t\treturn this.topLeft;\n\t});\n\tthis.__defineGetter__(\"TopRight\", function()\n\t{\n\t\treturn this.topRight;\n\t});\n}\n\nfunction FinderPatternFinder()\n{\n\tthis.image=null;\n\tthis.possibleCenters = [];\n\tthis.hasSkipped = false;\n\tthis.crossCheckStateCount = new Array(0,0,0,0,0);\n\tthis.resultPointCallback = null;\n\n\tthis.__defineGetter__(\"CrossCheckStateCount\", function()\n\t{\n\t\tthis.crossCheckStateCount[0] = 0;\n\t\tthis.crossCheckStateCount[1] = 0;\n\t\tthis.crossCheckStateCount[2] = 0;\n\t\tthis.crossCheckStateCount[3] = 0;\n\t\tthis.crossCheckStateCount[4] = 0;\n\t\treturn this.crossCheckStateCount;\n\t});\n\n\tthis.foundPatternCross=function( stateCount)\n\t\t{\n\t\t\tvar totalModuleSize = 0;\n\t\t\tfor (var i = 0; i < 5; i++)\n\t\t\t{\n\t\t\t\tvar count = stateCount[i];\n\t\t\t\tif (count == 0)\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\ttotalModuleSize += count;\n\t\t\t}\n\t\t\tif (totalModuleSize < 7)\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tvar moduleSize = Math.floor((totalModuleSize << INTEGER_MATH_SHIFT) / 7);\n\t\t\tvar maxVariance = Math.floor(moduleSize / 2);\n\t\t\t// Allow less than 50% variance from 1-1-3-1-1 proportions\n\t\t\treturn Math.abs(moduleSize - (stateCount[0] << INTEGER_MATH_SHIFT)) < maxVariance && Math.abs(moduleSize - (stateCount[1] << INTEGER_MATH_SHIFT)) < maxVariance && Math.abs(3 * moduleSize - (stateCount[2] << INTEGER_MATH_SHIFT)) < 3 * maxVariance && Math.abs(moduleSize - (stateCount[3] << INTEGER_MATH_SHIFT)) < maxVariance && Math.abs(moduleSize - (stateCount[4] << INTEGER_MATH_SHIFT)) < maxVariance;\n\t\t}\n\tthis.centerFromEnd=function( stateCount, end)\n\t\t{\n\t\t\treturn (end - stateCount[4] - stateCount[3]) - stateCount[2] / 2.0;\n\t\t}\n\tthis.crossCheckVertical=function( startI, centerJ, maxCount, originalStateCountTotal)\n\t\t{\n\t\t\tvar image = this.image;\n\n\t\t\tvar maxI = qrcode.height;\n\t\t\tvar stateCount = this.CrossCheckStateCount;\n\n\t\t\t// Start counting up from center\n\t\t\tvar i = startI;\n\t\t\twhile (i >= 0 && image[centerJ + i*qrcode.width])\n\t\t\t{\n\t\t\t\tstateCount[2]++;\n\t\t\t\ti--;\n\t\t\t}\n\t\t\tif (i < 0)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\t\t\twhile (i >= 0 && !image[centerJ +i*qrcode.width] && stateCount[1] <= maxCount)\n\t\t\t{\n\t\t\t\tstateCount[1]++;\n\t\t\t\ti--;\n\t\t\t}\n\t\t\t// If already too many modules in this state or ran off the edge:\n\t\t\tif (i < 0 || stateCount[1] > maxCount)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\t\t\twhile (i >= 0 && image[centerJ + i*qrcode.width] && stateCount[0] <= maxCount)\n\t\t\t{\n\t\t\t\tstateCount[0]++;\n\t\t\t\ti--;\n\t\t\t}\n\t\t\tif (stateCount[0] > maxCount)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\n\t\t\t// Now also count down from center\n\t\t\ti = startI + 1;\n\t\t\twhile (i < maxI && image[centerJ +i*qrcode.width])\n\t\t\t{\n\t\t\t\tstateCount[2]++;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tif (i == maxI)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\t\t\twhile (i < maxI && !image[centerJ + i*qrcode.width] && stateCount[3] < maxCount)\n\t\t\t{\n\t\t\t\tstateCount[3]++;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tif (i == maxI || stateCount[3] >= maxCount)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\t\t\twhile (i < maxI && image[centerJ + i*qrcode.width] && stateCount[4] < maxCount)\n\t\t\t{\n\t\t\t\tstateCount[4]++;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tif (stateCount[4] >= maxCount)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\n\t\t\t// If we found a finder-pattern-like section, but its size is more than 40% different than\n\t\t\t// the original, assume it's a false positive\n\t\t\tvar stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];\n\t\t\tif (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= 2 * originalStateCountTotal)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\n\t\t\treturn this.foundPatternCross(stateCount)?this.centerFromEnd(stateCount, i):NaN;\n\t\t}\n\tthis.crossCheckHorizontal=function( startJ, centerI, maxCount, originalStateCountTotal)\n\t\t{\n\t\t\tvar image = this.image;\n\n\t\t\tvar maxJ = qrcode.width;\n\t\t\tvar stateCount = this.CrossCheckStateCount;\n\n\t\t\tvar j = startJ;\n\t\t\twhile (j >= 0 && image[j+ centerI*qrcode.width])\n\t\t\t{\n\t\t\t\tstateCount[2]++;\n\t\t\t\tj--;\n\t\t\t}\n\t\t\tif (j < 0)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\t\t\twhile (j >= 0 && !image[j+ centerI*qrcode.width] && stateCount[1] <= maxCount)\n\t\t\t{\n\t\t\t\tstateCount[1]++;\n\t\t\t\tj--;\n\t\t\t}\n\t\t\tif (j < 0 || stateCount[1] > maxCount)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\t\t\twhile (j >= 0 && image[j+ centerI*qrcode.width] && stateCount[0] <= maxCount)\n\t\t\t{\n\t\t\t\tstateCount[0]++;\n\t\t\t\tj--;\n\t\t\t}\n\t\t\tif (stateCount[0] > maxCount)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\n\t\t\tj = startJ + 1;\n\t\t\twhile (j < maxJ && image[j+ centerI*qrcode.width])\n\t\t\t{\n\t\t\t\tstateCount[2]++;\n\t\t\t\tj++;\n\t\t\t}\n\t\t\tif (j == maxJ)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\t\t\twhile (j < maxJ && !image[j+ centerI*qrcode.width] && stateCount[3] < maxCount)\n\t\t\t{\n\t\t\t\tstateCount[3]++;\n\t\t\t\tj++;\n\t\t\t}\n\t\t\tif (j == maxJ || stateCount[3] >= maxCount)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\t\t\twhile (j < maxJ && image[j+ centerI*qrcode.width] && stateCount[4] < maxCount)\n\t\t\t{\n\t\t\t\tstateCount[4]++;\n\t\t\t\tj++;\n\t\t\t}\n\t\t\tif (stateCount[4] >= maxCount)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\n\t\t\t// If we found a finder-pattern-like section, but its size is significantly different than\n\t\t\t// the original, assume it's a false positive\n\t\t\tvar stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];\n\t\t\tif (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= originalStateCountTotal)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\n\t\t\treturn this.foundPatternCross(stateCount)?this.centerFromEnd(stateCount, j):NaN;\n\t\t}\n\tthis.handlePossibleCenter=function( stateCount, i, j)\n\t\t{\n\t\t\tvar stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];\n\t\t\tvar centerJ = this.centerFromEnd(stateCount, j); //float\n\t\t\tvar centerI = this.crossCheckVertical(i, Math.floor( centerJ), stateCount[2], stateCountTotal); //float\n\t\t\tif (!isNaN(centerI))\n\t\t\t{\n\t\t\t\t// Re-cross check\n\t\t\t\tcenterJ = this.crossCheckHorizontal(Math.floor( centerJ), Math.floor( centerI), stateCount[2], stateCountTotal);\n\t\t\t\tif (!isNaN(centerJ))\n\t\t\t\t{\n\t\t\t\t\tvar estimatedModuleSize = stateCountTotal / 7.0;\n\t\t\t\t\tvar found = false;\n\t\t\t\t\tvar max = this.possibleCenters.length;\n\t\t\t\t\tfor (var index = 0; index < max; index++)\n\t\t\t\t\t{\n\t\t\t\t\t\tvar center = this.possibleCenters[index];\n\t\t\t\t\t\t// Look for about the same center and module size:\n\t\t\t\t\t\tif (center.aboutEquals(estimatedModuleSize, centerI, centerJ))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcenter.incrementCount();\n\t\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!found)\n\t\t\t\t\t{\n\t\t\t\t\t\tvar point = new FinderPattern(centerJ, centerI, estimatedModuleSize);\n\t\t\t\t\t\tthis.possibleCenters.push(point);\n\t\t\t\t\t\tif (this.resultPointCallback != null)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tthis.resultPointCallback.foundPossibleResultPoint(point);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\tthis.selectBestPatterns=function()\n\t\t{\n\n\t\t\tvar startSize = this.possibleCenters.length;\n\t\t\tif (startSize < 3)\n\t\t\t{\n\t\t\t\t// Couldn't find enough finder patterns\n\t\t\t\tthrow \"Couldn't find enough finder patterns\";\n\t\t\t}\n\n\t\t\t// Filter outlier possibilities whose module size is too different\n\t\t\tif (startSize > 3)\n\t\t\t{\n\t\t\t\t// But we can only afford to do so if we have at least 4 possibilities to choose from\n\t\t\t\tvar totalModuleSize = 0.0;\n var square = 0.0;\n\t\t\t\tfor (var i = 0; i < startSize; i++)\n\t\t\t\t{\n\t\t\t\t\t//totalModuleSize += this.possibleCenters[i].EstimatedModuleSize;\n var\tcenterValue=this.possibleCenters[i].EstimatedModuleSize;\n\t\t\t\t\ttotalModuleSize += centerValue;\n\t\t\t\t\tsquare += (centerValue * centerValue);\n\t\t\t\t}\n\t\t\t\tvar average = totalModuleSize / startSize;\n this.possibleCenters.sort(function(center1,center2) {\n\t\t\t\t var dA=Math.abs(center2.EstimatedModuleSize - average);\n\t\t\t\t var dB=Math.abs(center1.EstimatedModuleSize - average);\n\t\t\t\t if (dA < dB) {\n\t\t\t\t \t return (-1);\n\t\t\t\t } else if (dA == dB) {\n\t\t\t\t \t return 0;\n\t\t\t\t } else {\n\t\t\t\t \t return 1;\n\t\t\t\t }\n\t\t\t\t\t});\n\n\t\t\t\tvar stdDev = Math.sqrt(square / startSize - average * average);\n\t\t\t\tvar limit = Math.max(0.2 * average, stdDev);\n\t\t\t\tfor (var i = 0; i < this.possibleCenters.length && this.possibleCenters.length > 3; i++)\n\t\t\t\t{\n\t\t\t\t\tvar pattern = this.possibleCenters[i];\n\t\t\t\t\t//if (Math.abs(pattern.EstimatedModuleSize - average) > 0.2 * average)\n if (Math.abs(pattern.EstimatedModuleSize - average) > limit)\n\t\t\t\t\t{\n\t\t\t\t\t\tthis.possibleCenters.remove(i);\n\t\t\t\t\t\ti--;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.possibleCenters.length > 3)\n\t\t\t{\n\t\t\t\t// Throw away all but those first size candidate points we found.\n\t\t\t\tthis.possibleCenters.sort(function(a, b){\n\t\t\t\t\tif (a.count > b.count){return -1;}\n\t\t\t\t\tif (a.count < b.count){return 1;}\n\t\t\t\t\treturn 0;\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn new Array( this.possibleCenters[0], this.possibleCenters[1], this.possibleCenters[2]);\n\t\t}\n\n\tthis.findRowSkip=function()\n\t\t{\n\t\t\tvar max = this.possibleCenters.length;\n\t\t\tif (max <= 1)\n\t\t\t{\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tvar firstConfirmedCenter = null;\n\t\t\tfor (var i = 0; i < max; i++)\n\t\t\t{\n\t\t\t\tvar center = this.possibleCenters[i];\n\t\t\t\tif (center.Count >= CENTER_QUORUM)\n\t\t\t\t{\n\t\t\t\t\tif (firstConfirmedCenter == null)\n\t\t\t\t\t{\n\t\t\t\t\t\tfirstConfirmedCenter = center;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t// We have two confirmed centers\n\t\t\t\t\t\t// How far down can we skip before resuming looking for the next\n\t\t\t\t\t\t// pattern? In the worst case, only the difference between the\n\t\t\t\t\t\t// difference in the x / y coordinates of the two centers.\n\t\t\t\t\t\t// This is the case where you find top left last.\n\t\t\t\t\t\tthis.hasSkipped = true;\n\t\t\t\t\t\treturn Math.floor ((Math.abs(firstConfirmedCenter.X - center.X) - Math.abs(firstConfirmedCenter.Y - center.Y)) / 2);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn 0;\n\t\t}\n\n\tthis.haveMultiplyConfirmedCenters=function()\n\t\t{\n\t\t\tvar confirmedCount = 0;\n\t\t\tvar totalModuleSize = 0.0;\n\t\t\tvar max = this.possibleCenters.length;\n\t\t\tfor (var i = 0; i < max; i++)\n\t\t\t{\n\t\t\t\tvar pattern = this.possibleCenters[i];\n\t\t\t\tif (pattern.Count >= CENTER_QUORUM)\n\t\t\t\t{\n\t\t\t\t\tconfirmedCount++;\n\t\t\t\t\ttotalModuleSize += pattern.EstimatedModuleSize;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (confirmedCount < 3)\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t// OK, we have at least 3 confirmed centers, but, it's possible that one is a \"false positive\"\n\t\t\t// and that we need to keep looking. We detect this by asking if the estimated module sizes\n\t\t\t// vary too much. We arbitrarily say that when the total deviation from average exceeds\n\t\t\t// 5% of the total module size estimates, it's too much.\n\t\t\tvar average = totalModuleSize / max;\n\t\t\tvar totalDeviation = 0.0;\n\t\t\tfor (var i = 0; i < max; i++)\n\t\t\t{\n\t\t\t\tpattern = this.possibleCenters[i];\n\t\t\t\ttotalDeviation += Math.abs(pattern.EstimatedModuleSize - average);\n\t\t\t}\n\t\t\treturn totalDeviation <= 0.05 * totalModuleSize;\n\t\t}\n\n\tthis.findFinderPattern = function(image){\n\t\tvar tryHarder = false;\n\t\tthis.image=image;\n\t\tvar maxI = qrcode.height;\n\t\tvar maxJ = qrcode.width;\n\t\tvar iSkip = Math.floor((3 * maxI) / (4 * MAX_MODULES));\n\t\tif (iSkip < MIN_SKIP || tryHarder)\n\t\t{\n\t\t\t\tiSkip = MIN_SKIP;\n\t\t}\n\n\t\tvar done = false;\n\t\tvar stateCount = new Array(5);\n\t\tfor (var i = iSkip - 1; i < maxI && !done; i += iSkip)\n\t\t{\n\t\t\t// Get a row of black/white values\n\t\t\tstateCount[0] = 0;\n\t\t\tstateCount[1] = 0;\n\t\t\tstateCount[2] = 0;\n\t\t\tstateCount[3] = 0;\n\t\t\tstateCount[4] = 0;\n\t\t\tvar currentState = 0;\n\t\t\tfor (var j = 0; j < maxJ; j++)\n\t\t\t{\n\t\t\t\tif (image[j+i*qrcode.width] )\n\t\t\t\t{\n\t\t\t\t\t// Black pixel\n\t\t\t\t\tif ((currentState & 1) == 1)\n\t\t\t\t\t{\n\t\t\t\t\t\t// Counting white pixels\n\t\t\t\t\t\tcurrentState++;\n\t\t\t\t\t}\n\t\t\t\t\tstateCount[currentState]++;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// White pixel\n\t\t\t\t\tif ((currentState & 1) == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\t// Counting black pixels\n\t\t\t\t\t\tif (currentState == 4)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// A winner?\n\t\t\t\t\t\t\tif (this.foundPatternCross(stateCount))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t// Yes\n\t\t\t\t\t\t\t\tvar confirmed = this.handlePossibleCenter(stateCount, i, j);\n\t\t\t\t\t\t\t\tif (confirmed)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t// Start examining every other line. Checking each line turned out to be too\n\t\t\t\t\t\t\t\t\t// expensive and didn't improve performance.\n\t\t\t\t\t\t\t\t\tiSkip = 2;\n\t\t\t\t\t\t\t\t\tif (this.hasSkipped)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tdone = this.haveMultiplyConfirmedCenters();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tvar rowSkip = this.findRowSkip();\n\t\t\t\t\t\t\t\t\t\tif (rowSkip > stateCount[2])\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t// Skip rows between row of lower confirmed center\n\t\t\t\t\t\t\t\t\t\t\t// and top of presumed third confirmed center\n\t\t\t\t\t\t\t\t\t\t\t// but back up a bit to get a full chance of detecting\n\t\t\t\t\t\t\t\t\t\t\t// it, entire width of center of finder pattern\n\n\t\t\t\t\t\t\t\t\t\t\t// Skip by rowSkip, but back off by stateCount[2] (size of last center\n\t\t\t\t\t\t\t\t\t\t\t// of pattern we saw) to be conservative, and also back off by iSkip which\n\t\t\t\t\t\t\t\t\t\t\t// is about to be re-added\n\t\t\t\t\t\t\t\t\t\t\ti += rowSkip - stateCount[2] - iSkip;\n\t\t\t\t\t\t\t\t\t\t\tj = maxJ - 1;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t// Advance to next black pixel\n\t\t\t\t\t\t\t\t\tdo\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tj++;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\twhile (j < maxJ && !image[j + i*qrcode.width]);\n\t\t\t\t\t\t\t\t\tj--; // back up to that last white pixel\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Clear state to start looking again\n\t\t\t\t\t\t\t\tcurrentState = 0;\n\t\t\t\t\t\t\t\tstateCount[0] = 0;\n\t\t\t\t\t\t\t\tstateCount[1] = 0;\n\t\t\t\t\t\t\t\tstateCount[2] = 0;\n\t\t\t\t\t\t\t\tstateCount[3] = 0;\n\t\t\t\t\t\t\t\tstateCount[4] = 0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t// No, shift counts back by two\n\t\t\t\t\t\t\t\tstateCount[0] = stateCount[2];\n\t\t\t\t\t\t\t\tstateCount[1] = stateCount[3];\n\t\t\t\t\t\t\t\tstateCount[2] = stateCount[4];\n\t\t\t\t\t\t\t\tstateCount[3] = 1;\n\t\t\t\t\t\t\t\tstateCount[4] = 0;\n\t\t\t\t\t\t\t\tcurrentState = 3;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstateCount[++currentState]++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t// Counting white pixels\n\t\t\t\t\t\tstateCount[currentState]++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this.foundPatternCross(stateCount))\n\t\t\t{\n\t\t\t\tvar confirmed = this.handlePossibleCenter(stateCount, i, maxJ);\n\t\t\t\tif (confirmed)\n\t\t\t\t{\n\t\t\t\t\tiSkip = stateCount[0];\n\t\t\t\t\tif (this.hasSkipped)\n\t\t\t\t\t{\n\t\t\t\t\t\t// Found a third one\n\t\t\t\t\t\tdone = haveMultiplyConfirmedCenters();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvar patternInfo = this.selectBestPatterns();\n\t\tqrcode.orderBestPatterns(patternInfo);\n\n\t\treturn new FinderPatternInfo(patternInfo);\n\t};\n}\n\n/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction AlignmentPattern(posX, posY, estimatedModuleSize)\r\n{\r\n\tthis.x=posX;\r\n\tthis.y=posY;\r\n\tthis.count = 1;\r\n\tthis.estimatedModuleSize = estimatedModuleSize;\r\n\t\r\n\tthis.__defineGetter__(\"EstimatedModuleSize\", function()\r\n\t{\r\n\t\treturn this.estimatedModuleSize;\r\n\t}); \r\n\tthis.__defineGetter__(\"Count\", function()\r\n\t{\r\n\t\treturn this.count;\r\n\t});\r\n\tthis.__defineGetter__(\"X\", function()\r\n\t{\r\n\t\treturn Math.floor(this.x);\r\n\t});\r\n\tthis.__defineGetter__(\"Y\", function()\r\n\t{\r\n\t\treturn Math.floor(this.y);\r\n\t});\r\n\tthis.incrementCount = function()\r\n\t{\r\n\t\tthis.count++;\r\n\t}\r\n\tthis.aboutEquals=function( moduleSize, i, j)\r\n\t\t{\r\n\t\t\tif (Math.abs(i - this.y) <= moduleSize && Math.abs(j - this.x) <= moduleSize)\r\n\t\t\t{\r\n\t\t\t\tvar moduleSizeDiff = Math.abs(moduleSize - this.estimatedModuleSize);\r\n\t\t\t\treturn moduleSizeDiff <= 1.0 || moduleSizeDiff / this.estimatedModuleSize <= 1.0;\r\n\t\t\t}\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\r\n}\r\n\r\nfunction AlignmentPatternFinder( image, startX, startY, width, height, moduleSize, resultPointCallback)\r\n{\r\n\tthis.image = image;\r\n\tthis.possibleCenters = new Array();\r\n\tthis.startX = startX;\r\n\tthis.startY = startY;\r\n\tthis.width = width;\r\n\tthis.height = height;\r\n\tthis.moduleSize = moduleSize;\r\n\tthis.crossCheckStateCount = new Array(0,0,0);\r\n\tthis.resultPointCallback = resultPointCallback;\r\n\t\r\n\tthis.centerFromEnd=function(stateCount, end)\r\n\t\t{\r\n\t\t\treturn (end - stateCount[2]) - stateCount[1] / 2.0;\r\n\t\t}\r\n\tthis.foundPatternCross = function(stateCount)\r\n\t\t{\r\n\t\t\tvar moduleSize = this.moduleSize;\r\n\t\t\tvar maxVariance = moduleSize / 2.0;\r\n\t\t\tfor (var i = 0; i < 3; i++)\r\n\t\t\t{\r\n\t\t\t\tif (Math.abs(moduleSize - stateCount[i]) >= maxVariance)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\tthis.crossCheckVertical=function( startI, centerJ, maxCount, originalStateCountTotal)\r\n\t\t{\r\n\t\t\tvar image = this.image;\r\n\t\t\t\r\n\t\t\tvar maxI = qrcode.height;\r\n\t\t\tvar stateCount = this.crossCheckStateCount;\r\n\t\t\tstateCount[0] = 0;\r\n\t\t\tstateCount[1] = 0;\r\n\t\t\tstateCount[2] = 0;\r\n\t\t\t\r\n\t\t\t// Start counting up from center\r\n\t\t\tvar i = startI;\r\n\t\t\twhile (i >= 0 && image[centerJ + i*qrcode.width] && stateCount[1] <= maxCount)\r\n\t\t\t{\r\n\t\t\t\tstateCount[1]++;\r\n\t\t\t\ti--;\r\n\t\t\t}\r\n\t\t\t// If already too many modules in this state or ran off the edge:\r\n\t\t\tif (i < 0 || stateCount[1] > maxCount)\r\n\t\t\t{\r\n\t\t\t\treturn NaN;\r\n\t\t\t}\r\n\t\t\twhile (i >= 0 && !image[centerJ + i*qrcode.width] && stateCount[0] <= maxCount)\r\n\t\t\t{\r\n\t\t\t\tstateCount[0]++;\r\n\t\t\t\ti--;\r\n\t\t\t}\r\n\t\t\tif (stateCount[0] > maxCount)\r\n\t\t\t{\r\n\t\t\t\treturn NaN;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Now also count down from center\r\n\t\t\ti = startI + 1;\r\n\t\t\twhile (i < maxI && image[centerJ + i*qrcode.width] && stateCount[1] <= maxCount)\r\n\t\t\t{\r\n\t\t\t\tstateCount[1]++;\r\n\t\t\t\ti++;\r\n\t\t\t}\r\n\t\t\tif (i == maxI || stateCount[1] > maxCount)\r\n\t\t\t{\r\n\t\t\t\treturn NaN;\r\n\t\t\t}\r\n\t\t\twhile (i < maxI && !image[centerJ + i*qrcode.width] && stateCount[2] <= maxCount)\r\n\t\t\t{\r\n\t\t\t\tstateCount[2]++;\r\n\t\t\t\ti++;\r\n\t\t\t}\r\n\t\t\tif (stateCount[2] > maxCount)\r\n\t\t\t{\r\n\t\t\t\treturn NaN;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2];\r\n\t\t\tif (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= 2 * originalStateCountTotal)\r\n\t\t\t{\r\n\t\t\t\treturn NaN;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn this.foundPatternCross(stateCount)?this.centerFromEnd(stateCount, i):NaN;\r\n\t\t}\r\n\t\t\r\n\tthis.handlePossibleCenter=function( stateCount, i, j)\r\n\t\t{\r\n\t\t\tvar stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2];\r\n\t\t\tvar centerJ = this.centerFromEnd(stateCount, j);\r\n\t\t\tvar centerI = this.crossCheckVertical(i, Math.floor (centerJ), 2 * stateCount[1], stateCountTotal);\r\n\t\t\tif (!isNaN(centerI))\r\n\t\t\t{\r\n\t\t\t\tvar estimatedModuleSize = (stateCount[0] + stateCount[1] + stateCount[2]) / 3.0;\r\n\t\t\t\tvar max = this.possibleCenters.length;\r\n\t\t\t\tfor (var index = 0; index < max; index++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar center = this.possibleCenters[index];\r\n\t\t\t\t\t// Look for about the same center and module size:\r\n\t\t\t\t\tif (center.aboutEquals(estimatedModuleSize, centerI, centerJ))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\treturn new AlignmentPattern(centerJ, centerI, estimatedModuleSize);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t// Hadn't found this before; save it\r\n\t\t\t\tvar point = new AlignmentPattern(centerJ, centerI, estimatedModuleSize);\r\n\t\t\t\tthis.possibleCenters.push(point);\r\n\t\t\t\tif (this.resultPointCallback != null)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.resultPointCallback.foundPossibleResultPoint(point);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\t\r\n\tthis.find = function()\r\n\t{\r\n\t\t\tvar startX = this.startX;\r\n\t\t\tvar height = this.height;\r\n\t\t\tvar maxJ = startX + width;\r\n\t\t\tvar middleI = startY + (height >> 1);\r\n\t\t\t// We are looking for black/white/black modules in 1:1:1 ratio;\r\n\t\t\t// this tracks the number of black/white/black modules seen so far\r\n\t\t\tvar stateCount = new Array(0,0,0);\r\n\t\t\tfor (var iGen = 0; iGen < height; iGen++)\r\n\t\t\t{\r\n\t\t\t\t// Search from middle outwards\r\n\t\t\t\tvar i = middleI + ((iGen & 0x01) == 0?((iGen + 1) >> 1):- ((iGen + 1) >> 1));\r\n\t\t\t\tstateCount[0] = 0;\r\n\t\t\t\tstateCount[1] = 0;\r\n\t\t\t\tstateCount[2] = 0;\r\n\t\t\t\tvar j = startX;\r\n\t\t\t\t// Burn off leading white pixels before anything else; if we start in the middle of\r\n\t\t\t\t// a white run, it doesn't make sense to count its length, since we don't know if the\r\n\t\t\t\t// white run continued to the left of the start point\r\n\t\t\t\twhile (j < maxJ && !image[j + qrcode.width* i])\r\n\t\t\t\t{\r\n\t\t\t\t\tj++;\r\n\t\t\t\t}\r\n\t\t\t\tvar currentState = 0;\r\n\t\t\t\twhile (j < maxJ)\r\n\t\t\t\t{\r\n\t\t\t\t\tif (image[j + i*qrcode.width])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// Black pixel\r\n\t\t\t\t\t\tif (currentState == 1)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t// Counting black pixels\r\n\t\t\t\t\t\t\tstateCount[currentState]++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t// Counting white pixels\r\n\t\t\t\t\t\t\tif (currentState == 2)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t// A winner?\r\n\t\t\t\t\t\t\t\tif (this.foundPatternCross(stateCount))\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t// Yes\r\n\t\t\t\t\t\t\t\t\tvar confirmed = this.handlePossibleCenter(stateCount, i, j);\r\n\t\t\t\t\t\t\t\t\tif (confirmed != null)\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\treturn confirmed;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tstateCount[0] = stateCount[2];\r\n\t\t\t\t\t\t\t\tstateCount[1] = 1;\r\n\t\t\t\t\t\t\t\tstateCount[2] = 0;\r\n\t\t\t\t\t\t\t\tcurrentState = 1;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tstateCount[++currentState]++;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// White pixel\r\n\t\t\t\t\t\tif (currentState == 1)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t// Counting black pixels\r\n\t\t\t\t\t\t\tcurrentState++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tstateCount[currentState]++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tj++;\r\n\t\t\t\t}\r\n\t\t\t\tif (this.foundPatternCross(stateCount))\r\n\t\t\t\t{\r\n\t\t\t\t\tvar confirmed = this.handlePossibleCenter(stateCount, i, maxJ);\r\n\t\t\t\t\tif (confirmed != null)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\treturn confirmed;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Hmm, nothing we saw was observed and confirmed twice. If we had\r\n\t\t\t// any guess at all, return it.\r\n\t\t\tif (!(this.possibleCenters.length == 0))\r\n\t\t\t{\r\n\t\t\t\treturn this.possibleCenters[0];\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tthrow \"Couldn't find enough alignment patterns\";\r\n\t\t}\r\n\t\r\n}\n/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction QRCodeDataBlockReader(blocks, version, numErrorCorrectionCode)\r\n{\r\n\tthis.blockPointer = 0;\r\n\tthis.bitPointer = 7;\r\n\tthis.dataLength = 0;\r\n\tthis.blocks = blocks;\r\n\tthis.numErrorCorrectionCode = numErrorCorrectionCode;\r\n\tif (version <= 9)\r\n\t\tthis.dataLengthMode = 0;\r\n\telse if (version >= 10 && version <= 26)\r\n\t\tthis.dataLengthMode = 1;\r\n\telse if (version >= 27 && version <= 40)\r\n\t\tthis.dataLengthMode = 2;\r\n\t\t\r\n\tthis.getNextBits = function( numBits)\r\n\t\t{\t\t\t\r\n\t\t\tvar bits = 0;\r\n\t\t\tif (numBits < this.bitPointer + 1)\r\n\t\t\t{\r\n\t\t\t\t// next word fits into current data block\r\n\t\t\t\tvar mask = 0;\r\n\t\t\t\tfor (var i = 0; i < numBits; i++)\r\n\t\t\t\t{\r\n\t\t\t\t\tmask += (1 << i);\r\n\t\t\t\t}\r\n\t\t\t\tmask <<= (this.bitPointer - numBits + 1);\r\n\t\t\t\t\r\n\t\t\t\tbits = (this.blocks[this.blockPointer] & mask) >> (this.bitPointer - numBits + 1);\r\n\t\t\t\tthis.bitPointer -= numBits;\r\n\t\t\t\treturn bits;\r\n\t\t\t}\r\n\t\t\telse if (numBits < this.bitPointer + 1 + 8)\r\n\t\t\t{\r\n\t\t\t\t// next word crosses 2 data blocks\r\n\t\t\t\tvar mask1 = 0;\r\n\t\t\t\tfor (var i = 0; i < this.bitPointer + 1; i++)\r\n\t\t\t\t{\r\n\t\t\t\t\tmask1 += (1 << i);\r\n\t\t\t\t}\r\n\t\t\t\tbits = (this.blocks[this.blockPointer] & mask1) << (numBits - (this.bitPointer + 1));\r\n this.blockPointer++;\r\n\t\t\t\tbits += ((this.blocks[this.blockPointer]) >> (8 - (numBits - (this.bitPointer + 1))));\r\n\t\t\t\t\r\n\t\t\t\tthis.bitPointer = this.bitPointer - numBits % 8;\r\n\t\t\t\tif (this.bitPointer < 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.bitPointer = 8 + this.bitPointer;\r\n\t\t\t\t}\r\n\t\t\t\treturn bits;\r\n\t\t\t}\r\n\t\t\telse if (numBits < this.bitPointer + 1 + 16)\r\n\t\t\t{\r\n\t\t\t\t// next word crosses 3 data blocks\r\n\t\t\t\tvar mask1 = 0; // mask of first block\r\n\t\t\t\tvar mask3 = 0; // mask of 3rd block\r\n\t\t\t\t//bitPointer + 1 : number of bits of the 1st block\r\n\t\t\t\t//8 : number of the 2nd block (note that use already 8bits because next word uses 3 data blocks)\r\n\t\t\t\t//numBits - (bitPointer + 1 + 8) : number of bits of the 3rd block \r\n\t\t\t\tfor (var i = 0; i < this.bitPointer + 1; i++)\r\n\t\t\t\t{\r\n\t\t\t\t\tmask1 += (1 << i);\r\n\t\t\t\t}\r\n\t\t\t\tvar bitsFirstBlock = (this.blocks[this.blockPointer] & mask1) << (numBits - (this.bitPointer + 1));\r\n\t\t\t\tthis.blockPointer++;\r\n\t\t\t\t\r\n\t\t\t\tvar bitsSecondBlock = this.blocks[this.blockPointer] << (numBits - (this.bitPointer + 1 + 8));\r\n\t\t\t\tthis.blockPointer++;\r\n\t\t\t\t\r\n\t\t\t\tfor (var i = 0; i < numBits - (this.bitPointer + 1 + 8); i++)\r\n\t\t\t\t{\r\n\t\t\t\t\tmask3 += (1 << i);\r\n\t\t\t\t}\r\n\t\t\t\tmask3 <<= 8 - (numBits - (this.bitPointer + 1 + 8));\r\n\t\t\t\tvar bitsThirdBlock = (this.blocks[this.blockPointer] & mask3) >> (8 - (numBits - (this.bitPointer + 1 + 8)));\r\n\t\t\t\t\r\n\t\t\t\tbits = bitsFirstBlock + bitsSecondBlock + bitsThirdBlock;\r\n\t\t\t\tthis.bitPointer = this.bitPointer - (numBits - 8) % 8;\r\n\t\t\t\tif (this.bitPointer < 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.bitPointer = 8 + this.bitPointer;\r\n\t\t\t\t}\r\n\t\t\t\treturn bits;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\t\t}\r\n\tthis.NextMode=function()\r\n\t{\r\n\t\tif ((this.blockPointer > this.blocks.length - this.numErrorCorrectionCode - 2))\r\n\t\t\treturn 0;\r\n\t\telse\r\n\t\t\treturn this.getNextBits(4);\r\n\t}\r\n\tthis.getDataLength=function( modeIndicator)\r\n\t\t{\r\n\t\t\tvar index = 0;\r\n\t\t\twhile (true)\r\n\t\t\t{\r\n\t\t\t\tif ((modeIndicator >> index) == 1)\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tindex++;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn this.getNextBits(qrcode.sizeOfDataLengthInfo[this.dataLengthMode][index]);\r\n\t\t}\r\n\tthis.getRomanAndFigureString=function( dataLength)\r\n\t\t{\r\n\t\t\tvar length = dataLength;\r\n\t\t\tvar intData = 0;\r\n\t\t\tvar strData = \"\";\r\n\t\t\tvar tableRomanAndFigure = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', '$', '%', '*', '+', '-', '.', '/', ':');\r\n\t\t\tdo \r\n\t\t\t{\r\n\t\t\t\tif (length > 1)\r\n\t\t\t\t{\r\n\t\t\t\t\tintData = this.getNextBits(11);\r\n\t\t\t\t\tvar firstLetter = Math.floor(intData / 45);\r\n\t\t\t\t\tvar secondLetter = intData % 45;\r\n\t\t\t\t\tstrData += tableRomanAndFigure[firstLetter];\r\n\t\t\t\t\tstrData += tableRomanAndFigure[secondLetter];\r\n\t\t\t\t\tlength -= 2;\r\n\t\t\t\t}\r\n\t\t\t\telse if (length == 1)\r\n\t\t\t\t{\r\n\t\t\t\t\tintData = this.getNextBits(6);\r\n\t\t\t\t\tstrData += tableRomanAndFigure[intData];\r\n\t\t\t\t\tlength -= 1;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\twhile (length > 0);\r\n\t\t\t\r\n\t\t\treturn strData;\r\n\t\t}\r\n\tthis.getFigureString=function( dataLength)\r\n\t\t{\r\n\t\t\tvar length = dataLength;\r\n\t\t\tvar intData = 0;\r\n\t\t\tvar strData = \"\";\r\n\t\t\tdo \r\n\t\t\t{\r\n\t\t\t\tif (length >= 3)\r\n\t\t\t\t{\r\n\t\t\t\t\tintData = this.getNextBits(10);\r\n\t\t\t\t\tif (intData < 100)\r\n\t\t\t\t\t\tstrData += \"0\";\r\n\t\t\t\t\tif (intData < 10)\r\n\t\t\t\t\t\tstrData += \"0\";\r\n\t\t\t\t\tlength -= 3;\r\n\t\t\t\t}\r\n\t\t\t\telse if (length == 2)\r\n\t\t\t\t{\r\n\t\t\t\t\tintData = this.getNextBits(7);\r\n\t\t\t\t\tif (intData < 10)\r\n\t\t\t\t\t\tstrData += \"0\";\r\n\t\t\t\t\tlength -= 2;\r\n\t\t\t\t}\r\n\t\t\t\telse if (length == 1)\r\n\t\t\t\t{\r\n\t\t\t\t\tintData = this.getNextBits(4);\r\n\t\t\t\t\tlength -= 1;\r\n\t\t\t\t}\r\n\t\t\t\tstrData += intData;\r\n\t\t\t}\r\n\t\t\twhile (length > 0);\r\n\t\t\t\r\n\t\t\treturn strData;\r\n\t\t}\r\n\tthis.get8bitByteArray=function( dataLength)\r\n\t\t{\r\n\t\t\tvar length = dataLength;\r\n\t\t\tvar intData = 0;\r\n\t\t\tvar output = new Array();\r\n\t\t\t\r\n\t\t\tdo \r\n\t\t\t{\r\n\t\t\t\tintData = this.getNextBits(8);\r\n\t\t\t\toutput.push( intData);\r\n\t\t\t\tlength--;\r\n\t\t\t}\r\n\t\t\twhile (length > 0);\r\n\t\t\treturn output;\r\n\t\t}\r\n this.getKanjiString=function( dataLength)\r\n\t\t{\r\n\t\t\tvar length = dataLength;\r\n\t\t\tvar intData = 0;\r\n\t\t\tvar unicodeString = \"\";\r\n\t\t\tdo \r\n\t\t\t{\r\n\t\t\t\tintData = getNextBits(13);\r\n\t\t\t\tvar lowerByte = intData % 0xC0;\r\n\t\t\t\tvar higherByte = intData / 0xC0;\r\n\t\t\t\t\r\n\t\t\t\tvar tempWord = (higherByte << 8) + lowerByte;\r\n\t\t\t\tvar shiftjisWord = 0;\r\n\t\t\t\tif (tempWord + 0x8140 <= 0x9FFC)\r\n\t\t\t\t{\r\n\t\t\t\t\t// between 8140 - 9FFC on Shift_JIS character set\r\n\t\t\t\t\tshiftjisWord = tempWord + 0x8140;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\t// between E040 - EBBF on Shift_JIS character set\r\n\t\t\t\t\tshiftjisWord = tempWord + 0xC140;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t//var tempByte = new Array(0,0);\r\n\t\t\t\t//tempByte[0] = (sbyte) (shiftjisWord >> 8);\r\n\t\t\t\t//tempByte[1] = (sbyte) (shiftjisWord & 0xFF);\r\n\t\t\t\t//unicodeString += new String(SystemUtils.ToCharArray(SystemUtils.ToByteArray(tempByte)));\r\n unicodeString += String.fromCharCode(shiftjisWord);\r\n\t\t\t\tlength--;\r\n\t\t\t}\r\n\t\t\twhile (length > 0);\r\n\t\t\t\r\n\t\t\t\r\n\t\t\treturn unicodeString;\r\n\t\t}\r\n\r\n\tthis.__defineGetter__(\"DataByte\", function()\r\n\t{\r\n\t\tvar output = new Array();\r\n\t\tvar MODE_NUMBER = 1;\r\n\t var MODE_ROMAN_AND_NUMBER = 2;\r\n\t var MODE_8BIT_BYTE = 4;\r\n\t var MODE_KANJI = 8;\r\n\t\tdo \r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar mode = this.NextMode();\r\n\t\t\t\t\t\t//canvas.println(\"mode: \" + mode);\r\n\t\t\t\t\t\tif (mode == 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tif (output.length > 0)\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\tthrow \"Empty data block\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t//if (mode != 1 && mode != 2 && mode != 4 && mode != 8)\r\n\t\t\t\t\t\t//\tbreak;\r\n\t\t\t\t\t\t//}\r\n\t\t\t\t\t\tif (mode != MODE_NUMBER && mode != MODE_ROMAN_AND_NUMBER && mode != MODE_8BIT_BYTE && mode != MODE_KANJI)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t/*\t\t\t\t\tcanvas.println(\"Invalid mode: \" + mode);\r\n\t\t\t\t\t\t\tmode = guessMode(mode);\r\n\t\t\t\t\t\t\tcanvas.println(\"Guessed mode: \" + mode); */\r\n\t\t\t\t\t\t\tthrow \"Invalid mode: \" + mode + \" in (block:\" + this.blockPointer + \" bit:\" + this.bitPointer + \")\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tdataLength = this.getDataLength(mode);\r\n\t\t\t\t\t\tif (dataLength < 1)\r\n\t\t\t\t\t\t\tthrow \"Invalid data length: \" + dataLength;\r\n\t\t\t\t\t\t//canvas.println(\"length: \" + dataLength);\r\n\t\t\t\t\t\tswitch (mode)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tcase MODE_NUMBER: \r\n\t\t\t\t\t\t\t\t//canvas.println(\"Mode: Figure\");\r\n\t\t\t\t\t\t\t\tvar temp_str = this.getFigureString(dataLength);\r\n\t\t\t\t\t\t\t\tvar ta = new Array(temp_str.length);\r\n\t\t\t\t\t\t\t\tfor(var j=0;j dom\n * element\n * @param {Function} errcb callback\n * function to be\n * called in case of\n * error\n */\nQCodeDecoder.prototype.decodeFromCamera = function (videoElem, cb, once) {\n var scope = (this.stop(), this);\n\n if (!this.hasGetUserMedia())\n cb(new Error('Couldn\\'t get video from camera'));\n\n navigator.getUserMedia(this.videoConstraints, function (stream) {\n videoElem.src = window.URL.createObjectURL(stream);\n scope.videoElem = videoElem;\n scope.stream = stream;\n scope.videoDimensions = false;\n\n setTimeout(function () {\n scope._captureToCanvas.call(scope, videoElem, cb, once);\n }, 500);\n }, cb);\n\n return this;\n};\n\nQCodeDecoder.prototype.decodeFromVideo = function (videoElem, cb, once) {\n setTimeout(function () {\n this._captureToCanvas.call(this, videoElem, cb, once);\n }.bind(this), 500);\n\n return this;\n};\n\n/**\n * Decodes an image from its src.\n * @param {DOMNode} imageElemvideoElem\n * @param {Function} cb callback\n * @return {Object} this\n */\nQCodeDecoder.prototype.decodeFromImage = function (img, cb) {\n if (+img.nodeType > 0 && !img.src)\n throw new Error('The ImageElement must contain a src');\n\n img = img.src ? img.src : img;\n\n return (qrcode.decode(img, cb), this);\n};\n\n\n\n/**\n * Releases a video stream that was being\n * captured by prepareToVideo\n */\nQCodeDecoder.prototype.stop = function() {\n if (this.stream) {\n this.stream.stop();\n this.stream = undefined;\n }\n\n if (this.timerCapture) {\n clearTimeout(this.timerCapture);\n this.timerCapture = undefined;\n }\n\n return this;\n};\n\n/**\n * Sets the sourceId for the camera to use.\n *\n * The sourceId can be found using the\n * getVideoSources function on a browser that\n * supports it (currently only Chrome).\n *\n * @param {String} sourceId The id of the\n * video source you want to use (or false to use\n * the current default)\n */\nQCodeDecoder.prototype.setSourceId = function (sourceId) {\n if (sourceId)\n this.videoConstraints.video = { optional: [{ sourceId: sourceId }]};\n else\n this.videoConstraints.video = true;\n\n return this;\n};\n\n\n/**\n * Gets a list of all available video sources on\n * the device\n */\nQCodeDecoder.prototype.getVideoSources = function (cb) {\n var sources = [];\n\n if (MediaStreamTrack && MediaStreamTrack.getSources) {\n MediaStreamTrack.getSources(function (sourceInfos) {\n sourceInfos.forEach(function(sourceInfo) {\n if (sourceInfo.kind === 'video')\n sources.push(sourceInfo);\n });\n cb(null, sources);\n });\n } else {\n cb(new Error('Current browser doest not support MediaStreamTrack.getSources'));\n }\n\n return this;\n};\n\n\nreturn QCodeDecoder; }));\n"],"sourceRoot":"/source/"}
\ No newline at end of file
diff --git a/build/qrcode.js b/build/qrcode.js
new file mode 100644
index 0000000..69cf5d9
--- /dev/null
+++ b/build/qrcode.js
@@ -0,0 +1,3841 @@
+(function (root, factory) {
+ if (typeof define === 'function' && define.amd)
+ define([], factory);
+ else if (typeof exports === 'object')
+ module.exports = factory();
+ else root.qrcode = factory();
+}(this, function () {
+/*
+ Ported to JavaScript by Lazar Laszlo 2011
+
+ lazarsoft@gmail.com, www.lazarsoft.info
+
+*/
+
+/*
+*
+* Copyright 2007 ZXing authors
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+GridSampler = {};
+
+GridSampler.checkAndNudgePoints=function( image, points)
+ {
+ var width = qrcode.width;
+ var height = qrcode.height;
+ // Check and nudge points from start until we see some that are OK:
+ var nudged = true;
+ for (var offset = 0; offset < points.length && nudged; offset += 2)
+ {
+ var x = Math.floor (points[offset]);
+ var y = Math.floor( points[offset + 1]);
+ if (x < - 1 || x > width || y < - 1 || y > height)
+ {
+ throw "Error.checkAndNudgePoints ";
+ }
+ nudged = false;
+ if (x == - 1)
+ {
+ points[offset] = 0.0;
+ nudged = true;
+ }
+ else if (x == width)
+ {
+ points[offset] = width - 1;
+ nudged = true;
+ }
+ if (y == - 1)
+ {
+ points[offset + 1] = 0.0;
+ nudged = true;
+ }
+ else if (y == height)
+ {
+ points[offset + 1] = height - 1;
+ nudged = true;
+ }
+ }
+ // Check and nudge points from end:
+ nudged = true;
+ for (var offset = points.length - 2; offset >= 0 && nudged; offset -= 2)
+ {
+ var x = Math.floor( points[offset]);
+ var y = Math.floor( points[offset + 1]);
+ if (x < - 1 || x > width || y < - 1 || y > height)
+ {
+ throw "Error.checkAndNudgePoints ";
+ }
+ nudged = false;
+ if (x == - 1)
+ {
+ points[offset] = 0.0;
+ nudged = true;
+ }
+ else if (x == width)
+ {
+ points[offset] = width - 1;
+ nudged = true;
+ }
+ if (y == - 1)
+ {
+ points[offset + 1] = 0.0;
+ nudged = true;
+ }
+ else if (y == height)
+ {
+ points[offset + 1] = height - 1;
+ nudged = true;
+ }
+ }
+ }
+
+
+
+GridSampler.sampleGrid3=function( image, dimension, transform)
+ {
+ var bits = new BitMatrix(dimension);
+ var points = new Array(dimension << 1);
+ for (var y = 0; y < dimension; y++)
+ {
+ var max = points.length;
+ var iValue = y + 0.5;
+ for (var x = 0; x < max; x += 2)
+ {
+ points[x] = (x >> 1) + 0.5;
+ points[x + 1] = iValue;
+ }
+ transform.transformPoints1(points);
+ // Quick check to see if points transformed to something inside the image;
+ // sufficient to check the endpoints
+ GridSampler.checkAndNudgePoints(image, points);
+ try
+ {
+ for (var x = 0; x < max; x += 2)
+ {
+ var xpoint = (Math.floor( points[x]) * 4) + (Math.floor( points[x + 1]) * qrcode.width * 4);
+ var bit = image[Math.floor( points[x])+ qrcode.width* Math.floor( points[x + 1])];
+ qrcode.imagedata.data[xpoint] = bit?255:0;
+ qrcode.imagedata.data[xpoint+1] = bit?255:0;
+ qrcode.imagedata.data[xpoint+2] = 0;
+ qrcode.imagedata.data[xpoint+3] = 255;
+ //bits[x >> 1][ y]=bit;
+ if(bit)
+ bits.set_Renamed(x >> 1, y);
+ }
+ }
+ catch ( aioobe)
+ {
+ // This feels wrong, but, sometimes if the finder patterns are misidentified, the resulting
+ // transform gets "twisted" such that it maps a straight line of points to a set of points
+ // whose endpoints are in bounds, but others are not. There is probably some mathematical
+ // way to detect this about the transformation that I don't know yet.
+ // This results in an ugly runtime exception despite our clever checks above -- can't have
+ // that. We could check each point's coordinates but that feels duplicative. We settle for
+ // catching and wrapping ArrayIndexOutOfBoundsException.
+ throw "Error.checkAndNudgePoints";
+ }
+ }
+ return bits;
+ }
+
+GridSampler.sampleGridx=function( image, dimension, p1ToX, p1ToY, p2ToX, p2ToY, p3ToX, p3ToY, p4ToX, p4ToY, p1FromX, p1FromY, p2FromX, p2FromY, p3FromX, p3FromY, p4FromX, p4FromY)
+{
+ var transform = PerspectiveTransform.quadrilateralToQuadrilateral(p1ToX, p1ToY, p2ToX, p2ToY, p3ToX, p3ToY, p4ToX, p4ToY, p1FromX, p1FromY, p2FromX, p2FromY, p3FromX, p3FromY, p4FromX, p4FromY);
+
+ return GridSampler.sampleGrid3(image, dimension, transform);
+}
+
+/*
+ Ported to JavaScript by Lazar Laszlo 2011
+
+ lazarsoft@gmail.com, www.lazarsoft.info
+
+*/
+
+/*
+*
+* Copyright 2007 ZXing authors
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+
+function ECB(count, dataCodewords)
+{
+ this.count = count;
+ this.dataCodewords = dataCodewords;
+
+ this.__defineGetter__("Count", function()
+ {
+ return this.count;
+ });
+ this.__defineGetter__("DataCodewords", function()
+ {
+ return this.dataCodewords;
+ });
+}
+
+function ECBlocks( ecCodewordsPerBlock, ecBlocks1, ecBlocks2)
+{
+ this.ecCodewordsPerBlock = ecCodewordsPerBlock;
+ if(ecBlocks2)
+ this.ecBlocks = new Array(ecBlocks1, ecBlocks2);
+ else
+ this.ecBlocks = new Array(ecBlocks1);
+
+ this.__defineGetter__("ECCodewordsPerBlock", function()
+ {
+ return this.ecCodewordsPerBlock;
+ });
+
+ this.__defineGetter__("TotalECCodewords", function()
+ {
+ return this.ecCodewordsPerBlock * this.NumBlocks;
+ });
+
+ this.__defineGetter__("NumBlocks", function()
+ {
+ var total = 0;
+ for (var i = 0; i < this.ecBlocks.length; i++)
+ {
+ total += this.ecBlocks[i].length;
+ }
+ return total;
+ });
+
+ this.getECBlocks=function()
+ {
+ return this.ecBlocks;
+ }
+}
+
+function Version( versionNumber, alignmentPatternCenters, ecBlocks1, ecBlocks2, ecBlocks3, ecBlocks4)
+{
+ this.versionNumber = versionNumber;
+ this.alignmentPatternCenters = alignmentPatternCenters;
+ this.ecBlocks = new Array(ecBlocks1, ecBlocks2, ecBlocks3, ecBlocks4);
+
+ var total = 0;
+ var ecCodewords = ecBlocks1.ECCodewordsPerBlock;
+ var ecbArray = ecBlocks1.getECBlocks();
+ for (var i = 0; i < ecbArray.length; i++)
+ {
+ var ecBlock = ecbArray[i];
+ total += ecBlock.Count * (ecBlock.DataCodewords + ecCodewords);
+ }
+ this.totalCodewords = total;
+
+ this.__defineGetter__("VersionNumber", function()
+ {
+ return this.versionNumber;
+ });
+
+ this.__defineGetter__("AlignmentPatternCenters", function()
+ {
+ return this.alignmentPatternCenters;
+ });
+ this.__defineGetter__("TotalCodewords", function()
+ {
+ return this.totalCodewords;
+ });
+ this.__defineGetter__("DimensionForVersion", function()
+ {
+ return 17 + 4 * this.versionNumber;
+ });
+
+ this.buildFunctionPattern=function()
+ {
+ var dimension = this.DimensionForVersion;
+ var bitMatrix = new BitMatrix(dimension);
+
+ // Top left finder pattern + separator + format
+ bitMatrix.setRegion(0, 0, 9, 9);
+ // Top right finder pattern + separator + format
+ bitMatrix.setRegion(dimension - 8, 0, 8, 9);
+ // Bottom left finder pattern + separator + format
+ bitMatrix.setRegion(0, dimension - 8, 9, 8);
+
+ // Alignment patterns
+ var max = this.alignmentPatternCenters.length;
+ for (var x = 0; x < max; x++)
+ {
+ var i = this.alignmentPatternCenters[x] - 2;
+ for (var y = 0; y < max; y++)
+ {
+ if ((x == 0 && (y == 0 || y == max - 1)) || (x == max - 1 && y == 0))
+ {
+ // No alignment patterns near the three finder paterns
+ continue;
+ }
+ bitMatrix.setRegion(this.alignmentPatternCenters[y] - 2, i, 5, 5);
+ }
+ }
+
+ // Vertical timing pattern
+ bitMatrix.setRegion(6, 9, 1, dimension - 17);
+ // Horizontal timing pattern
+ bitMatrix.setRegion(9, 6, dimension - 17, 1);
+
+ if (this.versionNumber > 6)
+ {
+ // Version info, top right
+ bitMatrix.setRegion(dimension - 11, 0, 3, 6);
+ // Version info, bottom left
+ bitMatrix.setRegion(0, dimension - 11, 6, 3);
+ }
+
+ return bitMatrix;
+ }
+ this.getECBlocksForLevel=function( ecLevel)
+ {
+ return this.ecBlocks[ecLevel.ordinal()];
+ }
+}
+
+Version.VERSION_DECODE_INFO = new Array(0x07C94, 0x085BC, 0x09A99, 0x0A4D3, 0x0BBF6, 0x0C762, 0x0D847, 0x0E60D, 0x0F928, 0x10B78, 0x1145D, 0x12A17, 0x13532, 0x149A6, 0x15683, 0x168C9, 0x177EC, 0x18EC4, 0x191E1, 0x1AFAB, 0x1B08E, 0x1CC1A, 0x1D33F, 0x1ED75, 0x1F250, 0x209D5, 0x216F0, 0x228BA, 0x2379F, 0x24B0B, 0x2542E, 0x26A64, 0x27541, 0x28C69);
+
+Version.VERSIONS = buildVersions();
+
+Version.getVersionForNumber=function( versionNumber)
+{
+ if (versionNumber < 1 || versionNumber > 40)
+ {
+ throw "ArgumentException";
+ }
+ return Version.VERSIONS[versionNumber - 1];
+}
+
+Version.getProvisionalVersionForDimension=function(dimension)
+{
+ if (dimension % 4 != 1)
+ {
+ throw "Error getProvisionalVersionForDimension";
+ }
+ try
+ {
+ return Version.getVersionForNumber((dimension - 17) >> 2);
+ }
+ catch ( iae)
+ {
+ throw "Error getVersionForNumber";
+ }
+}
+
+Version.decodeVersionInformation=function( versionBits)
+{
+ var bestDifference = 0xffffffff;
+ var bestVersion = 0;
+ for (var i = 0; i < Version.VERSION_DECODE_INFO.length; i++)
+ {
+ var targetVersion = Version.VERSION_DECODE_INFO[i];
+ // Do the version info bits match exactly? done.
+ if (targetVersion == versionBits)
+ {
+ return this.getVersionForNumber(i + 7);
+ }
+ // Otherwise see if this is the closest to a real version info bit string
+ // we have seen so far
+ var bitsDifference = FormatInformation.numBitsDiffering(versionBits, targetVersion);
+ if (bitsDifference < bestDifference)
+ {
+ bestVersion = i + 7;
+ bestDifference = bitsDifference;
+ }
+ }
+ // We can tolerate up to 3 bits of error since no two version info codewords will
+ // differ in less than 4 bits.
+ if (bestDifference <= 3)
+ {
+ return this.getVersionForNumber(bestVersion);
+ }
+ // If we didn't find a close enough match, fail
+ return null;
+}
+
+function buildVersions()
+{
+ return new Array(new Version(1, new Array(), new ECBlocks(7, new ECB(1, 19)), new ECBlocks(10, new ECB(1, 16)), new ECBlocks(13, new ECB(1, 13)), new ECBlocks(17, new ECB(1, 9))),
+ new Version(2, new Array(6, 18), new ECBlocks(10, new ECB(1, 34)), new ECBlocks(16, new ECB(1, 28)), new ECBlocks(22, new ECB(1, 22)), new ECBlocks(28, new ECB(1, 16))),
+ new Version(3, new Array(6, 22), new ECBlocks(15, new ECB(1, 55)), new ECBlocks(26, new ECB(1, 44)), new ECBlocks(18, new ECB(2, 17)), new ECBlocks(22, new ECB(2, 13))),
+ new Version(4, new Array(6, 26), new ECBlocks(20, new ECB(1, 80)), new ECBlocks(18, new ECB(2, 32)), new ECBlocks(26, new ECB(2, 24)), new ECBlocks(16, new ECB(4, 9))),
+ new Version(5, new Array(6, 30), new ECBlocks(26, new ECB(1, 108)), new ECBlocks(24, new ECB(2, 43)), new ECBlocks(18, new ECB(2, 15), new ECB(2, 16)), new ECBlocks(22, new ECB(2, 11), new ECB(2, 12))),
+ new Version(6, new Array(6, 34), new ECBlocks(18, new ECB(2, 68)), new ECBlocks(16, new ECB(4, 27)), new ECBlocks(24, new ECB(4, 19)), new ECBlocks(28, new ECB(4, 15))),
+ new Version(7, new Array(6, 22, 38), new ECBlocks(20, new ECB(2, 78)), new ECBlocks(18, new ECB(4, 31)), new ECBlocks(18, new ECB(2, 14), new ECB(4, 15)), new ECBlocks(26, new ECB(4, 13), new ECB(1, 14))),
+ new Version(8, new Array(6, 24, 42), new ECBlocks(24, new ECB(2, 97)), new ECBlocks(22, new ECB(2, 38), new ECB(2, 39)), new ECBlocks(22, new ECB(4, 18), new ECB(2, 19)), new ECBlocks(26, new ECB(4, 14), new ECB(2, 15))),
+ new Version(9, new Array(6, 26, 46), new ECBlocks(30, new ECB(2, 116)), new ECBlocks(22, new ECB(3, 36), new ECB(2, 37)), new ECBlocks(20, new ECB(4, 16), new ECB(4, 17)), new ECBlocks(24, new ECB(4, 12), new ECB(4, 13))),
+ new Version(10, new Array(6, 28, 50), new ECBlocks(18, new ECB(2, 68), new ECB(2, 69)), new ECBlocks(26, new ECB(4, 43), new ECB(1, 44)), new ECBlocks(24, new ECB(6, 19), new ECB(2, 20)), new ECBlocks(28, new ECB(6, 15), new ECB(2, 16))),
+ new Version(11, new Array(6, 30, 54), new ECBlocks(20, new ECB(4, 81)), new ECBlocks(30, new ECB(1, 50), new ECB(4, 51)), new ECBlocks(28, new ECB(4, 22), new ECB(4, 23)), new ECBlocks(24, new ECB(3, 12), new ECB(8, 13))),
+ new Version(12, new Array(6, 32, 58), new ECBlocks(24, new ECB(2, 92), new ECB(2, 93)), new ECBlocks(22, new ECB(6, 36), new ECB(2, 37)), new ECBlocks(26, new ECB(4, 20), new ECB(6, 21)), new ECBlocks(28, new ECB(7, 14), new ECB(4, 15))),
+ new Version(13, new Array(6, 34, 62), new ECBlocks(26, new ECB(4, 107)), new ECBlocks(22, new ECB(8, 37), new ECB(1, 38)), new ECBlocks(24, new ECB(8, 20), new ECB(4, 21)), new ECBlocks(22, new ECB(12, 11), new ECB(4, 12))),
+ new Version(14, new Array(6, 26, 46, 66), new ECBlocks(30, new ECB(3, 115), new ECB(1, 116)), new ECBlocks(24, new ECB(4, 40), new ECB(5, 41)), new ECBlocks(20, new ECB(11, 16), new ECB(5, 17)), new ECBlocks(24, new ECB(11, 12), new ECB(5, 13))),
+ new Version(15, new Array(6, 26, 48, 70), new ECBlocks(22, new ECB(5, 87), new ECB(1, 88)), new ECBlocks(24, new ECB(5, 41), new ECB(5, 42)), new ECBlocks(30, new ECB(5, 24), new ECB(7, 25)), new ECBlocks(24, new ECB(11, 12), new ECB(7, 13))),
+ new Version(16, new Array(6, 26, 50, 74), new ECBlocks(24, new ECB(5, 98), new ECB(1, 99)), new ECBlocks(28, new ECB(7, 45), new ECB(3, 46)), new ECBlocks(24, new ECB(15, 19), new ECB(2, 20)), new ECBlocks(30, new ECB(3, 15), new ECB(13, 16))),
+ new Version(17, new Array(6, 30, 54, 78), new ECBlocks(28, new ECB(1, 107), new ECB(5, 108)), new ECBlocks(28, new ECB(10, 46), new ECB(1, 47)), new ECBlocks(28, new ECB(1, 22), new ECB(15, 23)), new ECBlocks(28, new ECB(2, 14), new ECB(17, 15))),
+ new Version(18, new Array(6, 30, 56, 82), new ECBlocks(30, new ECB(5, 120), new ECB(1, 121)), new ECBlocks(26, new ECB(9, 43), new ECB(4, 44)), new ECBlocks(28, new ECB(17, 22), new ECB(1, 23)), new ECBlocks(28, new ECB(2, 14), new ECB(19, 15))),
+ new Version(19, new Array(6, 30, 58, 86), new ECBlocks(28, new ECB(3, 113), new ECB(4, 114)), new ECBlocks(26, new ECB(3, 44), new ECB(11, 45)), new ECBlocks(26, new ECB(17, 21), new ECB(4, 22)), new ECBlocks(26, new ECB(9, 13), new ECB(16, 14))),
+ new Version(20, new Array(6, 34, 62, 90), new ECBlocks(28, new ECB(3, 107), new ECB(5, 108)), new ECBlocks(26, new ECB(3, 41), new ECB(13, 42)), new ECBlocks(30, new ECB(15, 24), new ECB(5, 25)), new ECBlocks(28, new ECB(15, 15), new ECB(10, 16))),
+ new Version(21, new Array(6, 28, 50, 72, 94), new ECBlocks(28, new ECB(4, 116), new ECB(4, 117)), new ECBlocks(26, new ECB(17, 42)), new ECBlocks(28, new ECB(17, 22), new ECB(6, 23)), new ECBlocks(30, new ECB(19, 16), new ECB(6, 17))),
+ new Version(22, new Array(6, 26, 50, 74, 98), new ECBlocks(28, new ECB(2, 111), new ECB(7, 112)), new ECBlocks(28, new ECB(17, 46)), new ECBlocks(30, new ECB(7, 24), new ECB(16, 25)), new ECBlocks(24, new ECB(34, 13))),
+ new Version(23, new Array(6, 30, 54, 74, 102), new ECBlocks(30, new ECB(4, 121), new ECB(5, 122)), new ECBlocks(28, new ECB(4, 47), new ECB(14, 48)), new ECBlocks(30, new ECB(11, 24), new ECB(14, 25)), new ECBlocks(30, new ECB(16, 15), new ECB(14, 16))),
+ new Version(24, new Array(6, 28, 54, 80, 106), new ECBlocks(30, new ECB(6, 117), new ECB(4, 118)), new ECBlocks(28, new ECB(6, 45), new ECB(14, 46)), new ECBlocks(30, new ECB(11, 24), new ECB(16, 25)), new ECBlocks(30, new ECB(30, 16), new ECB(2, 17))),
+ new Version(25, new Array(6, 32, 58, 84, 110), new ECBlocks(26, new ECB(8, 106), new ECB(4, 107)), new ECBlocks(28, new ECB(8, 47), new ECB(13, 48)), new ECBlocks(30, new ECB(7, 24), new ECB(22, 25)), new ECBlocks(30, new ECB(22, 15), new ECB(13, 16))),
+ new Version(26, new Array(6, 30, 58, 86, 114), new ECBlocks(28, new ECB(10, 114), new ECB(2, 115)), new ECBlocks(28, new ECB(19, 46), new ECB(4, 47)), new ECBlocks(28, new ECB(28, 22), new ECB(6, 23)), new ECBlocks(30, new ECB(33, 16), new ECB(4, 17))),
+ new Version(27, new Array(6, 34, 62, 90, 118), new ECBlocks(30, new ECB(8, 122), new ECB(4, 123)), new ECBlocks(28, new ECB(22, 45), new ECB(3, 46)), new ECBlocks(30, new ECB(8, 23), new ECB(26, 24)), new ECBlocks(30, new ECB(12, 15), new ECB(28, 16))),
+ new Version(28, new Array(6, 26, 50, 74, 98, 122), new ECBlocks(30, new ECB(3, 117), new ECB(10, 118)), new ECBlocks(28, new ECB(3, 45), new ECB(23, 46)), new ECBlocks(30, new ECB(4, 24), new ECB(31, 25)), new ECBlocks(30, new ECB(11, 15), new ECB(31, 16))),
+ new Version(29, new Array(6, 30, 54, 78, 102, 126), new ECBlocks(30, new ECB(7, 116), new ECB(7, 117)), new ECBlocks(28, new ECB(21, 45), new ECB(7, 46)), new ECBlocks(30, new ECB(1, 23), new ECB(37, 24)), new ECBlocks(30, new ECB(19, 15), new ECB(26, 16))),
+ new Version(30, new Array(6, 26, 52, 78, 104, 130), new ECBlocks(30, new ECB(5, 115), new ECB(10, 116)), new ECBlocks(28, new ECB(19, 47), new ECB(10, 48)), new ECBlocks(30, new ECB(15, 24), new ECB(25, 25)), new ECBlocks(30, new ECB(23, 15), new ECB(25, 16))),
+ new Version(31, new Array(6, 30, 56, 82, 108, 134), new ECBlocks(30, new ECB(13, 115), new ECB(3, 116)), new ECBlocks(28, new ECB(2, 46), new ECB(29, 47)), new ECBlocks(30, new ECB(42, 24), new ECB(1, 25)), new ECBlocks(30, new ECB(23, 15), new ECB(28, 16))),
+ new Version(32, new Array(6, 34, 60, 86, 112, 138), new ECBlocks(30, new ECB(17, 115)), new ECBlocks(28, new ECB(10, 46), new ECB(23, 47)), new ECBlocks(30, new ECB(10, 24), new ECB(35, 25)), new ECBlocks(30, new ECB(19, 15), new ECB(35, 16))),
+ new Version(33, new Array(6, 30, 58, 86, 114, 142), new ECBlocks(30, new ECB(17, 115), new ECB(1, 116)), new ECBlocks(28, new ECB(14, 46), new ECB(21, 47)), new ECBlocks(30, new ECB(29, 24), new ECB(19, 25)), new ECBlocks(30, new ECB(11, 15), new ECB(46, 16))),
+ new Version(34, new Array(6, 34, 62, 90, 118, 146), new ECBlocks(30, new ECB(13, 115), new ECB(6, 116)), new ECBlocks(28, new ECB(14, 46), new ECB(23, 47)), new ECBlocks(30, new ECB(44, 24), new ECB(7, 25)), new ECBlocks(30, new ECB(59, 16), new ECB(1, 17))),
+ new Version(35, new Array(6, 30, 54, 78, 102, 126, 150), new ECBlocks(30, new ECB(12, 121), new ECB(7, 122)), new ECBlocks(28, new ECB(12, 47), new ECB(26, 48)), new ECBlocks(30, new ECB(39, 24), new ECB(14, 25)),new ECBlocks(30, new ECB(22, 15), new ECB(41, 16))),
+ new Version(36, new Array(6, 24, 50, 76, 102, 128, 154), new ECBlocks(30, new ECB(6, 121), new ECB(14, 122)), new ECBlocks(28, new ECB(6, 47), new ECB(34, 48)), new ECBlocks(30, new ECB(46, 24), new ECB(10, 25)), new ECBlocks(30, new ECB(2, 15), new ECB(64, 16))),
+ new Version(37, new Array(6, 28, 54, 80, 106, 132, 158), new ECBlocks(30, new ECB(17, 122), new ECB(4, 123)), new ECBlocks(28, new ECB(29, 46), new ECB(14, 47)), new ECBlocks(30, new ECB(49, 24), new ECB(10, 25)), new ECBlocks(30, new ECB(24, 15), new ECB(46, 16))),
+ new Version(38, new Array(6, 32, 58, 84, 110, 136, 162), new ECBlocks(30, new ECB(4, 122), new ECB(18, 123)), new ECBlocks(28, new ECB(13, 46), new ECB(32, 47)), new ECBlocks(30, new ECB(48, 24), new ECB(14, 25)), new ECBlocks(30, new ECB(42, 15), new ECB(32, 16))),
+ new Version(39, new Array(6, 26, 54, 82, 110, 138, 166), new ECBlocks(30, new ECB(20, 117), new ECB(4, 118)), new ECBlocks(28, new ECB(40, 47), new ECB(7, 48)), new ECBlocks(30, new ECB(43, 24), new ECB(22, 25)), new ECBlocks(30, new ECB(10, 15), new ECB(67, 16))),
+ new Version(40, new Array(6, 30, 58, 86, 114, 142, 170), new ECBlocks(30, new ECB(19, 118), new ECB(6, 119)), new ECBlocks(28, new ECB(18, 47), new ECB(31, 48)), new ECBlocks(30, new ECB(34, 24), new ECB(34, 25)), new ECBlocks(30, new ECB(20, 15), new ECB(61, 16))));
+}
+/*
+ Ported to JavaScript by Lazar Laszlo 2011
+
+ lazarsoft@gmail.com, www.lazarsoft.info
+
+*/
+
+/*
+*
+* Copyright 2007 ZXing authors
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+function PerspectiveTransform( a11, a21, a31, a12, a22, a32, a13, a23, a33)
+{
+ this.a11 = a11;
+ this.a12 = a12;
+ this.a13 = a13;
+ this.a21 = a21;
+ this.a22 = a22;
+ this.a23 = a23;
+ this.a31 = a31;
+ this.a32 = a32;
+ this.a33 = a33;
+ this.transformPoints1=function( points)
+ {
+ var max = points.length;
+ var a11 = this.a11;
+ var a12 = this.a12;
+ var a13 = this.a13;
+ var a21 = this.a21;
+ var a22 = this.a22;
+ var a23 = this.a23;
+ var a31 = this.a31;
+ var a32 = this.a32;
+ var a33 = this.a33;
+ for (var i = 0; i < max; i += 2)
+ {
+ var x = points[i];
+ var y = points[i + 1];
+ var denominator = a13 * x + a23 * y + a33;
+ points[i] = (a11 * x + a21 * y + a31) / denominator;
+ points[i + 1] = (a12 * x + a22 * y + a32) / denominator;
+ }
+ }
+ this. transformPoints2=function(xValues, yValues)
+ {
+ var n = xValues.length;
+ for (var i = 0; i < n; i++)
+ {
+ var x = xValues[i];
+ var y = yValues[i];
+ var denominator = this.a13 * x + this.a23 * y + this.a33;
+ xValues[i] = (this.a11 * x + this.a21 * y + this.a31) / denominator;
+ yValues[i] = (this.a12 * x + this.a22 * y + this.a32) / denominator;
+ }
+ }
+
+ this.buildAdjoint=function()
+ {
+ // Adjoint is the transpose of the cofactor matrix:
+ return new PerspectiveTransform(this.a22 * this.a33 - this.a23 * this.a32, this.a23 * this.a31 - this.a21 * this.a33, this.a21 * this.a32 - this.a22 * this.a31, this.a13 * this.a32 - this.a12 * this.a33, this.a11 * this.a33 - this.a13 * this.a31, this.a12 * this.a31 - this.a11 * this.a32, this.a12 * this.a23 - this.a13 * this.a22, this.a13 * this.a21 - this.a11 * this.a23, this.a11 * this.a22 - this.a12 * this.a21);
+ }
+ this.times=function( other)
+ {
+ return new PerspectiveTransform(this.a11 * other.a11 + this.a21 * other.a12 + this.a31 * other.a13, this.a11 * other.a21 + this.a21 * other.a22 + this.a31 * other.a23, this.a11 * other.a31 + this.a21 * other.a32 + this.a31 * other.a33, this.a12 * other.a11 + this.a22 * other.a12 + this.a32 * other.a13, this.a12 * other.a21 + this.a22 * other.a22 + this.a32 * other.a23, this.a12 * other.a31 + this.a22 * other.a32 + this.a32 * other.a33, this.a13 * other.a11 + this.a23 * other.a12 +this.a33 * other.a13, this.a13 * other.a21 + this.a23 * other.a22 + this.a33 * other.a23, this.a13 * other.a31 + this.a23 * other.a32 + this.a33 * other.a33);
+ }
+
+}
+
+PerspectiveTransform.quadrilateralToQuadrilateral=function( x0, y0, x1, y1, x2, y2, x3, y3, x0p, y0p, x1p, y1p, x2p, y2p, x3p, y3p)
+{
+
+ var qToS = this.quadrilateralToSquare(x0, y0, x1, y1, x2, y2, x3, y3);
+ var sToQ = this.squareToQuadrilateral(x0p, y0p, x1p, y1p, x2p, y2p, x3p, y3p);
+ return sToQ.times(qToS);
+}
+
+PerspectiveTransform.squareToQuadrilateral=function( x0, y0, x1, y1, x2, y2, x3, y3)
+{
+ dy2 = y3 - y2;
+ dy3 = y0 - y1 + y2 - y3;
+ if (dy2 == 0.0 && dy3 == 0.0)
+ {
+ return new PerspectiveTransform(x1 - x0, x2 - x1, x0, y1 - y0, y2 - y1, y0, 0.0, 0.0, 1.0);
+ }
+ else
+ {
+ dx1 = x1 - x2;
+ dx2 = x3 - x2;
+ dx3 = x0 - x1 + x2 - x3;
+ dy1 = y1 - y2;
+ denominator = dx1 * dy2 - dx2 * dy1;
+ a13 = (dx3 * dy2 - dx2 * dy3) / denominator;
+ a23 = (dx1 * dy3 - dx3 * dy1) / denominator;
+ return new PerspectiveTransform(x1 - x0 + a13 * x1, x3 - x0 + a23 * x3, x0, y1 - y0 + a13 * y1, y3 - y0 + a23 * y3, y0, a13, a23, 1.0);
+ }
+}
+
+PerspectiveTransform.quadrilateralToSquare=function( x0, y0, x1, y1, x2, y2, x3, y3)
+{
+ // Here, the adjoint serves as the inverse:
+ return this.squareToQuadrilateral(x0, y0, x1, y1, x2, y2, x3, y3).buildAdjoint();
+}
+
+function DetectorResult(bits, points)
+{
+ this.bits = bits;
+ this.points = points;
+}
+
+
+function Detector(image)
+{
+ this.image=image;
+ this.resultPointCallback = null;
+
+ this.sizeOfBlackWhiteBlackRun=function( fromX, fromY, toX, toY)
+ {
+ // Mild variant of Bresenham's algorithm;
+ // see http://en.wikipedia.org/wiki/Bresenham's_line_algorithm
+ var steep = Math.abs(toY - fromY) > Math.abs(toX - fromX);
+ if (steep)
+ {
+ var temp = fromX;
+ fromX = fromY;
+ fromY = temp;
+ temp = toX;
+ toX = toY;
+ toY = temp;
+ }
+
+ var dx = Math.abs(toX - fromX);
+ var dy = Math.abs(toY - fromY);
+ var error = - dx >> 1;
+ var ystep = fromY < toY?1:- 1;
+ var xstep = fromX < toX?1:- 1;
+ var state = 0; // In black pixels, looking for white, first or second time
+ for (var x = fromX, y = fromY; x != toX; x += xstep)
+ {
+
+ var realX = steep?y:x;
+ var realY = steep?x:y;
+ if (state == 1)
+ {
+ // In white pixels, looking for black
+ if (this.image[realX + realY*qrcode.width])
+ {
+ state++;
+ }
+ }
+ else
+ {
+ if (!this.image[realX + realY*qrcode.width])
+ {
+ state++;
+ }
+ }
+
+ if (state == 3)
+ {
+ // Found black, white, black, and stumbled back onto white; done
+ var diffX = x - fromX;
+ var diffY = y - fromY;
+ return Math.sqrt( (diffX * diffX + diffY * diffY));
+ }
+ error += dy;
+ if (error > 0)
+ {
+ if (y == toY)
+ {
+ break;
+ }
+ y += ystep;
+ error -= dx;
+ }
+ }
+ var diffX2 = toX - fromX;
+ var diffY2 = toY - fromY;
+ return Math.sqrt( (diffX2 * diffX2 + diffY2 * diffY2));
+ }
+
+
+ this.sizeOfBlackWhiteBlackRunBothWays=function( fromX, fromY, toX, toY)
+ {
+
+ var result = this.sizeOfBlackWhiteBlackRun(fromX, fromY, toX, toY);
+
+ // Now count other way -- don't run off image though of course
+ var scale = 1.0;
+ var otherToX = fromX - (toX - fromX);
+ if (otherToX < 0)
+ {
+ scale = fromX / (fromX - otherToX);
+ otherToX = 0;
+ }
+ else if (otherToX >= qrcode.width)
+ {
+ scale = (qrcode.width - 1 - fromX) / (otherToX - fromX);
+ otherToX = qrcode.width - 1;
+ }
+ var otherToY = Math.floor (fromY - (toY - fromY) * scale);
+
+ scale = 1.0;
+ if (otherToY < 0)
+ {
+ scale = fromY / (fromY - otherToY);
+ otherToY = 0;
+ }
+ else if (otherToY >= qrcode.height)
+ {
+ scale = (qrcode.height - 1 - fromY) / (otherToY - fromY);
+ otherToY = qrcode.height - 1;
+ }
+ otherToX = Math.floor (fromX + (otherToX - fromX) * scale);
+
+ result += this.sizeOfBlackWhiteBlackRun(fromX, fromY, otherToX, otherToY);
+ return result - 1.0; // -1 because we counted the middle pixel twice
+ }
+
+
+
+ this.calculateModuleSizeOneWay=function( pattern, otherPattern)
+ {
+ var moduleSizeEst1 = this.sizeOfBlackWhiteBlackRunBothWays(Math.floor( pattern.X), Math.floor( pattern.Y), Math.floor( otherPattern.X), Math.floor(otherPattern.Y));
+ var moduleSizeEst2 = this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(otherPattern.X), Math.floor(otherPattern.Y), Math.floor( pattern.X), Math.floor(pattern.Y));
+ if (isNaN(moduleSizeEst1))
+ {
+ return moduleSizeEst2 / 7.0;
+ }
+ if (isNaN(moduleSizeEst2))
+ {
+ return moduleSizeEst1 / 7.0;
+ }
+ // Average them, and divide by 7 since we've counted the width of 3 black modules,
+ // and 1 white and 1 black module on either side. Ergo, divide sum by 14.
+ return (moduleSizeEst1 + moduleSizeEst2) / 14.0;
+ }
+
+
+ this.calculateModuleSize=function( topLeft, topRight, bottomLeft)
+ {
+ // Take the average
+ return (this.calculateModuleSizeOneWay(topLeft, topRight) + this.calculateModuleSizeOneWay(topLeft, bottomLeft)) / 2.0;
+ }
+
+ this.distance=function( pattern1, pattern2)
+ {
+ xDiff = pattern1.X - pattern2.X;
+ yDiff = pattern1.Y - pattern2.Y;
+ return Math.sqrt( (xDiff * xDiff + yDiff * yDiff));
+ }
+ this.computeDimension=function( topLeft, topRight, bottomLeft, moduleSize)
+ {
+
+ var tltrCentersDimension = Math.round(this.distance(topLeft, topRight) / moduleSize);
+ var tlblCentersDimension = Math.round(this.distance(topLeft, bottomLeft) / moduleSize);
+ var dimension = ((tltrCentersDimension + tlblCentersDimension) >> 1) + 7;
+ switch (dimension & 0x03)
+ {
+
+ // mod 4
+ case 0:
+ dimension++;
+ break;
+ // 1? do nothing
+
+ case 2:
+ dimension--;
+ break;
+
+ case 3:
+ throw "Error";
+ }
+ return dimension;
+ }
+
+ this.findAlignmentInRegion=function( overallEstModuleSize, estAlignmentX, estAlignmentY, allowanceFactor)
+ {
+ // Look for an alignment pattern (3 modules in size) around where it
+ // should be
+ var allowance = Math.floor (allowanceFactor * overallEstModuleSize);
+ var alignmentAreaLeftX = Math.max(0, estAlignmentX - allowance);
+ var alignmentAreaRightX = Math.min(qrcode.width - 1, estAlignmentX + allowance);
+ if (alignmentAreaRightX - alignmentAreaLeftX < overallEstModuleSize * 3)
+ {
+ throw "Error";
+ }
+
+ var alignmentAreaTopY = Math.max(0, estAlignmentY - allowance);
+ var alignmentAreaBottomY = Math.min(qrcode.height - 1, estAlignmentY + allowance);
+
+ var alignmentFinder = new AlignmentPatternFinder(this.image, alignmentAreaLeftX, alignmentAreaTopY, alignmentAreaRightX - alignmentAreaLeftX, alignmentAreaBottomY - alignmentAreaTopY, overallEstModuleSize, this.resultPointCallback);
+ return alignmentFinder.find();
+ }
+
+ this.createTransform=function( topLeft, topRight, bottomLeft, alignmentPattern, dimension)
+ {
+ var dimMinusThree = dimension - 3.5;
+ var bottomRightX;
+ var bottomRightY;
+ var sourceBottomRightX;
+ var sourceBottomRightY;
+ if (alignmentPattern != null)
+ {
+ bottomRightX = alignmentPattern.X;
+ bottomRightY = alignmentPattern.Y;
+ sourceBottomRightX = sourceBottomRightY = dimMinusThree - 3.0;
+ }
+ else
+ {
+ // Don't have an alignment pattern, just make up the bottom-right point
+ bottomRightX = (topRight.X - topLeft.X) + bottomLeft.X;
+ bottomRightY = (topRight.Y - topLeft.Y) + bottomLeft.Y;
+ sourceBottomRightX = sourceBottomRightY = dimMinusThree;
+ }
+
+ var transform = PerspectiveTransform.quadrilateralToQuadrilateral(3.5, 3.5, dimMinusThree, 3.5, sourceBottomRightX, sourceBottomRightY, 3.5, dimMinusThree, topLeft.X, topLeft.Y, topRight.X, topRight.Y, bottomRightX, bottomRightY, bottomLeft.X, bottomLeft.Y);
+
+ return transform;
+ }
+
+ this.sampleGrid=function( image, transform, dimension)
+ {
+
+ var sampler = GridSampler;
+ return sampler.sampleGrid3(image, dimension, transform);
+ }
+
+ this.processFinderPatternInfo = function( info)
+ {
+
+ var topLeft = info.TopLeft;
+ var topRight = info.TopRight;
+ var bottomLeft = info.BottomLeft;
+
+ var moduleSize = this.calculateModuleSize(topLeft, topRight, bottomLeft);
+ if (moduleSize < 1.0)
+ {
+ throw "Error";
+ }
+ var dimension = this.computeDimension(topLeft, topRight, bottomLeft, moduleSize);
+ var provisionalVersion = Version.getProvisionalVersionForDimension(dimension);
+ var modulesBetweenFPCenters = provisionalVersion.DimensionForVersion - 7;
+
+ var alignmentPattern = null;
+ // Anything above version 1 has an alignment pattern
+ if (provisionalVersion.AlignmentPatternCenters.length > 0)
+ {
+
+ // Guess where a "bottom right" finder pattern would have been
+ var bottomRightX = topRight.X - topLeft.X + bottomLeft.X;
+ var bottomRightY = topRight.Y - topLeft.Y + bottomLeft.Y;
+
+ // Estimate that alignment pattern is closer by 3 modules
+ // from "bottom right" to known top left location
+ var correctionToTopLeft = 1.0 - 3.0 / modulesBetweenFPCenters;
+ var estAlignmentX = Math.floor (topLeft.X + correctionToTopLeft * (bottomRightX - topLeft.X));
+ var estAlignmentY = Math.floor (topLeft.Y + correctionToTopLeft * (bottomRightY - topLeft.Y));
+
+ // Kind of arbitrary -- expand search radius before giving up
+ for (var i = 4; i <= 16; i <<= 1)
+ {
+ //try
+ //{
+ alignmentPattern = this.findAlignmentInRegion(moduleSize, estAlignmentX, estAlignmentY, i);
+ break;
+ //}
+ //catch (re)
+ //{
+ // try next round
+ //}
+ }
+ // If we didn't find alignment pattern... well try anyway without it
+ }
+
+ var transform = this.createTransform(topLeft, topRight, bottomLeft, alignmentPattern, dimension);
+
+ var bits = this.sampleGrid(this.image, transform, dimension);
+
+ var points;
+ if (alignmentPattern == null)
+ {
+ points = new Array(bottomLeft, topLeft, topRight);
+ }
+ else
+ {
+ points = new Array(bottomLeft, topLeft, topRight, alignmentPattern);
+ }
+ return new DetectorResult(bits, points);
+ }
+
+
+
+ this.detect=function()
+ {
+ var info = new FinderPatternFinder().findFinderPattern(this.image);
+
+ return this.processFinderPatternInfo(info);
+ }
+}
+/*
+ Ported to JavaScript by Lazar Laszlo 2011
+
+ lazarsoft@gmail.com, www.lazarsoft.info
+
+*/
+
+/*
+*
+* Copyright 2007 ZXing authors
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+var FORMAT_INFO_MASK_QR = 0x5412;
+var FORMAT_INFO_DECODE_LOOKUP = new Array(new Array(0x5412, 0x00), new Array(0x5125, 0x01), new Array(0x5E7C, 0x02), new Array(0x5B4B, 0x03), new Array(0x45F9, 0x04), new Array(0x40CE, 0x05), new Array(0x4F97, 0x06), new Array(0x4AA0, 0x07), new Array(0x77C4, 0x08), new Array(0x72F3, 0x09), new Array(0x7DAA, 0x0A), new Array(0x789D, 0x0B), new Array(0x662F, 0x0C), new Array(0x6318, 0x0D), new Array(0x6C41, 0x0E), new Array(0x6976, 0x0F), new Array(0x1689, 0x10), new Array(0x13BE, 0x11), new Array(0x1CE7, 0x12), new Array(0x19D0, 0x13), new Array(0x0762, 0x14), new Array(0x0255, 0x15), new Array(0x0D0C, 0x16), new Array(0x083B, 0x17), new Array(0x355F, 0x18), new Array(0x3068, 0x19), new Array(0x3F31, 0x1A), new Array(0x3A06, 0x1B), new Array(0x24B4, 0x1C), new Array(0x2183, 0x1D), new Array(0x2EDA, 0x1E), new Array(0x2BED, 0x1F));
+var BITS_SET_IN_HALF_BYTE = new Array(0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4);
+
+
+function FormatInformation(formatInfo)
+{
+ this.errorCorrectionLevel = ErrorCorrectionLevel.forBits((formatInfo >> 3) & 0x03);
+ this.dataMask = (formatInfo & 0x07);
+
+ this.__defineGetter__("ErrorCorrectionLevel", function()
+ {
+ return this.errorCorrectionLevel;
+ });
+ this.__defineGetter__("DataMask", function()
+ {
+ return this.dataMask;
+ });
+ this.GetHashCode=function()
+ {
+ return (this.errorCorrectionLevel.ordinal() << 3) | dataMask;
+ }
+ this.Equals=function( o)
+ {
+ var other = o;
+ return this.errorCorrectionLevel == other.errorCorrectionLevel && this.dataMask == other.dataMask;
+ }
+}
+
+FormatInformation.numBitsDiffering=function( a, b)
+{
+ a ^= b; // a now has a 1 bit exactly where its bit differs with b's
+ // Count bits set quickly with a series of lookups:
+ return BITS_SET_IN_HALF_BYTE[a & 0x0F] + BITS_SET_IN_HALF_BYTE[(URShift(a, 4) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 8) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 12) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 16) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 20) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 24) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 28) & 0x0F)];
+}
+
+FormatInformation.decodeFormatInformation=function( maskedFormatInfo)
+{
+ var formatInfo = FormatInformation.doDecodeFormatInformation(maskedFormatInfo);
+ if (formatInfo != null)
+ {
+ return formatInfo;
+ }
+ // Should return null, but, some QR codes apparently
+ // do not mask this info. Try again by actually masking the pattern
+ // first
+ return FormatInformation.doDecodeFormatInformation(maskedFormatInfo ^ FORMAT_INFO_MASK_QR);
+}
+FormatInformation.doDecodeFormatInformation=function( maskedFormatInfo)
+{
+ // Find the int in FORMAT_INFO_DECODE_LOOKUP with fewest bits differing
+ var bestDifference = 0xffffffff;
+ var bestFormatInfo = 0;
+ for (var i = 0; i < FORMAT_INFO_DECODE_LOOKUP.length; i++)
+ {
+ var decodeInfo = FORMAT_INFO_DECODE_LOOKUP[i];
+ var targetInfo = decodeInfo[0];
+ if (targetInfo == maskedFormatInfo)
+ {
+ // Found an exact match
+ return new FormatInformation(decodeInfo[1]);
+ }
+ var bitsDifference = this.numBitsDiffering(maskedFormatInfo, targetInfo);
+ if (bitsDifference < bestDifference)
+ {
+ bestFormatInfo = decodeInfo[1];
+ bestDifference = bitsDifference;
+ }
+ }
+ // Hamming distance of the 32 masked codes is 7, by construction, so <= 3 bits
+ // differing means we found a match
+ if (bestDifference <= 3)
+ {
+ return new FormatInformation(bestFormatInfo);
+ }
+ return null;
+}
+
+
+/*
+ Ported to JavaScript by Lazar Laszlo 2011
+
+ lazarsoft@gmail.com, www.lazarsoft.info
+
+*/
+
+/*
+*
+* Copyright 2007 ZXing authors
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+function ErrorCorrectionLevel(ordinal, bits, name)
+{
+ this.ordinal_Renamed_Field = ordinal;
+ this.bits = bits;
+ this.name = name;
+ this.__defineGetter__("Bits", function()
+ {
+ return this.bits;
+ });
+ this.__defineGetter__("Name", function()
+ {
+ return this.name;
+ });
+ this.ordinal=function()
+ {
+ return this.ordinal_Renamed_Field;
+ }
+}
+
+ErrorCorrectionLevel.forBits=function( bits)
+{
+ if (bits < 0 || bits >= FOR_BITS.length)
+ {
+ throw "ArgumentException";
+ }
+ return FOR_BITS[bits];
+}
+
+var L = new ErrorCorrectionLevel(0, 0x01, "L");
+var M = new ErrorCorrectionLevel(1, 0x00, "M");
+var Q = new ErrorCorrectionLevel(2, 0x03, "Q");
+var H = new ErrorCorrectionLevel(3, 0x02, "H");
+var FOR_BITS = new Array( M, L, H, Q);
+
+/*
+ Ported to JavaScript by Lazar Laszlo 2011
+
+ lazarsoft@gmail.com, www.lazarsoft.info
+
+*/
+
+/*
+*
+* Copyright 2007 ZXing authors
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+function BitMatrix( width, height)
+{
+ if(!height)
+ height=width;
+ if (width < 1 || height < 1)
+ {
+ throw "Both dimensions must be greater than 0";
+ }
+ this.width = width;
+ this.height = height;
+ var rowSize = width >> 5;
+ if ((width & 0x1f) != 0)
+ {
+ rowSize++;
+ }
+ this.rowSize = rowSize;
+ this.bits = new Array(rowSize * height);
+ for(var i=0;i> 5);
+ return ((URShift(this.bits[offset], (x & 0x1f))) & 1) != 0;
+ }
+ this.set_Renamed=function( x, y)
+ {
+ var offset = y * this.rowSize + (x >> 5);
+ this.bits[offset] |= 1 << (x & 0x1f);
+ }
+ this.flip=function( x, y)
+ {
+ var offset = y * this.rowSize + (x >> 5);
+ this.bits[offset] ^= 1 << (x & 0x1f);
+ }
+ this.clear=function()
+ {
+ var max = this.bits.length;
+ for (var i = 0; i < max; i++)
+ {
+ this.bits[i] = 0;
+ }
+ }
+ this.setRegion=function( left, top, width, height)
+ {
+ if (top < 0 || left < 0)
+ {
+ throw "Left and top must be nonnegative";
+ }
+ if (height < 1 || width < 1)
+ {
+ throw "Height and width must be at least 1";
+ }
+ var right = left + width;
+ var bottom = top + height;
+ if (bottom > this.height || right > this.width)
+ {
+ throw "The region must fit inside the matrix";
+ }
+ for (var y = top; y < bottom; y++)
+ {
+ var offset = y * this.rowSize;
+ for (var x = left; x < right; x++)
+ {
+ this.bits[offset + (x >> 5)] |= 1 << (x & 0x1f);
+ }
+ }
+ }
+}
+/*
+ Ported to JavaScript by Lazar Laszlo 2011
+
+ lazarsoft@gmail.com, www.lazarsoft.info
+
+*/
+
+/*
+*
+* Copyright 2007 ZXing authors
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+function DataBlock(numDataCodewords, codewords)
+{
+ this.numDataCodewords = numDataCodewords;
+ this.codewords = codewords;
+
+ this.__defineGetter__("NumDataCodewords", function()
+ {
+ return this.numDataCodewords;
+ });
+ this.__defineGetter__("Codewords", function()
+ {
+ return this.codewords;
+ });
+}
+
+DataBlock.getDataBlocks=function(rawCodewords, version, ecLevel)
+{
+
+ if (rawCodewords.length != version.TotalCodewords)
+ {
+ throw "ArgumentException";
+ }
+
+ // Figure out the number and size of data blocks used by this version and
+ // error correction level
+ var ecBlocks = version.getECBlocksForLevel(ecLevel);
+
+ // First count the total number of data blocks
+ var totalBlocks = 0;
+ var ecBlockArray = ecBlocks.getECBlocks();
+ for (var i = 0; i < ecBlockArray.length; i++)
+ {
+ totalBlocks += ecBlockArray[i].Count;
+ }
+
+ // Now establish DataBlocks of the appropriate size and number of data codewords
+ var result = new Array(totalBlocks);
+ var numResultBlocks = 0;
+ for (var j = 0; j < ecBlockArray.length; j++)
+ {
+ var ecBlock = ecBlockArray[j];
+ for (var i = 0; i < ecBlock.Count; i++)
+ {
+ var numDataCodewords = ecBlock.DataCodewords;
+ var numBlockCodewords = ecBlocks.ECCodewordsPerBlock + numDataCodewords;
+ result[numResultBlocks++] = new DataBlock(numDataCodewords, new Array(numBlockCodewords));
+ }
+ }
+
+ // All blocks have the same amount of data, except that the last n
+ // (where n may be 0) have 1 more byte. Figure out where these start.
+ var shorterBlocksTotalCodewords = result[0].codewords.length;
+ var longerBlocksStartAt = result.length - 1;
+ while (longerBlocksStartAt >= 0)
+ {
+ var numCodewords = result[longerBlocksStartAt].codewords.length;
+ if (numCodewords == shorterBlocksTotalCodewords)
+ {
+ break;
+ }
+ longerBlocksStartAt--;
+ }
+ longerBlocksStartAt++;
+
+ var shorterBlocksNumDataCodewords = shorterBlocksTotalCodewords - ecBlocks.ECCodewordsPerBlock;
+ // The last elements of result may be 1 element longer;
+ // first fill out as many elements as all of them have
+ var rawCodewordsOffset = 0;
+ for (var i = 0; i < shorterBlocksNumDataCodewords; i++)
+ {
+ for (var j = 0; j < numResultBlocks; j++)
+ {
+ result[j].codewords[i] = rawCodewords[rawCodewordsOffset++];
+ }
+ }
+ // Fill out the last data block in the longer ones
+ for (var j = longerBlocksStartAt; j < numResultBlocks; j++)
+ {
+ result[j].codewords[shorterBlocksNumDataCodewords] = rawCodewords[rawCodewordsOffset++];
+ }
+ // Now add in error correction blocks
+ var max = result[0].codewords.length;
+ for (var i = shorterBlocksNumDataCodewords; i < max; i++)
+ {
+ for (var j = 0; j < numResultBlocks; j++)
+ {
+ var iOffset = j < longerBlocksStartAt?i:i + 1;
+ result[j].codewords[iOffset] = rawCodewords[rawCodewordsOffset++];
+ }
+ }
+ return result;
+}
+
+/*
+ Ported to JavaScript by Lazar Laszlo 2011
+
+ lazarsoft@gmail.com, www.lazarsoft.info
+
+*/
+
+/*
+*
+* Copyright 2007 ZXing authors
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+function BitMatrixParser(bitMatrix)
+{
+ var dimension = bitMatrix.Dimension;
+ if (dimension < 21 || (dimension & 0x03) != 1)
+ {
+ throw "Error BitMatrixParser";
+ }
+ this.bitMatrix = bitMatrix;
+ this.parsedVersion = null;
+ this.parsedFormatInfo = null;
+
+ this.copyBit=function( i, j, versionBits)
+ {
+ return this.bitMatrix.get_Renamed(i, j)?(versionBits << 1) | 0x1:versionBits << 1;
+ }
+
+ this.readFormatInformation=function()
+ {
+ if (this.parsedFormatInfo != null)
+ {
+ return this.parsedFormatInfo;
+ }
+
+ // Read top-left format info bits
+ var formatInfoBits = 0;
+ for (var i = 0; i < 6; i++)
+ {
+ formatInfoBits = this.copyBit(i, 8, formatInfoBits);
+ }
+ // .. and skip a bit in the timing pattern ...
+ formatInfoBits = this.copyBit(7, 8, formatInfoBits);
+ formatInfoBits = this.copyBit(8, 8, formatInfoBits);
+ formatInfoBits = this.copyBit(8, 7, formatInfoBits);
+ // .. and skip a bit in the timing pattern ...
+ for (var j = 5; j >= 0; j--)
+ {
+ formatInfoBits = this.copyBit(8, j, formatInfoBits);
+ }
+
+ this.parsedFormatInfo = FormatInformation.decodeFormatInformation(formatInfoBits);
+ if (this.parsedFormatInfo != null)
+ {
+ return this.parsedFormatInfo;
+ }
+
+ // Hmm, failed. Try the top-right/bottom-left pattern
+ var dimension = this.bitMatrix.Dimension;
+ formatInfoBits = 0;
+ var iMin = dimension - 8;
+ for (var i = dimension - 1; i >= iMin; i--)
+ {
+ formatInfoBits = this.copyBit(i, 8, formatInfoBits);
+ }
+ for (var j = dimension - 7; j < dimension; j++)
+ {
+ formatInfoBits = this.copyBit(8, j, formatInfoBits);
+ }
+
+ this.parsedFormatInfo = FormatInformation.decodeFormatInformation(formatInfoBits);
+ if (this.parsedFormatInfo != null)
+ {
+ return this.parsedFormatInfo;
+ }
+ throw "Error readFormatInformation";
+ }
+ this.readVersion=function()
+ {
+
+ if (this.parsedVersion != null)
+ {
+ return this.parsedVersion;
+ }
+
+ var dimension = this.bitMatrix.Dimension;
+
+ var provisionalVersion = (dimension - 17) >> 2;
+ if (provisionalVersion <= 6)
+ {
+ return Version.getVersionForNumber(provisionalVersion);
+ }
+
+ // Read top-right version info: 3 wide by 6 tall
+ var versionBits = 0;
+ var ijMin = dimension - 11;
+ for (var j = 5; j >= 0; j--)
+ {
+ for (var i = dimension - 9; i >= ijMin; i--)
+ {
+ versionBits = this.copyBit(i, j, versionBits);
+ }
+ }
+
+ this.parsedVersion = Version.decodeVersionInformation(versionBits);
+ if (this.parsedVersion != null && this.parsedVersion.DimensionForVersion == dimension)
+ {
+ return this.parsedVersion;
+ }
+
+ // Hmm, failed. Try bottom left: 6 wide by 3 tall
+ versionBits = 0;
+ for (var i = 5; i >= 0; i--)
+ {
+ for (var j = dimension - 9; j >= ijMin; j--)
+ {
+ versionBits = this.copyBit(i, j, versionBits);
+ }
+ }
+
+ this.parsedVersion = Version.decodeVersionInformation(versionBits);
+ if (this.parsedVersion != null && this.parsedVersion.DimensionForVersion == dimension)
+ {
+ return this.parsedVersion;
+ }
+ throw "Error readVersion";
+ }
+ this.readCodewords=function()
+ {
+
+ var formatInfo = this.readFormatInformation();
+ var version = this.readVersion();
+
+ // Get the data mask for the format used in this QR Code. This will exclude
+ // some bits from reading as we wind through the bit matrix.
+ var dataMask = DataMask.forReference( formatInfo.DataMask);
+ var dimension = this.bitMatrix.Dimension;
+ dataMask.unmaskBitMatrix(this.bitMatrix, dimension);
+
+ var functionPattern = version.buildFunctionPattern();
+
+ var readingUp = true;
+ var result = new Array(version.TotalCodewords);
+ var resultOffset = 0;
+ var currentByte = 0;
+ var bitsRead = 0;
+ // Read columns in pairs, from right to left
+ for (var j = dimension - 1; j > 0; j -= 2)
+ {
+ if (j == 6)
+ {
+ // Skip whole column with vertical alignment pattern;
+ // saves time and makes the other code proceed more cleanly
+ j--;
+ }
+ // Read alternatingly from bottom to top then top to bottom
+ for (var count = 0; count < dimension; count++)
+ {
+ var i = readingUp?dimension - 1 - count:count;
+ for (var col = 0; col < 2; col++)
+ {
+ // Ignore bits covered by the function pattern
+ if (!functionPattern.get_Renamed(j - col, i))
+ {
+ // Read a bit
+ bitsRead++;
+ currentByte <<= 1;
+ if (this.bitMatrix.get_Renamed(j - col, i))
+ {
+ currentByte |= 1;
+ }
+ // If we've made a whole byte, save it off
+ if (bitsRead == 8)
+ {
+ result[resultOffset++] = currentByte;
+ bitsRead = 0;
+ currentByte = 0;
+ }
+ }
+ }
+ }
+ readingUp ^= true; // readingUp = !readingUp; // switch directions
+ }
+ if (resultOffset != version.TotalCodewords)
+ {
+ throw "Error readCodewords";
+ }
+ return result;
+ }
+}
+/*
+ Ported to JavaScript by Lazar Laszlo 2011
+
+ lazarsoft@gmail.com, www.lazarsoft.info
+
+*/
+
+/*
+*
+* Copyright 2007 ZXing authors
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+DataMask = {};
+
+DataMask.forReference = function(reference)
+{
+ if (reference < 0 || reference > 7)
+ {
+ throw "System.ArgumentException";
+ }
+ return DataMask.DATA_MASKS[reference];
+}
+
+function DataMask000()
+{
+ this.unmaskBitMatrix=function(bits, dimension)
+ {
+ for (var i = 0; i < dimension; i++)
+ {
+ for (var j = 0; j < dimension; j++)
+ {
+ if (this.isMasked(i, j))
+ {
+ bits.flip(j, i);
+ }
+ }
+ }
+ }
+ this.isMasked=function( i, j)
+ {
+ return ((i + j) & 0x01) == 0;
+ }
+}
+
+function DataMask001()
+{
+ this.unmaskBitMatrix=function(bits, dimension)
+ {
+ for (var i = 0; i < dimension; i++)
+ {
+ for (var j = 0; j < dimension; j++)
+ {
+ if (this.isMasked(i, j))
+ {
+ bits.flip(j, i);
+ }
+ }
+ }
+ }
+ this.isMasked=function( i, j)
+ {
+ return (i & 0x01) == 0;
+ }
+}
+
+function DataMask010()
+{
+ this.unmaskBitMatrix=function(bits, dimension)
+ {
+ for (var i = 0; i < dimension; i++)
+ {
+ for (var j = 0; j < dimension; j++)
+ {
+ if (this.isMasked(i, j))
+ {
+ bits.flip(j, i);
+ }
+ }
+ }
+ }
+ this.isMasked=function( i, j)
+ {
+ return j % 3 == 0;
+ }
+}
+
+function DataMask011()
+{
+ this.unmaskBitMatrix=function(bits, dimension)
+ {
+ for (var i = 0; i < dimension; i++)
+ {
+ for (var j = 0; j < dimension; j++)
+ {
+ if (this.isMasked(i, j))
+ {
+ bits.flip(j, i);
+ }
+ }
+ }
+ }
+ this.isMasked=function( i, j)
+ {
+ return (i + j) % 3 == 0;
+ }
+}
+
+function DataMask100()
+{
+ this.unmaskBitMatrix=function(bits, dimension)
+ {
+ for (var i = 0; i < dimension; i++)
+ {
+ for (var j = 0; j < dimension; j++)
+ {
+ if (this.isMasked(i, j))
+ {
+ bits.flip(j, i);
+ }
+ }
+ }
+ }
+ this.isMasked=function( i, j)
+ {
+ return (((URShift(i, 1)) + (j / 3)) & 0x01) == 0;
+ }
+}
+
+function DataMask101()
+{
+ this.unmaskBitMatrix=function(bits, dimension)
+ {
+ for (var i = 0; i < dimension; i++)
+ {
+ for (var j = 0; j < dimension; j++)
+ {
+ if (this.isMasked(i, j))
+ {
+ bits.flip(j, i);
+ }
+ }
+ }
+ }
+ this.isMasked=function( i, j)
+ {
+ var temp = i * j;
+ return (temp & 0x01) + (temp % 3) == 0;
+ }
+}
+
+function DataMask110()
+{
+ this.unmaskBitMatrix=function(bits, dimension)
+ {
+ for (var i = 0; i < dimension; i++)
+ {
+ for (var j = 0; j < dimension; j++)
+ {
+ if (this.isMasked(i, j))
+ {
+ bits.flip(j, i);
+ }
+ }
+ }
+ }
+ this.isMasked=function( i, j)
+ {
+ var temp = i * j;
+ return (((temp & 0x01) + (temp % 3)) & 0x01) == 0;
+ }
+}
+function DataMask111()
+{
+ this.unmaskBitMatrix=function(bits, dimension)
+ {
+ for (var i = 0; i < dimension; i++)
+ {
+ for (var j = 0; j < dimension; j++)
+ {
+ if (this.isMasked(i, j))
+ {
+ bits.flip(j, i);
+ }
+ }
+ }
+ }
+ this.isMasked=function( i, j)
+ {
+ return ((((i + j) & 0x01) + ((i * j) % 3)) & 0x01) == 0;
+ }
+}
+
+DataMask.DATA_MASKS = new Array(new DataMask000(), new DataMask001(), new DataMask010(), new DataMask011(), new DataMask100(), new DataMask101(), new DataMask110(), new DataMask111());
+
+
+/*
+ Ported to JavaScript by Lazar Laszlo 2011
+
+ lazarsoft@gmail.com, www.lazarsoft.info
+
+*/
+
+/*
+*
+* Copyright 2007 ZXing authors
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+function ReedSolomonDecoder(field)
+{
+ this.field = field;
+ this.decode=function(received, twoS)
+ {
+ var poly = new GF256Poly(this.field, received);
+ var syndromeCoefficients = new Array(twoS);
+ for(var i=0;i= b's
+ if (a.Degree < b.Degree)
+ {
+ var temp = a;
+ a = b;
+ b = temp;
+ }
+
+ var rLast = a;
+ var r = b;
+ var sLast = this.field.One;
+ var s = this.field.Zero;
+ var tLast = this.field.Zero;
+ var t = this.field.One;
+
+ // Run Euclidean algorithm until r's degree is less than R/2
+ while (r.Degree >= Math.floor(R / 2))
+ {
+ var rLastLast = rLast;
+ var sLastLast = sLast;
+ var tLastLast = tLast;
+ rLast = r;
+ sLast = s;
+ tLast = t;
+
+ // Divide rLastLast by rLast, with quotient in q and remainder in r
+ if (rLast.Zero)
+ {
+ // Oops, Euclidean algorithm already terminated?
+ throw "r_{i-1} was zero";
+ }
+ r = rLastLast;
+ var q = this.field.Zero;
+ var denominatorLeadingTerm = rLast.getCoefficient(rLast.Degree);
+ var dltInverse = this.field.inverse(denominatorLeadingTerm);
+ while (r.Degree >= rLast.Degree && !r.Zero)
+ {
+ var degreeDiff = r.Degree - rLast.Degree;
+ var scale = this.field.multiply(r.getCoefficient(r.Degree), dltInverse);
+ q = q.addOrSubtract(this.field.buildMonomial(degreeDiff, scale));
+ r = r.addOrSubtract(rLast.multiplyByMonomial(degreeDiff, scale));
+ //r.EXE();
+ }
+
+ s = q.multiply1(sLast).addOrSubtract(sLastLast);
+ t = q.multiply1(tLast).addOrSubtract(tLastLast);
+ }
+
+ var sigmaTildeAtZero = t.getCoefficient(0);
+ if (sigmaTildeAtZero == 0)
+ {
+ throw "ReedSolomonException sigmaTilde(0) was zero";
+ }
+
+ var inverse = this.field.inverse(sigmaTildeAtZero);
+ var sigma = t.multiply2(inverse);
+ var omega = r.multiply2(inverse);
+ return new Array(sigma, omega);
+ }
+ this.findErrorLocations=function( errorLocator)
+ {
+ // This is a direct application of Chien's search
+ var numErrors = errorLocator.Degree;
+ if (numErrors == 1)
+ {
+ // shortcut
+ return new Array(errorLocator.getCoefficient(1));
+ }
+ var result = new Array(numErrors);
+ var e = 0;
+ for (var i = 1; i < 256 && e < numErrors; i++)
+ {
+ if (errorLocator.evaluateAt(i) == 0)
+ {
+ result[e] = this.field.inverse(i);
+ e++;
+ }
+ }
+ if (e != numErrors)
+ {
+ throw "Error locator degree does not match number of roots";
+ }
+ return result;
+ }
+ this.findErrorMagnitudes=function( errorEvaluator, errorLocations, dataMatrix)
+ {
+ // This is directly applying Forney's Formula
+ var s = errorLocations.length;
+ var result = new Array(s);
+ for (var i = 0; i < s; i++)
+ {
+ var xiInverse = this.field.inverse(errorLocations[i]);
+ var denominator = 1;
+ for (var j = 0; j < s; j++)
+ {
+ if (i != j)
+ {
+ denominator = this.field.multiply(denominator, GF256.addOrSubtract(1, this.field.multiply(errorLocations[j], xiInverse)));
+ }
+ }
+ result[i] = this.field.multiply(errorEvaluator.evaluateAt(xiInverse), this.field.inverse(denominator));
+ // Thanks to sanfordsquires for this fix:
+ if (dataMatrix)
+ {
+ result[i] = this.field.multiply(result[i], xiInverse);
+ }
+ }
+ return result;
+ }
+}
+/*
+ Ported to JavaScript by Lazar Laszlo 2011
+
+ lazarsoft@gmail.com, www.lazarsoft.info
+
+*/
+
+/*
+*
+* Copyright 2007 ZXing authors
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+function GF256Poly(field, coefficients)
+{
+ if (coefficients == null || coefficients.length == 0)
+ {
+ throw "System.ArgumentException";
+ }
+ this.field = field;
+ var coefficientsLength = coefficients.length;
+ if (coefficientsLength > 1 && coefficients[0] == 0)
+ {
+ // Leading term must be non-zero for anything except the constant polynomial "0"
+ var firstNonZero = 1;
+ while (firstNonZero < coefficientsLength && coefficients[firstNonZero] == 0)
+ {
+ firstNonZero++;
+ }
+ if (firstNonZero == coefficientsLength)
+ {
+ this.coefficients = field.Zero.coefficients;
+ }
+ else
+ {
+ this.coefficients = new Array(coefficientsLength - firstNonZero);
+ for(var i=0;i largerCoefficients.length)
+ {
+ var temp = smallerCoefficients;
+ smallerCoefficients = largerCoefficients;
+ largerCoefficients = temp;
+ }
+ var sumDiff = new Array(largerCoefficients.length);
+ var lengthDiff = largerCoefficients.length - smallerCoefficients.length;
+ // Copy high-order terms only found in higher-degree polynomial's coefficients
+ //Array.Copy(largerCoefficients, 0, sumDiff, 0, lengthDiff);
+ for(var ci=0;ci= other.Degree && !remainder.Zero)
+ {
+ var degreeDifference = remainder.Degree - other.Degree;
+ var scale = this.field.multiply(remainder.getCoefficient(remainder.Degree), inverseDenominatorLeadingTerm);
+ var term = other.multiplyByMonomial(degreeDifference, scale);
+ var iterationQuotient = this.field.buildMonomial(degreeDifference, scale);
+ quotient = quotient.addOrSubtract(iterationQuotient);
+ remainder = remainder.addOrSubtract(term);
+ }
+
+ return new Array(quotient, remainder);
+ }
+}
+/*
+ Ported to JavaScript by Lazar Laszlo 2011
+
+ lazarsoft@gmail.com, www.lazarsoft.info
+
+*/
+
+/*
+*
+* Copyright 2007 ZXing authors
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+function GF256( primitive)
+{
+ this.expTable = new Array(256);
+ this.logTable = new Array(256);
+ var x = 1;
+ for (var i = 0; i < 256; i++)
+ {
+ this.expTable[i] = x;
+ x <<= 1; // x = x * 2; we're assuming the generator alpha is 2
+ if (x >= 0x100)
+ {
+ x ^= primitive;
+ }
+ }
+ for (var i = 0; i < 255; i++)
+ {
+ this.logTable[this.expTable[i]] = i;
+ }
+ // logTable[0] == 0 but this should never be used
+ var at0=new Array(1);at0[0]=0;
+ this.zero = new GF256Poly(this, new Array(at0));
+ var at1=new Array(1);at1[0]=1;
+ this.one = new GF256Poly(this, new Array(at1));
+
+ this.__defineGetter__("Zero", function()
+ {
+ return this.zero;
+ });
+ this.__defineGetter__("One", function()
+ {
+ return this.one;
+ });
+ this.buildMonomial=function( degree, coefficient)
+ {
+ if (degree < 0)
+ {
+ throw "System.ArgumentException";
+ }
+ if (coefficient == 0)
+ {
+ return zero;
+ }
+ var coefficients = new Array(degree + 1);
+ for(var i=0;iqrcode.maxImgSize)
+ {
+ var ir = image.width / image.height;
+ nheight = Math.sqrt(qrcode.maxImgSize/ir);
+ nwidth=ir*nheight;
+ }
+
+ canvas_qr.width = nwidth;
+ canvas_qr.height = nheight;
+
+ context.drawImage(image, 0, 0, canvas_qr.width, canvas_qr.height );
+ qrcode.width = canvas_qr.width;
+ qrcode.height = canvas_qr.height;
+ try{
+ qrcode.imagedata = context.getImageData(0, 0, canvas_qr.width, canvas_qr.height);
+ }catch(e){
+ qrcode.result = "Cross domain Error";
+ if(qrcode.callback!=null)
+ qrcode.callback(qrcode.result);
+ return;
+ }
+
+ try
+ {
+ qrcode.result = qrcode.process(context);
+ cb(null, qrcode.result);
+ }
+ catch(e)
+ {
+ // console.log(e);
+ qrcode.result = "Error decoding QR Code from Image";
+ cb(new Error("Error decoding QR Code from Image"));
+ }
+ if(qrcode.callback!=null)
+ qrcode.callback(qrcode.result);
+ }
+ image.src = src;
+ }
+}
+
+qrcode.isUrl = function(s)
+{
+ var regexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
+ return regexp.test(s);
+}
+
+qrcode.decode_url = function (s)
+{
+ var escaped = "";
+ try{
+ escaped = escape( s );
+ }
+ catch(e)
+ {
+ // console.log(e);
+ escaped = s;
+ }
+ var ret = "";
+ try{
+ ret = decodeURIComponent( escaped );
+ }
+ catch(e)
+ {
+ // console.log(e);
+ ret = escaped;
+ }
+ return ret;
+}
+
+qrcode.decode_utf8 = function ( s )
+{
+ if(qrcode.isUrl(s))
+ return qrcode.decode_url(s);
+ else
+ return s;
+}
+
+qrcode.process = function(ctx){
+
+ var start = new Date().getTime();
+
+ var image = qrcode.grayScaleToBitmap(qrcode.grayscale());
+ //var image = qrcode.binarize(128);
+
+ if(qrcode.debug)
+ {
+ for (var y = 0; y < qrcode.height; y++)
+ {
+ for (var x = 0; x < qrcode.width; x++)
+ {
+ var point = (x * 4) + (y * qrcode.width * 4);
+ qrcode.imagedata.data[point] = image[x+y*qrcode.width]?0:0;
+ qrcode.imagedata.data[point+1] = image[x+y*qrcode.width]?0:0;
+ qrcode.imagedata.data[point+2] = image[x+y*qrcode.width]?255:0;
+ }
+ }
+ ctx.putImageData(qrcode.imagedata, 0, 0);
+ }
+
+ //var finderPatternInfo = new FinderPatternFinder().findFinderPattern(image);
+
+ var detector = new Detector(image);
+
+ var qRCodeMatrix = detector.detect();
+
+ /*for (var y = 0; y < qRCodeMatrix.bits.Height; y++)
+ {
+ for (var x = 0; x < qRCodeMatrix.bits.Width; x++)
+ {
+ var point = (x * 4*2) + (y*2 * qrcode.width * 4);
+ qrcode.imagedata.data[point] = qRCodeMatrix.bits.get_Renamed(x,y)?0:0;
+ qrcode.imagedata.data[point+1] = qRCodeMatrix.bits.get_Renamed(x,y)?0:0;
+ qrcode.imagedata.data[point+2] = qRCodeMatrix.bits.get_Renamed(x,y)?255:0;
+ }
+ }*/
+ if(qrcode.debug)
+ ctx.putImageData(qrcode.imagedata, 0, 0);
+
+ var reader = Decoder.decode(qRCodeMatrix.bits);
+ var data = reader.DataByte;
+ var str="";
+ for(var i=0;i minmax[ax][ay][1])
+ minmax[ax][ay][1] = target;
+ }
+ }
+ //minmax[ax][ay][0] = (minmax[ax][ay][0] + minmax[ax][ay][1]) / 2;
+ }
+ }
+ var middle = new Array(numSqrtArea);
+ for (var i3 = 0; i3 < numSqrtArea; i3++)
+ {
+ middle[i3] = new Array(numSqrtArea);
+ }
+ for (var ay = 0; ay < numSqrtArea; ay++)
+ {
+ for (var ax = 0; ax < numSqrtArea; ax++)
+ {
+ middle[ax][ay] = Math.floor((minmax[ax][ay][0] + minmax[ax][ay][1]) / 2);
+ //Console.out.print(middle[ax][ay] + ",");
+ }
+ //Console.out.println("");
+ }
+ //Console.out.println("");
+
+ return middle;
+}
+
+qrcode.grayScaleToBitmap=function(grayScale)
+{
+ var middle = qrcode.getMiddleBrightnessPerArea(grayScale);
+ var sqrtNumArea = middle.length;
+ var areaWidth = Math.floor(qrcode.width / sqrtNumArea);
+ var areaHeight = Math.floor(qrcode.height / sqrtNumArea);
+ var bitmap = new Array(qrcode.height*qrcode.width);
+
+ for (var ay = 0; ay < sqrtNumArea; ay++)
+ {
+ for (var ax = 0; ax < sqrtNumArea; ax++)
+ {
+ for (var dy = 0; dy < areaHeight; dy++)
+ {
+ for (var dx = 0; dx < areaWidth; dx++)
+ {
+ bitmap[areaWidth * ax + dx+ (areaHeight * ay + dy)*qrcode.width] = (grayScale[areaWidth * ax + dx+ (areaHeight * ay + dy)*qrcode.width] < middle[ax][ay])?true:false;
+ }
+ }
+ }
+ }
+ return bitmap;
+}
+
+qrcode.grayscale = function(){
+ var ret = new Array(qrcode.width*qrcode.height);
+ for (var y = 0; y < qrcode.height; y++)
+ {
+ for (var x = 0; x < qrcode.width; x++)
+ {
+ var gray = qrcode.getPixel(x, y);
+
+ ret[x+y*qrcode.width] = gray;
+ }
+ }
+ return ret;
+}
+
+
+
+
+function URShift( number, bits)
+{
+ if (number >= 0)
+ return number >> bits;
+ else
+ return (number >> bits) + (2 << ~bits);
+}
+
+
+Array.prototype.remove = function(from, to) {
+ var rest = this.slice((to || from) + 1 || this.length);
+ this.length = from < 0 ? this.length + from : from;
+ return this.push.apply(this, rest);
+};
+
+/*
+ Ported to JavaScript by Lazar Laszlo 2011
+
+ lazarsoft@gmail.com, www.lazarsoft.info
+
+*/
+
+/*
+*
+* Copyright 2007 ZXing authors
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+var MIN_SKIP = 3;
+var MAX_MODULES = 57;
+var INTEGER_MATH_SHIFT = 8;
+var CENTER_QUORUM = 2;
+
+qrcode.orderBestPatterns=function(patterns)
+ {
+
+ function distance( pattern1, pattern2)
+ {
+ xDiff = pattern1.X - pattern2.X;
+ yDiff = pattern1.Y - pattern2.Y;
+ return Math.sqrt( (xDiff * xDiff + yDiff * yDiff));
+ }
+
+ /// Returns the z component of the cross product between vectors BC and BA.
+ function crossProductZ( pointA, pointB, pointC)
+ {
+ var bX = pointB.x;
+ var bY = pointB.y;
+ return ((pointC.x - bX) * (pointA.y - bY)) - ((pointC.y - bY) * (pointA.x - bX));
+ }
+
+
+ // Find distances between pattern centers
+ var zeroOneDistance = distance(patterns[0], patterns[1]);
+ var oneTwoDistance = distance(patterns[1], patterns[2]);
+ var zeroTwoDistance = distance(patterns[0], patterns[2]);
+
+ var pointA, pointB, pointC;
+ // Assume one closest to other two is B; A and C will just be guesses at first
+ if (oneTwoDistance >= zeroOneDistance && oneTwoDistance >= zeroTwoDistance)
+ {
+ pointB = patterns[0];
+ pointA = patterns[1];
+ pointC = patterns[2];
+ }
+ else if (zeroTwoDistance >= oneTwoDistance && zeroTwoDistance >= zeroOneDistance)
+ {
+ pointB = patterns[1];
+ pointA = patterns[0];
+ pointC = patterns[2];
+ }
+ else
+ {
+ pointB = patterns[2];
+ pointA = patterns[0];
+ pointC = patterns[1];
+ }
+
+ // Use cross product to figure out whether A and C are correct or flipped.
+ // This asks whether BC x BA has a positive z component, which is the arrangement
+ // we want for A, B, C. If it's negative, then we've got it flipped around and
+ // should swap A and C.
+ if (crossProductZ(pointA, pointB, pointC) < 0.0)
+ {
+ var temp = pointA;
+ pointA = pointC;
+ pointC = temp;
+ }
+
+ patterns[0] = pointA;
+ patterns[1] = pointB;
+ patterns[2] = pointC;
+ }
+
+
+function FinderPattern(posX, posY, estimatedModuleSize)
+{
+ this.x=posX;
+ this.y=posY;
+ this.count = 1;
+ this.estimatedModuleSize = estimatedModuleSize;
+
+ this.__defineGetter__("EstimatedModuleSize", function()
+ {
+ return this.estimatedModuleSize;
+ });
+ this.__defineGetter__("Count", function()
+ {
+ return this.count;
+ });
+ this.__defineGetter__("X", function()
+ {
+ return this.x;
+ });
+ this.__defineGetter__("Y", function()
+ {
+ return this.y;
+ });
+ this.incrementCount = function()
+ {
+ this.count++;
+ }
+ this.aboutEquals=function( moduleSize, i, j)
+ {
+ if (Math.abs(i - this.y) <= moduleSize && Math.abs(j - this.x) <= moduleSize)
+ {
+ var moduleSizeDiff = Math.abs(moduleSize - this.estimatedModuleSize);
+ return moduleSizeDiff <= 1.0 || moduleSizeDiff / this.estimatedModuleSize <= 1.0;
+ }
+ return false;
+ }
+
+}
+
+function FinderPatternInfo(patternCenters)
+{
+ this.bottomLeft = patternCenters[0];
+ this.topLeft = patternCenters[1];
+ this.topRight = patternCenters[2];
+ this.__defineGetter__("BottomLeft", function()
+ {
+ return this.bottomLeft;
+ });
+ this.__defineGetter__("TopLeft", function()
+ {
+ return this.topLeft;
+ });
+ this.__defineGetter__("TopRight", function()
+ {
+ return this.topRight;
+ });
+}
+
+function FinderPatternFinder()
+{
+ this.image=null;
+ this.possibleCenters = [];
+ this.hasSkipped = false;
+ this.crossCheckStateCount = new Array(0,0,0,0,0);
+ this.resultPointCallback = null;
+
+ this.__defineGetter__("CrossCheckStateCount", function()
+ {
+ this.crossCheckStateCount[0] = 0;
+ this.crossCheckStateCount[1] = 0;
+ this.crossCheckStateCount[2] = 0;
+ this.crossCheckStateCount[3] = 0;
+ this.crossCheckStateCount[4] = 0;
+ return this.crossCheckStateCount;
+ });
+
+ this.foundPatternCross=function( stateCount)
+ {
+ var totalModuleSize = 0;
+ for (var i = 0; i < 5; i++)
+ {
+ var count = stateCount[i];
+ if (count == 0)
+ {
+ return false;
+ }
+ totalModuleSize += count;
+ }
+ if (totalModuleSize < 7)
+ {
+ return false;
+ }
+ var moduleSize = Math.floor((totalModuleSize << INTEGER_MATH_SHIFT) / 7);
+ var maxVariance = Math.floor(moduleSize / 2);
+ // Allow less than 50% variance from 1-1-3-1-1 proportions
+ return Math.abs(moduleSize - (stateCount[0] << INTEGER_MATH_SHIFT)) < maxVariance && Math.abs(moduleSize - (stateCount[1] << INTEGER_MATH_SHIFT)) < maxVariance && Math.abs(3 * moduleSize - (stateCount[2] << INTEGER_MATH_SHIFT)) < 3 * maxVariance && Math.abs(moduleSize - (stateCount[3] << INTEGER_MATH_SHIFT)) < maxVariance && Math.abs(moduleSize - (stateCount[4] << INTEGER_MATH_SHIFT)) < maxVariance;
+ }
+ this.centerFromEnd=function( stateCount, end)
+ {
+ return (end - stateCount[4] - stateCount[3]) - stateCount[2] / 2.0;
+ }
+ this.crossCheckVertical=function( startI, centerJ, maxCount, originalStateCountTotal)
+ {
+ var image = this.image;
+
+ var maxI = qrcode.height;
+ var stateCount = this.CrossCheckStateCount;
+
+ // Start counting up from center
+ var i = startI;
+ while (i >= 0 && image[centerJ + i*qrcode.width])
+ {
+ stateCount[2]++;
+ i--;
+ }
+ if (i < 0)
+ {
+ return NaN;
+ }
+ while (i >= 0 && !image[centerJ +i*qrcode.width] && stateCount[1] <= maxCount)
+ {
+ stateCount[1]++;
+ i--;
+ }
+ // If already too many modules in this state or ran off the edge:
+ if (i < 0 || stateCount[1] > maxCount)
+ {
+ return NaN;
+ }
+ while (i >= 0 && image[centerJ + i*qrcode.width] && stateCount[0] <= maxCount)
+ {
+ stateCount[0]++;
+ i--;
+ }
+ if (stateCount[0] > maxCount)
+ {
+ return NaN;
+ }
+
+ // Now also count down from center
+ i = startI + 1;
+ while (i < maxI && image[centerJ +i*qrcode.width])
+ {
+ stateCount[2]++;
+ i++;
+ }
+ if (i == maxI)
+ {
+ return NaN;
+ }
+ while (i < maxI && !image[centerJ + i*qrcode.width] && stateCount[3] < maxCount)
+ {
+ stateCount[3]++;
+ i++;
+ }
+ if (i == maxI || stateCount[3] >= maxCount)
+ {
+ return NaN;
+ }
+ while (i < maxI && image[centerJ + i*qrcode.width] && stateCount[4] < maxCount)
+ {
+ stateCount[4]++;
+ i++;
+ }
+ if (stateCount[4] >= maxCount)
+ {
+ return NaN;
+ }
+
+ // If we found a finder-pattern-like section, but its size is more than 40% different than
+ // the original, assume it's a false positive
+ var stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];
+ if (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= 2 * originalStateCountTotal)
+ {
+ return NaN;
+ }
+
+ return this.foundPatternCross(stateCount)?this.centerFromEnd(stateCount, i):NaN;
+ }
+ this.crossCheckHorizontal=function( startJ, centerI, maxCount, originalStateCountTotal)
+ {
+ var image = this.image;
+
+ var maxJ = qrcode.width;
+ var stateCount = this.CrossCheckStateCount;
+
+ var j = startJ;
+ while (j >= 0 && image[j+ centerI*qrcode.width])
+ {
+ stateCount[2]++;
+ j--;
+ }
+ if (j < 0)
+ {
+ return NaN;
+ }
+ while (j >= 0 && !image[j+ centerI*qrcode.width] && stateCount[1] <= maxCount)
+ {
+ stateCount[1]++;
+ j--;
+ }
+ if (j < 0 || stateCount[1] > maxCount)
+ {
+ return NaN;
+ }
+ while (j >= 0 && image[j+ centerI*qrcode.width] && stateCount[0] <= maxCount)
+ {
+ stateCount[0]++;
+ j--;
+ }
+ if (stateCount[0] > maxCount)
+ {
+ return NaN;
+ }
+
+ j = startJ + 1;
+ while (j < maxJ && image[j+ centerI*qrcode.width])
+ {
+ stateCount[2]++;
+ j++;
+ }
+ if (j == maxJ)
+ {
+ return NaN;
+ }
+ while (j < maxJ && !image[j+ centerI*qrcode.width] && stateCount[3] < maxCount)
+ {
+ stateCount[3]++;
+ j++;
+ }
+ if (j == maxJ || stateCount[3] >= maxCount)
+ {
+ return NaN;
+ }
+ while (j < maxJ && image[j+ centerI*qrcode.width] && stateCount[4] < maxCount)
+ {
+ stateCount[4]++;
+ j++;
+ }
+ if (stateCount[4] >= maxCount)
+ {
+ return NaN;
+ }
+
+ // If we found a finder-pattern-like section, but its size is significantly different than
+ // the original, assume it's a false positive
+ var stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];
+ if (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= originalStateCountTotal)
+ {
+ return NaN;
+ }
+
+ return this.foundPatternCross(stateCount)?this.centerFromEnd(stateCount, j):NaN;
+ }
+ this.handlePossibleCenter=function( stateCount, i, j)
+ {
+ var stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];
+ var centerJ = this.centerFromEnd(stateCount, j); //float
+ var centerI = this.crossCheckVertical(i, Math.floor( centerJ), stateCount[2], stateCountTotal); //float
+ if (!isNaN(centerI))
+ {
+ // Re-cross check
+ centerJ = this.crossCheckHorizontal(Math.floor( centerJ), Math.floor( centerI), stateCount[2], stateCountTotal);
+ if (!isNaN(centerJ))
+ {
+ var estimatedModuleSize = stateCountTotal / 7.0;
+ var found = false;
+ var max = this.possibleCenters.length;
+ for (var index = 0; index < max; index++)
+ {
+ var center = this.possibleCenters[index];
+ // Look for about the same center and module size:
+ if (center.aboutEquals(estimatedModuleSize, centerI, centerJ))
+ {
+ center.incrementCount();
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ var point = new FinderPattern(centerJ, centerI, estimatedModuleSize);
+ this.possibleCenters.push(point);
+ if (this.resultPointCallback != null)
+ {
+ this.resultPointCallback.foundPossibleResultPoint(point);
+ }
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ this.selectBestPatterns=function()
+ {
+
+ var startSize = this.possibleCenters.length;
+ if (startSize < 3)
+ {
+ // Couldn't find enough finder patterns
+ throw "Couldn't find enough finder patterns";
+ }
+
+ // Filter outlier possibilities whose module size is too different
+ if (startSize > 3)
+ {
+ // But we can only afford to do so if we have at least 4 possibilities to choose from
+ var totalModuleSize = 0.0;
+ var square = 0.0;
+ for (var i = 0; i < startSize; i++)
+ {
+ //totalModuleSize += this.possibleCenters[i].EstimatedModuleSize;
+ var centerValue=this.possibleCenters[i].EstimatedModuleSize;
+ totalModuleSize += centerValue;
+ square += (centerValue * centerValue);
+ }
+ var average = totalModuleSize / startSize;
+ this.possibleCenters.sort(function(center1,center2) {
+ var dA=Math.abs(center2.EstimatedModuleSize - average);
+ var dB=Math.abs(center1.EstimatedModuleSize - average);
+ if (dA < dB) {
+ return (-1);
+ } else if (dA == dB) {
+ return 0;
+ } else {
+ return 1;
+ }
+ });
+
+ var stdDev = Math.sqrt(square / startSize - average * average);
+ var limit = Math.max(0.2 * average, stdDev);
+ for (var i = 0; i < this.possibleCenters.length && this.possibleCenters.length > 3; i++)
+ {
+ var pattern = this.possibleCenters[i];
+ //if (Math.abs(pattern.EstimatedModuleSize - average) > 0.2 * average)
+ if (Math.abs(pattern.EstimatedModuleSize - average) > limit)
+ {
+ this.possibleCenters.remove(i);
+ i--;
+ }
+ }
+ }
+
+ if (this.possibleCenters.length > 3)
+ {
+ // Throw away all but those first size candidate points we found.
+ this.possibleCenters.sort(function(a, b){
+ if (a.count > b.count){return -1;}
+ if (a.count < b.count){return 1;}
+ return 0;
+ });
+ }
+
+ return new Array( this.possibleCenters[0], this.possibleCenters[1], this.possibleCenters[2]);
+ }
+
+ this.findRowSkip=function()
+ {
+ var max = this.possibleCenters.length;
+ if (max <= 1)
+ {
+ return 0;
+ }
+ var firstConfirmedCenter = null;
+ for (var i = 0; i < max; i++)
+ {
+ var center = this.possibleCenters[i];
+ if (center.Count >= CENTER_QUORUM)
+ {
+ if (firstConfirmedCenter == null)
+ {
+ firstConfirmedCenter = center;
+ }
+ else
+ {
+ // We have two confirmed centers
+ // How far down can we skip before resuming looking for the next
+ // pattern? In the worst case, only the difference between the
+ // difference in the x / y coordinates of the two centers.
+ // This is the case where you find top left last.
+ this.hasSkipped = true;
+ return Math.floor ((Math.abs(firstConfirmedCenter.X - center.X) - Math.abs(firstConfirmedCenter.Y - center.Y)) / 2);
+ }
+ }
+ }
+ return 0;
+ }
+
+ this.haveMultiplyConfirmedCenters=function()
+ {
+ var confirmedCount = 0;
+ var totalModuleSize = 0.0;
+ var max = this.possibleCenters.length;
+ for (var i = 0; i < max; i++)
+ {
+ var pattern = this.possibleCenters[i];
+ if (pattern.Count >= CENTER_QUORUM)
+ {
+ confirmedCount++;
+ totalModuleSize += pattern.EstimatedModuleSize;
+ }
+ }
+ if (confirmedCount < 3)
+ {
+ return false;
+ }
+ // OK, we have at least 3 confirmed centers, but, it's possible that one is a "false positive"
+ // and that we need to keep looking. We detect this by asking if the estimated module sizes
+ // vary too much. We arbitrarily say that when the total deviation from average exceeds
+ // 5% of the total module size estimates, it's too much.
+ var average = totalModuleSize / max;
+ var totalDeviation = 0.0;
+ for (var i = 0; i < max; i++)
+ {
+ pattern = this.possibleCenters[i];
+ totalDeviation += Math.abs(pattern.EstimatedModuleSize - average);
+ }
+ return totalDeviation <= 0.05 * totalModuleSize;
+ }
+
+ this.findFinderPattern = function(image){
+ var tryHarder = false;
+ this.image=image;
+ var maxI = qrcode.height;
+ var maxJ = qrcode.width;
+ var iSkip = Math.floor((3 * maxI) / (4 * MAX_MODULES));
+ if (iSkip < MIN_SKIP || tryHarder)
+ {
+ iSkip = MIN_SKIP;
+ }
+
+ var done = false;
+ var stateCount = new Array(5);
+ for (var i = iSkip - 1; i < maxI && !done; i += iSkip)
+ {
+ // Get a row of black/white values
+ stateCount[0] = 0;
+ stateCount[1] = 0;
+ stateCount[2] = 0;
+ stateCount[3] = 0;
+ stateCount[4] = 0;
+ var currentState = 0;
+ for (var j = 0; j < maxJ; j++)
+ {
+ if (image[j+i*qrcode.width] )
+ {
+ // Black pixel
+ if ((currentState & 1) == 1)
+ {
+ // Counting white pixels
+ currentState++;
+ }
+ stateCount[currentState]++;
+ }
+ else
+ {
+ // White pixel
+ if ((currentState & 1) == 0)
+ {
+ // Counting black pixels
+ if (currentState == 4)
+ {
+ // A winner?
+ if (this.foundPatternCross(stateCount))
+ {
+ // Yes
+ var confirmed = this.handlePossibleCenter(stateCount, i, j);
+ if (confirmed)
+ {
+ // Start examining every other line. Checking each line turned out to be too
+ // expensive and didn't improve performance.
+ iSkip = 2;
+ if (this.hasSkipped)
+ {
+ done = this.haveMultiplyConfirmedCenters();
+ }
+ else
+ {
+ var rowSkip = this.findRowSkip();
+ if (rowSkip > stateCount[2])
+ {
+ // Skip rows between row of lower confirmed center
+ // and top of presumed third confirmed center
+ // but back up a bit to get a full chance of detecting
+ // it, entire width of center of finder pattern
+
+ // Skip by rowSkip, but back off by stateCount[2] (size of last center
+ // of pattern we saw) to be conservative, and also back off by iSkip which
+ // is about to be re-added
+ i += rowSkip - stateCount[2] - iSkip;
+ j = maxJ - 1;
+ }
+ }
+ }
+ else
+ {
+ // Advance to next black pixel
+ do
+ {
+ j++;
+ }
+ while (j < maxJ && !image[j + i*qrcode.width]);
+ j--; // back up to that last white pixel
+ }
+ // Clear state to start looking again
+ currentState = 0;
+ stateCount[0] = 0;
+ stateCount[1] = 0;
+ stateCount[2] = 0;
+ stateCount[3] = 0;
+ stateCount[4] = 0;
+ }
+ else
+ {
+ // No, shift counts back by two
+ stateCount[0] = stateCount[2];
+ stateCount[1] = stateCount[3];
+ stateCount[2] = stateCount[4];
+ stateCount[3] = 1;
+ stateCount[4] = 0;
+ currentState = 3;
+ }
+ }
+ else
+ {
+ stateCount[++currentState]++;
+ }
+ }
+ else
+ {
+ // Counting white pixels
+ stateCount[currentState]++;
+ }
+ }
+ }
+ if (this.foundPatternCross(stateCount))
+ {
+ var confirmed = this.handlePossibleCenter(stateCount, i, maxJ);
+ if (confirmed)
+ {
+ iSkip = stateCount[0];
+ if (this.hasSkipped)
+ {
+ // Found a third one
+ done = haveMultiplyConfirmedCenters();
+ }
+ }
+ }
+ }
+
+ var patternInfo = this.selectBestPatterns();
+ qrcode.orderBestPatterns(patternInfo);
+
+ return new FinderPatternInfo(patternInfo);
+ };
+}
+
+/*
+ Ported to JavaScript by Lazar Laszlo 2011
+
+ lazarsoft@gmail.com, www.lazarsoft.info
+
+*/
+
+/*
+*
+* Copyright 2007 ZXing authors
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+function AlignmentPattern(posX, posY, estimatedModuleSize)
+{
+ this.x=posX;
+ this.y=posY;
+ this.count = 1;
+ this.estimatedModuleSize = estimatedModuleSize;
+
+ this.__defineGetter__("EstimatedModuleSize", function()
+ {
+ return this.estimatedModuleSize;
+ });
+ this.__defineGetter__("Count", function()
+ {
+ return this.count;
+ });
+ this.__defineGetter__("X", function()
+ {
+ return Math.floor(this.x);
+ });
+ this.__defineGetter__("Y", function()
+ {
+ return Math.floor(this.y);
+ });
+ this.incrementCount = function()
+ {
+ this.count++;
+ }
+ this.aboutEquals=function( moduleSize, i, j)
+ {
+ if (Math.abs(i - this.y) <= moduleSize && Math.abs(j - this.x) <= moduleSize)
+ {
+ var moduleSizeDiff = Math.abs(moduleSize - this.estimatedModuleSize);
+ return moduleSizeDiff <= 1.0 || moduleSizeDiff / this.estimatedModuleSize <= 1.0;
+ }
+ return false;
+ }
+
+}
+
+function AlignmentPatternFinder( image, startX, startY, width, height, moduleSize, resultPointCallback)
+{
+ this.image = image;
+ this.possibleCenters = new Array();
+ this.startX = startX;
+ this.startY = startY;
+ this.width = width;
+ this.height = height;
+ this.moduleSize = moduleSize;
+ this.crossCheckStateCount = new Array(0,0,0);
+ this.resultPointCallback = resultPointCallback;
+
+ this.centerFromEnd=function(stateCount, end)
+ {
+ return (end - stateCount[2]) - stateCount[1] / 2.0;
+ }
+ this.foundPatternCross = function(stateCount)
+ {
+ var moduleSize = this.moduleSize;
+ var maxVariance = moduleSize / 2.0;
+ for (var i = 0; i < 3; i++)
+ {
+ if (Math.abs(moduleSize - stateCount[i]) >= maxVariance)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ this.crossCheckVertical=function( startI, centerJ, maxCount, originalStateCountTotal)
+ {
+ var image = this.image;
+
+ var maxI = qrcode.height;
+ var stateCount = this.crossCheckStateCount;
+ stateCount[0] = 0;
+ stateCount[1] = 0;
+ stateCount[2] = 0;
+
+ // Start counting up from center
+ var i = startI;
+ while (i >= 0 && image[centerJ + i*qrcode.width] && stateCount[1] <= maxCount)
+ {
+ stateCount[1]++;
+ i--;
+ }
+ // If already too many modules in this state or ran off the edge:
+ if (i < 0 || stateCount[1] > maxCount)
+ {
+ return NaN;
+ }
+ while (i >= 0 && !image[centerJ + i*qrcode.width] && stateCount[0] <= maxCount)
+ {
+ stateCount[0]++;
+ i--;
+ }
+ if (stateCount[0] > maxCount)
+ {
+ return NaN;
+ }
+
+ // Now also count down from center
+ i = startI + 1;
+ while (i < maxI && image[centerJ + i*qrcode.width] && stateCount[1] <= maxCount)
+ {
+ stateCount[1]++;
+ i++;
+ }
+ if (i == maxI || stateCount[1] > maxCount)
+ {
+ return NaN;
+ }
+ while (i < maxI && !image[centerJ + i*qrcode.width] && stateCount[2] <= maxCount)
+ {
+ stateCount[2]++;
+ i++;
+ }
+ if (stateCount[2] > maxCount)
+ {
+ return NaN;
+ }
+
+ var stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2];
+ if (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= 2 * originalStateCountTotal)
+ {
+ return NaN;
+ }
+
+ return this.foundPatternCross(stateCount)?this.centerFromEnd(stateCount, i):NaN;
+ }
+
+ this.handlePossibleCenter=function( stateCount, i, j)
+ {
+ var stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2];
+ var centerJ = this.centerFromEnd(stateCount, j);
+ var centerI = this.crossCheckVertical(i, Math.floor (centerJ), 2 * stateCount[1], stateCountTotal);
+ if (!isNaN(centerI))
+ {
+ var estimatedModuleSize = (stateCount[0] + stateCount[1] + stateCount[2]) / 3.0;
+ var max = this.possibleCenters.length;
+ for (var index = 0; index < max; index++)
+ {
+ var center = this.possibleCenters[index];
+ // Look for about the same center and module size:
+ if (center.aboutEquals(estimatedModuleSize, centerI, centerJ))
+ {
+ return new AlignmentPattern(centerJ, centerI, estimatedModuleSize);
+ }
+ }
+ // Hadn't found this before; save it
+ var point = new AlignmentPattern(centerJ, centerI, estimatedModuleSize);
+ this.possibleCenters.push(point);
+ if (this.resultPointCallback != null)
+ {
+ this.resultPointCallback.foundPossibleResultPoint(point);
+ }
+ }
+ return null;
+ }
+
+ this.find = function()
+ {
+ var startX = this.startX;
+ var height = this.height;
+ var maxJ = startX + width;
+ var middleI = startY + (height >> 1);
+ // We are looking for black/white/black modules in 1:1:1 ratio;
+ // this tracks the number of black/white/black modules seen so far
+ var stateCount = new Array(0,0,0);
+ for (var iGen = 0; iGen < height; iGen++)
+ {
+ // Search from middle outwards
+ var i = middleI + ((iGen & 0x01) == 0?((iGen + 1) >> 1):- ((iGen + 1) >> 1));
+ stateCount[0] = 0;
+ stateCount[1] = 0;
+ stateCount[2] = 0;
+ var j = startX;
+ // Burn off leading white pixels before anything else; if we start in the middle of
+ // a white run, it doesn't make sense to count its length, since we don't know if the
+ // white run continued to the left of the start point
+ while (j < maxJ && !image[j + qrcode.width* i])
+ {
+ j++;
+ }
+ var currentState = 0;
+ while (j < maxJ)
+ {
+ if (image[j + i*qrcode.width])
+ {
+ // Black pixel
+ if (currentState == 1)
+ {
+ // Counting black pixels
+ stateCount[currentState]++;
+ }
+ else
+ {
+ // Counting white pixels
+ if (currentState == 2)
+ {
+ // A winner?
+ if (this.foundPatternCross(stateCount))
+ {
+ // Yes
+ var confirmed = this.handlePossibleCenter(stateCount, i, j);
+ if (confirmed != null)
+ {
+ return confirmed;
+ }
+ }
+ stateCount[0] = stateCount[2];
+ stateCount[1] = 1;
+ stateCount[2] = 0;
+ currentState = 1;
+ }
+ else
+ {
+ stateCount[++currentState]++;
+ }
+ }
+ }
+ else
+ {
+ // White pixel
+ if (currentState == 1)
+ {
+ // Counting black pixels
+ currentState++;
+ }
+ stateCount[currentState]++;
+ }
+ j++;
+ }
+ if (this.foundPatternCross(stateCount))
+ {
+ var confirmed = this.handlePossibleCenter(stateCount, i, maxJ);
+ if (confirmed != null)
+ {
+ return confirmed;
+ }
+ }
+ }
+
+ // Hmm, nothing we saw was observed and confirmed twice. If we had
+ // any guess at all, return it.
+ if (!(this.possibleCenters.length == 0))
+ {
+ return this.possibleCenters[0];
+ }
+
+ throw "Couldn't find enough alignment patterns";
+ }
+
+}
+/*
+ Ported to JavaScript by Lazar Laszlo 2011
+
+ lazarsoft@gmail.com, www.lazarsoft.info
+
+*/
+
+/*
+*
+* Copyright 2007 ZXing authors
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+function QRCodeDataBlockReader(blocks, version, numErrorCorrectionCode)
+{
+ this.blockPointer = 0;
+ this.bitPointer = 7;
+ this.dataLength = 0;
+ this.blocks = blocks;
+ this.numErrorCorrectionCode = numErrorCorrectionCode;
+ if (version <= 9)
+ this.dataLengthMode = 0;
+ else if (version >= 10 && version <= 26)
+ this.dataLengthMode = 1;
+ else if (version >= 27 && version <= 40)
+ this.dataLengthMode = 2;
+
+ this.getNextBits = function( numBits)
+ {
+ var bits = 0;
+ if (numBits < this.bitPointer + 1)
+ {
+ // next word fits into current data block
+ var mask = 0;
+ for (var i = 0; i < numBits; i++)
+ {
+ mask += (1 << i);
+ }
+ mask <<= (this.bitPointer - numBits + 1);
+
+ bits = (this.blocks[this.blockPointer] & mask) >> (this.bitPointer - numBits + 1);
+ this.bitPointer -= numBits;
+ return bits;
+ }
+ else if (numBits < this.bitPointer + 1 + 8)
+ {
+ // next word crosses 2 data blocks
+ var mask1 = 0;
+ for (var i = 0; i < this.bitPointer + 1; i++)
+ {
+ mask1 += (1 << i);
+ }
+ bits = (this.blocks[this.blockPointer] & mask1) << (numBits - (this.bitPointer + 1));
+ this.blockPointer++;
+ bits += ((this.blocks[this.blockPointer]) >> (8 - (numBits - (this.bitPointer + 1))));
+
+ this.bitPointer = this.bitPointer - numBits % 8;
+ if (this.bitPointer < 0)
+ {
+ this.bitPointer = 8 + this.bitPointer;
+ }
+ return bits;
+ }
+ else if (numBits < this.bitPointer + 1 + 16)
+ {
+ // next word crosses 3 data blocks
+ var mask1 = 0; // mask of first block
+ var mask3 = 0; // mask of 3rd block
+ //bitPointer + 1 : number of bits of the 1st block
+ //8 : number of the 2nd block (note that use already 8bits because next word uses 3 data blocks)
+ //numBits - (bitPointer + 1 + 8) : number of bits of the 3rd block
+ for (var i = 0; i < this.bitPointer + 1; i++)
+ {
+ mask1 += (1 << i);
+ }
+ var bitsFirstBlock = (this.blocks[this.blockPointer] & mask1) << (numBits - (this.bitPointer + 1));
+ this.blockPointer++;
+
+ var bitsSecondBlock = this.blocks[this.blockPointer] << (numBits - (this.bitPointer + 1 + 8));
+ this.blockPointer++;
+
+ for (var i = 0; i < numBits - (this.bitPointer + 1 + 8); i++)
+ {
+ mask3 += (1 << i);
+ }
+ mask3 <<= 8 - (numBits - (this.bitPointer + 1 + 8));
+ var bitsThirdBlock = (this.blocks[this.blockPointer] & mask3) >> (8 - (numBits - (this.bitPointer + 1 + 8)));
+
+ bits = bitsFirstBlock + bitsSecondBlock + bitsThirdBlock;
+ this.bitPointer = this.bitPointer - (numBits - 8) % 8;
+ if (this.bitPointer < 0)
+ {
+ this.bitPointer = 8 + this.bitPointer;
+ }
+ return bits;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ this.NextMode=function()
+ {
+ if ((this.blockPointer > this.blocks.length - this.numErrorCorrectionCode - 2))
+ return 0;
+ else
+ return this.getNextBits(4);
+ }
+ this.getDataLength=function( modeIndicator)
+ {
+ var index = 0;
+ while (true)
+ {
+ if ((modeIndicator >> index) == 1)
+ break;
+ index++;
+ }
+
+ return this.getNextBits(qrcode.sizeOfDataLengthInfo[this.dataLengthMode][index]);
+ }
+ this.getRomanAndFigureString=function( dataLength)
+ {
+ var length = dataLength;
+ var intData = 0;
+ var strData = "";
+ var tableRomanAndFigure = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', '$', '%', '*', '+', '-', '.', '/', ':');
+ do
+ {
+ if (length > 1)
+ {
+ intData = this.getNextBits(11);
+ var firstLetter = Math.floor(intData / 45);
+ var secondLetter = intData % 45;
+ strData += tableRomanAndFigure[firstLetter];
+ strData += tableRomanAndFigure[secondLetter];
+ length -= 2;
+ }
+ else if (length == 1)
+ {
+ intData = this.getNextBits(6);
+ strData += tableRomanAndFigure[intData];
+ length -= 1;
+ }
+ }
+ while (length > 0);
+
+ return strData;
+ }
+ this.getFigureString=function( dataLength)
+ {
+ var length = dataLength;
+ var intData = 0;
+ var strData = "";
+ do
+ {
+ if (length >= 3)
+ {
+ intData = this.getNextBits(10);
+ if (intData < 100)
+ strData += "0";
+ if (intData < 10)
+ strData += "0";
+ length -= 3;
+ }
+ else if (length == 2)
+ {
+ intData = this.getNextBits(7);
+ if (intData < 10)
+ strData += "0";
+ length -= 2;
+ }
+ else if (length == 1)
+ {
+ intData = this.getNextBits(4);
+ length -= 1;
+ }
+ strData += intData;
+ }
+ while (length > 0);
+
+ return strData;
+ }
+ this.get8bitByteArray=function( dataLength)
+ {
+ var length = dataLength;
+ var intData = 0;
+ var output = new Array();
+
+ do
+ {
+ intData = this.getNextBits(8);
+ output.push( intData);
+ length--;
+ }
+ while (length > 0);
+ return output;
+ }
+ this.getKanjiString=function( dataLength)
+ {
+ var length = dataLength;
+ var intData = 0;
+ var unicodeString = "";
+ do
+ {
+ intData = getNextBits(13);
+ var lowerByte = intData % 0xC0;
+ var higherByte = intData / 0xC0;
+
+ var tempWord = (higherByte << 8) + lowerByte;
+ var shiftjisWord = 0;
+ if (tempWord + 0x8140 <= 0x9FFC)
+ {
+ // between 8140 - 9FFC on Shift_JIS character set
+ shiftjisWord = tempWord + 0x8140;
+ }
+ else
+ {
+ // between E040 - EBBF on Shift_JIS character set
+ shiftjisWord = tempWord + 0xC140;
+ }
+
+ //var tempByte = new Array(0,0);
+ //tempByte[0] = (sbyte) (shiftjisWord >> 8);
+ //tempByte[1] = (sbyte) (shiftjisWord & 0xFF);
+ //unicodeString += new String(SystemUtils.ToCharArray(SystemUtils.ToByteArray(tempByte)));
+ unicodeString += String.fromCharCode(shiftjisWord);
+ length--;
+ }
+ while (length > 0);
+
+
+ return unicodeString;
+ }
+
+ this.__defineGetter__("DataByte", function()
+ {
+ var output = new Array();
+ var MODE_NUMBER = 1;
+ var MODE_ROMAN_AND_NUMBER = 2;
+ var MODE_8BIT_BYTE = 4;
+ var MODE_KANJI = 8;
+ do
+ {
+ var mode = this.NextMode();
+ //canvas.println("mode: " + mode);
+ if (mode == 0)
+ {
+ if (output.length > 0)
+ break;
+ else
+ throw "Empty data block";
+ }
+ //if (mode != 1 && mode != 2 && mode != 4 && mode != 8)
+ // break;
+ //}
+ if (mode != MODE_NUMBER && mode != MODE_ROMAN_AND_NUMBER && mode != MODE_8BIT_BYTE && mode != MODE_KANJI)
+ {
+ /* canvas.println("Invalid mode: " + mode);
+ mode = guessMode(mode);
+ canvas.println("Guessed mode: " + mode); */
+ throw "Invalid mode: " + mode + " in (block:" + this.blockPointer + " bit:" + this.bitPointer + ")";
+ }
+ dataLength = this.getDataLength(mode);
+ if (dataLength < 1)
+ throw "Invalid data length: " + dataLength;
+ //canvas.println("length: " + dataLength);
+ switch (mode)
+ {
+
+ case MODE_NUMBER:
+ //canvas.println("Mode: Figure");
+ var temp_str = this.getFigureString(dataLength);
+ var ta = new Array(temp_str.length);
+ for(var j=0;j width || y < - 1 || y > height)\n\t\t\t\t{\n\t\t\t\t\tthrow \"Error.checkAndNudgePoints \";\n\t\t\t\t}\n\t\t\t\tnudged = false;\n\t\t\t\tif (x == - 1)\n\t\t\t\t{\n\t\t\t\t\tpoints[offset] = 0.0;\n\t\t\t\t\tnudged = true;\n\t\t\t\t}\n\t\t\t\telse if (x == width)\n\t\t\t\t{\n\t\t\t\t\tpoints[offset] = width - 1;\n\t\t\t\t\tnudged = true;\n\t\t\t\t}\n\t\t\t\tif (y == - 1)\n\t\t\t\t{\n\t\t\t\t\tpoints[offset + 1] = 0.0;\n\t\t\t\t\tnudged = true;\n\t\t\t\t}\n\t\t\t\telse if (y == height)\n\t\t\t\t{\n\t\t\t\t\tpoints[offset + 1] = height - 1;\n\t\t\t\t\tnudged = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Check and nudge points from end:\n\t\t\tnudged = true;\n\t\t\tfor (var offset = points.length - 2; offset >= 0 && nudged; offset -= 2)\n\t\t\t{\n\t\t\t\tvar x = Math.floor( points[offset]);\n\t\t\t\tvar y = Math.floor( points[offset + 1]);\n\t\t\t\tif (x < - 1 || x > width || y < - 1 || y > height)\n\t\t\t\t{\n\t\t\t\t\tthrow \"Error.checkAndNudgePoints \";\n\t\t\t\t}\n\t\t\t\tnudged = false;\n\t\t\t\tif (x == - 1)\n\t\t\t\t{\n\t\t\t\t\tpoints[offset] = 0.0;\n\t\t\t\t\tnudged = true;\n\t\t\t\t}\n\t\t\t\telse if (x == width)\n\t\t\t\t{\n\t\t\t\t\tpoints[offset] = width - 1;\n\t\t\t\t\tnudged = true;\n\t\t\t\t}\n\t\t\t\tif (y == - 1)\n\t\t\t\t{\n\t\t\t\t\tpoints[offset + 1] = 0.0;\n\t\t\t\t\tnudged = true;\n\t\t\t\t}\n\t\t\t\telse if (y == height)\n\t\t\t\t{\n\t\t\t\t\tpoints[offset + 1] = height - 1;\n\t\t\t\t\tnudged = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\n\nGridSampler.sampleGrid3=function( image, dimension, transform)\n\t\t{\n\t\t\tvar bits = new BitMatrix(dimension);\n\t\t\tvar points = new Array(dimension << 1);\n\t\t\tfor (var y = 0; y < dimension; y++)\n\t\t\t{\n\t\t\t\tvar max = points.length;\n\t\t\t\tvar iValue = y + 0.5;\n\t\t\t\tfor (var x = 0; x < max; x += 2)\n\t\t\t\t{\n\t\t\t\t\tpoints[x] = (x >> 1) + 0.5;\n\t\t\t\t\tpoints[x + 1] = iValue;\n\t\t\t\t}\n\t\t\t\ttransform.transformPoints1(points);\n\t\t\t\t// Quick check to see if points transformed to something inside the image;\n\t\t\t\t// sufficient to check the endpoints\n\t\t\t\tGridSampler.checkAndNudgePoints(image, points);\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tfor (var x = 0; x < max; x += 2)\n\t\t\t\t\t{\n\t\t\t\t\t\tvar xpoint = (Math.floor( points[x]) * 4) + (Math.floor( points[x + 1]) * qrcode.width * 4);\n var bit = image[Math.floor( points[x])+ qrcode.width* Math.floor( points[x + 1])];\n\t\t\t\t\t\tqrcode.imagedata.data[xpoint] = bit?255:0;\n\t\t\t\t\t\tqrcode.imagedata.data[xpoint+1] = bit?255:0;\n\t\t\t\t\t\tqrcode.imagedata.data[xpoint+2] = 0;\n\t\t\t\t\t\tqrcode.imagedata.data[xpoint+3] = 255;\n\t\t\t\t\t\t//bits[x >> 1][ y]=bit;\n\t\t\t\t\t\tif(bit)\n\t\t\t\t\t\t\tbits.set_Renamed(x >> 1, y);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch ( aioobe)\n\t\t\t\t{\n\t\t\t\t\t// This feels wrong, but, sometimes if the finder patterns are misidentified, the resulting\n\t\t\t\t\t// transform gets \"twisted\" such that it maps a straight line of points to a set of points\n\t\t\t\t\t// whose endpoints are in bounds, but others are not. There is probably some mathematical\n\t\t\t\t\t// way to detect this about the transformation that I don't know yet.\n\t\t\t\t\t// This results in an ugly runtime exception despite our clever checks above -- can't have\n\t\t\t\t\t// that. We could check each point's coordinates but that feels duplicative. We settle for\n\t\t\t\t\t// catching and wrapping ArrayIndexOutOfBoundsException.\n\t\t\t\t\tthrow \"Error.checkAndNudgePoints\";\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn bits;\n\t\t}\n\nGridSampler.sampleGridx=function( image, dimension, p1ToX, p1ToY, p2ToX, p2ToY, p3ToX, p3ToY, p4ToX, p4ToY, p1FromX, p1FromY, p2FromX, p2FromY, p3FromX, p3FromY, p4FromX, p4FromY)\n{\n\tvar transform = PerspectiveTransform.quadrilateralToQuadrilateral(p1ToX, p1ToY, p2ToX, p2ToY, p3ToX, p3ToY, p4ToX, p4ToY, p1FromX, p1FromY, p2FromX, p2FromY, p3FromX, p3FromY, p4FromX, p4FromY);\n\n\treturn GridSampler.sampleGrid3(image, dimension, transform);\n}\n","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\n\r\nfunction ECB(count, dataCodewords)\r\n{\r\n\tthis.count = count;\r\n\tthis.dataCodewords = dataCodewords;\r\n\t\r\n\tthis.__defineGetter__(\"Count\", function()\r\n\t{\r\n\t\treturn this.count;\r\n\t});\r\n\tthis.__defineGetter__(\"DataCodewords\", function()\r\n\t{\r\n\t\treturn this.dataCodewords;\r\n\t});\r\n}\r\n\r\nfunction ECBlocks( ecCodewordsPerBlock, ecBlocks1, ecBlocks2)\r\n{\r\n\tthis.ecCodewordsPerBlock = ecCodewordsPerBlock;\r\n\tif(ecBlocks2)\r\n\t\tthis.ecBlocks = new Array(ecBlocks1, ecBlocks2);\r\n\telse\r\n\t\tthis.ecBlocks = new Array(ecBlocks1);\r\n\t\r\n\tthis.__defineGetter__(\"ECCodewordsPerBlock\", function()\r\n\t{\r\n\t\treturn this.ecCodewordsPerBlock;\r\n\t});\r\n\t\r\n\tthis.__defineGetter__(\"TotalECCodewords\", function()\r\n\t{\r\n\t\treturn this.ecCodewordsPerBlock * this.NumBlocks;\r\n\t});\r\n\t\r\n\tthis.__defineGetter__(\"NumBlocks\", function()\r\n\t{\r\n\t\tvar total = 0;\r\n\t\tfor (var i = 0; i < this.ecBlocks.length; i++)\r\n\t\t{\r\n\t\t\ttotal += this.ecBlocks[i].length;\r\n\t\t}\r\n\t\treturn total;\r\n\t});\r\n\t\r\n\tthis.getECBlocks=function()\r\n\t\t\t{\r\n\t\t\t\treturn this.ecBlocks;\r\n\t\t\t}\r\n}\r\n\r\nfunction Version( versionNumber, alignmentPatternCenters, ecBlocks1, ecBlocks2, ecBlocks3, ecBlocks4)\r\n{\r\n\tthis.versionNumber = versionNumber;\r\n\tthis.alignmentPatternCenters = alignmentPatternCenters;\r\n\tthis.ecBlocks = new Array(ecBlocks1, ecBlocks2, ecBlocks3, ecBlocks4);\r\n\t\r\n\tvar total = 0;\r\n\tvar ecCodewords = ecBlocks1.ECCodewordsPerBlock;\r\n\tvar ecbArray = ecBlocks1.getECBlocks();\r\n\tfor (var i = 0; i < ecbArray.length; i++)\r\n\t{\r\n\t\tvar ecBlock = ecbArray[i];\r\n\t\ttotal += ecBlock.Count * (ecBlock.DataCodewords + ecCodewords);\r\n\t}\r\n\tthis.totalCodewords = total;\r\n\t\r\n\tthis.__defineGetter__(\"VersionNumber\", function()\r\n\t{\r\n\t\treturn this.versionNumber;\r\n\t});\r\n\t\r\n\tthis.__defineGetter__(\"AlignmentPatternCenters\", function()\r\n\t{\r\n\t\treturn this.alignmentPatternCenters;\r\n\t});\r\n\tthis.__defineGetter__(\"TotalCodewords\", function()\r\n\t{\r\n\t\treturn this.totalCodewords;\r\n\t});\r\n\tthis.__defineGetter__(\"DimensionForVersion\", function()\r\n\t{\r\n\t\treturn 17 + 4 * this.versionNumber;\r\n\t});\r\n\t\r\n\tthis.buildFunctionPattern=function()\r\n\t\t{\r\n\t\t\tvar dimension = this.DimensionForVersion;\r\n\t\t\tvar bitMatrix = new BitMatrix(dimension);\r\n\t\t\t\r\n\t\t\t// Top left finder pattern + separator + format\r\n\t\t\tbitMatrix.setRegion(0, 0, 9, 9);\r\n\t\t\t// Top right finder pattern + separator + format\r\n\t\t\tbitMatrix.setRegion(dimension - 8, 0, 8, 9);\r\n\t\t\t// Bottom left finder pattern + separator + format\r\n\t\t\tbitMatrix.setRegion(0, dimension - 8, 9, 8);\r\n\t\t\t\r\n\t\t\t// Alignment patterns\r\n\t\t\tvar max = this.alignmentPatternCenters.length;\r\n\t\t\tfor (var x = 0; x < max; x++)\r\n\t\t\t{\r\n\t\t\t\tvar i = this.alignmentPatternCenters[x] - 2;\r\n\t\t\t\tfor (var y = 0; y < max; y++)\r\n\t\t\t\t{\r\n\t\t\t\t\tif ((x == 0 && (y == 0 || y == max - 1)) || (x == max - 1 && y == 0))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// No alignment patterns near the three finder paterns\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbitMatrix.setRegion(this.alignmentPatternCenters[y] - 2, i, 5, 5);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Vertical timing pattern\r\n\t\t\tbitMatrix.setRegion(6, 9, 1, dimension - 17);\r\n\t\t\t// Horizontal timing pattern\r\n\t\t\tbitMatrix.setRegion(9, 6, dimension - 17, 1);\r\n\t\t\t\r\n\t\t\tif (this.versionNumber > 6)\r\n\t\t\t{\r\n\t\t\t\t// Version info, top right\r\n\t\t\t\tbitMatrix.setRegion(dimension - 11, 0, 3, 6);\r\n\t\t\t\t// Version info, bottom left\r\n\t\t\t\tbitMatrix.setRegion(0, dimension - 11, 6, 3);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn bitMatrix;\r\n\t\t}\r\n\tthis.getECBlocksForLevel=function( ecLevel)\r\n\t{\r\n\t\treturn this.ecBlocks[ecLevel.ordinal()];\r\n\t}\r\n}\r\n\r\nVersion.VERSION_DECODE_INFO = new Array(0x07C94, 0x085BC, 0x09A99, 0x0A4D3, 0x0BBF6, 0x0C762, 0x0D847, 0x0E60D, 0x0F928, 0x10B78, 0x1145D, 0x12A17, 0x13532, 0x149A6, 0x15683, 0x168C9, 0x177EC, 0x18EC4, 0x191E1, 0x1AFAB, 0x1B08E, 0x1CC1A, 0x1D33F, 0x1ED75, 0x1F250, 0x209D5, 0x216F0, 0x228BA, 0x2379F, 0x24B0B, 0x2542E, 0x26A64, 0x27541, 0x28C69);\r\n\r\nVersion.VERSIONS = buildVersions();\r\n\r\nVersion.getVersionForNumber=function( versionNumber)\r\n{\r\n\tif (versionNumber < 1 || versionNumber > 40)\r\n\t{\r\n\t\tthrow \"ArgumentException\";\r\n\t}\r\n\treturn Version.VERSIONS[versionNumber - 1];\r\n}\r\n\r\nVersion.getProvisionalVersionForDimension=function(dimension)\r\n{\r\n\tif (dimension % 4 != 1)\r\n\t{\r\n\t\tthrow \"Error getProvisionalVersionForDimension\";\r\n\t}\r\n\ttry\r\n\t{\r\n\t\treturn Version.getVersionForNumber((dimension - 17) >> 2);\r\n\t}\r\n\tcatch ( iae)\r\n\t{\r\n\t\tthrow \"Error getVersionForNumber\";\r\n\t}\r\n}\r\n\r\nVersion.decodeVersionInformation=function( versionBits)\r\n{\r\n\tvar bestDifference = 0xffffffff;\r\n\tvar bestVersion = 0;\r\n\tfor (var i = 0; i < Version.VERSION_DECODE_INFO.length; i++)\r\n\t{\r\n\t\tvar targetVersion = Version.VERSION_DECODE_INFO[i];\r\n\t\t// Do the version info bits match exactly? done.\r\n\t\tif (targetVersion == versionBits)\r\n\t\t{\r\n\t\t\treturn this.getVersionForNumber(i + 7);\r\n\t\t}\r\n\t\t// Otherwise see if this is the closest to a real version info bit string\r\n\t\t// we have seen so far\r\n\t\tvar bitsDifference = FormatInformation.numBitsDiffering(versionBits, targetVersion);\r\n\t\tif (bitsDifference < bestDifference)\r\n\t\t{\r\n\t\t\tbestVersion = i + 7;\r\n\t\t\tbestDifference = bitsDifference;\r\n\t\t}\r\n\t}\r\n\t// We can tolerate up to 3 bits of error since no two version info codewords will\r\n\t// differ in less than 4 bits.\r\n\tif (bestDifference <= 3)\r\n\t{\r\n\t\treturn this.getVersionForNumber(bestVersion);\r\n\t}\r\n\t// If we didn't find a close enough match, fail\r\n\treturn null;\r\n}\r\n\r\nfunction buildVersions()\r\n{\r\n\treturn new Array(new Version(1, new Array(), new ECBlocks(7, new ECB(1, 19)), new ECBlocks(10, new ECB(1, 16)), new ECBlocks(13, new ECB(1, 13)), new ECBlocks(17, new ECB(1, 9))), \r\n\tnew Version(2, new Array(6, 18), new ECBlocks(10, new ECB(1, 34)), new ECBlocks(16, new ECB(1, 28)), new ECBlocks(22, new ECB(1, 22)), new ECBlocks(28, new ECB(1, 16))), \r\n\tnew Version(3, new Array(6, 22), new ECBlocks(15, new ECB(1, 55)), new ECBlocks(26, new ECB(1, 44)), new ECBlocks(18, new ECB(2, 17)), new ECBlocks(22, new ECB(2, 13))), \r\n\tnew Version(4, new Array(6, 26), new ECBlocks(20, new ECB(1, 80)), new ECBlocks(18, new ECB(2, 32)), new ECBlocks(26, new ECB(2, 24)), new ECBlocks(16, new ECB(4, 9))), \r\n\tnew Version(5, new Array(6, 30), new ECBlocks(26, new ECB(1, 108)), new ECBlocks(24, new ECB(2, 43)), new ECBlocks(18, new ECB(2, 15), new ECB(2, 16)), new ECBlocks(22, new ECB(2, 11), new ECB(2, 12))), \r\n\tnew Version(6, new Array(6, 34), new ECBlocks(18, new ECB(2, 68)), new ECBlocks(16, new ECB(4, 27)), new ECBlocks(24, new ECB(4, 19)), new ECBlocks(28, new ECB(4, 15))), \r\n\tnew Version(7, new Array(6, 22, 38), new ECBlocks(20, new ECB(2, 78)), new ECBlocks(18, new ECB(4, 31)), new ECBlocks(18, new ECB(2, 14), new ECB(4, 15)), new ECBlocks(26, new ECB(4, 13), new ECB(1, 14))), \r\n\tnew Version(8, new Array(6, 24, 42), new ECBlocks(24, new ECB(2, 97)), new ECBlocks(22, new ECB(2, 38), new ECB(2, 39)), new ECBlocks(22, new ECB(4, 18), new ECB(2, 19)), new ECBlocks(26, new ECB(4, 14), new ECB(2, 15))), \r\n\tnew Version(9, new Array(6, 26, 46), new ECBlocks(30, new ECB(2, 116)), new ECBlocks(22, new ECB(3, 36), new ECB(2, 37)), new ECBlocks(20, new ECB(4, 16), new ECB(4, 17)), new ECBlocks(24, new ECB(4, 12), new ECB(4, 13))), \r\n\tnew Version(10, new Array(6, 28, 50), new ECBlocks(18, new ECB(2, 68), new ECB(2, 69)), new ECBlocks(26, new ECB(4, 43), new ECB(1, 44)), new ECBlocks(24, new ECB(6, 19), new ECB(2, 20)), new ECBlocks(28, new ECB(6, 15), new ECB(2, 16))), \r\n\tnew Version(11, new Array(6, 30, 54), new ECBlocks(20, new ECB(4, 81)), new ECBlocks(30, new ECB(1, 50), new ECB(4, 51)), new ECBlocks(28, new ECB(4, 22), new ECB(4, 23)), new ECBlocks(24, new ECB(3, 12), new ECB(8, 13))), \r\n\tnew Version(12, new Array(6, 32, 58), new ECBlocks(24, new ECB(2, 92), new ECB(2, 93)), new ECBlocks(22, new ECB(6, 36), new ECB(2, 37)), new ECBlocks(26, new ECB(4, 20), new ECB(6, 21)), new ECBlocks(28, new ECB(7, 14), new ECB(4, 15))), \r\n\tnew Version(13, new Array(6, 34, 62), new ECBlocks(26, new ECB(4, 107)), new ECBlocks(22, new ECB(8, 37), new ECB(1, 38)), new ECBlocks(24, new ECB(8, 20), new ECB(4, 21)), new ECBlocks(22, new ECB(12, 11), new ECB(4, 12))), \r\n\tnew Version(14, new Array(6, 26, 46, 66), new ECBlocks(30, new ECB(3, 115), new ECB(1, 116)), new ECBlocks(24, new ECB(4, 40), new ECB(5, 41)), new ECBlocks(20, new ECB(11, 16), new ECB(5, 17)), new ECBlocks(24, new ECB(11, 12), new ECB(5, 13))), \r\n\tnew Version(15, new Array(6, 26, 48, 70), new ECBlocks(22, new ECB(5, 87), new ECB(1, 88)), new ECBlocks(24, new ECB(5, 41), new ECB(5, 42)), new ECBlocks(30, new ECB(5, 24), new ECB(7, 25)), new ECBlocks(24, new ECB(11, 12), new ECB(7, 13))), \r\n\tnew Version(16, new Array(6, 26, 50, 74), new ECBlocks(24, new ECB(5, 98), new ECB(1, 99)), new ECBlocks(28, new ECB(7, 45), new ECB(3, 46)), new ECBlocks(24, new ECB(15, 19), new ECB(2, 20)), new ECBlocks(30, new ECB(3, 15), new ECB(13, 16))), \r\n\tnew Version(17, new Array(6, 30, 54, 78), new ECBlocks(28, new ECB(1, 107), new ECB(5, 108)), new ECBlocks(28, new ECB(10, 46), new ECB(1, 47)), new ECBlocks(28, new ECB(1, 22), new ECB(15, 23)), new ECBlocks(28, new ECB(2, 14), new ECB(17, 15))), \r\n\tnew Version(18, new Array(6, 30, 56, 82), new ECBlocks(30, new ECB(5, 120), new ECB(1, 121)), new ECBlocks(26, new ECB(9, 43), new ECB(4, 44)), new ECBlocks(28, new ECB(17, 22), new ECB(1, 23)), new ECBlocks(28, new ECB(2, 14), new ECB(19, 15))), \r\n\tnew Version(19, new Array(6, 30, 58, 86), new ECBlocks(28, new ECB(3, 113), new ECB(4, 114)), new ECBlocks(26, new ECB(3, 44), new ECB(11, 45)), new ECBlocks(26, new ECB(17, 21), new ECB(4, 22)), new ECBlocks(26, new ECB(9, 13), new ECB(16, 14))), \r\n\tnew Version(20, new Array(6, 34, 62, 90), new ECBlocks(28, new ECB(3, 107), new ECB(5, 108)), new ECBlocks(26, new ECB(3, 41), new ECB(13, 42)), new ECBlocks(30, new ECB(15, 24), new ECB(5, 25)), new ECBlocks(28, new ECB(15, 15), new ECB(10, 16))), \r\n\tnew Version(21, new Array(6, 28, 50, 72, 94), new ECBlocks(28, new ECB(4, 116), new ECB(4, 117)), new ECBlocks(26, new ECB(17, 42)), new ECBlocks(28, new ECB(17, 22), new ECB(6, 23)), new ECBlocks(30, new ECB(19, 16), new ECB(6, 17))), \r\n\tnew Version(22, new Array(6, 26, 50, 74, 98), new ECBlocks(28, new ECB(2, 111), new ECB(7, 112)), new ECBlocks(28, new ECB(17, 46)), new ECBlocks(30, new ECB(7, 24), new ECB(16, 25)), new ECBlocks(24, new ECB(34, 13))), \r\n\tnew Version(23, new Array(6, 30, 54, 74, 102), new ECBlocks(30, new ECB(4, 121), new ECB(5, 122)), new ECBlocks(28, new ECB(4, 47), new ECB(14, 48)), new ECBlocks(30, new ECB(11, 24), new ECB(14, 25)), new ECBlocks(30, new ECB(16, 15), new ECB(14, 16))), \r\n\tnew Version(24, new Array(6, 28, 54, 80, 106), new ECBlocks(30, new ECB(6, 117), new ECB(4, 118)), new ECBlocks(28, new ECB(6, 45), new ECB(14, 46)), new ECBlocks(30, new ECB(11, 24), new ECB(16, 25)), new ECBlocks(30, new ECB(30, 16), new ECB(2, 17))), \r\n\tnew Version(25, new Array(6, 32, 58, 84, 110), new ECBlocks(26, new ECB(8, 106), new ECB(4, 107)), new ECBlocks(28, new ECB(8, 47), new ECB(13, 48)), new ECBlocks(30, new ECB(7, 24), new ECB(22, 25)), new ECBlocks(30, new ECB(22, 15), new ECB(13, 16))), \r\n\tnew Version(26, new Array(6, 30, 58, 86, 114), new ECBlocks(28, new ECB(10, 114), new ECB(2, 115)), new ECBlocks(28, new ECB(19, 46), new ECB(4, 47)), new ECBlocks(28, new ECB(28, 22), new ECB(6, 23)), new ECBlocks(30, new ECB(33, 16), new ECB(4, 17))), \r\n\tnew Version(27, new Array(6, 34, 62, 90, 118), new ECBlocks(30, new ECB(8, 122), new ECB(4, 123)), new ECBlocks(28, new ECB(22, 45), new ECB(3, 46)), new ECBlocks(30, new ECB(8, 23), new ECB(26, 24)), new ECBlocks(30, new ECB(12, 15), \t\tnew ECB(28, 16))),\r\n\tnew Version(28, new Array(6, 26, 50, 74, 98, 122), new ECBlocks(30, new ECB(3, 117), new ECB(10, 118)), new ECBlocks(28, new ECB(3, 45), new ECB(23, 46)), new ECBlocks(30, new ECB(4, 24), new ECB(31, 25)), new ECBlocks(30, new ECB(11, 15), new ECB(31, 16))), \r\n\tnew Version(29, new Array(6, 30, 54, 78, 102, 126), new ECBlocks(30, new ECB(7, 116), new ECB(7, 117)), new ECBlocks(28, new ECB(21, 45), new ECB(7, 46)), new ECBlocks(30, new ECB(1, 23), new ECB(37, 24)), new ECBlocks(30, new ECB(19, 15), new ECB(26, 16))), \r\n\tnew Version(30, new Array(6, 26, 52, 78, 104, 130), new ECBlocks(30, new ECB(5, 115), new ECB(10, 116)), new ECBlocks(28, new ECB(19, 47), new ECB(10, 48)), new ECBlocks(30, new ECB(15, 24), new ECB(25, 25)), new ECBlocks(30, new ECB(23, 15), new ECB(25, 16))), \r\n\tnew Version(31, new Array(6, 30, 56, 82, 108, 134), new ECBlocks(30, new ECB(13, 115), new ECB(3, 116)), new ECBlocks(28, new ECB(2, 46), new ECB(29, 47)), new ECBlocks(30, new ECB(42, 24), new ECB(1, 25)), new ECBlocks(30, new ECB(23, 15), new ECB(28, 16))), \r\n\tnew Version(32, new Array(6, 34, 60, 86, 112, 138), new ECBlocks(30, new ECB(17, 115)), new ECBlocks(28, new ECB(10, 46), new ECB(23, 47)), new ECBlocks(30, new ECB(10, 24), new ECB(35, 25)), new ECBlocks(30, new ECB(19, 15), new ECB(35, 16))), \r\n\tnew Version(33, new Array(6, 30, 58, 86, 114, 142), new ECBlocks(30, new ECB(17, 115), new ECB(1, 116)), new ECBlocks(28, new ECB(14, 46), new ECB(21, 47)), new ECBlocks(30, new ECB(29, 24), new ECB(19, 25)), new ECBlocks(30, new ECB(11, 15), new ECB(46, 16))), \r\n\tnew Version(34, new Array(6, 34, 62, 90, 118, 146), new ECBlocks(30, new ECB(13, 115), new ECB(6, 116)), new ECBlocks(28, new ECB(14, 46), new ECB(23, 47)), new ECBlocks(30, new ECB(44, 24), new ECB(7, 25)), new ECBlocks(30, new ECB(59, 16), new ECB(1, 17))), \r\n\tnew Version(35, new Array(6, 30, 54, 78, 102, 126, 150), new ECBlocks(30, new ECB(12, 121), new ECB(7, 122)), new ECBlocks(28, new ECB(12, 47), new ECB(26, 48)), new ECBlocks(30, new ECB(39, 24), new ECB(14, 25)),new ECBlocks(30, new ECB(22, 15), new ECB(41, 16))), \r\n\tnew Version(36, new Array(6, 24, 50, 76, 102, 128, 154), new ECBlocks(30, new ECB(6, 121), new ECB(14, 122)), new ECBlocks(28, new ECB(6, 47), new ECB(34, 48)), new ECBlocks(30, new ECB(46, 24), new ECB(10, 25)), new ECBlocks(30, new ECB(2, 15), new ECB(64, 16))), \r\n\tnew Version(37, new Array(6, 28, 54, 80, 106, 132, 158), new ECBlocks(30, new ECB(17, 122), new ECB(4, 123)), new ECBlocks(28, new ECB(29, 46), new ECB(14, 47)), new ECBlocks(30, new ECB(49, 24), new ECB(10, 25)), new ECBlocks(30, new ECB(24, 15), new ECB(46, 16))), \r\n\tnew Version(38, new Array(6, 32, 58, 84, 110, 136, 162), new ECBlocks(30, new ECB(4, 122), new ECB(18, 123)), new ECBlocks(28, new ECB(13, 46), new ECB(32, 47)), new ECBlocks(30, new ECB(48, 24), new ECB(14, 25)), new ECBlocks(30, new ECB(42, 15), new ECB(32, 16))), \r\n\tnew Version(39, new Array(6, 26, 54, 82, 110, 138, 166), new ECBlocks(30, new ECB(20, 117), new ECB(4, 118)), new ECBlocks(28, new ECB(40, 47), new ECB(7, 48)), new ECBlocks(30, new ECB(43, 24), new ECB(22, 25)), new ECBlocks(30, new ECB(10, 15), new ECB(67, 16))), \r\n\tnew Version(40, new Array(6, 30, 58, 86, 114, 142, 170), new ECBlocks(30, new ECB(19, 118), new ECB(6, 119)), new ECBlocks(28, new ECB(18, 47), new ECB(31, 48)), new ECBlocks(30, new ECB(34, 24), new ECB(34, 25)), new ECBlocks(30, new ECB(20, 15), new ECB(61, 16))));\r\n}","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction PerspectiveTransform( a11, a21, a31, a12, a22, a32, a13, a23, a33)\r\n{\r\n\tthis.a11 = a11;\r\n\tthis.a12 = a12;\r\n\tthis.a13 = a13;\r\n\tthis.a21 = a21;\r\n\tthis.a22 = a22;\r\n\tthis.a23 = a23;\r\n\tthis.a31 = a31;\r\n\tthis.a32 = a32;\r\n\tthis.a33 = a33;\r\n\tthis.transformPoints1=function( points)\r\n\t\t{\r\n\t\t\tvar max = points.length;\r\n\t\t\tvar a11 = this.a11;\r\n\t\t\tvar a12 = this.a12;\r\n\t\t\tvar a13 = this.a13;\r\n\t\t\tvar a21 = this.a21;\r\n\t\t\tvar a22 = this.a22;\r\n\t\t\tvar a23 = this.a23;\r\n\t\t\tvar a31 = this.a31;\r\n\t\t\tvar a32 = this.a32;\r\n\t\t\tvar a33 = this.a33;\r\n\t\t\tfor (var i = 0; i < max; i += 2)\r\n\t\t\t{\r\n\t\t\t\tvar x = points[i];\r\n\t\t\t\tvar y = points[i + 1];\r\n\t\t\t\tvar denominator = a13 * x + a23 * y + a33;\r\n\t\t\t\tpoints[i] = (a11 * x + a21 * y + a31) / denominator;\r\n\t\t\t\tpoints[i + 1] = (a12 * x + a22 * y + a32) / denominator;\r\n\t\t\t}\r\n\t\t}\r\n\tthis. transformPoints2=function(xValues, yValues)\r\n\t\t{\r\n\t\t\tvar n = xValues.length;\r\n\t\t\tfor (var i = 0; i < n; i++)\r\n\t\t\t{\r\n\t\t\t\tvar x = xValues[i];\r\n\t\t\t\tvar y = yValues[i];\r\n\t\t\t\tvar denominator = this.a13 * x + this.a23 * y + this.a33;\r\n\t\t\t\txValues[i] = (this.a11 * x + this.a21 * y + this.a31) / denominator;\r\n\t\t\t\tyValues[i] = (this.a12 * x + this.a22 * y + this.a32) / denominator;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\tthis.buildAdjoint=function()\r\n\t\t{\r\n\t\t\t// Adjoint is the transpose of the cofactor matrix:\r\n\t\t\treturn new PerspectiveTransform(this.a22 * this.a33 - this.a23 * this.a32, this.a23 * this.a31 - this.a21 * this.a33, this.a21 * this.a32 - this.a22 * this.a31, this.a13 * this.a32 - this.a12 * this.a33, this.a11 * this.a33 - this.a13 * this.a31, this.a12 * this.a31 - this.a11 * this.a32, this.a12 * this.a23 - this.a13 * this.a22, this.a13 * this.a21 - this.a11 * this.a23, this.a11 * this.a22 - this.a12 * this.a21);\r\n\t\t}\r\n\tthis.times=function( other)\r\n\t\t{\r\n\t\t\treturn new PerspectiveTransform(this.a11 * other.a11 + this.a21 * other.a12 + this.a31 * other.a13, this.a11 * other.a21 + this.a21 * other.a22 + this.a31 * other.a23, this.a11 * other.a31 + this.a21 * other.a32 + this.a31 * other.a33, this.a12 * other.a11 + this.a22 * other.a12 + this.a32 * other.a13, this.a12 * other.a21 + this.a22 * other.a22 + this.a32 * other.a23, this.a12 * other.a31 + this.a22 * other.a32 + this.a32 * other.a33, this.a13 * other.a11 + this.a23 * other.a12 +this.a33 * other.a13, this.a13 * other.a21 + this.a23 * other.a22 + this.a33 * other.a23, this.a13 * other.a31 + this.a23 * other.a32 + this.a33 * other.a33);\r\n\t\t}\r\n\r\n}\r\n\r\nPerspectiveTransform.quadrilateralToQuadrilateral=function( x0, y0, x1, y1, x2, y2, x3, y3, x0p, y0p, x1p, y1p, x2p, y2p, x3p, y3p)\r\n{\r\n\t\r\n\tvar qToS = this.quadrilateralToSquare(x0, y0, x1, y1, x2, y2, x3, y3);\r\n\tvar sToQ = this.squareToQuadrilateral(x0p, y0p, x1p, y1p, x2p, y2p, x3p, y3p);\r\n\treturn sToQ.times(qToS);\r\n}\r\n\r\nPerspectiveTransform.squareToQuadrilateral=function( x0, y0, x1, y1, x2, y2, x3, y3)\r\n{\r\n\t dy2 = y3 - y2;\r\n\t dy3 = y0 - y1 + y2 - y3;\r\n\tif (dy2 == 0.0 && dy3 == 0.0)\r\n\t{\r\n\t\treturn new PerspectiveTransform(x1 - x0, x2 - x1, x0, y1 - y0, y2 - y1, y0, 0.0, 0.0, 1.0);\r\n\t}\r\n\telse\r\n\t{\r\n\t\t dx1 = x1 - x2;\r\n\t\t dx2 = x3 - x2;\r\n\t\t dx3 = x0 - x1 + x2 - x3;\r\n\t\t dy1 = y1 - y2;\r\n\t\t denominator = dx1 * dy2 - dx2 * dy1;\r\n\t\t a13 = (dx3 * dy2 - dx2 * dy3) / denominator;\r\n\t\t a23 = (dx1 * dy3 - dx3 * dy1) / denominator;\r\n\t\treturn new PerspectiveTransform(x1 - x0 + a13 * x1, x3 - x0 + a23 * x3, x0, y1 - y0 + a13 * y1, y3 - y0 + a23 * y3, y0, a13, a23, 1.0);\r\n\t}\r\n}\r\n\r\nPerspectiveTransform.quadrilateralToSquare=function( x0, y0, x1, y1, x2, y2, x3, y3)\r\n{\r\n\t// Here, the adjoint serves as the inverse:\r\n\treturn this.squareToQuadrilateral(x0, y0, x1, y1, x2, y2, x3, y3).buildAdjoint();\r\n}\r\n\r\nfunction DetectorResult(bits, points)\r\n{\r\n\tthis.bits = bits;\r\n\tthis.points = points;\r\n}\r\n\r\n\r\nfunction Detector(image)\r\n{\r\n\tthis.image=image;\r\n\tthis.resultPointCallback = null;\r\n\t\r\n\tthis.sizeOfBlackWhiteBlackRun=function( fromX, fromY, toX, toY)\r\n\t\t{\r\n\t\t\t// Mild variant of Bresenham's algorithm;\r\n\t\t\t// see http://en.wikipedia.org/wiki/Bresenham's_line_algorithm\r\n\t\t\tvar steep = Math.abs(toY - fromY) > Math.abs(toX - fromX);\r\n\t\t\tif (steep)\r\n\t\t\t{\r\n\t\t\t\tvar temp = fromX;\r\n\t\t\t\tfromX = fromY;\r\n\t\t\t\tfromY = temp;\r\n\t\t\t\ttemp = toX;\r\n\t\t\t\ttoX = toY;\r\n\t\t\t\ttoY = temp;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar dx = Math.abs(toX - fromX);\r\n\t\t\tvar dy = Math.abs(toY - fromY);\r\n\t\t\tvar error = - dx >> 1;\r\n\t\t\tvar ystep = fromY < toY?1:- 1;\r\n\t\t\tvar xstep = fromX < toX?1:- 1;\r\n\t\t\tvar state = 0; // In black pixels, looking for white, first or second time\r\n\t\t\tfor (var x = fromX, y = fromY; x != toX; x += xstep)\r\n\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\tvar realX = steep?y:x;\r\n\t\t\t\tvar realY = steep?x:y;\r\n\t\t\t\tif (state == 1)\r\n\t\t\t\t{\r\n\t\t\t\t\t// In white pixels, looking for black\r\n\t\t\t\t\tif (this.image[realX + realY*qrcode.width])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tstate++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tif (!this.image[realX + realY*qrcode.width])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tstate++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tif (state == 3)\r\n\t\t\t\t{\r\n\t\t\t\t\t// Found black, white, black, and stumbled back onto white; done\r\n\t\t\t\t\tvar diffX = x - fromX;\r\n\t\t\t\t\tvar diffY = y - fromY;\r\n\t\t\t\t\treturn Math.sqrt( (diffX * diffX + diffY * diffY));\r\n\t\t\t\t}\r\n\t\t\t\terror += dy;\r\n\t\t\t\tif (error > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tif (y == toY)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\ty += ystep;\r\n\t\t\t\t\terror -= dx;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tvar diffX2 = toX - fromX;\r\n\t\t\tvar diffY2 = toY - fromY;\r\n\t\t\treturn Math.sqrt( (diffX2 * diffX2 + diffY2 * diffY2));\r\n\t\t}\r\n\r\n\t\r\n\tthis.sizeOfBlackWhiteBlackRunBothWays=function( fromX, fromY, toX, toY)\r\n\t\t{\r\n\t\t\t\r\n\t\t\tvar result = this.sizeOfBlackWhiteBlackRun(fromX, fromY, toX, toY);\r\n\t\t\t\r\n\t\t\t// Now count other way -- don't run off image though of course\r\n\t\t\tvar scale = 1.0;\r\n\t\t\tvar otherToX = fromX - (toX - fromX);\r\n\t\t\tif (otherToX < 0)\r\n\t\t\t{\r\n\t\t\t\tscale = fromX / (fromX - otherToX);\r\n\t\t\t\totherToX = 0;\r\n\t\t\t}\r\n\t\t\telse if (otherToX >= qrcode.width)\r\n\t\t\t{\r\n\t\t\t\tscale = (qrcode.width - 1 - fromX) / (otherToX - fromX);\r\n\t\t\t\totherToX = qrcode.width - 1;\r\n\t\t\t}\r\n\t\t\tvar otherToY = Math.floor (fromY - (toY - fromY) * scale);\r\n\t\t\t\r\n\t\t\tscale = 1.0;\r\n\t\t\tif (otherToY < 0)\r\n\t\t\t{\r\n\t\t\t\tscale = fromY / (fromY - otherToY);\r\n\t\t\t\totherToY = 0;\r\n\t\t\t}\r\n\t\t\telse if (otherToY >= qrcode.height)\r\n\t\t\t{\r\n\t\t\t\tscale = (qrcode.height - 1 - fromY) / (otherToY - fromY);\r\n\t\t\t\totherToY = qrcode.height - 1;\r\n\t\t\t}\r\n\t\t\totherToX = Math.floor (fromX + (otherToX - fromX) * scale);\r\n\t\t\t\r\n\t\t\tresult += this.sizeOfBlackWhiteBlackRun(fromX, fromY, otherToX, otherToY);\r\n\t\t\treturn result - 1.0; // -1 because we counted the middle pixel twice\r\n\t\t}\r\n\t\t\r\n\r\n\t\r\n\tthis.calculateModuleSizeOneWay=function( pattern, otherPattern)\r\n\t\t{\r\n\t\t\tvar moduleSizeEst1 = this.sizeOfBlackWhiteBlackRunBothWays(Math.floor( pattern.X), Math.floor( pattern.Y), Math.floor( otherPattern.X), Math.floor(otherPattern.Y));\r\n\t\t\tvar moduleSizeEst2 = this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(otherPattern.X), Math.floor(otherPattern.Y), Math.floor( pattern.X), Math.floor(pattern.Y));\r\n\t\t\tif (isNaN(moduleSizeEst1))\r\n\t\t\t{\r\n\t\t\t\treturn moduleSizeEst2 / 7.0;\r\n\t\t\t}\r\n\t\t\tif (isNaN(moduleSizeEst2))\r\n\t\t\t{\r\n\t\t\t\treturn moduleSizeEst1 / 7.0;\r\n\t\t\t}\r\n\t\t\t// Average them, and divide by 7 since we've counted the width of 3 black modules,\r\n\t\t\t// and 1 white and 1 black module on either side. Ergo, divide sum by 14.\r\n\t\t\treturn (moduleSizeEst1 + moduleSizeEst2) / 14.0;\r\n\t\t}\r\n\r\n\t\r\n\tthis.calculateModuleSize=function( topLeft, topRight, bottomLeft)\r\n\t\t{\r\n\t\t\t// Take the average\r\n\t\t\treturn (this.calculateModuleSizeOneWay(topLeft, topRight) + this.calculateModuleSizeOneWay(topLeft, bottomLeft)) / 2.0;\r\n\t\t}\r\n\r\n\tthis.distance=function( pattern1, pattern2)\r\n\t{\r\n\t\txDiff = pattern1.X - pattern2.X;\r\n\t\tyDiff = pattern1.Y - pattern2.Y;\r\n\t\treturn Math.sqrt( (xDiff * xDiff + yDiff * yDiff));\r\n\t}\r\n\tthis.computeDimension=function( topLeft, topRight, bottomLeft, moduleSize)\r\n\t\t{\r\n\t\t\t\r\n\t\t\tvar tltrCentersDimension = Math.round(this.distance(topLeft, topRight) / moduleSize);\r\n\t\t\tvar tlblCentersDimension = Math.round(this.distance(topLeft, bottomLeft) / moduleSize);\r\n\t\t\tvar dimension = ((tltrCentersDimension + tlblCentersDimension) >> 1) + 7;\r\n\t\t\tswitch (dimension & 0x03)\r\n\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\t// mod 4\r\n\t\t\t\tcase 0: \r\n\t\t\t\t\tdimension++;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t// 1? do nothing\r\n\t\t\t\t\r\n\t\t\t\tcase 2: \r\n\t\t\t\t\tdimension--;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\r\n\t\t\t\tcase 3: \r\n\t\t\t\t\tthrow \"Error\";\r\n\t\t\t\t}\r\n\t\t\treturn dimension;\r\n\t\t}\r\n\r\n\tthis.findAlignmentInRegion=function( overallEstModuleSize, estAlignmentX, estAlignmentY, allowanceFactor)\r\n\t\t{\r\n\t\t\t// Look for an alignment pattern (3 modules in size) around where it\r\n\t\t\t// should be\r\n\t\t\tvar allowance = Math.floor (allowanceFactor * overallEstModuleSize);\r\n\t\t\tvar alignmentAreaLeftX = Math.max(0, estAlignmentX - allowance);\r\n\t\t\tvar alignmentAreaRightX = Math.min(qrcode.width - 1, estAlignmentX + allowance);\r\n\t\t\tif (alignmentAreaRightX - alignmentAreaLeftX < overallEstModuleSize * 3)\r\n\t\t\t{\r\n\t\t\t\tthrow \"Error\";\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar alignmentAreaTopY = Math.max(0, estAlignmentY - allowance);\r\n\t\t\tvar alignmentAreaBottomY = Math.min(qrcode.height - 1, estAlignmentY + allowance);\r\n\t\t\t\r\n\t\t\tvar alignmentFinder = new AlignmentPatternFinder(this.image, alignmentAreaLeftX, alignmentAreaTopY, alignmentAreaRightX - alignmentAreaLeftX, alignmentAreaBottomY - alignmentAreaTopY, overallEstModuleSize, this.resultPointCallback);\r\n\t\t\treturn alignmentFinder.find();\r\n\t\t}\r\n\t\t\r\n\tthis.createTransform=function( topLeft, topRight, bottomLeft, alignmentPattern, dimension)\r\n\t\t{\r\n\t\t\tvar dimMinusThree = dimension - 3.5;\r\n\t\t\tvar bottomRightX;\r\n\t\t\tvar bottomRightY;\r\n\t\t\tvar sourceBottomRightX;\r\n\t\t\tvar sourceBottomRightY;\r\n\t\t\tif (alignmentPattern != null)\r\n\t\t\t{\r\n\t\t\t\tbottomRightX = alignmentPattern.X;\r\n\t\t\t\tbottomRightY = alignmentPattern.Y;\r\n\t\t\t\tsourceBottomRightX = sourceBottomRightY = dimMinusThree - 3.0;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t// Don't have an alignment pattern, just make up the bottom-right point\r\n\t\t\t\tbottomRightX = (topRight.X - topLeft.X) + bottomLeft.X;\r\n\t\t\t\tbottomRightY = (topRight.Y - topLeft.Y) + bottomLeft.Y;\r\n\t\t\t\tsourceBottomRightX = sourceBottomRightY = dimMinusThree;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar transform = PerspectiveTransform.quadrilateralToQuadrilateral(3.5, 3.5, dimMinusThree, 3.5, sourceBottomRightX, sourceBottomRightY, 3.5, dimMinusThree, topLeft.X, topLeft.Y, topRight.X, topRight.Y, bottomRightX, bottomRightY, bottomLeft.X, bottomLeft.Y);\r\n\t\t\t\r\n\t\t\treturn transform;\r\n\t\t}\t\t\r\n\t\r\n\tthis.sampleGrid=function( image, transform, dimension)\r\n\t\t{\r\n\t\t\t\r\n\t\t\tvar sampler = GridSampler;\r\n\t\t\treturn sampler.sampleGrid3(image, dimension, transform);\r\n\t\t}\r\n\t\r\n\tthis.processFinderPatternInfo = function( info)\r\n\t\t{\r\n\t\t\t\r\n\t\t\tvar topLeft = info.TopLeft;\r\n\t\t\tvar topRight = info.TopRight;\r\n\t\t\tvar bottomLeft = info.BottomLeft;\r\n\t\t\t\r\n\t\t\tvar moduleSize = this.calculateModuleSize(topLeft, topRight, bottomLeft);\r\n\t\t\tif (moduleSize < 1.0)\r\n\t\t\t{\r\n\t\t\t\tthrow \"Error\";\r\n\t\t\t}\r\n\t\t\tvar dimension = this.computeDimension(topLeft, topRight, bottomLeft, moduleSize);\r\n\t\t\tvar provisionalVersion = Version.getProvisionalVersionForDimension(dimension);\r\n\t\t\tvar modulesBetweenFPCenters = provisionalVersion.DimensionForVersion - 7;\r\n\t\t\t\r\n\t\t\tvar alignmentPattern = null;\r\n\t\t\t// Anything above version 1 has an alignment pattern\r\n\t\t\tif (provisionalVersion.AlignmentPatternCenters.length > 0)\r\n\t\t\t{\r\n\t\t\t\t\r\n\t\t\t\t// Guess where a \"bottom right\" finder pattern would have been\r\n\t\t\t\tvar bottomRightX = topRight.X - topLeft.X + bottomLeft.X;\r\n\t\t\t\tvar bottomRightY = topRight.Y - topLeft.Y + bottomLeft.Y;\r\n\t\t\t\t\r\n\t\t\t\t// Estimate that alignment pattern is closer by 3 modules\r\n\t\t\t\t// from \"bottom right\" to known top left location\r\n\t\t\t\tvar correctionToTopLeft = 1.0 - 3.0 / modulesBetweenFPCenters;\r\n\t\t\t\tvar estAlignmentX = Math.floor (topLeft.X + correctionToTopLeft * (bottomRightX - topLeft.X));\r\n\t\t\t\tvar estAlignmentY = Math.floor (topLeft.Y + correctionToTopLeft * (bottomRightY - topLeft.Y));\r\n\t\t\t\t\r\n\t\t\t\t// Kind of arbitrary -- expand search radius before giving up\r\n\t\t\t\tfor (var i = 4; i <= 16; i <<= 1)\r\n\t\t\t\t{\r\n\t\t\t\t\t//try\r\n\t\t\t\t\t//{\r\n\t\t\t\t\t\talignmentPattern = this.findAlignmentInRegion(moduleSize, estAlignmentX, estAlignmentY, i);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t//}\r\n\t\t\t\t\t//catch (re)\r\n\t\t\t\t\t//{\r\n\t\t\t\t\t\t// try next round\r\n\t\t\t\t\t//}\r\n\t\t\t\t}\r\n\t\t\t\t// If we didn't find alignment pattern... well try anyway without it\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar transform = this.createTransform(topLeft, topRight, bottomLeft, alignmentPattern, dimension);\r\n\t\t\t\r\n\t\t\tvar bits = this.sampleGrid(this.image, transform, dimension);\r\n\t\t\t\r\n\t\t\tvar points;\r\n\t\t\tif (alignmentPattern == null)\r\n\t\t\t{\r\n\t\t\t\tpoints = new Array(bottomLeft, topLeft, topRight);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tpoints = new Array(bottomLeft, topLeft, topRight, alignmentPattern);\r\n\t\t\t}\r\n\t\t\treturn new DetectorResult(bits, points);\r\n\t\t}\r\n\t\t\r\n\r\n\t\r\n\tthis.detect=function()\r\n\t{\r\n\t\tvar info = new FinderPatternFinder().findFinderPattern(this.image);\r\n\t\t\t\r\n\t\treturn this.processFinderPatternInfo(info); \r\n\t}\r\n}","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nvar FORMAT_INFO_MASK_QR = 0x5412;\r\nvar FORMAT_INFO_DECODE_LOOKUP = new Array(new Array(0x5412, 0x00), new Array(0x5125, 0x01), new Array(0x5E7C, 0x02), new Array(0x5B4B, 0x03), new Array(0x45F9, 0x04), new Array(0x40CE, 0x05), new Array(0x4F97, 0x06), new Array(0x4AA0, 0x07), new Array(0x77C4, 0x08), new Array(0x72F3, 0x09), new Array(0x7DAA, 0x0A), new Array(0x789D, 0x0B), new Array(0x662F, 0x0C), new Array(0x6318, 0x0D), new Array(0x6C41, 0x0E), new Array(0x6976, 0x0F), new Array(0x1689, 0x10), new Array(0x13BE, 0x11), new Array(0x1CE7, 0x12), new Array(0x19D0, 0x13), new Array(0x0762, 0x14), new Array(0x0255, 0x15), new Array(0x0D0C, 0x16), new Array(0x083B, 0x17), new Array(0x355F, 0x18), new Array(0x3068, 0x19), new Array(0x3F31, 0x1A), new Array(0x3A06, 0x1B), new Array(0x24B4, 0x1C), new Array(0x2183, 0x1D), new Array(0x2EDA, 0x1E), new Array(0x2BED, 0x1F));\r\nvar BITS_SET_IN_HALF_BYTE = new Array(0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4);\r\n\r\n\r\nfunction FormatInformation(formatInfo)\r\n{\r\n\tthis.errorCorrectionLevel = ErrorCorrectionLevel.forBits((formatInfo >> 3) & 0x03);\r\n\tthis.dataMask = (formatInfo & 0x07);\r\n\r\n\tthis.__defineGetter__(\"ErrorCorrectionLevel\", function()\r\n\t{\r\n\t\treturn this.errorCorrectionLevel;\r\n\t});\r\n\tthis.__defineGetter__(\"DataMask\", function()\r\n\t{\r\n\t\treturn this.dataMask;\r\n\t});\r\n\tthis.GetHashCode=function()\r\n\t{\r\n\t\treturn (this.errorCorrectionLevel.ordinal() << 3) | dataMask;\r\n\t}\r\n\tthis.Equals=function( o)\r\n\t{\r\n\t\tvar other = o;\r\n\t\treturn this.errorCorrectionLevel == other.errorCorrectionLevel && this.dataMask == other.dataMask;\r\n\t}\r\n}\r\n\r\nFormatInformation.numBitsDiffering=function( a, b)\r\n{\r\n\ta ^= b; // a now has a 1 bit exactly where its bit differs with b's\r\n\t// Count bits set quickly with a series of lookups:\r\n\treturn BITS_SET_IN_HALF_BYTE[a & 0x0F] + BITS_SET_IN_HALF_BYTE[(URShift(a, 4) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 8) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 12) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 16) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 20) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 24) & 0x0F)] + BITS_SET_IN_HALF_BYTE[(URShift(a, 28) & 0x0F)];\r\n}\r\n\r\nFormatInformation.decodeFormatInformation=function( maskedFormatInfo)\r\n{\r\n\tvar formatInfo = FormatInformation.doDecodeFormatInformation(maskedFormatInfo);\r\n\tif (formatInfo != null)\r\n\t{\r\n\t\treturn formatInfo;\r\n\t}\r\n\t// Should return null, but, some QR codes apparently\r\n\t// do not mask this info. Try again by actually masking the pattern\r\n\t// first\r\n\treturn FormatInformation.doDecodeFormatInformation(maskedFormatInfo ^ FORMAT_INFO_MASK_QR);\r\n}\r\nFormatInformation.doDecodeFormatInformation=function( maskedFormatInfo)\r\n{\r\n\t// Find the int in FORMAT_INFO_DECODE_LOOKUP with fewest bits differing\r\n\tvar bestDifference = 0xffffffff;\r\n\tvar bestFormatInfo = 0;\r\n\tfor (var i = 0; i < FORMAT_INFO_DECODE_LOOKUP.length; i++)\r\n\t{\r\n\t\tvar decodeInfo = FORMAT_INFO_DECODE_LOOKUP[i];\r\n\t\tvar targetInfo = decodeInfo[0];\r\n\t\tif (targetInfo == maskedFormatInfo)\r\n\t\t{\r\n\t\t\t// Found an exact match\r\n\t\t\treturn new FormatInformation(decodeInfo[1]);\r\n\t\t}\r\n\t\tvar bitsDifference = this.numBitsDiffering(maskedFormatInfo, targetInfo);\r\n\t\tif (bitsDifference < bestDifference)\r\n\t\t{\r\n\t\t\tbestFormatInfo = decodeInfo[1];\r\n\t\t\tbestDifference = bitsDifference;\r\n\t\t}\r\n\t}\r\n\t// Hamming distance of the 32 masked codes is 7, by construction, so <= 3 bits\r\n\t// differing means we found a match\r\n\tif (bestDifference <= 3)\r\n\t{\r\n\t\treturn new FormatInformation(bestFormatInfo);\r\n\t}\r\n\treturn null;\r\n}\r\n\r\n\t\t","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction ErrorCorrectionLevel(ordinal, bits, name)\r\n{\r\n\tthis.ordinal_Renamed_Field = ordinal;\r\n\tthis.bits = bits;\r\n\tthis.name = name;\r\n\tthis.__defineGetter__(\"Bits\", function()\r\n\t{\r\n\t\treturn this.bits;\r\n\t});\r\n\tthis.__defineGetter__(\"Name\", function()\r\n\t{\r\n\t\treturn this.name;\r\n\t});\r\n\tthis.ordinal=function()\r\n\t{\r\n\t\treturn this.ordinal_Renamed_Field;\r\n\t}\r\n}\r\n\r\nErrorCorrectionLevel.forBits=function( bits)\r\n{\r\n\tif (bits < 0 || bits >= FOR_BITS.length)\r\n\t{\r\n\t\tthrow \"ArgumentException\";\r\n\t}\r\n\treturn FOR_BITS[bits];\r\n}\r\n\r\nvar L = new ErrorCorrectionLevel(0, 0x01, \"L\");\r\nvar M = new ErrorCorrectionLevel(1, 0x00, \"M\");\r\nvar Q = new ErrorCorrectionLevel(2, 0x03, \"Q\");\r\nvar H = new ErrorCorrectionLevel(3, 0x02, \"H\");\r\nvar FOR_BITS = new Array( M, L, H, Q);\r\n","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction BitMatrix( width, height)\r\n{\r\n\tif(!height)\r\n\t\theight=width;\r\n\tif (width < 1 || height < 1)\r\n\t{\r\n\t\tthrow \"Both dimensions must be greater than 0\";\r\n\t}\r\n\tthis.width = width;\r\n\tthis.height = height;\r\n\tvar rowSize = width >> 5;\r\n\tif ((width & 0x1f) != 0)\r\n\t{\r\n\t\trowSize++;\r\n\t}\r\n\tthis.rowSize = rowSize;\r\n\tthis.bits = new Array(rowSize * height);\r\n\tfor(var i=0;i> 5);\r\n\t\t\treturn ((URShift(this.bits[offset], (x & 0x1f))) & 1) != 0;\r\n\t\t}\r\n\tthis.set_Renamed=function( x, y)\r\n\t\t{\r\n\t\t\tvar offset = y * this.rowSize + (x >> 5);\r\n\t\t\tthis.bits[offset] |= 1 << (x & 0x1f);\r\n\t\t}\r\n\tthis.flip=function( x, y)\r\n\t\t{\r\n\t\t\tvar offset = y * this.rowSize + (x >> 5);\r\n\t\t\tthis.bits[offset] ^= 1 << (x & 0x1f);\r\n\t\t}\r\n\tthis.clear=function()\r\n\t\t{\r\n\t\t\tvar max = this.bits.length;\r\n\t\t\tfor (var i = 0; i < max; i++)\r\n\t\t\t{\r\n\t\t\t\tthis.bits[i] = 0;\r\n\t\t\t}\r\n\t\t}\r\n\tthis.setRegion=function( left, top, width, height)\r\n\t\t{\r\n\t\t\tif (top < 0 || left < 0)\r\n\t\t\t{\r\n\t\t\t\tthrow \"Left and top must be nonnegative\";\r\n\t\t\t}\r\n\t\t\tif (height < 1 || width < 1)\r\n\t\t\t{\r\n\t\t\t\tthrow \"Height and width must be at least 1\";\r\n\t\t\t}\r\n\t\t\tvar right = left + width;\r\n\t\t\tvar bottom = top + height;\r\n\t\t\tif (bottom > this.height || right > this.width)\r\n\t\t\t{\r\n\t\t\t\tthrow \"The region must fit inside the matrix\";\r\n\t\t\t}\r\n\t\t\tfor (var y = top; y < bottom; y++)\r\n\t\t\t{\r\n\t\t\t\tvar offset = y * this.rowSize;\r\n\t\t\t\tfor (var x = left; x < right; x++)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.bits[offset + (x >> 5)] |= 1 << (x & 0x1f);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n}","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction DataBlock(numDataCodewords, codewords)\r\n{\r\n\tthis.numDataCodewords = numDataCodewords;\r\n\tthis.codewords = codewords;\r\n\t\r\n\tthis.__defineGetter__(\"NumDataCodewords\", function()\r\n\t{\r\n\t\treturn this.numDataCodewords;\r\n\t});\r\n\tthis.__defineGetter__(\"Codewords\", function()\r\n\t{\r\n\t\treturn this.codewords;\r\n\t});\r\n}\t\r\n\t\r\nDataBlock.getDataBlocks=function(rawCodewords, version, ecLevel)\r\n{\r\n\t\r\n\tif (rawCodewords.length != version.TotalCodewords)\r\n\t{\r\n\t\tthrow \"ArgumentException\";\r\n\t}\r\n\t\r\n\t// Figure out the number and size of data blocks used by this version and\r\n\t// error correction level\r\n\tvar ecBlocks = version.getECBlocksForLevel(ecLevel);\r\n\t\r\n\t// First count the total number of data blocks\r\n\tvar totalBlocks = 0;\r\n\tvar ecBlockArray = ecBlocks.getECBlocks();\r\n\tfor (var i = 0; i < ecBlockArray.length; i++)\r\n\t{\r\n\t\ttotalBlocks += ecBlockArray[i].Count;\r\n\t}\r\n\t\r\n\t// Now establish DataBlocks of the appropriate size and number of data codewords\r\n\tvar result = new Array(totalBlocks);\r\n\tvar numResultBlocks = 0;\r\n\tfor (var j = 0; j < ecBlockArray.length; j++)\r\n\t{\r\n\t\tvar ecBlock = ecBlockArray[j];\r\n\t\tfor (var i = 0; i < ecBlock.Count; i++)\r\n\t\t{\r\n\t\t\tvar numDataCodewords = ecBlock.DataCodewords;\r\n\t\t\tvar numBlockCodewords = ecBlocks.ECCodewordsPerBlock + numDataCodewords;\r\n\t\t\tresult[numResultBlocks++] = new DataBlock(numDataCodewords, new Array(numBlockCodewords));\r\n\t\t}\r\n\t}\r\n\t\r\n\t// All blocks have the same amount of data, except that the last n\r\n\t// (where n may be 0) have 1 more byte. Figure out where these start.\r\n\tvar shorterBlocksTotalCodewords = result[0].codewords.length;\r\n\tvar longerBlocksStartAt = result.length - 1;\r\n\twhile (longerBlocksStartAt >= 0)\r\n\t{\r\n\t\tvar numCodewords = result[longerBlocksStartAt].codewords.length;\r\n\t\tif (numCodewords == shorterBlocksTotalCodewords)\r\n\t\t{\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tlongerBlocksStartAt--;\r\n\t}\r\n\tlongerBlocksStartAt++;\r\n\t\r\n\tvar shorterBlocksNumDataCodewords = shorterBlocksTotalCodewords - ecBlocks.ECCodewordsPerBlock;\r\n\t// The last elements of result may be 1 element longer;\r\n\t// first fill out as many elements as all of them have\r\n\tvar rawCodewordsOffset = 0;\r\n\tfor (var i = 0; i < shorterBlocksNumDataCodewords; i++)\r\n\t{\r\n\t\tfor (var j = 0; j < numResultBlocks; j++)\r\n\t\t{\r\n\t\t\tresult[j].codewords[i] = rawCodewords[rawCodewordsOffset++];\r\n\t\t}\r\n\t}\r\n\t// Fill out the last data block in the longer ones\r\n\tfor (var j = longerBlocksStartAt; j < numResultBlocks; j++)\r\n\t{\r\n\t\tresult[j].codewords[shorterBlocksNumDataCodewords] = rawCodewords[rawCodewordsOffset++];\r\n\t}\r\n\t// Now add in error correction blocks\r\n\tvar max = result[0].codewords.length;\r\n\tfor (var i = shorterBlocksNumDataCodewords; i < max; i++)\r\n\t{\r\n\t\tfor (var j = 0; j < numResultBlocks; j++)\r\n\t\t{\r\n\t\t\tvar iOffset = j < longerBlocksStartAt?i:i + 1;\r\n\t\t\tresult[j].codewords[iOffset] = rawCodewords[rawCodewordsOffset++];\r\n\t\t}\r\n\t}\r\n\treturn result;\r\n}\r\n","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction BitMatrixParser(bitMatrix)\r\n{\r\n\tvar dimension = bitMatrix.Dimension;\r\n\tif (dimension < 21 || (dimension & 0x03) != 1)\r\n\t{\r\n\t\tthrow \"Error BitMatrixParser\";\r\n\t}\r\n\tthis.bitMatrix = bitMatrix;\r\n\tthis.parsedVersion = null;\r\n\tthis.parsedFormatInfo = null;\r\n\t\r\n\tthis.copyBit=function( i, j, versionBits)\r\n\t{\r\n\t\treturn this.bitMatrix.get_Renamed(i, j)?(versionBits << 1) | 0x1:versionBits << 1;\r\n\t}\r\n\t\r\n\tthis.readFormatInformation=function()\r\n\t{\r\n\t\t\tif (this.parsedFormatInfo != null)\r\n\t\t\t{\r\n\t\t\t\treturn this.parsedFormatInfo;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Read top-left format info bits\r\n\t\t\tvar formatInfoBits = 0;\r\n\t\t\tfor (var i = 0; i < 6; i++)\r\n\t\t\t{\r\n\t\t\t\tformatInfoBits = this.copyBit(i, 8, formatInfoBits);\r\n\t\t\t}\r\n\t\t\t// .. and skip a bit in the timing pattern ...\r\n\t\t\tformatInfoBits = this.copyBit(7, 8, formatInfoBits);\r\n\t\t\tformatInfoBits = this.copyBit(8, 8, formatInfoBits);\r\n\t\t\tformatInfoBits = this.copyBit(8, 7, formatInfoBits);\r\n\t\t\t// .. and skip a bit in the timing pattern ...\r\n\t\t\tfor (var j = 5; j >= 0; j--)\r\n\t\t\t{\r\n\t\t\t\tformatInfoBits = this.copyBit(8, j, formatInfoBits);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tthis.parsedFormatInfo = FormatInformation.decodeFormatInformation(formatInfoBits);\r\n\t\t\tif (this.parsedFormatInfo != null)\r\n\t\t\t{\r\n\t\t\t\treturn this.parsedFormatInfo;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Hmm, failed. Try the top-right/bottom-left pattern\r\n\t\t\tvar dimension = this.bitMatrix.Dimension;\r\n\t\t\tformatInfoBits = 0;\r\n\t\t\tvar iMin = dimension - 8;\r\n\t\t\tfor (var i = dimension - 1; i >= iMin; i--)\r\n\t\t\t{\r\n\t\t\t\tformatInfoBits = this.copyBit(i, 8, formatInfoBits);\r\n\t\t\t}\r\n\t\t\tfor (var j = dimension - 7; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tformatInfoBits = this.copyBit(8, j, formatInfoBits);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tthis.parsedFormatInfo = FormatInformation.decodeFormatInformation(formatInfoBits);\r\n\t\t\tif (this.parsedFormatInfo != null)\r\n\t\t\t{\r\n\t\t\t\treturn this.parsedFormatInfo;\r\n\t\t\t}\r\n\t\t\tthrow \"Error readFormatInformation\";\t\r\n\t}\r\n\tthis.readVersion=function()\r\n\t\t{\r\n\t\t\t\r\n\t\t\tif (this.parsedVersion != null)\r\n\t\t\t{\r\n\t\t\t\treturn this.parsedVersion;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar dimension = this.bitMatrix.Dimension;\r\n\t\t\t\r\n\t\t\tvar provisionalVersion = (dimension - 17) >> 2;\r\n\t\t\tif (provisionalVersion <= 6)\r\n\t\t\t{\r\n\t\t\t\treturn Version.getVersionForNumber(provisionalVersion);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Read top-right version info: 3 wide by 6 tall\r\n\t\t\tvar versionBits = 0;\r\n\t\t\tvar ijMin = dimension - 11;\r\n\t\t\tfor (var j = 5; j >= 0; j--)\r\n\t\t\t{\r\n\t\t\t\tfor (var i = dimension - 9; i >= ijMin; i--)\r\n\t\t\t\t{\r\n\t\t\t\t\tversionBits = this.copyBit(i, j, versionBits);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tthis.parsedVersion = Version.decodeVersionInformation(versionBits);\r\n\t\t\tif (this.parsedVersion != null && this.parsedVersion.DimensionForVersion == dimension)\r\n\t\t\t{\r\n\t\t\t\treturn this.parsedVersion;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Hmm, failed. Try bottom left: 6 wide by 3 tall\r\n\t\t\tversionBits = 0;\r\n\t\t\tfor (var i = 5; i >= 0; i--)\r\n\t\t\t{\r\n\t\t\t\tfor (var j = dimension - 9; j >= ijMin; j--)\r\n\t\t\t\t{\r\n\t\t\t\t\tversionBits = this.copyBit(i, j, versionBits);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tthis.parsedVersion = Version.decodeVersionInformation(versionBits);\r\n\t\t\tif (this.parsedVersion != null && this.parsedVersion.DimensionForVersion == dimension)\r\n\t\t\t{\r\n\t\t\t\treturn this.parsedVersion;\r\n\t\t\t}\r\n\t\t\tthrow \"Error readVersion\";\r\n\t\t}\r\n\tthis.readCodewords=function()\r\n\t\t{\r\n\t\t\t\r\n\t\t\tvar formatInfo = this.readFormatInformation();\r\n\t\t\tvar version = this.readVersion();\r\n\t\t\t\r\n\t\t\t// Get the data mask for the format used in this QR Code. This will exclude\r\n\t\t\t// some bits from reading as we wind through the bit matrix.\r\n\t\t\tvar dataMask = DataMask.forReference( formatInfo.DataMask);\r\n\t\t\tvar dimension = this.bitMatrix.Dimension;\r\n\t\t\tdataMask.unmaskBitMatrix(this.bitMatrix, dimension);\r\n\t\t\t\r\n\t\t\tvar functionPattern = version.buildFunctionPattern();\r\n\t\t\t\r\n\t\t\tvar readingUp = true;\r\n\t\t\tvar result = new Array(version.TotalCodewords);\r\n\t\t\tvar resultOffset = 0;\r\n\t\t\tvar currentByte = 0;\r\n\t\t\tvar bitsRead = 0;\r\n\t\t\t// Read columns in pairs, from right to left\r\n\t\t\tfor (var j = dimension - 1; j > 0; j -= 2)\r\n\t\t\t{\r\n\t\t\t\tif (j == 6)\r\n\t\t\t\t{\r\n\t\t\t\t\t// Skip whole column with vertical alignment pattern;\r\n\t\t\t\t\t// saves time and makes the other code proceed more cleanly\r\n\t\t\t\t\tj--;\r\n\t\t\t\t}\r\n\t\t\t\t// Read alternatingly from bottom to top then top to bottom\r\n\t\t\t\tfor (var count = 0; count < dimension; count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar i = readingUp?dimension - 1 - count:count;\r\n\t\t\t\t\tfor (var col = 0; col < 2; col++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// Ignore bits covered by the function pattern\r\n\t\t\t\t\t\tif (!functionPattern.get_Renamed(j - col, i))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t// Read a bit\r\n\t\t\t\t\t\t\tbitsRead++;\r\n\t\t\t\t\t\t\tcurrentByte <<= 1;\r\n\t\t\t\t\t\t\tif (this.bitMatrix.get_Renamed(j - col, i))\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tcurrentByte |= 1;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t// If we've made a whole byte, save it off\r\n\t\t\t\t\t\t\tif (bitsRead == 8)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tresult[resultOffset++] = currentByte;\r\n\t\t\t\t\t\t\t\tbitsRead = 0;\r\n\t\t\t\t\t\t\t\tcurrentByte = 0;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\treadingUp ^= true; // readingUp = !readingUp; // switch directions\r\n\t\t\t}\r\n\t\t\tif (resultOffset != version.TotalCodewords)\r\n\t\t\t{\r\n\t\t\t\tthrow \"Error readCodewords\";\r\n\t\t\t}\r\n\t\t\treturn result;\r\n\t\t}\r\n}","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nDataMask = {};\r\n\r\nDataMask.forReference = function(reference)\r\n{\r\n\tif (reference < 0 || reference > 7)\r\n\t{\r\n\t\tthrow \"System.ArgumentException\";\r\n\t}\r\n\treturn DataMask.DATA_MASKS[reference];\r\n}\r\n\r\nfunction DataMask000()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\treturn ((i + j) & 0x01) == 0;\r\n\t}\r\n}\r\n\r\nfunction DataMask001()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\treturn (i & 0x01) == 0;\r\n\t}\r\n}\r\n\r\nfunction DataMask010()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\treturn j % 3 == 0;\r\n\t}\r\n}\r\n\r\nfunction DataMask011()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\treturn (i + j) % 3 == 0;\r\n\t}\r\n}\r\n\r\nfunction DataMask100()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\treturn (((URShift(i, 1)) + (j / 3)) & 0x01) == 0;\r\n\t}\r\n}\r\n\r\nfunction DataMask101()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\tvar temp = i * j;\r\n\t\treturn (temp & 0x01) + (temp % 3) == 0;\r\n\t}\r\n}\r\n\r\nfunction DataMask110()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\tvar temp = i * j;\r\n\t\treturn (((temp & 0x01) + (temp % 3)) & 0x01) == 0;\r\n\t}\r\n}\r\nfunction DataMask111()\r\n{\r\n\tthis.unmaskBitMatrix=function(bits, dimension)\r\n\t{\r\n\t\tfor (var i = 0; i < dimension; i++)\r\n\t\t{\r\n\t\t\tfor (var j = 0; j < dimension; j++)\r\n\t\t\t{\r\n\t\t\t\tif (this.isMasked(i, j))\r\n\t\t\t\t{\r\n\t\t\t\t\tbits.flip(j, i);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tthis.isMasked=function( i, j)\r\n\t{\r\n\t\treturn ((((i + j) & 0x01) + ((i * j) % 3)) & 0x01) == 0;\r\n\t}\r\n}\r\n\r\nDataMask.DATA_MASKS = new Array(new DataMask000(), new DataMask001(), new DataMask010(), new DataMask011(), new DataMask100(), new DataMask101(), new DataMask110(), new DataMask111());\r\n\r\n","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction ReedSolomonDecoder(field)\r\n{\r\n\tthis.field = field;\r\n\tthis.decode=function(received, twoS)\r\n\t{\r\n\t\t\tvar poly = new GF256Poly(this.field, received);\r\n\t\t\tvar syndromeCoefficients = new Array(twoS);\r\n\t\t\tfor(var i=0;i= b's\r\n\t\t\tif (a.Degree < b.Degree)\r\n\t\t\t{\r\n\t\t\t\tvar temp = a;\r\n\t\t\t\ta = b;\r\n\t\t\t\tb = temp;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar rLast = a;\r\n\t\t\tvar r = b;\r\n\t\t\tvar sLast = this.field.One;\r\n\t\t\tvar s = this.field.Zero;\r\n\t\t\tvar tLast = this.field.Zero;\r\n\t\t\tvar t = this.field.One;\r\n\t\t\t\r\n\t\t\t// Run Euclidean algorithm until r's degree is less than R/2\r\n\t\t\twhile (r.Degree >= Math.floor(R / 2))\r\n\t\t\t{\r\n\t\t\t\tvar rLastLast = rLast;\r\n\t\t\t\tvar sLastLast = sLast;\r\n\t\t\t\tvar tLastLast = tLast;\r\n\t\t\t\trLast = r;\r\n\t\t\t\tsLast = s;\r\n\t\t\t\ttLast = t;\r\n\t\t\t\t\r\n\t\t\t\t// Divide rLastLast by rLast, with quotient in q and remainder in r\r\n\t\t\t\tif (rLast.Zero)\r\n\t\t\t\t{\r\n\t\t\t\t\t// Oops, Euclidean algorithm already terminated?\r\n\t\t\t\t\tthrow \"r_{i-1} was zero\";\r\n\t\t\t\t}\r\n\t\t\t\tr = rLastLast;\r\n\t\t\t\tvar q = this.field.Zero;\r\n\t\t\t\tvar denominatorLeadingTerm = rLast.getCoefficient(rLast.Degree);\r\n\t\t\t\tvar dltInverse = this.field.inverse(denominatorLeadingTerm);\r\n\t\t\t\twhile (r.Degree >= rLast.Degree && !r.Zero)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar degreeDiff = r.Degree - rLast.Degree;\r\n\t\t\t\t\tvar scale = this.field.multiply(r.getCoefficient(r.Degree), dltInverse);\r\n\t\t\t\t\tq = q.addOrSubtract(this.field.buildMonomial(degreeDiff, scale));\r\n\t\t\t\t\tr = r.addOrSubtract(rLast.multiplyByMonomial(degreeDiff, scale));\r\n\t\t\t\t\t//r.EXE();\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\ts = q.multiply1(sLast).addOrSubtract(sLastLast);\r\n\t\t\t\tt = q.multiply1(tLast).addOrSubtract(tLastLast);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar sigmaTildeAtZero = t.getCoefficient(0);\r\n\t\t\tif (sigmaTildeAtZero == 0)\r\n\t\t\t{\r\n\t\t\t\tthrow \"ReedSolomonException sigmaTilde(0) was zero\";\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar inverse = this.field.inverse(sigmaTildeAtZero);\r\n\t\t\tvar sigma = t.multiply2(inverse);\r\n\t\t\tvar omega = r.multiply2(inverse);\r\n\t\t\treturn new Array(sigma, omega);\r\n\t\t}\r\n\tthis.findErrorLocations=function( errorLocator)\r\n\t\t{\r\n\t\t\t// This is a direct application of Chien's search\r\n\t\t\tvar numErrors = errorLocator.Degree;\r\n\t\t\tif (numErrors == 1)\r\n\t\t\t{\r\n\t\t\t\t// shortcut\r\n\t\t\t\treturn new Array(errorLocator.getCoefficient(1));\r\n\t\t\t}\r\n\t\t\tvar result = new Array(numErrors);\r\n\t\t\tvar e = 0;\r\n\t\t\tfor (var i = 1; i < 256 && e < numErrors; i++)\r\n\t\t\t{\r\n\t\t\t\tif (errorLocator.evaluateAt(i) == 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tresult[e] = this.field.inverse(i);\r\n\t\t\t\t\te++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (e != numErrors)\r\n\t\t\t{\r\n\t\t\t\tthrow \"Error locator degree does not match number of roots\";\r\n\t\t\t}\r\n\t\t\treturn result;\r\n\t\t}\r\n\tthis.findErrorMagnitudes=function( errorEvaluator, errorLocations, dataMatrix)\r\n\t\t{\r\n\t\t\t// This is directly applying Forney's Formula\r\n\t\t\tvar s = errorLocations.length;\r\n\t\t\tvar result = new Array(s);\r\n\t\t\tfor (var i = 0; i < s; i++)\r\n\t\t\t{\r\n\t\t\t\tvar xiInverse = this.field.inverse(errorLocations[i]);\r\n\t\t\t\tvar denominator = 1;\r\n\t\t\t\tfor (var j = 0; j < s; j++)\r\n\t\t\t\t{\r\n\t\t\t\t\tif (i != j)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tdenominator = this.field.multiply(denominator, GF256.addOrSubtract(1, this.field.multiply(errorLocations[j], xiInverse)));\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tresult[i] = this.field.multiply(errorEvaluator.evaluateAt(xiInverse), this.field.inverse(denominator));\r\n\t\t\t\t// Thanks to sanfordsquires for this fix:\r\n\t\t\t\tif (dataMatrix)\r\n\t\t\t\t{\r\n\t\t\t\t\tresult[i] = this.field.multiply(result[i], xiInverse);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn result;\r\n\t\t}\r\n}","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction GF256Poly(field, coefficients)\r\n{\r\n\tif (coefficients == null || coefficients.length == 0)\r\n\t{\r\n\t\tthrow \"System.ArgumentException\";\r\n\t}\r\n\tthis.field = field;\r\n\tvar coefficientsLength = coefficients.length;\r\n\tif (coefficientsLength > 1 && coefficients[0] == 0)\r\n\t{\r\n\t\t// Leading term must be non-zero for anything except the constant polynomial \"0\"\r\n\t\tvar firstNonZero = 1;\r\n\t\twhile (firstNonZero < coefficientsLength && coefficients[firstNonZero] == 0)\r\n\t\t{\r\n\t\t\tfirstNonZero++;\r\n\t\t}\r\n\t\tif (firstNonZero == coefficientsLength)\r\n\t\t{\r\n\t\t\tthis.coefficients = field.Zero.coefficients;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.coefficients = new Array(coefficientsLength - firstNonZero);\r\n\t\t\tfor(var i=0;i largerCoefficients.length)\r\n\t\t\t{\r\n\t\t\t\tvar temp = smallerCoefficients;\r\n\t\t\t\tsmallerCoefficients = largerCoefficients;\r\n\t\t\t\tlargerCoefficients = temp;\r\n\t\t\t}\r\n\t\t\tvar sumDiff = new Array(largerCoefficients.length);\r\n\t\t\tvar lengthDiff = largerCoefficients.length - smallerCoefficients.length;\r\n\t\t\t// Copy high-order terms only found in higher-degree polynomial's coefficients\r\n\t\t\t//Array.Copy(largerCoefficients, 0, sumDiff, 0, lengthDiff);\r\n\t\t\tfor(var ci=0;ci= other.Degree && !remainder.Zero)\r\n\t\t\t{\r\n\t\t\t\tvar degreeDifference = remainder.Degree - other.Degree;\r\n\t\t\t\tvar scale = this.field.multiply(remainder.getCoefficient(remainder.Degree), inverseDenominatorLeadingTerm);\r\n\t\t\t\tvar term = other.multiplyByMonomial(degreeDifference, scale);\r\n\t\t\t\tvar iterationQuotient = this.field.buildMonomial(degreeDifference, scale);\r\n\t\t\t\tquotient = quotient.addOrSubtract(iterationQuotient);\r\n\t\t\t\tremainder = remainder.addOrSubtract(term);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn new Array(quotient, remainder);\r\n\t\t}\r\n}","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction GF256( primitive)\r\n{\r\n\tthis.expTable = new Array(256);\r\n\tthis.logTable = new Array(256);\r\n\tvar x = 1;\r\n\tfor (var i = 0; i < 256; i++)\r\n\t{\r\n\t\tthis.expTable[i] = x;\r\n\t\tx <<= 1; // x = x * 2; we're assuming the generator alpha is 2\r\n\t\tif (x >= 0x100)\r\n\t\t{\r\n\t\t\tx ^= primitive;\r\n\t\t}\r\n\t}\r\n\tfor (var i = 0; i < 255; i++)\r\n\t{\r\n\t\tthis.logTable[this.expTable[i]] = i;\r\n\t}\r\n\t// logTable[0] == 0 but this should never be used\r\n\tvar at0=new Array(1);at0[0]=0;\r\n\tthis.zero = new GF256Poly(this, new Array(at0));\r\n\tvar at1=new Array(1);at1[0]=1;\r\n\tthis.one = new GF256Poly(this, new Array(at1));\r\n\t\r\n\tthis.__defineGetter__(\"Zero\", function()\r\n\t{\r\n\t\treturn this.zero;\r\n\t});\r\n\tthis.__defineGetter__(\"One\", function()\r\n\t{\r\n\t\treturn this.one;\r\n\t});\r\n\tthis.buildMonomial=function( degree, coefficient)\r\n\t\t{\r\n\t\t\tif (degree < 0)\r\n\t\t\t{\r\n\t\t\t\tthrow \"System.ArgumentException\";\r\n\t\t\t}\r\n\t\t\tif (coefficient == 0)\r\n\t\t\t{\r\n\t\t\t\treturn zero;\r\n\t\t\t}\r\n\t\t\tvar coefficients = new Array(degree + 1);\r\n\t\t\tfor(var i=0;iqrcode.maxImgSize)\n {\n var ir = image.width / image.height;\n nheight = Math.sqrt(qrcode.maxImgSize/ir);\n nwidth=ir*nheight;\n }\n\n canvas_qr.width = nwidth;\n canvas_qr.height = nheight;\n\n context.drawImage(image, 0, 0, canvas_qr.width, canvas_qr.height );\n qrcode.width = canvas_qr.width;\n qrcode.height = canvas_qr.height;\n try{\n qrcode.imagedata = context.getImageData(0, 0, canvas_qr.width, canvas_qr.height);\n }catch(e){\n qrcode.result = \"Cross domain Error\";\n if(qrcode.callback!=null)\n qrcode.callback(qrcode.result);\n return;\n }\n\n try\n {\n qrcode.result = qrcode.process(context);\n cb(null, qrcode.result);\n }\n catch(e)\n {\n // console.log(e);\n qrcode.result = \"Error decoding QR Code from Image\";\n cb(new Error(\"Error decoding QR Code from Image\"));\n }\n if(qrcode.callback!=null)\n qrcode.callback(qrcode.result);\n }\n image.src = src;\n }\n}\n\nqrcode.isUrl = function(s)\n{\n var regexp = /(ftp|http|https):\\/\\/(\\w+:{0,1}\\w*@)?(\\S+)(:[0-9]+)?(\\/|\\/([\\w#!:.?+=&%@!\\-\\/]))?/;\n return regexp.test(s);\n}\n\nqrcode.decode_url = function (s)\n{\n var escaped = \"\";\n try{\n escaped = escape( s );\n }\n catch(e)\n {\n // console.log(e);\n escaped = s;\n }\n var ret = \"\";\n try{\n ret = decodeURIComponent( escaped );\n }\n catch(e)\n {\n // console.log(e);\n ret = escaped;\n }\n return ret;\n}\n\nqrcode.decode_utf8 = function ( s )\n{\n if(qrcode.isUrl(s))\n return qrcode.decode_url(s);\n else\n return s;\n}\n\nqrcode.process = function(ctx){\n\n var start = new Date().getTime();\n\n var image = qrcode.grayScaleToBitmap(qrcode.grayscale());\n //var image = qrcode.binarize(128);\n\n if(qrcode.debug)\n {\n for (var y = 0; y < qrcode.height; y++)\n {\n for (var x = 0; x < qrcode.width; x++)\n {\n var point = (x * 4) + (y * qrcode.width * 4);\n qrcode.imagedata.data[point] = image[x+y*qrcode.width]?0:0;\n qrcode.imagedata.data[point+1] = image[x+y*qrcode.width]?0:0;\n qrcode.imagedata.data[point+2] = image[x+y*qrcode.width]?255:0;\n }\n }\n ctx.putImageData(qrcode.imagedata, 0, 0);\n }\n\n //var finderPatternInfo = new FinderPatternFinder().findFinderPattern(image);\n\n var detector = new Detector(image);\n\n var qRCodeMatrix = detector.detect();\n\n /*for (var y = 0; y < qRCodeMatrix.bits.Height; y++)\n {\n for (var x = 0; x < qRCodeMatrix.bits.Width; x++)\n {\n var point = (x * 4*2) + (y*2 * qrcode.width * 4);\n qrcode.imagedata.data[point] = qRCodeMatrix.bits.get_Renamed(x,y)?0:0;\n qrcode.imagedata.data[point+1] = qRCodeMatrix.bits.get_Renamed(x,y)?0:0;\n qrcode.imagedata.data[point+2] = qRCodeMatrix.bits.get_Renamed(x,y)?255:0;\n }\n }*/\n if(qrcode.debug)\n ctx.putImageData(qrcode.imagedata, 0, 0);\n\n var reader = Decoder.decode(qRCodeMatrix.bits);\n var data = reader.DataByte;\n var str=\"\";\n for(var i=0;i minmax[ax][ay][1])\n minmax[ax][ay][1] = target;\n }\n }\n //minmax[ax][ay][0] = (minmax[ax][ay][0] + minmax[ax][ay][1]) / 2;\n }\n }\n var middle = new Array(numSqrtArea);\n for (var i3 = 0; i3 < numSqrtArea; i3++)\n {\n middle[i3] = new Array(numSqrtArea);\n }\n for (var ay = 0; ay < numSqrtArea; ay++)\n {\n for (var ax = 0; ax < numSqrtArea; ax++)\n {\n middle[ax][ay] = Math.floor((minmax[ax][ay][0] + minmax[ax][ay][1]) / 2);\n //Console.out.print(middle[ax][ay] + \",\");\n }\n //Console.out.println(\"\");\n }\n //Console.out.println(\"\");\n\n return middle;\n}\n\nqrcode.grayScaleToBitmap=function(grayScale)\n{\n var middle = qrcode.getMiddleBrightnessPerArea(grayScale);\n var sqrtNumArea = middle.length;\n var areaWidth = Math.floor(qrcode.width / sqrtNumArea);\n var areaHeight = Math.floor(qrcode.height / sqrtNumArea);\n var bitmap = new Array(qrcode.height*qrcode.width);\n\n for (var ay = 0; ay < sqrtNumArea; ay++)\n {\n for (var ax = 0; ax < sqrtNumArea; ax++)\n {\n for (var dy = 0; dy < areaHeight; dy++)\n {\n for (var dx = 0; dx < areaWidth; dx++)\n {\n bitmap[areaWidth * ax + dx+ (areaHeight * ay + dy)*qrcode.width] = (grayScale[areaWidth * ax + dx+ (areaHeight * ay + dy)*qrcode.width] < middle[ax][ay])?true:false;\n }\n }\n }\n }\n return bitmap;\n}\n\nqrcode.grayscale = function(){\n var ret = new Array(qrcode.width*qrcode.height);\n for (var y = 0; y < qrcode.height; y++)\n {\n for (var x = 0; x < qrcode.width; x++)\n {\n var gray = qrcode.getPixel(x, y);\n\n ret[x+y*qrcode.width] = gray;\n }\n }\n return ret;\n}\n\n\n\n\nfunction URShift( number, bits)\n{\n if (number >= 0)\n return number >> bits;\n else\n return (number >> bits) + (2 << ~bits);\n}\n\n\nArray.prototype.remove = function(from, to) {\n var rest = this.slice((to || from) + 1 || this.length);\n this.length = from < 0 ? this.length + from : from;\n return this.push.apply(this, rest);\n};\n","/*\n Ported to JavaScript by Lazar Laszlo 2011\n\n lazarsoft@gmail.com, www.lazarsoft.info\n\n*/\n\n/*\n*\n* Copyright 2007 ZXing authors\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n\nvar MIN_SKIP = 3;\nvar MAX_MODULES = 57;\nvar INTEGER_MATH_SHIFT = 8;\nvar CENTER_QUORUM = 2;\n\nqrcode.orderBestPatterns=function(patterns)\n\t\t{\n\n\t\t\tfunction distance( pattern1, pattern2)\n\t\t\t{\n\t\t\t\txDiff = pattern1.X - pattern2.X;\n\t\t\t\tyDiff = pattern1.Y - pattern2.Y;\n\t\t\t\treturn Math.sqrt( (xDiff * xDiff + yDiff * yDiff));\n\t\t\t}\n\n\t\t\t/// Returns the z component of the cross product between vectors BC and BA.\n\t\t\tfunction crossProductZ( pointA, pointB, pointC)\n\t\t\t{\n\t\t\t\tvar bX = pointB.x;\n\t\t\t\tvar bY = pointB.y;\n\t\t\t\treturn ((pointC.x - bX) * (pointA.y - bY)) - ((pointC.y - bY) * (pointA.x - bX));\n\t\t\t}\n\n\n\t\t\t// Find distances between pattern centers\n\t\t\tvar zeroOneDistance = distance(patterns[0], patterns[1]);\n\t\t\tvar oneTwoDistance = distance(patterns[1], patterns[2]);\n\t\t\tvar zeroTwoDistance = distance(patterns[0], patterns[2]);\n\n\t\t\tvar pointA, pointB, pointC;\n\t\t\t// Assume one closest to other two is B; A and C will just be guesses at first\n\t\t\tif (oneTwoDistance >= zeroOneDistance && oneTwoDistance >= zeroTwoDistance)\n\t\t\t{\n\t\t\t\tpointB = patterns[0];\n\t\t\t\tpointA = patterns[1];\n\t\t\t\tpointC = patterns[2];\n\t\t\t}\n\t\t\telse if (zeroTwoDistance >= oneTwoDistance && zeroTwoDistance >= zeroOneDistance)\n\t\t\t{\n\t\t\t\tpointB = patterns[1];\n\t\t\t\tpointA = patterns[0];\n\t\t\t\tpointC = patterns[2];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tpointB = patterns[2];\n\t\t\t\tpointA = patterns[0];\n\t\t\t\tpointC = patterns[1];\n\t\t\t}\n\n\t\t\t// Use cross product to figure out whether A and C are correct or flipped.\n\t\t\t// This asks whether BC x BA has a positive z component, which is the arrangement\n\t\t\t// we want for A, B, C. If it's negative, then we've got it flipped around and\n\t\t\t// should swap A and C.\n\t\t\tif (crossProductZ(pointA, pointB, pointC) < 0.0)\n\t\t\t{\n\t\t\t\tvar temp = pointA;\n\t\t\t\tpointA = pointC;\n\t\t\t\tpointC = temp;\n\t\t\t}\n\n\t\t\tpatterns[0] = pointA;\n\t\t\tpatterns[1] = pointB;\n\t\t\tpatterns[2] = pointC;\n\t\t}\n\n\nfunction FinderPattern(posX, posY, estimatedModuleSize)\n{\n\tthis.x=posX;\n\tthis.y=posY;\n\tthis.count = 1;\n\tthis.estimatedModuleSize = estimatedModuleSize;\n\n\tthis.__defineGetter__(\"EstimatedModuleSize\", function()\n\t{\n\t\treturn this.estimatedModuleSize;\n\t});\n\tthis.__defineGetter__(\"Count\", function()\n\t{\n\t\treturn this.count;\n\t});\n\tthis.__defineGetter__(\"X\", function()\n\t{\n\t\treturn this.x;\n\t});\n\tthis.__defineGetter__(\"Y\", function()\n\t{\n\t\treturn this.y;\n\t});\n\tthis.incrementCount = function()\n\t{\n\t\tthis.count++;\n\t}\n\tthis.aboutEquals=function( moduleSize, i, j)\n\t\t{\n\t\t\tif (Math.abs(i - this.y) <= moduleSize && Math.abs(j - this.x) <= moduleSize)\n\t\t\t{\n\t\t\t\tvar moduleSizeDiff = Math.abs(moduleSize - this.estimatedModuleSize);\n\t\t\t\treturn moduleSizeDiff <= 1.0 || moduleSizeDiff / this.estimatedModuleSize <= 1.0;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n}\n\nfunction FinderPatternInfo(patternCenters)\n{\n\tthis.bottomLeft = patternCenters[0];\n\tthis.topLeft = patternCenters[1];\n\tthis.topRight = patternCenters[2];\n\tthis.__defineGetter__(\"BottomLeft\", function()\n\t{\n\t\treturn this.bottomLeft;\n\t});\n\tthis.__defineGetter__(\"TopLeft\", function()\n\t{\n\t\treturn this.topLeft;\n\t});\n\tthis.__defineGetter__(\"TopRight\", function()\n\t{\n\t\treturn this.topRight;\n\t});\n}\n\nfunction FinderPatternFinder()\n{\n\tthis.image=null;\n\tthis.possibleCenters = [];\n\tthis.hasSkipped = false;\n\tthis.crossCheckStateCount = new Array(0,0,0,0,0);\n\tthis.resultPointCallback = null;\n\n\tthis.__defineGetter__(\"CrossCheckStateCount\", function()\n\t{\n\t\tthis.crossCheckStateCount[0] = 0;\n\t\tthis.crossCheckStateCount[1] = 0;\n\t\tthis.crossCheckStateCount[2] = 0;\n\t\tthis.crossCheckStateCount[3] = 0;\n\t\tthis.crossCheckStateCount[4] = 0;\n\t\treturn this.crossCheckStateCount;\n\t});\n\n\tthis.foundPatternCross=function( stateCount)\n\t\t{\n\t\t\tvar totalModuleSize = 0;\n\t\t\tfor (var i = 0; i < 5; i++)\n\t\t\t{\n\t\t\t\tvar count = stateCount[i];\n\t\t\t\tif (count == 0)\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\ttotalModuleSize += count;\n\t\t\t}\n\t\t\tif (totalModuleSize < 7)\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tvar moduleSize = Math.floor((totalModuleSize << INTEGER_MATH_SHIFT) / 7);\n\t\t\tvar maxVariance = Math.floor(moduleSize / 2);\n\t\t\t// Allow less than 50% variance from 1-1-3-1-1 proportions\n\t\t\treturn Math.abs(moduleSize - (stateCount[0] << INTEGER_MATH_SHIFT)) < maxVariance && Math.abs(moduleSize - (stateCount[1] << INTEGER_MATH_SHIFT)) < maxVariance && Math.abs(3 * moduleSize - (stateCount[2] << INTEGER_MATH_SHIFT)) < 3 * maxVariance && Math.abs(moduleSize - (stateCount[3] << INTEGER_MATH_SHIFT)) < maxVariance && Math.abs(moduleSize - (stateCount[4] << INTEGER_MATH_SHIFT)) < maxVariance;\n\t\t}\n\tthis.centerFromEnd=function( stateCount, end)\n\t\t{\n\t\t\treturn (end - stateCount[4] - stateCount[3]) - stateCount[2] / 2.0;\n\t\t}\n\tthis.crossCheckVertical=function( startI, centerJ, maxCount, originalStateCountTotal)\n\t\t{\n\t\t\tvar image = this.image;\n\n\t\t\tvar maxI = qrcode.height;\n\t\t\tvar stateCount = this.CrossCheckStateCount;\n\n\t\t\t// Start counting up from center\n\t\t\tvar i = startI;\n\t\t\twhile (i >= 0 && image[centerJ + i*qrcode.width])\n\t\t\t{\n\t\t\t\tstateCount[2]++;\n\t\t\t\ti--;\n\t\t\t}\n\t\t\tif (i < 0)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\t\t\twhile (i >= 0 && !image[centerJ +i*qrcode.width] && stateCount[1] <= maxCount)\n\t\t\t{\n\t\t\t\tstateCount[1]++;\n\t\t\t\ti--;\n\t\t\t}\n\t\t\t// If already too many modules in this state or ran off the edge:\n\t\t\tif (i < 0 || stateCount[1] > maxCount)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\t\t\twhile (i >= 0 && image[centerJ + i*qrcode.width] && stateCount[0] <= maxCount)\n\t\t\t{\n\t\t\t\tstateCount[0]++;\n\t\t\t\ti--;\n\t\t\t}\n\t\t\tif (stateCount[0] > maxCount)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\n\t\t\t// Now also count down from center\n\t\t\ti = startI + 1;\n\t\t\twhile (i < maxI && image[centerJ +i*qrcode.width])\n\t\t\t{\n\t\t\t\tstateCount[2]++;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tif (i == maxI)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\t\t\twhile (i < maxI && !image[centerJ + i*qrcode.width] && stateCount[3] < maxCount)\n\t\t\t{\n\t\t\t\tstateCount[3]++;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tif (i == maxI || stateCount[3] >= maxCount)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\t\t\twhile (i < maxI && image[centerJ + i*qrcode.width] && stateCount[4] < maxCount)\n\t\t\t{\n\t\t\t\tstateCount[4]++;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tif (stateCount[4] >= maxCount)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\n\t\t\t// If we found a finder-pattern-like section, but its size is more than 40% different than\n\t\t\t// the original, assume it's a false positive\n\t\t\tvar stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];\n\t\t\tif (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= 2 * originalStateCountTotal)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\n\t\t\treturn this.foundPatternCross(stateCount)?this.centerFromEnd(stateCount, i):NaN;\n\t\t}\n\tthis.crossCheckHorizontal=function( startJ, centerI, maxCount, originalStateCountTotal)\n\t\t{\n\t\t\tvar image = this.image;\n\n\t\t\tvar maxJ = qrcode.width;\n\t\t\tvar stateCount = this.CrossCheckStateCount;\n\n\t\t\tvar j = startJ;\n\t\t\twhile (j >= 0 && image[j+ centerI*qrcode.width])\n\t\t\t{\n\t\t\t\tstateCount[2]++;\n\t\t\t\tj--;\n\t\t\t}\n\t\t\tif (j < 0)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\t\t\twhile (j >= 0 && !image[j+ centerI*qrcode.width] && stateCount[1] <= maxCount)\n\t\t\t{\n\t\t\t\tstateCount[1]++;\n\t\t\t\tj--;\n\t\t\t}\n\t\t\tif (j < 0 || stateCount[1] > maxCount)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\t\t\twhile (j >= 0 && image[j+ centerI*qrcode.width] && stateCount[0] <= maxCount)\n\t\t\t{\n\t\t\t\tstateCount[0]++;\n\t\t\t\tj--;\n\t\t\t}\n\t\t\tif (stateCount[0] > maxCount)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\n\t\t\tj = startJ + 1;\n\t\t\twhile (j < maxJ && image[j+ centerI*qrcode.width])\n\t\t\t{\n\t\t\t\tstateCount[2]++;\n\t\t\t\tj++;\n\t\t\t}\n\t\t\tif (j == maxJ)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\t\t\twhile (j < maxJ && !image[j+ centerI*qrcode.width] && stateCount[3] < maxCount)\n\t\t\t{\n\t\t\t\tstateCount[3]++;\n\t\t\t\tj++;\n\t\t\t}\n\t\t\tif (j == maxJ || stateCount[3] >= maxCount)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\t\t\twhile (j < maxJ && image[j+ centerI*qrcode.width] && stateCount[4] < maxCount)\n\t\t\t{\n\t\t\t\tstateCount[4]++;\n\t\t\t\tj++;\n\t\t\t}\n\t\t\tif (stateCount[4] >= maxCount)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\n\t\t\t// If we found a finder-pattern-like section, but its size is significantly different than\n\t\t\t// the original, assume it's a false positive\n\t\t\tvar stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];\n\t\t\tif (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= originalStateCountTotal)\n\t\t\t{\n\t\t\t\treturn NaN;\n\t\t\t}\n\n\t\t\treturn this.foundPatternCross(stateCount)?this.centerFromEnd(stateCount, j):NaN;\n\t\t}\n\tthis.handlePossibleCenter=function( stateCount, i, j)\n\t\t{\n\t\t\tvar stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];\n\t\t\tvar centerJ = this.centerFromEnd(stateCount, j); //float\n\t\t\tvar centerI = this.crossCheckVertical(i, Math.floor( centerJ), stateCount[2], stateCountTotal); //float\n\t\t\tif (!isNaN(centerI))\n\t\t\t{\n\t\t\t\t// Re-cross check\n\t\t\t\tcenterJ = this.crossCheckHorizontal(Math.floor( centerJ), Math.floor( centerI), stateCount[2], stateCountTotal);\n\t\t\t\tif (!isNaN(centerJ))\n\t\t\t\t{\n\t\t\t\t\tvar estimatedModuleSize = stateCountTotal / 7.0;\n\t\t\t\t\tvar found = false;\n\t\t\t\t\tvar max = this.possibleCenters.length;\n\t\t\t\t\tfor (var index = 0; index < max; index++)\n\t\t\t\t\t{\n\t\t\t\t\t\tvar center = this.possibleCenters[index];\n\t\t\t\t\t\t// Look for about the same center and module size:\n\t\t\t\t\t\tif (center.aboutEquals(estimatedModuleSize, centerI, centerJ))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcenter.incrementCount();\n\t\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!found)\n\t\t\t\t\t{\n\t\t\t\t\t\tvar point = new FinderPattern(centerJ, centerI, estimatedModuleSize);\n\t\t\t\t\t\tthis.possibleCenters.push(point);\n\t\t\t\t\t\tif (this.resultPointCallback != null)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tthis.resultPointCallback.foundPossibleResultPoint(point);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\tthis.selectBestPatterns=function()\n\t\t{\n\n\t\t\tvar startSize = this.possibleCenters.length;\n\t\t\tif (startSize < 3)\n\t\t\t{\n\t\t\t\t// Couldn't find enough finder patterns\n\t\t\t\tthrow \"Couldn't find enough finder patterns\";\n\t\t\t}\n\n\t\t\t// Filter outlier possibilities whose module size is too different\n\t\t\tif (startSize > 3)\n\t\t\t{\n\t\t\t\t// But we can only afford to do so if we have at least 4 possibilities to choose from\n\t\t\t\tvar totalModuleSize = 0.0;\n var square = 0.0;\n\t\t\t\tfor (var i = 0; i < startSize; i++)\n\t\t\t\t{\n\t\t\t\t\t//totalModuleSize += this.possibleCenters[i].EstimatedModuleSize;\n var\tcenterValue=this.possibleCenters[i].EstimatedModuleSize;\n\t\t\t\t\ttotalModuleSize += centerValue;\n\t\t\t\t\tsquare += (centerValue * centerValue);\n\t\t\t\t}\n\t\t\t\tvar average = totalModuleSize / startSize;\n this.possibleCenters.sort(function(center1,center2) {\n\t\t\t\t var dA=Math.abs(center2.EstimatedModuleSize - average);\n\t\t\t\t var dB=Math.abs(center1.EstimatedModuleSize - average);\n\t\t\t\t if (dA < dB) {\n\t\t\t\t \t return (-1);\n\t\t\t\t } else if (dA == dB) {\n\t\t\t\t \t return 0;\n\t\t\t\t } else {\n\t\t\t\t \t return 1;\n\t\t\t\t }\n\t\t\t\t\t});\n\n\t\t\t\tvar stdDev = Math.sqrt(square / startSize - average * average);\n\t\t\t\tvar limit = Math.max(0.2 * average, stdDev);\n\t\t\t\tfor (var i = 0; i < this.possibleCenters.length && this.possibleCenters.length > 3; i++)\n\t\t\t\t{\n\t\t\t\t\tvar pattern = this.possibleCenters[i];\n\t\t\t\t\t//if (Math.abs(pattern.EstimatedModuleSize - average) > 0.2 * average)\n if (Math.abs(pattern.EstimatedModuleSize - average) > limit)\n\t\t\t\t\t{\n\t\t\t\t\t\tthis.possibleCenters.remove(i);\n\t\t\t\t\t\ti--;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.possibleCenters.length > 3)\n\t\t\t{\n\t\t\t\t// Throw away all but those first size candidate points we found.\n\t\t\t\tthis.possibleCenters.sort(function(a, b){\n\t\t\t\t\tif (a.count > b.count){return -1;}\n\t\t\t\t\tif (a.count < b.count){return 1;}\n\t\t\t\t\treturn 0;\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn new Array( this.possibleCenters[0], this.possibleCenters[1], this.possibleCenters[2]);\n\t\t}\n\n\tthis.findRowSkip=function()\n\t\t{\n\t\t\tvar max = this.possibleCenters.length;\n\t\t\tif (max <= 1)\n\t\t\t{\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tvar firstConfirmedCenter = null;\n\t\t\tfor (var i = 0; i < max; i++)\n\t\t\t{\n\t\t\t\tvar center = this.possibleCenters[i];\n\t\t\t\tif (center.Count >= CENTER_QUORUM)\n\t\t\t\t{\n\t\t\t\t\tif (firstConfirmedCenter == null)\n\t\t\t\t\t{\n\t\t\t\t\t\tfirstConfirmedCenter = center;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t// We have two confirmed centers\n\t\t\t\t\t\t// How far down can we skip before resuming looking for the next\n\t\t\t\t\t\t// pattern? In the worst case, only the difference between the\n\t\t\t\t\t\t// difference in the x / y coordinates of the two centers.\n\t\t\t\t\t\t// This is the case where you find top left last.\n\t\t\t\t\t\tthis.hasSkipped = true;\n\t\t\t\t\t\treturn Math.floor ((Math.abs(firstConfirmedCenter.X - center.X) - Math.abs(firstConfirmedCenter.Y - center.Y)) / 2);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn 0;\n\t\t}\n\n\tthis.haveMultiplyConfirmedCenters=function()\n\t\t{\n\t\t\tvar confirmedCount = 0;\n\t\t\tvar totalModuleSize = 0.0;\n\t\t\tvar max = this.possibleCenters.length;\n\t\t\tfor (var i = 0; i < max; i++)\n\t\t\t{\n\t\t\t\tvar pattern = this.possibleCenters[i];\n\t\t\t\tif (pattern.Count >= CENTER_QUORUM)\n\t\t\t\t{\n\t\t\t\t\tconfirmedCount++;\n\t\t\t\t\ttotalModuleSize += pattern.EstimatedModuleSize;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (confirmedCount < 3)\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t// OK, we have at least 3 confirmed centers, but, it's possible that one is a \"false positive\"\n\t\t\t// and that we need to keep looking. We detect this by asking if the estimated module sizes\n\t\t\t// vary too much. We arbitrarily say that when the total deviation from average exceeds\n\t\t\t// 5% of the total module size estimates, it's too much.\n\t\t\tvar average = totalModuleSize / max;\n\t\t\tvar totalDeviation = 0.0;\n\t\t\tfor (var i = 0; i < max; i++)\n\t\t\t{\n\t\t\t\tpattern = this.possibleCenters[i];\n\t\t\t\ttotalDeviation += Math.abs(pattern.EstimatedModuleSize - average);\n\t\t\t}\n\t\t\treturn totalDeviation <= 0.05 * totalModuleSize;\n\t\t}\n\n\tthis.findFinderPattern = function(image){\n\t\tvar tryHarder = false;\n\t\tthis.image=image;\n\t\tvar maxI = qrcode.height;\n\t\tvar maxJ = qrcode.width;\n\t\tvar iSkip = Math.floor((3 * maxI) / (4 * MAX_MODULES));\n\t\tif (iSkip < MIN_SKIP || tryHarder)\n\t\t{\n\t\t\t\tiSkip = MIN_SKIP;\n\t\t}\n\n\t\tvar done = false;\n\t\tvar stateCount = new Array(5);\n\t\tfor (var i = iSkip - 1; i < maxI && !done; i += iSkip)\n\t\t{\n\t\t\t// Get a row of black/white values\n\t\t\tstateCount[0] = 0;\n\t\t\tstateCount[1] = 0;\n\t\t\tstateCount[2] = 0;\n\t\t\tstateCount[3] = 0;\n\t\t\tstateCount[4] = 0;\n\t\t\tvar currentState = 0;\n\t\t\tfor (var j = 0; j < maxJ; j++)\n\t\t\t{\n\t\t\t\tif (image[j+i*qrcode.width] )\n\t\t\t\t{\n\t\t\t\t\t// Black pixel\n\t\t\t\t\tif ((currentState & 1) == 1)\n\t\t\t\t\t{\n\t\t\t\t\t\t// Counting white pixels\n\t\t\t\t\t\tcurrentState++;\n\t\t\t\t\t}\n\t\t\t\t\tstateCount[currentState]++;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// White pixel\n\t\t\t\t\tif ((currentState & 1) == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\t// Counting black pixels\n\t\t\t\t\t\tif (currentState == 4)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// A winner?\n\t\t\t\t\t\t\tif (this.foundPatternCross(stateCount))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t// Yes\n\t\t\t\t\t\t\t\tvar confirmed = this.handlePossibleCenter(stateCount, i, j);\n\t\t\t\t\t\t\t\tif (confirmed)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t// Start examining every other line. Checking each line turned out to be too\n\t\t\t\t\t\t\t\t\t// expensive and didn't improve performance.\n\t\t\t\t\t\t\t\t\tiSkip = 2;\n\t\t\t\t\t\t\t\t\tif (this.hasSkipped)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tdone = this.haveMultiplyConfirmedCenters();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tvar rowSkip = this.findRowSkip();\n\t\t\t\t\t\t\t\t\t\tif (rowSkip > stateCount[2])\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t// Skip rows between row of lower confirmed center\n\t\t\t\t\t\t\t\t\t\t\t// and top of presumed third confirmed center\n\t\t\t\t\t\t\t\t\t\t\t// but back up a bit to get a full chance of detecting\n\t\t\t\t\t\t\t\t\t\t\t// it, entire width of center of finder pattern\n\n\t\t\t\t\t\t\t\t\t\t\t// Skip by rowSkip, but back off by stateCount[2] (size of last center\n\t\t\t\t\t\t\t\t\t\t\t// of pattern we saw) to be conservative, and also back off by iSkip which\n\t\t\t\t\t\t\t\t\t\t\t// is about to be re-added\n\t\t\t\t\t\t\t\t\t\t\ti += rowSkip - stateCount[2] - iSkip;\n\t\t\t\t\t\t\t\t\t\t\tj = maxJ - 1;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t// Advance to next black pixel\n\t\t\t\t\t\t\t\t\tdo\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tj++;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\twhile (j < maxJ && !image[j + i*qrcode.width]);\n\t\t\t\t\t\t\t\t\tj--; // back up to that last white pixel\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Clear state to start looking again\n\t\t\t\t\t\t\t\tcurrentState = 0;\n\t\t\t\t\t\t\t\tstateCount[0] = 0;\n\t\t\t\t\t\t\t\tstateCount[1] = 0;\n\t\t\t\t\t\t\t\tstateCount[2] = 0;\n\t\t\t\t\t\t\t\tstateCount[3] = 0;\n\t\t\t\t\t\t\t\tstateCount[4] = 0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t// No, shift counts back by two\n\t\t\t\t\t\t\t\tstateCount[0] = stateCount[2];\n\t\t\t\t\t\t\t\tstateCount[1] = stateCount[3];\n\t\t\t\t\t\t\t\tstateCount[2] = stateCount[4];\n\t\t\t\t\t\t\t\tstateCount[3] = 1;\n\t\t\t\t\t\t\t\tstateCount[4] = 0;\n\t\t\t\t\t\t\t\tcurrentState = 3;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstateCount[++currentState]++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t// Counting white pixels\n\t\t\t\t\t\tstateCount[currentState]++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this.foundPatternCross(stateCount))\n\t\t\t{\n\t\t\t\tvar confirmed = this.handlePossibleCenter(stateCount, i, maxJ);\n\t\t\t\tif (confirmed)\n\t\t\t\t{\n\t\t\t\t\tiSkip = stateCount[0];\n\t\t\t\t\tif (this.hasSkipped)\n\t\t\t\t\t{\n\t\t\t\t\t\t// Found a third one\n\t\t\t\t\t\tdone = haveMultiplyConfirmedCenters();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvar patternInfo = this.selectBestPatterns();\n\t\tqrcode.orderBestPatterns(patternInfo);\n\n\t\treturn new FinderPatternInfo(patternInfo);\n\t};\n}\n","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction AlignmentPattern(posX, posY, estimatedModuleSize)\r\n{\r\n\tthis.x=posX;\r\n\tthis.y=posY;\r\n\tthis.count = 1;\r\n\tthis.estimatedModuleSize = estimatedModuleSize;\r\n\t\r\n\tthis.__defineGetter__(\"EstimatedModuleSize\", function()\r\n\t{\r\n\t\treturn this.estimatedModuleSize;\r\n\t}); \r\n\tthis.__defineGetter__(\"Count\", function()\r\n\t{\r\n\t\treturn this.count;\r\n\t});\r\n\tthis.__defineGetter__(\"X\", function()\r\n\t{\r\n\t\treturn Math.floor(this.x);\r\n\t});\r\n\tthis.__defineGetter__(\"Y\", function()\r\n\t{\r\n\t\treturn Math.floor(this.y);\r\n\t});\r\n\tthis.incrementCount = function()\r\n\t{\r\n\t\tthis.count++;\r\n\t}\r\n\tthis.aboutEquals=function( moduleSize, i, j)\r\n\t\t{\r\n\t\t\tif (Math.abs(i - this.y) <= moduleSize && Math.abs(j - this.x) <= moduleSize)\r\n\t\t\t{\r\n\t\t\t\tvar moduleSizeDiff = Math.abs(moduleSize - this.estimatedModuleSize);\r\n\t\t\t\treturn moduleSizeDiff <= 1.0 || moduleSizeDiff / this.estimatedModuleSize <= 1.0;\r\n\t\t\t}\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\r\n}\r\n\r\nfunction AlignmentPatternFinder( image, startX, startY, width, height, moduleSize, resultPointCallback)\r\n{\r\n\tthis.image = image;\r\n\tthis.possibleCenters = new Array();\r\n\tthis.startX = startX;\r\n\tthis.startY = startY;\r\n\tthis.width = width;\r\n\tthis.height = height;\r\n\tthis.moduleSize = moduleSize;\r\n\tthis.crossCheckStateCount = new Array(0,0,0);\r\n\tthis.resultPointCallback = resultPointCallback;\r\n\t\r\n\tthis.centerFromEnd=function(stateCount, end)\r\n\t\t{\r\n\t\t\treturn (end - stateCount[2]) - stateCount[1] / 2.0;\r\n\t\t}\r\n\tthis.foundPatternCross = function(stateCount)\r\n\t\t{\r\n\t\t\tvar moduleSize = this.moduleSize;\r\n\t\t\tvar maxVariance = moduleSize / 2.0;\r\n\t\t\tfor (var i = 0; i < 3; i++)\r\n\t\t\t{\r\n\t\t\t\tif (Math.abs(moduleSize - stateCount[i]) >= maxVariance)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\tthis.crossCheckVertical=function( startI, centerJ, maxCount, originalStateCountTotal)\r\n\t\t{\r\n\t\t\tvar image = this.image;\r\n\t\t\t\r\n\t\t\tvar maxI = qrcode.height;\r\n\t\t\tvar stateCount = this.crossCheckStateCount;\r\n\t\t\tstateCount[0] = 0;\r\n\t\t\tstateCount[1] = 0;\r\n\t\t\tstateCount[2] = 0;\r\n\t\t\t\r\n\t\t\t// Start counting up from center\r\n\t\t\tvar i = startI;\r\n\t\t\twhile (i >= 0 && image[centerJ + i*qrcode.width] && stateCount[1] <= maxCount)\r\n\t\t\t{\r\n\t\t\t\tstateCount[1]++;\r\n\t\t\t\ti--;\r\n\t\t\t}\r\n\t\t\t// If already too many modules in this state or ran off the edge:\r\n\t\t\tif (i < 0 || stateCount[1] > maxCount)\r\n\t\t\t{\r\n\t\t\t\treturn NaN;\r\n\t\t\t}\r\n\t\t\twhile (i >= 0 && !image[centerJ + i*qrcode.width] && stateCount[0] <= maxCount)\r\n\t\t\t{\r\n\t\t\t\tstateCount[0]++;\r\n\t\t\t\ti--;\r\n\t\t\t}\r\n\t\t\tif (stateCount[0] > maxCount)\r\n\t\t\t{\r\n\t\t\t\treturn NaN;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Now also count down from center\r\n\t\t\ti = startI + 1;\r\n\t\t\twhile (i < maxI && image[centerJ + i*qrcode.width] && stateCount[1] <= maxCount)\r\n\t\t\t{\r\n\t\t\t\tstateCount[1]++;\r\n\t\t\t\ti++;\r\n\t\t\t}\r\n\t\t\tif (i == maxI || stateCount[1] > maxCount)\r\n\t\t\t{\r\n\t\t\t\treturn NaN;\r\n\t\t\t}\r\n\t\t\twhile (i < maxI && !image[centerJ + i*qrcode.width] && stateCount[2] <= maxCount)\r\n\t\t\t{\r\n\t\t\t\tstateCount[2]++;\r\n\t\t\t\ti++;\r\n\t\t\t}\r\n\t\t\tif (stateCount[2] > maxCount)\r\n\t\t\t{\r\n\t\t\t\treturn NaN;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2];\r\n\t\t\tif (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= 2 * originalStateCountTotal)\r\n\t\t\t{\r\n\t\t\t\treturn NaN;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn this.foundPatternCross(stateCount)?this.centerFromEnd(stateCount, i):NaN;\r\n\t\t}\r\n\t\t\r\n\tthis.handlePossibleCenter=function( stateCount, i, j)\r\n\t\t{\r\n\t\t\tvar stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2];\r\n\t\t\tvar centerJ = this.centerFromEnd(stateCount, j);\r\n\t\t\tvar centerI = this.crossCheckVertical(i, Math.floor (centerJ), 2 * stateCount[1], stateCountTotal);\r\n\t\t\tif (!isNaN(centerI))\r\n\t\t\t{\r\n\t\t\t\tvar estimatedModuleSize = (stateCount[0] + stateCount[1] + stateCount[2]) / 3.0;\r\n\t\t\t\tvar max = this.possibleCenters.length;\r\n\t\t\t\tfor (var index = 0; index < max; index++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar center = this.possibleCenters[index];\r\n\t\t\t\t\t// Look for about the same center and module size:\r\n\t\t\t\t\tif (center.aboutEquals(estimatedModuleSize, centerI, centerJ))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\treturn new AlignmentPattern(centerJ, centerI, estimatedModuleSize);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t// Hadn't found this before; save it\r\n\t\t\t\tvar point = new AlignmentPattern(centerJ, centerI, estimatedModuleSize);\r\n\t\t\t\tthis.possibleCenters.push(point);\r\n\t\t\t\tif (this.resultPointCallback != null)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.resultPointCallback.foundPossibleResultPoint(point);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\t\r\n\tthis.find = function()\r\n\t{\r\n\t\t\tvar startX = this.startX;\r\n\t\t\tvar height = this.height;\r\n\t\t\tvar maxJ = startX + width;\r\n\t\t\tvar middleI = startY + (height >> 1);\r\n\t\t\t// We are looking for black/white/black modules in 1:1:1 ratio;\r\n\t\t\t// this tracks the number of black/white/black modules seen so far\r\n\t\t\tvar stateCount = new Array(0,0,0);\r\n\t\t\tfor (var iGen = 0; iGen < height; iGen++)\r\n\t\t\t{\r\n\t\t\t\t// Search from middle outwards\r\n\t\t\t\tvar i = middleI + ((iGen & 0x01) == 0?((iGen + 1) >> 1):- ((iGen + 1) >> 1));\r\n\t\t\t\tstateCount[0] = 0;\r\n\t\t\t\tstateCount[1] = 0;\r\n\t\t\t\tstateCount[2] = 0;\r\n\t\t\t\tvar j = startX;\r\n\t\t\t\t// Burn off leading white pixels before anything else; if we start in the middle of\r\n\t\t\t\t// a white run, it doesn't make sense to count its length, since we don't know if the\r\n\t\t\t\t// white run continued to the left of the start point\r\n\t\t\t\twhile (j < maxJ && !image[j + qrcode.width* i])\r\n\t\t\t\t{\r\n\t\t\t\t\tj++;\r\n\t\t\t\t}\r\n\t\t\t\tvar currentState = 0;\r\n\t\t\t\twhile (j < maxJ)\r\n\t\t\t\t{\r\n\t\t\t\t\tif (image[j + i*qrcode.width])\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// Black pixel\r\n\t\t\t\t\t\tif (currentState == 1)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t// Counting black pixels\r\n\t\t\t\t\t\t\tstateCount[currentState]++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t// Counting white pixels\r\n\t\t\t\t\t\t\tif (currentState == 2)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t// A winner?\r\n\t\t\t\t\t\t\t\tif (this.foundPatternCross(stateCount))\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t// Yes\r\n\t\t\t\t\t\t\t\t\tvar confirmed = this.handlePossibleCenter(stateCount, i, j);\r\n\t\t\t\t\t\t\t\t\tif (confirmed != null)\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\treturn confirmed;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tstateCount[0] = stateCount[2];\r\n\t\t\t\t\t\t\t\tstateCount[1] = 1;\r\n\t\t\t\t\t\t\t\tstateCount[2] = 0;\r\n\t\t\t\t\t\t\t\tcurrentState = 1;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tstateCount[++currentState]++;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// White pixel\r\n\t\t\t\t\t\tif (currentState == 1)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t// Counting black pixels\r\n\t\t\t\t\t\t\tcurrentState++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tstateCount[currentState]++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tj++;\r\n\t\t\t\t}\r\n\t\t\t\tif (this.foundPatternCross(stateCount))\r\n\t\t\t\t{\r\n\t\t\t\t\tvar confirmed = this.handlePossibleCenter(stateCount, i, maxJ);\r\n\t\t\t\t\tif (confirmed != null)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\treturn confirmed;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// Hmm, nothing we saw was observed and confirmed twice. If we had\r\n\t\t\t// any guess at all, return it.\r\n\t\t\tif (!(this.possibleCenters.length == 0))\r\n\t\t\t{\r\n\t\t\t\treturn this.possibleCenters[0];\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tthrow \"Couldn't find enough alignment patterns\";\r\n\t\t}\r\n\t\r\n}","/*\r\n Ported to JavaScript by Lazar Laszlo 2011 \r\n \r\n lazarsoft@gmail.com, www.lazarsoft.info\r\n \r\n*/\r\n\r\n/*\r\n*\r\n* Copyright 2007 ZXing authors\r\n*\r\n* Licensed under the Apache License, Version 2.0 (the \"License\");\r\n* you may not use this file except in compliance with the License.\r\n* You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing, software\r\n* distributed under the License is distributed on an \"AS IS\" BASIS,\r\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n* See the License for the specific language governing permissions and\r\n* limitations under the License.\r\n*/\r\n\r\n\r\nfunction QRCodeDataBlockReader(blocks, version, numErrorCorrectionCode)\r\n{\r\n\tthis.blockPointer = 0;\r\n\tthis.bitPointer = 7;\r\n\tthis.dataLength = 0;\r\n\tthis.blocks = blocks;\r\n\tthis.numErrorCorrectionCode = numErrorCorrectionCode;\r\n\tif (version <= 9)\r\n\t\tthis.dataLengthMode = 0;\r\n\telse if (version >= 10 && version <= 26)\r\n\t\tthis.dataLengthMode = 1;\r\n\telse if (version >= 27 && version <= 40)\r\n\t\tthis.dataLengthMode = 2;\r\n\t\t\r\n\tthis.getNextBits = function( numBits)\r\n\t\t{\t\t\t\r\n\t\t\tvar bits = 0;\r\n\t\t\tif (numBits < this.bitPointer + 1)\r\n\t\t\t{\r\n\t\t\t\t// next word fits into current data block\r\n\t\t\t\tvar mask = 0;\r\n\t\t\t\tfor (var i = 0; i < numBits; i++)\r\n\t\t\t\t{\r\n\t\t\t\t\tmask += (1 << i);\r\n\t\t\t\t}\r\n\t\t\t\tmask <<= (this.bitPointer - numBits + 1);\r\n\t\t\t\t\r\n\t\t\t\tbits = (this.blocks[this.blockPointer] & mask) >> (this.bitPointer - numBits + 1);\r\n\t\t\t\tthis.bitPointer -= numBits;\r\n\t\t\t\treturn bits;\r\n\t\t\t}\r\n\t\t\telse if (numBits < this.bitPointer + 1 + 8)\r\n\t\t\t{\r\n\t\t\t\t// next word crosses 2 data blocks\r\n\t\t\t\tvar mask1 = 0;\r\n\t\t\t\tfor (var i = 0; i < this.bitPointer + 1; i++)\r\n\t\t\t\t{\r\n\t\t\t\t\tmask1 += (1 << i);\r\n\t\t\t\t}\r\n\t\t\t\tbits = (this.blocks[this.blockPointer] & mask1) << (numBits - (this.bitPointer + 1));\r\n this.blockPointer++;\r\n\t\t\t\tbits += ((this.blocks[this.blockPointer]) >> (8 - (numBits - (this.bitPointer + 1))));\r\n\t\t\t\t\r\n\t\t\t\tthis.bitPointer = this.bitPointer - numBits % 8;\r\n\t\t\t\tif (this.bitPointer < 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.bitPointer = 8 + this.bitPointer;\r\n\t\t\t\t}\r\n\t\t\t\treturn bits;\r\n\t\t\t}\r\n\t\t\telse if (numBits < this.bitPointer + 1 + 16)\r\n\t\t\t{\r\n\t\t\t\t// next word crosses 3 data blocks\r\n\t\t\t\tvar mask1 = 0; // mask of first block\r\n\t\t\t\tvar mask3 = 0; // mask of 3rd block\r\n\t\t\t\t//bitPointer + 1 : number of bits of the 1st block\r\n\t\t\t\t//8 : number of the 2nd block (note that use already 8bits because next word uses 3 data blocks)\r\n\t\t\t\t//numBits - (bitPointer + 1 + 8) : number of bits of the 3rd block \r\n\t\t\t\tfor (var i = 0; i < this.bitPointer + 1; i++)\r\n\t\t\t\t{\r\n\t\t\t\t\tmask1 += (1 << i);\r\n\t\t\t\t}\r\n\t\t\t\tvar bitsFirstBlock = (this.blocks[this.blockPointer] & mask1) << (numBits - (this.bitPointer + 1));\r\n\t\t\t\tthis.blockPointer++;\r\n\t\t\t\t\r\n\t\t\t\tvar bitsSecondBlock = this.blocks[this.blockPointer] << (numBits - (this.bitPointer + 1 + 8));\r\n\t\t\t\tthis.blockPointer++;\r\n\t\t\t\t\r\n\t\t\t\tfor (var i = 0; i < numBits - (this.bitPointer + 1 + 8); i++)\r\n\t\t\t\t{\r\n\t\t\t\t\tmask3 += (1 << i);\r\n\t\t\t\t}\r\n\t\t\t\tmask3 <<= 8 - (numBits - (this.bitPointer + 1 + 8));\r\n\t\t\t\tvar bitsThirdBlock = (this.blocks[this.blockPointer] & mask3) >> (8 - (numBits - (this.bitPointer + 1 + 8)));\r\n\t\t\t\t\r\n\t\t\t\tbits = bitsFirstBlock + bitsSecondBlock + bitsThirdBlock;\r\n\t\t\t\tthis.bitPointer = this.bitPointer - (numBits - 8) % 8;\r\n\t\t\t\tif (this.bitPointer < 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.bitPointer = 8 + this.bitPointer;\r\n\t\t\t\t}\r\n\t\t\t\treturn bits;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\t\t}\r\n\tthis.NextMode=function()\r\n\t{\r\n\t\tif ((this.blockPointer > this.blocks.length - this.numErrorCorrectionCode - 2))\r\n\t\t\treturn 0;\r\n\t\telse\r\n\t\t\treturn this.getNextBits(4);\r\n\t}\r\n\tthis.getDataLength=function( modeIndicator)\r\n\t\t{\r\n\t\t\tvar index = 0;\r\n\t\t\twhile (true)\r\n\t\t\t{\r\n\t\t\t\tif ((modeIndicator >> index) == 1)\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tindex++;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn this.getNextBits(qrcode.sizeOfDataLengthInfo[this.dataLengthMode][index]);\r\n\t\t}\r\n\tthis.getRomanAndFigureString=function( dataLength)\r\n\t\t{\r\n\t\t\tvar length = dataLength;\r\n\t\t\tvar intData = 0;\r\n\t\t\tvar strData = \"\";\r\n\t\t\tvar tableRomanAndFigure = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', '$', '%', '*', '+', '-', '.', '/', ':');\r\n\t\t\tdo \r\n\t\t\t{\r\n\t\t\t\tif (length > 1)\r\n\t\t\t\t{\r\n\t\t\t\t\tintData = this.getNextBits(11);\r\n\t\t\t\t\tvar firstLetter = Math.floor(intData / 45);\r\n\t\t\t\t\tvar secondLetter = intData % 45;\r\n\t\t\t\t\tstrData += tableRomanAndFigure[firstLetter];\r\n\t\t\t\t\tstrData += tableRomanAndFigure[secondLetter];\r\n\t\t\t\t\tlength -= 2;\r\n\t\t\t\t}\r\n\t\t\t\telse if (length == 1)\r\n\t\t\t\t{\r\n\t\t\t\t\tintData = this.getNextBits(6);\r\n\t\t\t\t\tstrData += tableRomanAndFigure[intData];\r\n\t\t\t\t\tlength -= 1;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\twhile (length > 0);\r\n\t\t\t\r\n\t\t\treturn strData;\r\n\t\t}\r\n\tthis.getFigureString=function( dataLength)\r\n\t\t{\r\n\t\t\tvar length = dataLength;\r\n\t\t\tvar intData = 0;\r\n\t\t\tvar strData = \"\";\r\n\t\t\tdo \r\n\t\t\t{\r\n\t\t\t\tif (length >= 3)\r\n\t\t\t\t{\r\n\t\t\t\t\tintData = this.getNextBits(10);\r\n\t\t\t\t\tif (intData < 100)\r\n\t\t\t\t\t\tstrData += \"0\";\r\n\t\t\t\t\tif (intData < 10)\r\n\t\t\t\t\t\tstrData += \"0\";\r\n\t\t\t\t\tlength -= 3;\r\n\t\t\t\t}\r\n\t\t\t\telse if (length == 2)\r\n\t\t\t\t{\r\n\t\t\t\t\tintData = this.getNextBits(7);\r\n\t\t\t\t\tif (intData < 10)\r\n\t\t\t\t\t\tstrData += \"0\";\r\n\t\t\t\t\tlength -= 2;\r\n\t\t\t\t}\r\n\t\t\t\telse if (length == 1)\r\n\t\t\t\t{\r\n\t\t\t\t\tintData = this.getNextBits(4);\r\n\t\t\t\t\tlength -= 1;\r\n\t\t\t\t}\r\n\t\t\t\tstrData += intData;\r\n\t\t\t}\r\n\t\t\twhile (length > 0);\r\n\t\t\t\r\n\t\t\treturn strData;\r\n\t\t}\r\n\tthis.get8bitByteArray=function( dataLength)\r\n\t\t{\r\n\t\t\tvar length = dataLength;\r\n\t\t\tvar intData = 0;\r\n\t\t\tvar output = new Array();\r\n\t\t\t\r\n\t\t\tdo \r\n\t\t\t{\r\n\t\t\t\tintData = this.getNextBits(8);\r\n\t\t\t\toutput.push( intData);\r\n\t\t\t\tlength--;\r\n\t\t\t}\r\n\t\t\twhile (length > 0);\r\n\t\t\treturn output;\r\n\t\t}\r\n this.getKanjiString=function( dataLength)\r\n\t\t{\r\n\t\t\tvar length = dataLength;\r\n\t\t\tvar intData = 0;\r\n\t\t\tvar unicodeString = \"\";\r\n\t\t\tdo \r\n\t\t\t{\r\n\t\t\t\tintData = getNextBits(13);\r\n\t\t\t\tvar lowerByte = intData % 0xC0;\r\n\t\t\t\tvar higherByte = intData / 0xC0;\r\n\t\t\t\t\r\n\t\t\t\tvar tempWord = (higherByte << 8) + lowerByte;\r\n\t\t\t\tvar shiftjisWord = 0;\r\n\t\t\t\tif (tempWord + 0x8140 <= 0x9FFC)\r\n\t\t\t\t{\r\n\t\t\t\t\t// between 8140 - 9FFC on Shift_JIS character set\r\n\t\t\t\t\tshiftjisWord = tempWord + 0x8140;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\t// between E040 - EBBF on Shift_JIS character set\r\n\t\t\t\t\tshiftjisWord = tempWord + 0xC140;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t//var tempByte = new Array(0,0);\r\n\t\t\t\t//tempByte[0] = (sbyte) (shiftjisWord >> 8);\r\n\t\t\t\t//tempByte[1] = (sbyte) (shiftjisWord & 0xFF);\r\n\t\t\t\t//unicodeString += new String(SystemUtils.ToCharArray(SystemUtils.ToByteArray(tempByte)));\r\n unicodeString += String.fromCharCode(shiftjisWord);\r\n\t\t\t\tlength--;\r\n\t\t\t}\r\n\t\t\twhile (length > 0);\r\n\t\t\t\r\n\t\t\t\r\n\t\t\treturn unicodeString;\r\n\t\t}\r\n\r\n\tthis.__defineGetter__(\"DataByte\", function()\r\n\t{\r\n\t\tvar output = new Array();\r\n\t\tvar MODE_NUMBER = 1;\r\n\t var MODE_ROMAN_AND_NUMBER = 2;\r\n\t var MODE_8BIT_BYTE = 4;\r\n\t var MODE_KANJI = 8;\r\n\t\tdo \r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar mode = this.NextMode();\r\n\t\t\t\t\t\t//canvas.println(\"mode: \" + mode);\r\n\t\t\t\t\t\tif (mode == 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tif (output.length > 0)\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\tthrow \"Empty data block\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t//if (mode != 1 && mode != 2 && mode != 4 && mode != 8)\r\n\t\t\t\t\t\t//\tbreak;\r\n\t\t\t\t\t\t//}\r\n\t\t\t\t\t\tif (mode != MODE_NUMBER && mode != MODE_ROMAN_AND_NUMBER && mode != MODE_8BIT_BYTE && mode != MODE_KANJI)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t/*\t\t\t\t\tcanvas.println(\"Invalid mode: \" + mode);\r\n\t\t\t\t\t\t\tmode = guessMode(mode);\r\n\t\t\t\t\t\t\tcanvas.println(\"Guessed mode: \" + mode); */\r\n\t\t\t\t\t\t\tthrow \"Invalid mode: \" + mode + \" in (block:\" + this.blockPointer + \" bit:\" + this.bitPointer + \")\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tdataLength = this.getDataLength(mode);\r\n\t\t\t\t\t\tif (dataLength < 1)\r\n\t\t\t\t\t\t\tthrow \"Invalid data length: \" + dataLength;\r\n\t\t\t\t\t\t//canvas.println(\"length: \" + dataLength);\r\n\t\t\t\t\t\tswitch (mode)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tcase MODE_NUMBER: \r\n\t\t\t\t\t\t\t\t//canvas.println(\"Mode: Figure\");\r\n\t\t\t\t\t\t\t\tvar temp_str = this.getFigureString(dataLength);\r\n\t\t\t\t\t\t\t\tvar ta = new Array(temp_str.length);\r\n\t\t\t\t\t\t\t\tfor(var j=0;j
+
+
+ QCodeDecoder - Camera
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/image.html b/examples/image.html
new file mode 100644
index 0000000..851730f
--- /dev/null
+++ b/examples/image.html
@@ -0,0 +1,36 @@
+
+
+
+
+ QCodeDecoder - Image
+
+
+
+