mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-05-30 22:13:54 +00:00
Merge pull request #692 from go-vgo/bitmap-pr
Fixed: default use high capture resolution in macos15
This commit is contained in:
commit
217d6cf1f1
@ -11,6 +11,7 @@
|
|||||||
package robotgo
|
package robotgo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"image"
|
"image"
|
||||||
|
|
||||||
"github.com/kbinani/screenshot"
|
"github.com/kbinani/screenshot"
|
||||||
@ -53,9 +54,9 @@ func Capture(args ...int) (*image.RGBA, error) {
|
|||||||
|
|
||||||
// SaveCapture capture screen and save the screenshot to image
|
// SaveCapture capture screen and save the screenshot to image
|
||||||
func SaveCapture(path string, args ...int) error {
|
func SaveCapture(path string, args ...int) error {
|
||||||
img, err := Capture(args...)
|
img := CaptureImg(args...)
|
||||||
if err != nil {
|
if img == nil {
|
||||||
return err
|
return errors.New("Capture image not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
return Save(img, path)
|
return Save(img, path)
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
#include "../base/pubs.h"
|
#include "../base/pubs.h"
|
||||||
#include "../base/rgb.h"
|
#include "../base/rgb.h"
|
||||||
#include "screengrab_c.h"
|
#include "screengrab_c.h"
|
||||||
#include "screen_c.h"
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
void padHex(MMRGBHex color, char* hex) {
|
void padHex(MMRGBHex color, char* hex) {
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#elif defined(IS_WINDOWS)
|
#elif defined(IS_WINDOWS)
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include "screen_c.h"
|
||||||
|
|
||||||
#if defined(IS_MACOSX) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > MAC_OS_VERSION_14_4
|
#if defined(IS_MACOSX) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > MAC_OS_VERSION_14_4
|
||||||
static CGImageRef capture15(CGDirectDisplayID id, CGRect diIntersectDisplayLocal, CGColorSpaceRef colorSpace) {
|
static CGImageRef capture15(CGDirectDisplayID id, CGRect diIntersectDisplayLocal, CGColorSpaceRef colorSpace) {
|
||||||
@ -39,9 +40,12 @@
|
|||||||
|
|
||||||
SCContentFilter* filter = [[SCContentFilter alloc] initWithDisplay:target excludingWindows:@[]];
|
SCContentFilter* filter = [[SCContentFilter alloc] initWithDisplay:target excludingWindows:@[]];
|
||||||
SCStreamConfiguration* config = [[SCStreamConfiguration alloc] init];
|
SCStreamConfiguration* config = [[SCStreamConfiguration alloc] init];
|
||||||
|
config.queueDepth = 5;
|
||||||
config.sourceRect = diIntersectDisplayLocal;
|
config.sourceRect = diIntersectDisplayLocal;
|
||||||
config.width = diIntersectDisplayLocal.size.width;
|
config.width = diIntersectDisplayLocal.size.width * sys_scale(id);
|
||||||
config.height = diIntersectDisplayLocal.size.height;
|
config.height = diIntersectDisplayLocal.size.height * sys_scale(id);
|
||||||
|
config.scalesToFit = false;
|
||||||
|
config.captureResolution = 1;
|
||||||
|
|
||||||
[SCScreenshotManager captureImageWithFilter:filter
|
[SCScreenshotManager captureImageWithFilter:filter
|
||||||
configuration:config
|
configuration:config
|
||||||
|
Loading…
Reference in New Issue
Block a user