• 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: Fastest way to push strings to the screen in an NSView?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fastest way to push strings to the screen in an NSView?


  • Subject: Re: Fastest way to push strings to the screen in an NSView?
  • From: Scott Ellsworth <email@hidden>
  • Date: Thu, 18 Nov 2004 22:22:44 -0800


On Nov 17, 2004, at 6:24 PM, Robbie Haertel wrote:

From the, whatever you call those extra information pages on classes
(http://developer.apple.com/documentation/Cocoa/Conceptual/ AttributedStrings/index.html#//apple_ref/doc/uid/10000036i)

The drawAtPoint: and drawInRect: methods are designed for drawing
small amounts of text or text that must be drawn rarely. They create
and dispose of various supporting text objects every time you call
them. To draw strings repeatedly, it is more efficient to use
NSLayoutManager, as described in "Drawing Strings".

Given that an NSTextStorage is just a subclass of NSMutableAttributedString, I can use replaceCharactersInRange to change the strings held in the NSTextStorage. Does everything react appropriately if I use this to change the characters to be drawn?


(In other words, does my inner draw loop become something as simple as:

[textStorage replaceCharactersInRange:glyphRange withString:hexNumString];
NSSize numberSize=[textStorage size];
NSRect r=NSMakeRect(2.0*hexSz2-numberSize.width/2, 0, numberSize.width, numberSize.height);
[layoutManager drawGlyphsForGlyphRange: glyphRange atPoint: r.origin];
)


Scott

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Fastest way to push strings to the screen in an NSView? (From: Scott Ellsworth <email@hidden>)
 >Re: Fastest way to push strings to the screen in an NSView? (From: Robbie Haertel <email@hidden>)

  • Prev by Date: Re: NSNetService address resolution crash
  • Next by Date: Re: Cursor rects, cursors and dragging
  • Previous by thread: Re: Fastest way to push strings to the screen in an NSView?
  • Next by thread: Re: Fastest way to push strings to the screen in an NSView?
  • Index(es):
    • Date
    • Thread