mirror of
https://github.com/go-vgo/robotgo
synced 2026-05-23 17:59:12 +00:00
update get_pixel_color remove duplicate code
This commit is contained in:
parent
3e024a3fe1
commit
213521927f
1 changed files with 2 additions and 22 deletions
|
|
@ -62,29 +62,9 @@ MMRGBHex get_px_color(size_t x, size_t y){
|
|||
}
|
||||
|
||||
char* get_pixel_color(size_t x, size_t y){
|
||||
MMBitmapRef bitmap;
|
||||
MMRGBHex color;
|
||||
|
||||
if (!pointVisibleOnMainDisplay(MMPointMake(x, y))){
|
||||
// return 1;
|
||||
return "screen's dimensions.";
|
||||
}
|
||||
|
||||
bitmap = copyMMBitmapFromDisplayInRect(MMRectMake(x, y, 1, 1));
|
||||
// bitmap = MMRectMake(x, y, 1, 1);
|
||||
|
||||
color = MMRGBHexAtPoint(bitmap, 0, 0);
|
||||
|
||||
char hex[7];
|
||||
padHex(color, hex);
|
||||
destroyMMBitmap(bitmap);
|
||||
|
||||
// printf("%s\n", hex);
|
||||
// return 0;
|
||||
|
||||
char* s = (char*)calloc(100, sizeof(char*));
|
||||
if(s)strcpy(s, hex);
|
||||
MMRGBHex color = get_px_color(x, y);
|
||||
|
||||
char* s = pad_hex(color);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue