Note: This library is is stable and contains no known bugs. I will continue to fix any bugs and test against the platforms as they are updated.
Cross-platform screen and window capturing library . . . this is made to be lightweight and fast. see the Exmaple folder for a demo
linux: sudo apt-get install libxtst-dev libxinerama-dev libx11-dev libxfixes-dev
- Windows 7 and Up
- MacOS
- Linux
The image format is raw BGRA 32 bits per pixel. Alpha is unused!
The data exists like this if you were to march through with a for loop [A,R,G,B], [A,R,G,B], [A,R,G,B]. For a read on why this is check out the post here post here
https://github.com/smasherprog/screen_capture_lite/blob/master/Example/Screen_Capture_Example.cpp
//Setup Screen Capture for all monitors
auto framgrabber = SL::Screen_Capture::CreateCaptureConfiguration([]() {
//add your own custom filtering here if you want to capture only some monitors
return SL::Screen_Capture::GetMonitors();
})->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, const SL::Screen_Capture::Point& point) {
})->start_capturing();
framgrabber->setFrameChangeInterval(std::chrono::milliseconds(100));//100 ms
framgrabber->setMouseChangeInterval(std::chrono::milliseconds(100));//100 ms
//Setup Screen Capture for windows that have the title "cmake 3.8" in it
auto windowframgrabber = SL::Screen_Capture::CreateCaptureConfiguration([]() {
auto windows = SL::Screen_Capture::GetWindows();
std::string srchterm = "cmake 3.8";
// convert to lower case for easier comparisons
std::transform(srchterm.begin(), srchterm.end(), srchterm.begin(), [](char c) { return std::tolower(c, std::locale());});
decltype(windows) filtereditems;
for(auto& a : windows) {
std::string name = a.Name;
std::transform(name.begin(), name.end(), name.begin(), [](char c) {return std::tolower(c, std::locale()); });
if(name.find(srchterm) != std::string::npos) {
filtereditems.push_back(a);
}
}
return filtereditems;
})->onFrameChanged([&](const SL::Screen_Capture::Image& img, const SL::Screen_Capture::Window& window) {
})->onNewFrame([&](const SL::Screen_Capture::Image& img, const SL::Screen_Capture::Window& window) {
})->onMouseChanged([&](const SL::Screen_Capture::Image* img, const SL::Screen_Capture::Point& point) {
})->start_capturing();
windowframgrabber->setFrameChangeInterval(std::chrono::milliseconds(100));//100 ms
windowframgrabber->setMouseChangeInterval(std::chrono::milliseconds(100));//100 ms