Open satoshinm opened 7 years ago
Screenshots taken with F2 in the native app appear fine, so may be specific to WebGL:
On the web version, all I do is:
#ifdef __EMSCRIPTEN__
EM_ASM(
var url = document.getElementsByTagName("canvas")[0].toDataURL();
var a = document.createElement("a");
var timestamp = new Date().toISOString();
a.setAttribute("download", "screenshot-netcraft-" + timestamp + ".png");
a.setAttribute("href", url);
a.click();
);
#else
whereas on native, glReadPixels(GL_RGBA)
then compress to png with miniz tdefl_write_image_to_png_file_in_memory_ex
. Something about premultiplied alpha? According to https://bugzilla.mozilla.org/show_bug.cgi?id=650720
It's also worth noting, that calling toDataUrl on the canvas causes it to be premultiplied before it gets to the encoder. The PNG decoder will un-premultiply it again.
Taking with F2:
and taken with Shift-Cmd-4, Space, Enter:
The first screenshot taken by hitting the F2 shortcut is brighter than expected, especially noticeable around the text. First noticed with https://github.com/satoshinm/NetCraft/pull/175#issuecomment-306016772 - maybe related to alpha channels? Screenshots were added in https://github.com/satoshinm/NetCraft/issues/119 https://github.com/satoshinm/NetCraft/pull/127