#7996 closed patch
Screenshots (feature request #559626)
Reported by: | eriktorbjorn | Owned by: | Kirben |
---|---|---|---|
Priority: | normal | Component: | --Other-- |
Version: | Keywords: | ||
Cc: | Game: |
Description
Looks like you can't attach files to feature requests so I'm submitting a patch instead. This is in regards to part of feature request #559626.
The screenshot feature should be trivial to add. At least for the SDL version, since there already is an SDL_SaveBMP() macro available. Admittedly, BMP isn't the sexiest image format around, but I didn't want to add dependencies on other libraries.
With this patch, you should be able to use Alt-S to make a screenshot.
It's still a bit rough. For instance, it always saves the screenshots to the current directory, and it doesn't hide the mouse cursor before the screenshot is made. (That first item could be partially adressed by patch #587694, by the way, since that puts the code to figure out save directory in a separate function.)
Of course, similar code would have to be added to the other versions.
The patch is made against an August 1 CVS snapshot.
Ticket imported from: #590233. Ticket imported from: patches/101.
Attachments (5)
Change History (14)
by , 22 years ago
Attachment: | screenshot.diff added |
---|
by , 22 years ago
Attachment: | screenshot2.diff added |
---|
Updated patch against a September 21 CVS snapshot
comment:1 by , 22 years ago
For whatever it's worth, here's an updated version of the patch. I'm still not quite happy with it, for two reasons: a) It doesn't support the SDL/OpenGL backend at all, and b) it saves the screenshots in the current directory. I'd like for it to use the savegame directory instead.
comment:2 by , 22 years ago
I overheard Fingolfin saying that this feature could be implemented using the new grab_overlay() function. At least once all backends support it. I think he has a point.
Of course this means that I can no longer use SDL_SaveBMP(), which raises the question: What image format should we use for screenshots? PNG would be nice, but that would add new library dependencies for ScummVM. I guess I could make it a compile-time option. We can always add a built-in BMP writer later, if the need arises.
I'll look into it.
comment:3 by , 22 years ago
Here's a new version of the patch. It's still too rough to be applied, I think, but it should do as a proof-of-concept.
It no longer depends on SDL, but it does currently depend on libpng so I've added a compile-time option for whether or not it should be included. It would be nice if we had some simpler image format (probably BMP) to use as a fallback.
The screenshots are always of the unscaled image. Perhaps we could add a function to OSystem to return the image that is actually being displayed?
The screenshots are always 320x240 pixels, even if the game window is smaller.
It's not currently possible to make screenshots of our shiny new GUI.
On the bright side, it does work for both SCUMM and Simon games.
comment:4 by , 22 years ago
Another update to the patch, but still not quite ready to be applied.
As per Fingolfin's suggestion, this adds a function to OSystem to query whether or not the overlay is visible. More job for the porters, but at least it's possible to make screenshots of the NewGUI now...
I've also moved the test for the screenshot key back into the SDL backend. It's not that it's impossible to put it in the ScummVM core, it's just that there are so many event loops to add it to now. Scumm, Simon, NewGUI, launcher... any others?
Unresolved issues:
I still need some way of getting the actual size of the screen.
I still think it'd be nice to dump what's actually on screen, instead of the unscaled image.
comment:6 by , 21 years ago
Since we now have more game engines than backends that can sensibly handle screenshots, maybe it is easier to put this functionality in the backend after all.
I've attached an updated patch for the SDL backend, that only handles BMP images.
In other words, I'm back to where I started again. :-)
(I'm not quite sure about how virtual functions really work, so I may have written something ugly here.)
comment:7 by , 21 years ago
Added to ScummVM cvs. Two suggestions though: An option to choose directory for snapshots would be very useful. Or at least use the save dir. again. Having the screenshot named after game alias/target would make sorting screenshots easier too, if possible.
comment:8 by , 21 years ago
Owner: | set to |
---|---|
Status: | new → closed |
comment:9 by , 6 years ago
Component: | → --Other-- |
---|
Proof-of-concept screenshot patch