diff --git a/lib/modes/fatcat.js b/lib/modes/fatcat.js new file mode 100644 index 0000000..c3d626f --- /dev/null +++ b/lib/modes/fatcat.js @@ -0,0 +1,37 @@ +'use strict' + +module.exports = function (original) { + const min = Math.min + + const bitmapData = original.bitmap.data + const data = Buffer.from(bitmapData) + + const bounceMax = [280, 268, 256, 255] + + for (let i = 0; i < data.length; i += 4) { + data[i + 0] = min(data[i + 0] * 1.4, bounceMax[0]) + data[i + 1] = min(data[i + 1] * 1.4, bounceMax[0]) + data[i + 2] = min(data[i + 2] * 1.4, bounceMax[0]) + } + + for (let i = 0; i < data.length; i += 4) { + data[i + 0] = min(data[i + 0] * 1.4, bounceMax[0]) + data[i + 1] = min(data[i + 1] * 1.4, bounceMax[0]) + data[i + 2] = min(data[i + 2] * 1.4, bounceMax[0]) + } + + for (let i = 0; i < data.length; i += 4) { + data[i + 0] = min(data[i + 0] * 1.4, 256) + data[i + 1] = min(data[i + 1] * 1.4, 256) + data[i + 2] = min(data[i + 2] * 1.4, 256) + } + + for (let i = 0; i < data.length; i += 4) { + data[i + 0] = min(data[i + 0] * 1.4, 255) + data[i + 1] = min(data[i + 1] * 1.4, 255) + data[i + 2] = min(data[i + 2] * 1.4, 255) + } + + original.bitmap.data = data + return original +} diff --git a/lib/mosh.js b/lib/mosh.js index 72faa53..7fe54d3 100644 --- a/lib/mosh.js +++ b/lib/mosh.js @@ -28,7 +28,7 @@ function mosh (options, cb) { /^[\w\-. ]+.jpeg$/.test(filename) || /^[\w\-. ]+.png$/.test(filename) || /^[\w\-. ]+.bmp$/.test(filename) || - /^[\w\-. ]+*.tiff$/.test(filename) || + /^[\w\-. ]+.tiff$/.test(filename) || /^[\w\-. ]+.gif$/.test(filename)) ) ) { @@ -40,8 +40,8 @@ function mosh (options, cb) { const _mode = mode == null ? Object.keys(mosh.MODES)[ - Math.floor(Math.random() * Object.keys(mosh.MODES).length) - ] + Math.floor(Math.random() * Object.keys(mosh.MODES).length) + ] : mode debug(`Mode selected: ${_mode}`) @@ -75,5 +75,6 @@ mosh.MODES = { blurbobb: require('./modes/blurbobb'), schifty: require('./modes/schifty'), veneneux: require('./modes/veneneux'), - vana: require('./modes/vana') + vana: require('./modes/vana'), + fatcat: require('./modes/fatcat') }