Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Screenshot for text mode #441

Closed
Artoria2e5 opened this issue Apr 12, 2021 · 1 comment
Closed

Screenshot for text mode #441

Artoria2e5 opened this issue Apr 12, 2021 · 1 comment

Comments

@Artoria2e5
Copy link

It would be nice to also have some sort of screenshot functionality for text mode too. A not-too-complicated way to do it may be extracting the text_screen outerHTML to pop it into a data:text/html with the necessary styles.

@Pixelsuft
Copy link
Contributor

Pixelsuft commented Apr 17, 2021

Edit in main.js:

$("take_screenshot").onclick = function()
{
	if(document.getElementById('vga').style.display == 'block')emulator.screen_make_screenshot();
	else
	{
		var html_text = '<body style="padding: 0px;margin: 0px;">';
		html_text += '<link rel="stylesheet" type="text/css" href="http://copy.sh/v86/v86.css">'; 
		html_text += '<div id="screen_container" style="display: block;outline: 0px;margin: 0px;">'; 
		html_text += '<div id="screen" style="display: block;">'; 
		html_text += document.getElementById('screen').innerHTML; 
		html_text += '</div></div></body>'
		dump_file(html_text, 'screenshot.html');
	}
	$("take_screenshot").blur();
};

image1
or

$("take_screenshot").onclick = function()
{
	if(document.getElementById('vga').style.display == 'block')emulator.screen_make_screenshot();
	else
	{
		var html_text = '<body style="padding: 0px;margin: 0px;">';
		html_text += '<link rel="stylesheet" type="text/css" href="http://copy.sh/v86/v86.css">'; 
		html_text += '<div id="screen_container" style="display: block;outline: 0px;margin: 0px;">'; 
		html_text += '<div id="screen" style="display: block;">'; 
		html_text += document.getElementById('screen').innerHTML; 
		html_text += '</div></div></body>'
		var wnd = window.open();
		wnd.document.write(html_text);
	}
	$("take_screenshot").blur();
};

image2
or draw text on canvas
image3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants