ios - Cepillo de dibujo de dedos toches movimientos
Quiero dibujar en mi aplicación de iPad como en la siguiente imagen
En mi aplicación he colocado una imagen y mientras muevo el dedo (movimiento táctil) repito las imágenes, pero mi imagen parece ser la siguiente.
A continuación se muestra mi código para dibujar la imagen.
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();
Como obtener mi imagen como en la primera imagen.
De hecho, tengo una imagen y relleno el color seleccionado con la imagen y comencé a dibujar aquí. Tengo una imagen