A suite to track Project Diva score statistics and ratings / D4DJ event data.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
projectdivar/server/node_modules/image-decode/bmp.js

33 lines
721 B

// decode bmp buffer
'use strict'
var bmp = require('bmp-js')
module.exports = function read (data, o) {
var bmpData = bmp.decode(Buffer.from(data))
var width = bmpData.width
var height = bmpData.height
var pixels = new Uint8Array(width * height * 4)
// bmp stores stuff as ABGR seq
for (var i = 0; i < pixels.length; i+=4) {
var alpha = bmpData.data[i + 0];
var blue = bmpData.data[i + 1];
var green = bmpData.data[i + 2];
var red = bmpData.data[i + 3];
pixels[i + 0] = red;
pixels[i + 1] = green;
pixels[i + 2] = blue;
pixels[i + 3] = bmpData.is_with_alpha ? alpha : 0xff;
}
return {
data: pixels,
width: bmpData.width,
height: bmpData.height
}
}