解决我的最后一个问题:在 UIView 中的贝塞尔曲线路径内像草图颜色一样绘制/绘制,我拍摄了一个精确的图像(路径),并填充了所选颜色。然后,将其画入UIView
,对于上下文颜色,我采用了:
lineColor=[UIColor colorWithPatternImage:img];
在绘图中:
CGPoint mid1 = midPoint(previousPoint1, previousPoint2);
CGPoint mid2 = midPoint(currentPoint, previousPoint1);
[curImage drawInRect:CGRectZero];
CGContextRef context = UIGraphicsGetCurrentContext();
[self.layer renderInContext:context];
CGContextMoveToPoint(context, mid1.x, mid1.y);
CGContextAddQuadCurveToPoint(context,
previousPoint1.x,
previousPoint1.y,
mid2.x,
mid2.y);
CGContextSetLineCap(context, kCGLineCapRound);
CGContextSetBlendMode(context, kCGBlendModeCopy);
CGContextSetLineJoin(context, kCGLineJoinRound);
CGContextSetLineWidth(context, self.lineWidth);
CGContextSetStrokeColorWithColor(context,lineColor.CGColor);
CGContextSetShouldAntialias(context, YES);
CGContextSetAllowsAntialiasing(context, YES);
CGContextSetFlatness(context,0.5);
CGContextSetAlpha(context, 1.0);
CGContextStrokePath(context);
它精确地在视图路径中绘制,但在边界上颜色像融化效果一样消失。
Source Image in which color has to be filled :
image to be used as colorWithPatternImage (img)
After drawing on touches ,resultimg Image :
我在这里缺少什么来完美地填补它?
非常欢迎任何有关核心显卡的帮助!
谢谢你!
为了掩盖图像我也做了:
-(void)clipView :(MyUIBezierPath*)path drawingView:(DrawingView*)myView
{
MyUIBezierPath *myClippingPath =path;
CAShapeLayer *mask = [CAShapeLayer layer];
mask.path = myClippingPath.CGPath;
myView.layer.mask = mask;
}
但是 colorWithPatternImage 和这个遮罩做了同样的技巧,即让我只在路径内部绘制,我现在面临的问题是:它对在路径边界周围的触摸点上绘制产生了不好的影响!