mirror of
https://github.com/zellyn/apple2shader.git
synced 2024-11-23 11:30:55 +00:00
webgl: add battle-chess image; add dhgr conversion param
This commit is contained in:
parent
142acc1523
commit
9781548413
BIN
images/battle-chess.png
Normal file
BIN
images/battle-chess.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
@ -176,6 +176,7 @@
|
|||||||
|
|
||||||
async function setupScreenView() {
|
async function setupScreenView() {
|
||||||
const image = await screenEmu.loadImage("images/airheart-560x192.png");
|
const image = await screenEmu.loadImage("images/airheart-560x192.png");
|
||||||
|
// const image = await screenEmu.loadImage("images/battle-chess.png");
|
||||||
const [imageCanvas, imageData] = screenEmu.screenData(image, screenEmu.C.NTSC_DETAILS);
|
const [imageCanvas, imageData] = screenEmu.screenData(image, screenEmu.C.NTSC_DETAILS);
|
||||||
|
|
||||||
let canvas = document.getElementById("d");
|
let canvas = document.getElementById("d");
|
||||||
|
@ -487,7 +487,7 @@ void main(void)
|
|||||||
// image: a 560x192 image, from the same domain (hence readable).
|
// image: a 560x192 image, from the same domain (hence readable).
|
||||||
// details: NTSC_DETAILS, or PAL_DETAILS
|
// details: NTSC_DETAILS, or PAL_DETAILS
|
||||||
// returns: a canvas
|
// returns: a canvas
|
||||||
const screenData = (image, details) => {
|
const screenData = (image, details, dhgr=true) => {
|
||||||
if ((image.naturalWidth != 560) || (image.naturalHeight != 192)) {
|
if ((image.naturalWidth != 560) || (image.naturalHeight != 192)) {
|
||||||
throw new Error('screenData expects an image 560x192;' +
|
throw new Error('screenData expects an image 560x192;' +
|
||||||
` got ${image.naturalWidth}x${image.naturalHeight}`);
|
` got ${image.naturalWidth}x${image.naturalHeight}`);
|
||||||
@ -500,7 +500,8 @@ void main(void)
|
|||||||
canvas.height = height;
|
canvas.height = height;
|
||||||
context.fillStyle = 'rgba(0,0,0,1)';
|
context.fillStyle = 'rgba(0,0,0,1)';
|
||||||
context.fillRect(0, 0, width, height);
|
context.fillRect(0, 0, width, height);
|
||||||
context.drawImage(image, details.topLeft80Col.x, details.topLeft80Col.y);
|
const topLeft = dhgr ? details.topLeft80Col : details.topLeft;
|
||||||
|
context.drawImage(image, topLeft.x, topLeft.y);
|
||||||
const imageData = context.getImageData(0, 0, width, height);
|
const imageData = context.getImageData(0, 0, width, height);
|
||||||
return [canvas, imageData];
|
return [canvas, imageData];
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user