
โลโก้ด้านบนสร้างโดย https://github.com/mansya
อาจารย์คือการพัฒนาที่เกิดขึ้นและไม่ควรถือว่ามีเสถียรภาพ ใช้แท็กสำหรับรีลีสที่เสถียร
หน้าต่าง/linux/mac
หน้าจอข้ามแพลตฟอร์มและไลบรารีการจับหน้าต่าง
Linux: sudo apt-get ติดตั้ง libxtst-dev libxinerama-dev libx11-dev libxfixes-dev
รูปแบบภาพคือ RAW BGRA 32 บิตต่อพิกเซล อัลฟ่าไม่ได้ใช้สำหรับ OnNewFrame และ OnFrameChanged ยกเว้น OnmouseChanged ที่ใช้!
ข้อมูลมีอยู่เช่นนี้หากคุณต้องเดินผ่านด้วย A สำหรับห่วง [A, R, G, B], [A, R, G, B], [A, R, G, B, 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 ) ;กำหนดสิ่งที่คุณสนใจเท่านั้นอย่านิยามการโทรกลับสำหรับ OnmouseChanged หากคุณไม่ต้องการข้อมูลนั้น ถ้าคุณทำเช่นนั้นห้องสมุดจะถือว่าคุณต้องการข้อมูลเมาส์และตรวจสอบสิ่งนั้น -อย่า!
อีกครั้งอย่านิยามการโทรกลับสำหรับเหตุการณ์ที่คุณไม่สนใจ ถ้าคุณทำเช่นนั้นห้องสมุดจะทำงานพิเศษโดยสมมติว่าคุณต้องการข้อมูล
ไลบรารีเป็นเจ้าของข้อมูลรูปภาพทั้งหมดดังนั้นหากคุณต้องการใช้เพื่อจุดประสงค์ของคุณเองหลังจากการโทรกลับเสร็จสมบูรณ์คุณต้องคัดลอกข้อมูลออกมา!
แต่ละจอภาพหรือหน้าต่างจะทำงานในเธรดของตัวเองดังนั้นจึงไม่มีการปิดกั้นหรือการซิงโครไนซ์ภายใน หากคุณกำลังจับจอมอนิเตอร์สามตัวเธรดจะจับภาพแต่ละจอ
การโทรไปยัง ICAPTURECONFIGURATION ไม่สามารถเปลี่ยนแปลงได้หลังจากเรียก start_capturing คุณต้องทำลายมันและสร้างมันขึ้นมาใหม่!
การโทรไปยัง iScreencaptureManager สามารถเปลี่ยนแปลงได้ตลอดเวลาจากเธรดใด ๆ เนื่องจากการโทรทั้งหมดนั้นปลอดภัย!