Iphone iOS RGB颜色不正确?
我用RGB(135213,0)画一条线,RGB(135213,0)应该是。但是iOS显示黄线!!为什么?将每个值除以255即RGB(135/255213/255,0)您需要使值在[0,1]范围内。因此,需要将每个值除以255Iphone iOS RGB颜色不正确?,iphone,ios,ipad,rgb,uicolor,Iphone,Ios,Ipad,Rgb,Uicolor,我用RGB(135213,0)画一条线,RGB(135213,0)应该是。但是iOS显示黄线!!为什么?将每个值除以255即RGB(135/255213/255,0)您需要使值在[0,1]范围内。因此,需要将每个值除以255 UIGraphicsBeginImageContext(self.view.frame.size); [drawImage.image drawInRect:CGRectMake(0, 0, self.view.frame.size.width, self.vie
UIGraphicsBeginImageContext(self.view.frame.size);
[drawImage.image drawInRect:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 8.0);
CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 135.0,213.0,0.0,1.0);
CGContextBeginPath(UIGraphicsGetCurrentContext());
CGContextMoveToPoint(UIGraphicsGetCurrentContext(),currentPoint.x, currentPoint.y);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentPoint.x, currentPoint.y);
CGContextStrokePath(UIGraphicsGetCurrentContext());
drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
最大值为1.0,将每个参数除以255.0
CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 135.0/255.0,213.0/255.0,0.0,1.0);