• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: IB palettes and [NSBezierPath setDefaultLineWidth:]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Re: IB palettes and [NSBezierPath setDefaultLineWidth:] (From: Pete Yandell <email@hidden>)

  • Prev by Date: Re: Log4Cocoa
  • Next by Date: Allocation and disposal inside a loop
  • Previous by thread: Re: IB palettes and [NSBezierPath setDefaultLineWidth:]
  • Next by thread: Re: Setting the action for a menu item
  • Index(es):
    • Date
    • Thread