
Oben Logo erstellt von https://github.com/mansya
Der Meister ist, wo die Entwicklung erfolgt und nicht als stabil angesehen werden sollte. Verwenden Sie Tags für stabile Veröffentlichungen.
Fenster/Linux/Mac
Plattformübergreifende Bildschirm- und Fensterfassungsbibliothek
Linux: sudo apt-Get Installieren
Das Bildformat ist rohe BGRA 32 Bit pro Pixel. Alpha ist für OnNewframe und Onframechanged mit Ausnahme von OnmousChanged, wo es verwendet wird, nicht genutzt!
Die Daten existieren so, wenn Sie mit A for Loop [A, R, G, B], [A, R, G, B], [A, R, G, B] durchmarschieren würden. Lesen Sie, warum dies der Beitrag hier hier ist
https://github.com/smasherprog/screen_capture_lite/blob/master/example_cpp/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::SCL_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::MousePoint &mousepoint) {
})-> start_capturing ();
framgrabber-> SCL_SetFrameChangeInterval (std::chrono::milliseconds( 100 )); // 100 ms
framgrabber-> SCL_SetMouseChangeInterval (std::chrono::milliseconds( 100 )); // 100 ms
// Setup Screen Capture for windows that have the title "cmake" in it
auto windowframgrabber = SL::Screen_Capture::CreateCaptureConfiguration([]() {
auto windows = SL::Screen_Capture::SCL_GetWindows ();
std::string srchterm = " cmake " ;
// 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::MousePoint &mousepoint) {
})-> start_capturing ();
windowframgrabber-> SCL_SetFrameChangeInterval (std::chrono::milliseconds( 100 )); // 100 ms
windowframgrabber-> SCL_SetMouseChangeInterval (std::chrono::milliseconds( 100 )); // 100 ms
C#
https://github.com/smasherprog/screen_capture_lite/blob/master/example_csharp/program.cs
//Setup Screen Capture for all monitors
var framgrabber = SL . Screen_Capture . CaptureConfiguration . CreateCaptureConfiguration ( ( ) =>
{
var mons = SL . Screen_Capture . SCL_GetMonitors ( ) ;
Console . WriteLine ( "Library is requesting the list of monitors to capture!" ) ;
for ( int i = 0 ; i < mons . Length ; ++ i )
{
WriteLine ( mons [ i ] ) ;
}
return mons ;
} ) . onNewFrame ( ( SL . Screen_Capture . Image img , SL . Screen_Capture . Monitor monitor ) =>
{
} ) . onFrameChanged ( ( SL . Screen_Capture . Image img , SL . Screen_Capture . Monitor monitor ) =>
{
} ) . onMouseChanged ( ( SL . Screen_Capture . Image img , SL . Screen_Capture . MousePoint mousePoint ) =>
{
} ) . start_capturing ( ) ;
framgrabber . SCL_SetFrameChangeInterval ( 100 ) ;
framgrabber . SCL_SetMouseChangeInterval ( 100 ) ;
//Setup Screen Capture for windows that have the title "google" in it
var framgrabber = SL . Screen_Capture . CaptureConfiguration . CreateCaptureConfiguration ( ( ) =>
{
var windows = SL . Screen_Capture . SCL_GetWindows ( ) ;
Console . WriteLine ( "Library is requesting the list of windows to capture!" ) ;
for ( int i = 0 ; i < windows . Length ; ++ i )
{
WriteLine ( windows [ i ] ) ;
}
return windows . Where ( a => a . Name . ToLower ( ) . Contains ( "google" ) ) . ToArray ( ) ;
} ) . onNewFrame ( ( SL . Screen_Capture . Image img , SL . Screen_Capture . Window monitor ) =>
{
} ) . onFrameChanged ( ( SL . Screen_Capture . Image img , SL . Screen_Capture . Window monitor ) =>
{
} ) . onMouseChanged ( ( SL . Screen_Capture . Image img , SL . Screen_Capture . MousePoint mousePoint ) =>
{
} ) . start_capturing ( ) ;
framgrabber . SCL_SetFrameChangeInterval ( 100 ) ;
framgrabber . SCL_SetMouseChangeInterval ( 100 ) ;Definieren Sie nur, woran Sie interessiert sind. Definieren Sie keinen Rückruf für Onmousechanged, wenn Sie diese Informationen nicht wünschen. Wenn Sie dies tun, wird die Bibliothek davon ausgehen, dass Sie Mausinformationen möchten und dies überwachen -also nicht!
Definieren Sie noch einmal Rückrufe für Ereignisse, die Ihnen egal sind. Wenn Sie dies tun, wird die Bibliothek zusätzliche Arbeit erledigen, vorausgesetzt, Sie möchten die Informationen.
Die Bibliothek besitzt alle Bilddaten. Wenn Sie sie nach Abschluss des Rückrufs zu Ihrem eigenen Zweck verwenden möchten, müssen Sie die Daten auskopieren!
Jeder Monitor oder Fenster wird in seinem eigenen Thread ausgeführt, sodass keine Blockierung oder interne Synchronisation vorhanden ist. Wenn Sie drei Monitore erfassen, erfasst ein Thread jeden Monitor.
Anrufe bei IcaptureConfiguration können nicht geändert werden, nachdem start_capturing aufgerufen wurde. Sie müssen es zerstören und neu erstellen!
Anrufe bei IsCreencapturemanager können jederzeit von jedem Thread geändert werden, da alle Anrufe sicher sind!