我正在使用route-me的框架来处理位置。 在此代码中,两个标记(点)之间的路径将绘制为一条线。用CGContext绘制三角形/箭头线
我的问题:
感谢
- (void)drawInContext:(CGContextRef)theContext
{
renderedScale = [contents metersPerPixel];
float scale = 1.0f/[contents metersPerPixel];
float scaledLineWidth = lineWidth;
if(!scaleLineWidth) {
scaledLineWidth *= renderedScale;
}
//NSLog(@"line width = %f, content scale = %f", scaledLineWidth, renderedScale);
CGContextScaleCTM(theContext, scale, scale);
CGContextBeginPath(theContext);
CGContextAddPath(theContext, path);
CGContextSetLineWidth(theContext, scaledLineWidth);
CGContextSetStrokeColorWithColor(theContext, [lineColor CGColor]);
CGContextSetFillColorWithColor(theContext, [fillColor CGColor]);
// according to Apple's documentation, DrawPath closes the path if it's a filled style, so a call to ClosePath isn't necessary
CGContextDrawPath(theContext, drawingMode);
}
我通过http://www.codeguru.com/cpp/gm/gdi/article.php/c3683得到它前一阵子反正thansk的答案格尔茨 – Pete 2010-04-16 12:34:18
皮特,它可能是很好的你将答案标记为已接受,或者将答案张贴为答案,然后接受答案。 – 2012-03-14 10:47:51
@Pete你为什么不标记正确的答案(我的意思是Friedhelm的)? – yas375 2012-11-12 13:22:51