Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>Logic for air brush......... - (UIBezierPath *)pathFromPoint:(CGPoint)start toPoint:(CGPoint)end { CGFloat lineWidth=10; redrawRect = CGRectMake(end.x-lineWidth,end.y-lineWidth,lineWidth*2,lineWidth*2); UIBezierPath *bezierPath = [UIBezierPath bezierPath]; UIBezierPath *circle = [UIBezierPath bezierPathWithOvalInRect:redrawRect]; NSInteger i, x, y; NSInteger modNumber =4*(int)lineWidth; for (i = 0; i &lt; (lineWidth*lineWidth)/2; i++) { do { x = (random() % modNumber)+end.x - 2*lineWidth; y = (random() % modNumber)+end.y - 2*lineWidth; } while (![circle containsPoint:CGPointMake(x,y)]); [bezierPath appendPath:[UIBezierPath bezierPathWithRect:CGRectMake(x,y,0.5,0.5)]]; } return bezierPath; } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; currentPoint = [touch locationInView:self.view]; currentPoint.y -=20; [self drawCircle]; } -(void)drawCircle{ UIGraphicsBeginImageContext(self.drawImage.frame.size); [drawImage.image drawInRect:CGRectMake(0,0, drawImage.frame.size.width, drawImage.frame.size.height)]; //originally self.frame.size.width, self.frame.size.height)]; CGContextSetLineWidth(UIGraphicsGetCurrentContext(),10); CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 0.0, 0.0, 0.0, 1.0); UIBezierPath *path=[self pathFromPoint:currentPoint toPoint:currentPoint]; [path stroke]; lastPoint = currentPoint; CGContextStrokePath(UIGraphicsGetCurrentContext()); CGContextFlush(UIGraphicsGetCurrentContext()); drawImage.image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload