BradyBrenot / screen_capture_lite

cross platform screen/window capturing library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

screen capture lite

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.

Linux/Mac

Windows

Cross-platform screen and window capturing library . . . this is made to be lightweight and fast. see the Exmaple folder for a demo

No External Dependencies

Platforms supported:

  • Windows XP and Up
  • MacOS
  • Linux

USAGE

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

About

cross platform screen/window capturing library

License:MIT License


Languages

Language:C++ 90.2%Language:C 8.8%Language:CMake 0.9%Language:Objective-C 0.2%