退房這個奇怪路徑我的塗料中的應用產生:石英2D鋸齒線
在中間的紅線是調試功能,它表示輸入鼠標的移動和它們之間的距離,在1 px線寬,黑色是30px寬度的輸出。
我畫這個很簡單的方式,只是點,以點聚結的鼠標事件之間:
//This is called in mouseDragged: and [theEvent locationInWindow] is passed to point
-(void)addPointToCurrentStroke:(CGPoint)point
if (self.newStroke == TRUE) //If the currentStroke doesn't exist or is empty
{
self.currentStroke = CGPathCreateMutable();
CGPathMoveToPoint(self.currentStroke, NULL, point.x, point.y);
self.newStroke = FALSE;
}
else if (self.newStroke == FALSE)
CGPathAddLineToPoint(self.currentStroke, NULL, point.x, point.y);
}
此路徑,然後在撫摸的drawRect:使用適當的用戶設置,在這種情況下,大小30和顏色黑色。請注意圓形的帽子,這使得它變得更加怪異。
那麼,爲什麼我會把那些尖刺戳到遠離預定路徑?我無法制作它的頭或尾。如果有人能告訴我這裏發生了什麼,我將不勝感激。
相似問題:[「在某些角度的連接線有指向頂點而不是圓角」](http://stackoverflow.com/questions/20307817/joined-lines-at-certain-angles-have-pointed-vertexes-而不是四捨五入/ 20307928#20307928),[「UIBezierPath round edges?」](http://stackoverflow.com/questions/18167327/uibezierpath-round-edges/18167360#18167360)。 –