2

I searched the web site, and I found how to draw a color wheel... Math behind the Colour Wheel

But 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

Community
  • 1
  • 1
Tattat
  • 15,548
  • 33
  • 87
  • 138

1 Answers1

0

Maybe its use for you.

  1. 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()); }

  1. Draw UIImage to UIView. UIColor* backColor = [UIColor colorWithPatternImage:your_image_from_cgcontext]; view.backgroundColor = backColor;
O' y
  • 1
  • 1