我尝试做从 UIColor 获取 B(亮度)的方法。
问题出在方法的第二部分。当我记录结果时 bri 等于 _red。哪里有问题?
-(void)rgbToHSBWithR:(float)_red G:(float)_green B:(float)_blue {
_red = _red / 255.0;
_green = _green / 255.0;
_blue = _blue / 255.0;
UIColor *color = [UIColor colorWithRed:_red green:_green blue:_blue alpha:1];
float hue, sat, bri, alpha;
[color getHue:&hue saturation:&sat brightness:&bri alpha:&alpha];
NSLog(@"R: %f, G: %0.2f, B: %0.2f, V: %f", _red, _green, _blue, bri);
}