I searched the web site, and I found how to draw a color wheel... Math behind the Colour Wheel
B开发者_如何学运维ut I would like to implement it by drawing on the UIView. But how can I do using the Quartz technology? I should draw from by dots or lines? Thank you
Maybe its use for you.
- CGContext*** functions to draw dots or lines, and UIGraphicsGetImageFromCurrentImageContext to get UIImage item.
-(void) drawPoint:(CGPoint)point { CGContextBeginPath(UIGraphicsGetCurrentContext()); CGContextMoveToPoint(UIGraphicsGetCurrentContext(), point.x, point.y); CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), point.x, point.y); CGContextStrokePath(UIGraphicsGetCurrentContext()); }
-(void) drawLineFrom:(CGPoint)start to:(CGPoint)end { CGContextBeginPath(UIGraphicsGetCurrentContext()); CGContextMoveToPoint(UIGraphicsGetCurrentContext(), start.x, start.y); CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), end.x, end.y); CGContextStrokePath(UIGraphicsGetCurrentContext()); }
- Draw UIImage to UIView. UIColor* backColor = [UIColor colorWithPatternImage:your_image_from_cgcontext]; view.backgroundColor = backColor;
精彩评论