forked from Blendman974/faceclaw
Screen test for dithering experimentation; landscape layout for phone preview
This commit is contained in:
1 parent
8d6fe60c79
commit
468291aac3
9 files changed
+215
-34
No files matched your search
@@ -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)));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user