Closed JulianMined closed 7 years ago
As part of the setup you have to pass a function here https://github.com/smasherprog/Screen_Capture/blob/master/include/ScreenCapture.h#L141
The library uses a callback to determine which monitors to capture You could do something like this
auto framgrabber = SL::Screen_Capture::CreateScreeCapture([]() {
//Modify this function to return the monitors you want to capture
//for example this takes the first monitor and only captures that, but it can be any monitor as long as it is valid
std::vector<std::shared_ptr<Monitor>> tmp;
auto allmonitors=SL::Screen_Capture::GetMonitors();
tmp.push_back(allmonitors[0]);
return tmp;
}).onFrameChanged([&](const SL::Screen_Capture::Image& img, const SL::Screen_Capture::Monitor& monitor) {
}).onNewFrame([&](const SL::Screen_Capture::Image& img, const SL::Screen_Capture::Monitor& monitor) {
}).onMouseChanged([&](const SL::Screen_Capture::Image* img, int x, int y) {
}).start_capturing();
framgrabber.setFrameChangeInterval(std::chrono::milliseconds(100));//100 ms
framgrabber.setMouseChangeInterval(std::chrono::milliseconds(100));//100 ms
It' working, thank you.
Glad to hear.
Hello, it seem that under Linux, all monitors are captured even with the sample code above.
You are Correct.. Ill take a look at that now
Almost done fixing this
This should be fixed for Linux now . . . I also added support for capturing part of the monitor that you wanted. This is supported naively on Linux. I updated the example to show how you can capture just a part of the monitor. https://github.com/smasherprog/screen_capture_lite/blob/master/Example/Screen_Capture_Example.cpp#L35 Care should be taken to make sure you are WITHIN the bounds of the monitor otherwise the library will continually rebuild itself and never capture anything because it thinks the monitors have changed. Capturing just the top left 512x512 squares on two monitors, I was getting over 2k fps so its pretty efficient.
I am now implementing windows/mac variants of this as well.
This is in master, but not part of a release yet as there is more work to be done. It appears to work in linux now
I am still adding checks to make sure the area is within the monitors so there might be a few bugs, but they will be fixed today
This should be fixed now. Added support for capturing part of the monitor as well. . .
Great, i will test this out this week, i hope that partial capture on Mac is possible
I didnt implement this for mac just yet.. only windows and linux..
I have to research more for the mac version
Hello, how can i select a single Monitor?