On 03/01/2010, at 12:42 AM, Bengt Nilsson wrote:

> B) What is the simplest object that will draw a simple line? I have found 
> NSBox (from IB) and NSBezierPath from docs, both with lots of bells and 
> whistles... Is there no NSLine, NSPath?


NSBezierPath. For a simple line, there is the class method 
+strokeLineFromPoint:toPoint: which is easy to use but may be slightly 
inefficient if it is creating and destroying a bezier path object internally 
for each call (but it may not be). There are also some utility functions such 
as NSRectFill() that can be used to draw orthogonal lines.

Note that the number of "bells and whistles" an object has does not necessarily 
translate into an inefficiency that would affect you. An object's code is 
fixed, it doesn't cause instances of that object to be more expensive to create 
just because it has a lot of methods. Don't sweat performance unless it really 
can be proved to be adversely affecting you. 

NSBezierPath is what you do vector drawing with, if you don't want to drop down 
to the Core Graphics functions directly.

--Graham


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to