目前采用了这个方法当imageview读取的图片的RGB
- (UIColor *)getPixelWithImage:(UIImage *)image: atPointX:(int)x andY:(int)y {
int a=UIColor.red;
CFDataRef pixelData = CGDataProviderCopyData(CGImageGetDataProvider(
image.CGImage));
const UInt8* data = CFDataGetBytePtr(pixelData);
int pixelInfo = ((image.size.width * y) + x ) * 4;
UInt8 red = data[pixelInfo];
UInt8 green = data[(pixelInfo + 1)];
UInt8 blue = data[pixelInfo + 2];
UInt8 alpha = data[pixelInfo + 3];
CFRelease(pixelData);
return [UIColor colorWithRed:red/255.0f green:green/255.0f
blue:blue/255.0f alpha:alpha/255.0f];
}
请问有方法依照鼠标目前的位置
秀出那个位置的RGB的值吗?
目前就只剩这边卡关了
请各位高手务必帮忙