| 518 | } |
| 519 | |
| 520 | long BindingSession::set_display_method(const wstring &method) { |
| 521 | if (method == L"screen") { |
| 522 | _display_method = {L"screen", L""}; |
| 523 | return 1; |
| 524 | } |
| 525 | |
| 526 | auto idx = method.find(L"pic:"); |
| 527 | if (idx != wstring::npos) { |
| 528 | const auto file_path = method.substr(idx + 4); |
| 529 | wstring fullpath; |
| 530 | if (!Path2GlobalPath(file_path, _curr_path, fullpath)) { |
| 531 | return 0; |
| 532 | } |
| 533 | |
| 534 | Image image; |
| 535 | if (!image.read(fullpath.data())) { |
| 536 | return 0; |
| 537 | } |
| 538 | |
| 539 | _pic = image; |
| 540 | _display_method = {L"pic", file_path}; |
| 541 | return 1; |
| 542 | } |
| 543 | |
| 544 | idx = method.find(L"mem:"); |
| 545 | if (idx != wstring::npos) { |
| 546 | std::wstring mem_arg; |
| 547 | Image image; |
| 548 | if (!op::capture::ParseMemoryImageSource(method.substr(idx + 4), image, mem_arg)) { |
| 549 | return 0; |
| 550 | } |
| 551 | |
| 552 | _pic = image; |
| 553 | _display_method = {L"mem", mem_arg}; |
| 554 | return 1; |
| 555 | } |
| 556 | |
| 557 | return 0; |
| 558 | } |
| 559 | |
| 560 | bool BindingSession::requestCapture(int x1, int y1, int w, int h, Image &img) { |
| 561 | const auto &method = get_display_method().first; |
no test coverage detected