0
我通過RGB值255-140-0傳遞RGB值到CGContextSetRGBStrokeColor不是爲橙色正常工作
CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(),紅,綠,藍,1.0);對我來說它的繪畫黃色!不是橙色。
我嘗試測試一些255以下的隨機值到CGContextSetRGBStokeColor,它向我繪製白色。我不知道爲什麼這樣!
@ALL任何一個可以建議我在這個問題上
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch *touch = [touches anyObject];
CGPoint currentPoint = [touch locationInView:drawImage];
currentPoint.y -= 20;
UIGraphicsBeginImageContext(drawImage.frame.size);
[drawImage.image drawInRect:CGRectMake(0, 0, drawImage.frame.size.width, drawImage.frame.size.height)];
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 5.0);
CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), red, green, blue, 1.0);
CGContextBeginPath(UIGraphicsGetCurrentContext());
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentPoint.x, currentPoint.y);
CGContextStrokePath(UIGraphicsGetCurrentContext());
drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
Nick Bull謝謝你!我將這些值與255分開,對我的工作非常感謝! – user905582 2012-02-06 14:48:35