Make screenshot function return an Image (#820)
* Make screenshot facility return an Image Returning an image rather than always opennig a new window slightly expands the utility of embedding v86---we may want to take a screenshot and use just its data without asking the user to download it.
This commit is contained in:
parent
d840540d21
commit
66dab8f39a
|
@ -1932,7 +1932,12 @@
|
|||
|
||||
$("take_screenshot").onclick = function()
|
||||
{
|
||||
emulator.screen_make_screenshot();
|
||||
const image = emulator.screen_make_screenshot();
|
||||
try {
|
||||
const w = window.open("");
|
||||
w.document.write(image.outerHTML);
|
||||
}
|
||||
catch(e) {}
|
||||
$("take_screenshot").blur();
|
||||
};
|
||||
|
||||
|
|
|
@ -220,12 +220,7 @@ function ScreenAdapter(screen_container, bus)
|
|||
|
||||
image.src = canvas.toDataURL("image/png");
|
||||
}
|
||||
|
||||
try {
|
||||
const w = window.open("");
|
||||
w.document.write(image.outerHTML);
|
||||
}
|
||||
catch(e) {}
|
||||
return image;
|
||||
};
|
||||
|
||||
this.put_char = function(row, col, chr, bg_color, fg_color)
|
||||
|
|
|
@ -963,8 +963,9 @@ V86Starter.prototype.screen_make_screenshot = function()
|
|||
{
|
||||
if(this.screen_adapter)
|
||||
{
|
||||
this.screen_adapter.make_screenshot();
|
||||
return this.screen_adapter.make_screenshot();
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue