Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath
Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath
- Subject: Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath
- From: Scott Thompson <email@hidden>
- Date: Fri, 18 Apr 2008 08:36:27 -0500
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 example, if you use NSFrameRectWithWidth, and
supply a width of 1 (or 0) then you will see that your framed
rectangle does not have to have the 0.5 pixel offset in order to align
to the pixel grid. You will also note that when using wider widths,
the stroke does not straddle the rectangle's path the way it would
when using NSBezierPath. The entire width of the stroke (in pixels)
will be contained within the rectangle. Finally, the pixel-oriented
nature of these routines is clear when you consider that there is
NSFrameRectWithWidthUsingOperation which draws the frame while
applying a pixel operation.
In a lot of ways, using NSFrameRect and friends is more like copying a
bitmap onto the screen rather than drawing with the underlying Quartz
mechanisms.
As a result, the NSFrameRect routines are very handy for drawing on-
screen or to bitmap contexts, but may, or may not, give you suitable
results when drawing to other devices.
Scott
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden