Re: IB palettes and [NSBezierPath setDefaultLineWidth:]
Re: IB palettes and [NSBezierPath setDefaultLineWidth:]
- Subject: Re: IB palettes and [NSBezierPath setDefaultLineWidth:]
- From: Greg Titus <email@hidden>
- Date: Mon, 3 Feb 2003 20:37:20 -0800
On Monday, February 3, 2003, at 08:14 PM, Pete Yandell wrote:
On Tuesday, February 4, 2003, at 02:43 PM, Buddy Kurz wrote:
I'm thinkin' that since setDefaultLineWidth is a class method and not
an instance method that the defaults are stored in the NSBezierPath
class and not in the graphics context and you need to save the
individual defaults yourself or create an instance and change the
values in your instance.
Not according to the docs on setDefaultLineWidth: in NZBezierPath:
"Sets the current graphics context's line width to width points."
I could potentially create an NSBezierPath instance to draw my line and
use setLineWidth: instead, but I'm trying to get my drawing as quick as
possible and instantiating an NSBezierPath object just to draw a single
line seems a waste.
Why not:
float oldLineWidth = [NSBezierPath defaultLineWidth];
[[NSColor blackColor] set];
[NSBezierPath setDefaultLineWidth:2.0];
[NSBezierPath strokeLineFromPoint:pointA toPoint:pointB];
[NSBezierPath setDefaultLineWidth:oldLineWidth];
This is likely to be quite a bit more efficient than saving and
restoring the whole graphics context anyway.
- Greg
_______________________________________________
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.