File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed
Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 1111package robotgo
1212
1313import (
14+ "errors"
1415 "image"
1516
1617 "github.com/kbinani/screenshot"
@@ -53,9 +54,9 @@ func Capture(args ...int) (*image.RGBA, error) {
5354
5455// SaveCapture capture screen and save the screenshot to image
5556func SaveCapture (path string , args ... int ) error {
56- img , err := Capture (args ... )
57- if err ! = nil {
58- return err
57+ img := CaptureImg (args ... )
58+ if img = = nil {
59+ return errors . New ( "Capture image not found" )
5960 }
6061
6162 return Save (img , path )
Original file line number Diff line number Diff line change 1212#include "../base/pubs.h"
1313#include "../base/rgb.h"
1414#include "screengrab_c.h"
15- #include "screen_c.h"
1615#include <stdio.h>
1716
1817void padHex (MMRGBHex color , char * hex ) {
Original file line number Diff line number Diff line change 1313#elif defined(IS_WINDOWS )
1414 #include <string.h>
1515#endif
16+ #include "screen_c.h"
1617
1718#if defined(IS_MACOSX ) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > MAC_OS_VERSION_14_4
1819 static CGImageRef capture15 (CGDirectDisplayID id , CGRect diIntersectDisplayLocal , CGColorSpaceRef colorSpace ) {
3940
4041 SCContentFilter * filter = [[SCContentFilter alloc ] initWithDisplay :target excludingWindows :@[]];
4142 SCStreamConfiguration * config = [[SCStreamConfiguration alloc ] init ];
43+ config .queueDepth = 5 ;
4244 config .sourceRect = diIntersectDisplayLocal ;
43- config .width = diIntersectDisplayLocal .size .width ;
44- config .height = diIntersectDisplayLocal .size .height ;
45+ config .width = diIntersectDisplayLocal .size .width * sys_scale (id );
46+ config .height = diIntersectDisplayLocal .size .height * sys_scale (id );
47+ config .scalesToFit = false;
48+ config .captureResolution = 1 ;
4549
4650 [SCScreenshotManager captureImageWithFilter :filter
4751 configuration :config
You can’t perform that action at this time.
0 commit comments