MCPcopy Create free account
hub / github.com/WallBreaker2/op / set_display_method

Method set_display_method

libop/binding/BindingSession.cpp:520–558  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

518}
519
520long 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
560bool BindingSession::requestCapture(int x1, int y1, int w, int h, Image &img) {
561 const auto &method = get_display_method().first;

Callers 1

SetDisplayInputMethod · 0.80

Calls 5

Path2GlobalPathFunction · 0.85
ParseMemoryImageSourceFunction · 0.85
findMethod · 0.80
readMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected