Screen test for dithering experimentation; landscape layout for phone preview

This commit is contained in:
James Babcock committed 2026-05-17 18:17:06 -07:00
1 parent 8d6fe60c79
commit 468291aac3
9 files changed
+215 -34

No files matched your search

+6 -1
View File
@@ -251,7 +251,7 @@ export class GrayImage {
y: ty,
width,
height,
bmp: buildEvenHubBmp(width, height, (x, y) => this.getPixel(tx + x, ty + y) >> 4),
bmp: buildEvenHubBmp(width, height, (x, y) => grayToEvenHubNibble(this.getPixel(tx + x, ty + y))),
});
}
}
@@ -327,6 +327,11 @@ function buildEvenHubBmp(
return buf;
}
function grayToEvenHubNibble(value: number): number {
const clamped = clampByte(value);
return clamped === 0 ? 0 : Math.min(15, (clamped + 15) >> 4);
}
function clampByte(value: number): number {
return Math.max(0, Math.min(255, Math.round(value)));
}