1
我一直在使用下面的代碼來吸引用戶輸入我的基本塗料中的應用:石英線插去靠不住的,在一定的線寬
CGContextRef drawSpace = CGLayerGetContext(currentLayer);
CGContextBeginPath(drawSpace);
CGContextMoveToPoint(drawSpace, [[self.currentStroke objectAtIndex:0]pointValue].x, [[self.currentStroke objectAtIndex:0]pointValue].y);
for (NSValue *v in self.currentStroke) {
CGContextAddLineToPoint(drawSpace, [v pointValue].x ,[v pointValue].y);
/* CGContextMoveToPoint(drawSpace, [v pointValue].x ,[v pointValue].y);
The link I got only showed this called when index = 0, so I dummied it out. Left in,
it produces the original jagged image behavior */
}
CGContextClosePath(drawSpace);
CGContextSetStrokeColorWithColor(drawSpace, [[NSColor blackColor]CGColor]);
CGContextSetLineWidth(drawSpace, self.BrushSize); //Sets the brush size
CGContextStrokePath(drawSpace); //Strokes the path to the layer
在哪個小線寬工作正常,但在大尺寸圖像如下圖所示。我知道這與角度有關,但我不知道如何解決這個問題。有沒有人知道我可以在任何尺寸下獲得清潔的中風?
聽起來不錯,但用戶使用鼠標進行繪圖時應該顯示什麼內容? – PopKernel
好吧,如果我是你,我會存儲用戶在單筆畫中繪製的點,並在每次鼠標移動時重新繪製整條線。這應該給你你想要的結果。 – insys
我試過了,但它不起作用。也許我做錯了?我要更新問題... – PopKernel