我想在我的 iPad 应用程序中画画,如下图所示
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.
以下是我绘制图像的代码
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();
如何获取第一张图片中的我的图片
Actually i have an image and fill the selected color to the image and started drawing here i have a image
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)