This commit is contained in:
Brooke Vibber 2024-09-07 08:48:12 -07:00
parent f7df0999d7
commit 4fc0a92dbe

View file

@ -20,7 +20,7 @@ class Dither {
} }
to4bit(val8) { to4bit(val8) {
let val = (val8 / 255) - this.err; let val = (val8 / 255) + this.err;
if (val < 0) { if (val < 0) {
val = 0; val = 0;
} }
@ -29,7 +29,7 @@ class Dither {
} }
let val4 = Math.round(val * 15); let val4 = Math.round(val * 15);
let dithered = (val4 / 15); let dithered = (val4 / 15);
this.err = (dithered - val); this.err = (val - dithered);
return val4; return val4;
} }
} }