| 1392 | } |
| 1393 | |
| 1394 | string Image::toString() const { |
| 1395 | ostringstream sstream; |
| 1396 | sstream << mName << "\n\n"; |
| 1397 | |
| 1398 | { |
| 1399 | const time_t cftime = to_time_t(mFileLastModified); |
| 1400 | sstream << "Last modified:\n" << asctime(localtime(&cftime)) << "\n"; |
| 1401 | } |
| 1402 | |
| 1403 | sstream << "Resolution: (" << size().x() << ", " << size().y() << ")\n"; |
| 1404 | if (displayWindow() != dataWindow() || displayWindow().min != Vector2i{0}) { |
| 1405 | sstream << "Display window: (" << displayWindow().min.x() << ", " << displayWindow().min.y() << ")(" << displayWindow().max.x() |
| 1406 | << ", " << displayWindow().max.y() << ")\n"; |
| 1407 | sstream << "Data window: (" << dataWindow().min.x() << ", " << dataWindow().min.y() << ")(" << dataWindow().max.x() << ", " |
| 1408 | << dataWindow().max.y() << ")\n"; |
| 1409 | } |
| 1410 | |
| 1411 | sstream << "\nChannels:\n"; |
| 1412 | |
| 1413 | sstream << join( |
| 1414 | mData.layers | views::transform([this](string_view layer) { |
| 1415 | const auto channels = mData.channelsInLayer(layer) | views::transform([](string_view c) { return Channel::tail(c); }); |
| 1416 | |
| 1417 | if (layer.empty()) { |
| 1418 | return join(channels, ","); |
| 1419 | } else if (channels.size() == 1) { |
| 1420 | return fmt::format("{}{}", layer, channels.front()); |
| 1421 | } else { |
| 1422 | return fmt::format("{}({})", layer, join(channels, ",")); |
| 1423 | } |
| 1424 | }), |
| 1425 | "\n" |
| 1426 | ); |
| 1427 | |
| 1428 | return std::move(sstream).str(); |
| 1429 | } |
| 1430 | |
| 1431 | // Modifies `data` and returns the new size of the data after reorientation. |
| 1432 | Task<nanogui::Vector2i> orientToTopLeft(PixelBuffer& data, nanogui::Vector2i size, EOrientation orientation, int priority) { |
no test coverage detected