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