Hi, I am having trouble drawing one pixel wide lines. All lines are perfectly horizontal or vertical (I am not drawing diagonal lines) but they do not draw cleanly. It looks like it is drawing across two pixels at a reduced alpha. No doubt due to antialiasing. I've searched the docs and forums and have come across a statement saying that there's "...no problem drawing horizontal and vertical lines one pixel wide..." but I don't know how exactly. Any pointers would be welcome.
The drawing code is simple:
else if ([[value entity].name isEqualToString:@"RTLine"]) {
CGContextSetRGBStrokeColor(ctx, 0, 0, 0, 1);
CGContextSetLineWidth(ctx, [[value valueForKey:@"thickness"] doubleValue]);
CGContextMoveToPoint(ctx, [[value valueForKey:@"beginDrawLocationX"] doubleValue],
[[value valueForKey:@"beginDrawLocationY"] doubleValue]);
CGContextAddLineToPoint(ctx, [[value valueForKey:@"endDrawLocationX"] doubleValue],
[[value valueForKey:@"endDrawLocationY"] doubleValue]);
CGContextStrokePath(ctx);
}
In the above, 'thickness' is equal to 1. I used doubleValue instead of floatValue for conversion from int in case float was mushing the value to something not quite 1 - it wasn't.