This commit is contained in:
cnwhy
2018-07-20 17:47:08 +08:00
parent 64acd199eb
commit 5a11eff012
28 changed files with 93 additions and 69 deletions
+15 -15
View File
@@ -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) {
-18
View File
@@ -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;