mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-13 11:50:02 +01:00
Pixel set redundancy removed (#1188)
* Pixels.set Redundancy removed * eslint fixes * move require to top with const
This commit is contained in:
@@ -7,7 +7,9 @@ module.exports = function Channel(options, UI) {
|
||||
|
||||
function draw(input, callback, progressObj) {
|
||||
|
||||
var defaults = require('./../../util/getDefaults.js')(require('./info.json'));
|
||||
const defaults = require('./../../util/getDefaults.js')(require('./info.json'));
|
||||
const pixelSetter = require('../../util/pixelSetter.js');
|
||||
|
||||
options.gradient = options.gradient || defaults.gradient;
|
||||
options.gradient = JSON.parse(options.gradient);
|
||||
|
||||
@@ -32,10 +34,8 @@ module.exports = function Channel(options, UI) {
|
||||
|
||||
for (let x = 0; x < 256; x++) {
|
||||
for (let y = 0; y < 256; y++) {
|
||||
pixels.set(x, y, 0, 255);
|
||||
pixels.set(x, y, 1, 255);
|
||||
pixels.set(x, y, 2, 255);
|
||||
pixels.set(x, y, 3, 255);
|
||||
pixelSetter(x, y, [255, 255, 255, 255], pixels);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,9 +43,8 @@ module.exports = function Channel(options, UI) {
|
||||
if (options.gradient) {
|
||||
for (let x = 0; x < 256; x++) {
|
||||
for (let y = 0; y < 10; y++) {
|
||||
pixels.set(x, 255 - y, 0, x);
|
||||
pixels.set(x, 255 - y, 1, x);
|
||||
pixels.set(x, 255 - y, 2, x);
|
||||
pixelSetter(x, 255 - y, [x, x, x], pixels);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,9 +55,8 @@ module.exports = function Channel(options, UI) {
|
||||
let pixCount = Math.round(convfactor * hist[x]);
|
||||
|
||||
for (let y = startY; y < pixCount; y++) {
|
||||
pixels.set(x, 255 - y, 0, 204);
|
||||
pixels.set(x, 255 - y, 1, 255);
|
||||
pixels.set(x, 255 - y, 2, 153);
|
||||
pixelSetter(x, 255 - y, [204, 255, 153], pixels);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user