Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath

2008-04-18 Thread Scott Thompson
On Apr 17, 2008, at 4:28 AM, Heinrich Giesen wrote: Sorry, pressed the wrong button. And: if the bezier path shall always be drawn 1 pixel wide, independent of resolution and scaling the lineWidth should be set to 0 (zero) While this works for PostScript, it does not work for Quartz.

Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath

2008-04-18 Thread Graham Cox
On 18 Apr 2008, at 10:19 pm, Scott Thompson wrote: On Apr 17, 2008, at 4:28 AM, Heinrich Giesen wrote: Sorry, pressed the wrong button. And: if the bezier path shall always be drawn 1 pixel wide, independent of resolution and scaling the lineWidth should be set to 0 (zero) While this

Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath

2008-04-18 Thread Peter Zegelin
On 18/04/2008, at 10:28 PM, Graham Cox wrote: On 18 Apr 2008, at 10:19 pm, Scott Thompson wrote: On Apr 17, 2008, at 4:28 AM, Heinrich Giesen wrote: Sorry, pressed the wrong button. And: if the bezier path shall always be drawn 1 pixel wide, independent of resolution and scaling the

Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath

2008-04-18 Thread Peter Zegelin
On 18/04/2008, at 11:06 PM, Graham Cox wrote: On 18 Apr 2008, at 11:01 pm, Peter Zegelin wrote: Weird - I just set the stroke width of my selection rectangle to 0 and didn't get anything. Peter What function is drawing? I'm not sure this works with NSFrameRectWithWidth(), but it

Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath

2008-04-18 Thread Graham Cox
On 18 Apr 2008, at 11:21 pm, Scott Thompson wrote: Setting a line width of 0 draws a 1-pixel wide line at the resolution of the device it draws to, so on screen, that's 1/72 of an inch (approx) on a printer 1/600 inch, say. It's a useful way to isolate drawing from any CTM scaling. This is

Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath

2008-04-18 Thread Scott Thompson
What function is drawing? I'm not sure this works with NSFrameRectWithWidth(), but it definitely does with NSBezierPath/ stroke. The NSFrameRect family of routines are odd ducks to begin with. In some ways, they tend to to be more pixel oriented than your typical drawing routines. For

Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath

2008-04-17 Thread Heinrich Giesen
Sorry, pressed the wrong button. And: if the bezier path shall always be drawn 1 pixel wide, independent of resolution and scaling the lineWidth should be set to 0 (zero) -- Heinrich Giesen [EMAIL PROTECTED] ___ Cocoa-dev mailing list

Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath

2008-04-17 Thread Heinrich Giesen
Graham Cox wrote: Offsetting by 0.5 makes it draw such that the exact pixel is filled. When a bezier path is more complicated it can become very ugly to add 0.5 to all coordinates. To avoid this the NSBezierPath class offers the method - transformUsingAffineTransform: So you can create a

Drawing a 1 pixel-perfect wide bordered NSBezierPath

2008-04-16 Thread Martin
Hi, I'm trying to draw a rounded rectangle with a 1 pixel-perfect wide border. Although I made sure that the rect has integral values and its height it an even number (so that height/2.0 is also even), the top and bottom lines look blurry (screenshot:

Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath

2008-04-16 Thread Martin
It works! Why such a behaviour? Thanks, -Martin On Apr 17, 2008, at 1:15 AM, John Terranova wrote: Try adding these lines before creating the NSBezierPath: cellFrame.origin.x += 0.5; cellFrame.origin.y += 0.5; Let me know if it works. It should. john On Apr 16, 2008, at 3:52 PM,

Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath

2008-04-16 Thread Graham Cox
Because strokes are drawn centred on the coordinate of the path, so a 1-pixel line extends 0.5 of a pixel above and below the coordinate. Offsetting by 0.5 makes it draw such that the exact pixel is filled. -- S.O.S. On 17 Apr 2008, at 9:17 am, Martin wrote: It works! Why such a