| 1412 | } |
| 1413 | |
| 1414 | void RenderingController::HandleGET_stdmultiScreenshot(const httplib::Request& req, httplib::Response& res) const |
| 1415 | { |
| 1416 | if (m_RenderWindowBridge == nullptr || !m_RenderWindowBridge->HasStdMultiEditorScreenshotProvider()) |
| 1417 | { |
| 1418 | const auto error = ErrorResponse::RenderWindowNotAvailable(req.path); |
| 1419 | this->SendErrorResponse(res, 503, error); |
| 1420 | return; |
| 1421 | } |
| 1422 | |
| 1423 | ScreenshotQueryParams params; |
| 1424 | try |
| 1425 | { |
| 1426 | params = ParseScreenshotQueryParams(req); |
| 1427 | } |
| 1428 | catch (const InvalidScreenshotRequest& e) |
| 1429 | { |
| 1430 | this->SendErrorResponse(res, 400, ErrorResponse::InvalidRequest(e.detail, req.path)); |
| 1431 | return; |
| 1432 | } |
| 1433 | |
| 1434 | try |
| 1435 | { |
| 1436 | const auto imageData = m_RenderWindowBridge->TakeStdMultiEditorScreenshot(params.size, params.format); |
| 1437 | res.status = 200; |
| 1438 | res.set_content( |
| 1439 | reinterpret_cast<const char*>(imageData.data()), |
| 1440 | imageData.size(), |
| 1441 | ContentTypeFor(params.format)); |
| 1442 | } |
| 1443 | catch (const std::exception& e) |
| 1444 | { |
| 1445 | const auto [status, payload] = MapBridgeException(e, req.path); |
| 1446 | this->SendErrorResponse(res, status, payload); |
| 1447 | } |
| 1448 | } |
| 1449 | |
| 1450 | void RenderingController::HandleGET_stdmultiWindowScreenshot(const httplib::Request& req, httplib::Response& res) const |
| 1451 | { |