/* * PHP QR Code encoder * * QR Code CANVAS support * * PHP QR Code is distributed under LGPL 3 * Copyright (C) 2010 Dominik Dzienia * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ function QRdiffCharDecode(str) { if (str == '0') { return 0; } else { var updchar = str.toUpperCase(); var multi = 1; if (str == updchar) multi = -1; var delta = updchar.charCodeAt(0)-64; return delta*multi; } } function QRdecompactOps(str) { var ops = new Array(); var strTab = str.split(','); while (strTab.length > 0) { var code = strTab.shift(); var rcode = code.toUpperCase(); switch (rcode) { case 'P': case 'R': if (code == rcode) { ops.push('S'); } else { ops.push('W'); } ops.push(rcode); var points = strTab.shift(); var plen = points.length; for (var i=0;i= 97) { ccode += ((n - 97) + 10);} else if (n >= 65 ) { ccode += ((n - 65) + 35); } else if (n >= 48) { ccode += (n - 48); } ops.push(ccode+''); } break; case 'B': var count = parseInt(strTab.shift()); for (var no = 0; no < count; no++) { if (code == rcode) { ops.push('S'); } else { ops.push('W'); } ops.push('B'); ops.push('M'); var px = parseInt(strTab.shift()); var py = parseInt(strTab.shift()); ops.push(px+''); ops.push(py+''); ops.push('T'); var points = strTab.shift(); points = points.split('1').join('00') .split('2').join('aa').split('3').join('aA') .split('4').join('Aa').split('5').join('AA') .split('6').join('aB').split('7').join('Ab') .split('8').join('bA').split('9').join('Ba'); var plen = points.length; for (var i=0;i