Skip to content

Commit

Permalink
Merge v2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mster committed Jun 21, 2021
2 parents 3517f80 + c3bf504 commit d4e6c0c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
27 changes: 27 additions & 0 deletions lib/modes/castles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"use strict";

module.exports = function (data) {
const red = new Array(data.length / 4),
green = new Array(data.length / 4),
blue = new Array(data.length / 4),
a = new Array(data.length / 4);

let high = 165,
low = 80;
for (let i = 0; i < data.length / 4; i++) {
if (data[i] < high && data[i] > low) red[i] = data[i];
if (data[i + 1] < high && data[i + 1] > low) green[i] = data[i + 1];
if (data[i + 2] < high && data[i + 2] > low) blue[i] = data[i + 2];
a[i] = data[i + 3];
}

const ret = [];
for (let i = 0; i < red.length; i++) {
ret.push(red[i]);
ret.push(green[i]);
ret.push(blue[i]);
ret.push(a[i]);
}

return ret;
};
1 change: 1 addition & 0 deletions lib/mosh.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,5 @@ mosh.MODES = {
fatcat: require("./modes/fatcat"),
vaporwave: require("./modes/vaporwave"),
walter: require("./modes/walter"),
castles: require("./modes/castles"),
};
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "datamosh",
"version": "2.0.0",
"version": "2.1.0",
"description": "Edit images via buffers.",
"keywords": [
"datamosh",
Expand Down

0 comments on commit d4e6c0c

Please sign in to comment.