Fixed: default use high capture resolution in macos15

This commit is contained in:
vcaesar 2024-10-06 18:04:17 -07:00
parent ead43d062e
commit bed6776ca2
3 changed files with 10 additions and 6 deletions

View File

@ -11,6 +11,7 @@
package robotgo
import (
"errors"
"image"
"github.com/kbinani/screenshot"
@ -53,9 +54,9 @@ func Capture(args ...int) (*image.RGBA, error) {
// SaveCapture capture screen and save the screenshot to image
func SaveCapture(path string, args ...int) error {
img, err := Capture(args...)
if err != nil {
return err
img := CaptureImg(args...)
if img == nil {
return errors.New("Capture image not found")
}
return Save(img, path)

View File

@ -12,7 +12,6 @@
#include "../base/pubs.h"
#include "../base/rgb.h"
#include "screengrab_c.h"
#include "screen_c.h"
#include <stdio.h>
void padHex(MMRGBHex color, char* hex) {

View File

@ -1,4 +1,5 @@
#include "../base/bitmap_free_c.h"
#include "screen_c.h"
#include <stdlib.h> /* malloc() */
#if defined(IS_MACOSX)
@ -39,9 +40,12 @@
SCContentFilter* filter = [[SCContentFilter alloc] initWithDisplay:target excludingWindows:@[]];
SCStreamConfiguration* config = [[SCStreamConfiguration alloc] init];
config.queueDepth = 5;
config.sourceRect = diIntersectDisplayLocal;
config.width = diIntersectDisplayLocal.size.width;
config.height = diIntersectDisplayLocal.size.height;
config.width = diIntersectDisplayLocal.size.width * sys_scale(id);
config.height = diIntersectDisplayLocal.size.height * sys_scale(id);
config.scalesToFit = false;
config.captureResolution = 1;
[SCScreenshotManager captureImageWithFilter:filter
configuration:config