update get_pixel_color remove duplicate code

This commit is contained in:
vcaesar 2018-08-18 09:25:23 -04:00
parent 3e024a3fe1
commit 213521927f

View File

@ -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;
}