TomHarte / CLK

A latency-hating emulator of: the Acorn Electron and Archimedes, Amstrad CPC, Apple II/II+/IIe and early Macintosh, Atari 2600 and ST, ColecoVision, Enterprise 64/128, Commodore Vic-20 and Amiga, MSX 1/2, Oric 1/Atmos, early PC compatibles, Sega Master System, Sinclair ZX80/81 and ZX Spectrum.
MIT License
931 stars 52 forks source link

Support for screenshots #501

Closed reidrac closed 6 years ago

reidrac commented 6 years ago

I was wondering it it would be possible to have a "screen grab" key combination to save a PNG image to disk, including all the filters etc of the output.

Very often I need to take screenshots of the games and currently isn't ideal because I need to capture the emulator screen with an external tool.

TomHarte commented 6 years ago

I'll have a look; it'd actually be good to have a general route to screen grabbing anyway, as I currently implement 'paste' but not 'copy', so the one mechanism could serve both goals.

Shrapnel21 commented 6 years ago

One-key PNG screenshots would be a godsend, at least for me since I run a retrogaming website and I use screenshots from emulators. =)

TomHarte commented 6 years ago

Two votes for a feature is the most that this emulator has ever received, therefore consider it definite. PNG should be no problem on macOS, but SDL seems by default to provide only a BMP encoder so this might end up being another minor of platform divergence but I doubt anybody will be too upset.

reidrac commented 6 years ago

SDL requires SDL_Image, or you could use libpng; but BMP is just fine IMHO. Thanks!

Shrapnel21 commented 6 years ago

Yep, BMP would be good anyway. It's still lossless and, at least for me, fits the purpose. Thanks! =)

TomHarte commented 6 years ago

As per the merged pull request ctrl+shift+d will now happily save BMP screenshots to your home directory in the SDL build. I'll worry about the Mac some other time.

reidrac commented 6 years ago

The coiors on the screenshot seem to be off; looks like is not using the right palette. clk-screenshot-0

Shrapnel21 commented 6 years ago

I'll give it a go and check it as soon as it's available on macOS. =)

TomHarte commented 6 years ago

Clearly I've forgotten to account for disagreements about byte ordering between SDL and OpenGL. So the red and green channels are the wrong way around. That should be an easy fix.

The Mac version will be forthcoming.

TomHarte commented 6 years ago

Fingers crossed, both SDL and the Mac versions should now work as intended. A Mac build is attached for testing. In that version it's option+shift+d to take a screenshot, and it'll end up in your Pictures folder with the time and date in the name much like macOS's built-in command+shift+4. Clock Signal.zip

reidrac commented 6 years ago

Not sure if is worth it, but int Linux you could use this: https://wiki.archlinux.org/index.php/XDG_user_directories

Basically you try to execute xdg-user-dir PICTURES and get the output, with fallback to $HOME.

Shrapnel21 commented 6 years ago

Just tried the test version for macOS and it works fine, though I only tried it with CPC so far. Thanks! =)

TomHarte commented 6 years ago

@reidrac done!

reidrac commented 6 years ago

Works perfect! Thanks!