mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Add options for screenshot format and quality
This commit is contained in:
parent
37b4f0d34c
commit
2c72f6da7b
5 changed files with 29 additions and 2 deletions
|
@ -1813,9 +1813,12 @@ void Client::makeScreenshot(IrrlichtDevice *device)
|
|||
+ DIR_DELIM
|
||||
+ std::string("screenshot_")
|
||||
+ std::string(timetstamp_c);
|
||||
std::string filename_ext = ".png";
|
||||
std::string filename_ext = "." + g_settings->get("screenshot_format");
|
||||
std::string filename;
|
||||
|
||||
u32 quality = (u32)g_settings->getS32("screenshot_quality");
|
||||
quality = MYMIN(MYMAX(quality, 0), 100) / 100.0 * 255;
|
||||
|
||||
// Try to find a unique filename
|
||||
unsigned serial = 0;
|
||||
|
||||
|
@ -1837,7 +1840,7 @@ void Client::makeScreenshot(IrrlichtDevice *device)
|
|||
raw_image->copyTo(image);
|
||||
|
||||
std::ostringstream sstr;
|
||||
if (driver->writeImageToFile(image, filename.c_str())) {
|
||||
if (driver->writeImageToFile(image, filename.c_str(), quality)) {
|
||||
sstr << "Saved screenshot to '" << filename << "'";
|
||||
} else {
|
||||
sstr << "Failed to save screenshot '" << filename << "'";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue