Line width in an NSBezierPath
Line width in an NSBezierPath
- Subject: Line width in an NSBezierPath
- From: Nicola Vitacolonna <email@hidden>
- Date: Mon, 13 May 2002 09:19:52 +0200
Hi all,
a very simple question (I hope), for which I cannot find an answer.
I have a NSView in which I draw some horizontal black lines on a white
background. I have set the line width with setLineWidth:0.0 to be the
minimum allowed, but still these lines appear as they were
"anti-aliased" or something like that, so they appear thicker than one
pixel and, what's worse, their width differ from each other and changes
when I resize the NSView. This is not what I want.
How can I get a straight line whose (fixed) width is one pixel? A code
snippet follows.
Thank you in advance,
Nicola
- (void)drawRect:(NSRect)rect {
NSRect r;
NSBezierPath *bp;
float originH, originV, stepV, offset;
int i;
// Init variables
[...]
// Color background
[[NSColor whiteColor] set];
NSRectFill(rect);
bp = [NSBezierPath bezierPath];
[bp setLineWidth:0.0];
[[NSColor blackColor] set];
for (i=0;i<=10;i++) {
// Draw an horizontal line
[bp moveToPoint:NSMakePoint(originH,originV)];
[bp lineToPoint:NSMakePoint(originH+offset,originV)];
[bp stroke];
originV -= stepV;
}
** ** Get my PGP public key at:
** * ** * www.dimi.uniud.it/~vitacolo
** * ** * or finger email@hidden
** * Universita' degli Studi di Udine
* ***icola Vitacolonna
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.