我又有两个问题,它们是相关的:
- 我想用核心图形绘制浮雕线。 有人能建议我如何在触摸事件上绘制内阴影的线吗?
- 即使是为了绘制外部阴影。 阴影重叠在中间。 而且用其他颜色绘制的线就像蠕虫一样……有人能帮忙吗?
下面的图像说明了我想解释问题2的意思:
创建的阴影不均匀。 它们在某些点变暗
我添加的代码用于绘制线条:
for (int i=0; i<[currentPath count]; i++)
{
CGPoint mid1 = [[self midPoint:[currentPath objectAtIndex:i+1] :[currentPath objectAtIndex:i]] CGPointValue];
CGPoint mid2 = [[self midPoint:[currentPath objectAtIndex:i+2] :[currentPath objectAtIndex:i+1]] CGPointValue];
CGContextMoveToPoint(context, mid1.x, mid1.y);
CGContextAddQuadCurveToPoint(context, [[currentPath objectAtIndex:i+1] CGPointValue].x, [[currentPath objectAtIndex:i+1] CGPointValue].y, mid2.x, mid2.y);
CGContextSetShadow(context, CGSizeMake(-2, -2), 3);
CGContextSetLineCap(context, kCGLineCapRound);
CGContextSetStrokeColorWithColor(context,[color CGColor]);
CGContextSetLineWidth(context, linewidth);
CGContextStrokePath(context);
i+=2;
}