Compare commits

...

2 Commits

Author SHA1 Message Date
6dc1196646 Added screenshot command 2025-05-30 11:55:04 -04:00
557096abef Used date timestamp for screenshot name 2025-05-30 11:49:55 -04:00

View File

@@ -90,6 +90,10 @@ void FractalInspectorApp::ParseCmdLineMessage(const std::string &message) {
}
if (misc::string_matches(cmd, {"screenshot", "screeny", "capture"})) {
return TakeScreenshot();
}
console->Log(std::format("No such command: {}", cmd), Colors::Red);
}
@@ -680,7 +684,13 @@ void FractalInspectorApp::TakeScreenshot() {
}
uint8_t* frameBuffer = reinterpret_cast<uint8_t*>(pdatac3.data());
std::ofstream file("screenshot.bmp", std::ios::out | std::ios::binary);
time_t t = std::time(nullptr);
tm tm = *std::localtime(&t);
std::ostringstream filename;
filename << std::put_time(&tm, "%Y-%m-%d %H-%M-%S") << ".bmp";
std::ofstream file(filename.str(), std::ios::out | std::ios::binary);
Vector2i wh = this->canvas->GetDimensions();
@@ -719,4 +729,6 @@ void FractalInspectorApp::TakeScreenshot() {
file.close();
console->Log(std::format("Took screenshot: {}", filename.str()));
}