iphone中的CGContextSetStrokeColorWithColor

时间:2012-12-12 12:50:05

标签: iphone objective-c ios xcode

我在UITouches Moved中使用此代码来绘制图片。

 UIGraphicsBeginImageContext(myimage.frame.size);

[myimage.image drawInRect:myimage.frame];

CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);

CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 10);

CGContextSetStrokeColorWithColor(UIGraphicsGetCurrentContext(), [UIColor colorWithPatternImage:[UIImage imageNamed:@"coloredImage.png"]].CGColor);

CGContextSetFillColorWithColor(UIGraphicsGetCurrentContext(), [UIColor clearColor].CGColor);

CGContextSetShouldAntialias(UIGraphicsGetCurrentContext(), YES);


CGContextBeginPath(UIGraphicsGetCurrentContext());


CGContextMoveToPoint(UIGraphicsGetCurrentContext(), previous.x, previous.y);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), touchLocation.x, touchLocation.y);
CGContextStrokePath(UIGraphicsGetCurrentContext());
myimage.image = UIGraphicsGetImageFromCurrentImageContext();
previous = touchLocation;

这里我需要在用户完全绘制图像时进行警告...即,我有一个图案图像为myimagecoloredImage是覆盖myimage的图像当用户触摸时如何确定用户是否完成了图像绘制?

0 个答案:

没有答案