mirror of
https://github.com/cnwhy/QRCode-decode.git
synced 2026-08-12 20:31:40 +08:00
bug fix
This commit is contained in:
+15
-15
@@ -1,10 +1,12 @@
|
||||
var jpg = require('./jpg');
|
||||
var jpgDecode = new jpg.JpegDecoder();
|
||||
var pngDecode = require('./png').decode;
|
||||
var upng = require('./png');
|
||||
var bmpDecode = require('./bmp');
|
||||
var gifDecode = require('./gif').decode;
|
||||
var gif1Decode = require('./gif.1').decode;
|
||||
|
||||
|
||||
|
||||
exports.bmp = function (buffer) {
|
||||
// return new Promise(function (res, rej) {
|
||||
// res(bmpDecode(buffer));
|
||||
@@ -22,20 +24,18 @@ exports.jpg = function (buffer) {
|
||||
}
|
||||
|
||||
exports.png = function (buffer) {
|
||||
// return new Promise(function (res, rej) {
|
||||
// var png = pngDecode(buffer);
|
||||
// res({
|
||||
// data: png.data,
|
||||
// width: png.width,
|
||||
// height: png.height
|
||||
// });
|
||||
// })
|
||||
var png = pngDecode(buffer);
|
||||
return {
|
||||
data: png.data,
|
||||
width: png.width,
|
||||
height: png.height
|
||||
};
|
||||
// console.log('png');
|
||||
var png = upng.decode(buffer);
|
||||
var datas = upng.toRGBA8(png);
|
||||
var images = [];
|
||||
datas.forEach(function(v){
|
||||
images.push({
|
||||
width:png.width,
|
||||
height:png.height,
|
||||
data:new Uint8Array(v),
|
||||
})
|
||||
})
|
||||
return images;
|
||||
}
|
||||
|
||||
exports.gif = function (data) {
|
||||
|
||||
@@ -5,24 +5,6 @@
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* 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;
|
||||
|
||||
Reference in New Issue
Block a user