i want to draw in my iPad app as in the following image
in my app i have placed a image and while moving the finger(touch movement) i am repeating the images, but my image seems to be as follows.
Following is my code to draw the image
CGBlendMode blendMode = kCGBlendModeColorDodge;
UIGraphicsBeginImageContext(drawImage.frame.size);
[drawImage.image drawInRect:CGRectMake(0, 0, drawImage.frame.size.width, drawImage.frame.size.height)];
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
//// NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"Watercolor-edge-45x45.png" ofType:nil];
UIImage * textureColor;// = [UIImage imageWithContentsOfFile:imagePath];
float angle = hypot(deltaX, deltaY);
angle *= rand() % 180;//(M_PI / 180);
CGPoint vector = CGPointMake(currentPoint.x - lastPoint.x, currentPoint.y - lastPoint.y);
CGFloat distance = hypotf(vector.x, vector.y);
vector.x /= distance;
vector.y /= distance;
for (CGFloat i = 0; i < distance; i += 1.0f) {
textureColor = [UIImage imageWithCGImage:[self CGImageRotatedByAngle:image angle:angle * -1]];
CGPoint p = CGPointMake(lastPoint.x + i * vector.x, lastPoint.y + i * vector.y);
[textureColor drawAtPoint:p blendMode:blendMode alpha:0.1f];
}
CGContextBeginPath(UIGraphicsGetCurrentContext());
CGContextStrokePath(UIGraphicsGetCurrentContext());
UIImage *newimage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
How to get the my image as in the first image
Actually i have an image and fill the selected color to the image and started drawing here i have a image