views:

159

answers:

1

I've got a weird issue with quartz. The first time I run the piece of code below, the line will be drawn like the line to the right in the image. The second time (and every time after) these lines are executed, the line will look like the line to the left. Why does it look like that? It's all jaggy and seems to have a dark border. If you'd draw the curve with opacity, it would be rather bright the first time, and very dark the second.

CGContextSetRGBFillColor(context, 0.0,0.0,0.0,0.0);
CGContextClearRect(context, CGRectMake( 0, 0, 320, 480)); 
CGContextSetRGBFillColor(context, 0, 0, 0, 0);
CGContextSetBlendMode(context, kCGBlendModeNormal);
CGContextSetRGBStrokeColor(context, 1.0, 1.0, 1.0, 1.0);
CGContextSetLineWidth(context, 4.0);

CGContextMoveToPoint(context, p1.x, p1.y);
CGContextAddCurveToPoint(context, cp1.x, cp1.y, cp2.x, cp2.y, p2.x, p2.y);

CGContextDrawPath(context, kCGPathStroke);

alt text

A: 

antialiasing OFF? also, you might want to make sure the x and y values are rounded as the Quartz Framework doesn't handle well the half point.

pothibault