title: how to get only pixels from inside a irregular shape from uiimageview in iphone?
body: <p>i want to get only those pixels which are inside an irregular shape..using core graphics not openGL.here is an image where i have drawn an irregular shape.</p>
  
  <p><a href="https://i.stack.imgur.com/3LMRx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3LMRx.png" alt="alt text"></a>
  </p>
  
  <p>and here is the drawing code</p>
  
  <pre><code>- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
      if(drawLineClicked)
      {
          UITouch *touch = [touches anyObject];
          if ([touch view] == EditImageView)
          {
          lastPoint = [touch locationInView:self.view];
          [self drawLines:10.0 andColorWithRed:1.0 Green:0.0 Blue:0.0 Alpha:1.0];
          [self.view setNeedsDisplay];
          currentPoint = lastPoint;
          }
      }
  }
  
  
  -(void)drawLines:(CGFloat)withWidth andColorWithRed:(CGFloat)red Green:(CGFloat)green Blue:(CGFloat)blue Alpha:(CGFloat)alpha
  {
  UIGraphicsBeginImageContext(Image.size);
      [EditImageView.image drawInRect:CGRectMake(0, 0, Image.size.width, Image.size.height)];
   ctx = UIGraphicsGetCurrentContext();
  CGContextSetLineCap(ctx, kCGLineCapRound);
  CGContextSetAllowsAntialiasing(ctx,TRUE);
  CGContextFlush(ctx);
  //sets the line width for a graphic context
  CGContextSetLineWidth(ctx,withWidth);
  //set the line colour
  CGContextSetRGBStrokeColor(ctx, red, green, blue, alpha);  
  CGContextMoveToPoint(ctx, currentPoint.x, currentPoint.y);     
  CGContextAddLineToPoint(ctx, lastPoint.x,lastPoint.y);      
  CGContextStrokePath(ctx);
  EditImageView.image = UIGraphicsGetImageFromCurrentImageContext();
  UIGraphicsEndImageContext();
  }
  </code></pre>