
https://github.com/mansyaによって作成された上記のロゴ
マスターは開発が起こる場所であり、安定したと見なされるべきではありません。安定したリリースにタグを使用します。
ウィンドウ/Linux/Mac
クロスプラットフォーム画面とウィンドウキャプチャライブラリ
Linux:sudo apt-getインストールlibxtst-dev libxinerama-dev libx11-dev libxfixes-dev
画像形式は、ピクセルあたりRAW BGRA 32ビットです。 AlphaはonnewFrameで使用されておらず、使用されている場所を除いてオンフレマチェンジをしています!
あなたがa for loop [a、r、g、b]、[a、r、g、b]、[a、r、g、b]で行進する場合、データはこのように存在します。これがここで投稿されている理由については、こちらの投稿をご覧ください
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 ) ;興味のあることのみを定義してください。その情報が必要ない場合は、オンマーチェンジのコールバックを定義しないでください。もしそうなら、ライブラリはマウス情報が必要であると想定し、それを監視します - そうしないでください!
繰り返しますが、気にしないイベントのコールバックを定義しないでください。もしそうなら、図書館はあなたが情報を望むと仮定して追加の作業を行います。
ライブラリはすべての画像データを所有しているため、コールバックが完了した後に自分の目的のために使用したい場合は、データをコピーする必要があります。
各モニターまたはウィンドウは独自のスレッドで実行されるため、ブロッキングや内部同期はありません。 3つのモニターをキャプチャしている場合、スレッドが各モニターをキャプチャしています。
start_capturingが呼び出された後、icaptureconfigurationへの呼び出しを変更することはできません。あなたはそれを破壊して再現する必要があります!
すべての呼び出しがスレッドセーフであるため、iScreencapturemanagerへの呼び出しはいつでもスレッドから変更できます!