0
我使用如何在兩個方向上使用CGMutablePathRef繪製線條?
CGMutablePathRef path = CGPathCreateMutable();
for (int i = 0; i < [_points count]; i++)
{
CGPoint pt = [[_points objectAtIndex:i] CGPointValue];
if (i == 0)
{
CGPathMoveToPoint(path, NULL, pt.x+1, pt.y+1);
}
else
{
CGPathAddLineToPoint(path, NULL, pt.x+1, pt.y+1);
}
}
CGContextSetLineWidth(context, 1.0f);
CGContextSetStrokeColorWithColor(context, curveColor.CGColor);
CGContextAddPath(context, path);
CGContextStrokePath(context);
CGPathRelease(path);
我可以程度在一個方向上的線條畫線。但是我想在一定程度上延伸這兩個方向(上行和下行)。如何在兩個方向上延長線?
我無法找到newStartPoint和newEndPoint ...所以我想擴展遞歸,直到點達到一定限制..如何做到這一點? – Surfer
http://www.mathsisfun.com/equation_of_line.html – Wain