1

我想画线,就像粉笔一样。线条的边缘是微弱的。就像在黑板上用粉笔画一样。

我怎么得到这个?现在,我用图像画了线,但它看起来不像在黑板上画,因为线并不模糊。请给我一些建议。

我的- (void)drawRect:(CGRect)rect方法中的代码:

 UIGraphicsBeginImageContext(self.bounds.size);
[curImage  drawInRect:self.bounds];
CGContextRef context = UIGraphicsGetCurrentContext();
 [self.layer renderInContext:context];

  UIImage *imgType = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle]pathForResource:self.strFile ofType:@"png"]];
 [imgType drawInRect:CGRectMake(currentPoint.x, currentPoint.y, 40, 40)];

 curImage = UIGraphicsGetImageFromCurrentImageContext();
 [curImage retain];
UIGraphicsEndImageContext();

输出

粉笔图案图像

4

0 回答 0