Ios 用图形绘制

Ios 用图形绘制,ios,drawing,Ios,Drawing,我正在玩我正在制作的一个小绘图应用程序,想知道如何像在photoshop中那样更改“画笔”。我想使用自定义图像作为画笔,而不仅仅是一个圆。我该怎么做呢 以下是我目前的绘图方式: UIGraphicsBeginImageContext(self.view.frame.size); [drawImage.image drawInRect:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)

我正在玩我正在制作的一个小绘图应用程序,想知道如何像在photoshop中那样更改“画笔”。我想使用自定义图像作为画笔,而不仅仅是一个圆。我该怎么做呢

以下是我目前的绘图方式:

    UIGraphicsBeginImageContext(self.view.frame.size);

    [drawImage.image drawInRect:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];

    CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);

    CGContextSetBlendMode(UIGraphicsGetCurrentContext(), kCGBlendModeCopy);

    CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 0.0, 0.0, 0.0, 1.0);


    CGContextSetLineWidth(UIGraphicsGetCurrentContext(), currentSize);

    CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);

    CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);

    CGContextStrokePath(UIGraphicsGetCurrentContext());

    CGContextFlush(UIGraphicsGetCurrentContext());

    drawImage.image = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

您需要在组成笔刷笔划的线段上的多个点上绘制具有适当混合的笔刷图像