我想在我的iPad应用程序中绘制,如下图所示
在我的应用程序中,我放置了一个图像,同时移动手指(触摸移动)我重复图像,但我的图像似乎如下。
以下是我绘制图像的代码
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();
如何在第一张图片中获取我的图片
实际上我有一个图像并将所选颜色填充到图像并开始在这里绘图我有一个图像