• 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: How can I implement labels without the overhead of an NSTextField?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How can I implement labels without the overhead of an NSTextField?


  • Subject: Re: How can I implement labels without the overhead of an NSTextField?
  • From: Guy English <email@hidden>
  • Date: Mon, 13 Dec 2004 12:21:37 -0500

On Mon, 13 Dec 2004 08:35:55 -0800, Henry McGilton <email@hidden> wrote:
> I just performed a simple experiment . . .
Cool, I was going to try it out myself this evening. :)

I think it can still be improved a little though ...

I think you can eliminate the background buffer:

In the init:
Load the original background, make a copy.
(if you need the original you can keep it otherwise release it)
Generate all the strings. I'd use NSAttributedStrings, and draw those
directly into the copy.
Lock the image once, draw all your strings, then unlock it.
In your NIB you would have a scroll view with an NSImageView inside it.
Set the imageView size to the size of your background.
Set the imageView image to the image you've just generated.
You're all done.

I think this will be a little faster because it eliminates an extra
copy during scrolling. (you don't need to copy from the backbuffer, to
the view, then to the screen)
It also moves the initial rendering hit to the init method and, by
locking only once, and using the attributed strings directly, I think
it'll be a little faster.

I think this method does fall apart at some point - I seem to remember
there is a cap on the usable size of an NSImage. It's big but it is
there.

Take care,
Guy
 _______________________________________________
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

  • Follow-Ups:
    • Re: How can I implement labels without the overhead of an NSTextField?
      • From: Henry McGilton <email@hidden>
References: 
 >RE: How can I implement labels without the overhead of an NSTextField? (From: email@hidden)
 >Re: How can I implement labels without the overhead of an NSTextField? (From: Guy English <email@hidden>)
 >Re: How can I implement labels without the overhead of an NSTextField? (From: Henry McGilton <email@hidden>)

  • Prev by Date: Re: Trouble reading a binary file.
  • Next by Date: Re: Registering for NSNotification globally?
  • Previous by thread: Re: How can I implement labels without the overhead of an NSTextField?
  • Next by thread: Re: How can I implement labels without the overhead of an NSTextField?
  • Index(es):
    • Date
    • Thread