• 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: NSRegion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSRegion


  • Subject: Re: NSRegion
  • From: Timothy Carl Buchheim <email@hidden>
  • Date: Tue, 23 Mar 2004 11:25:12 -0800

On Mar 23, 2004, at 1:03 AM, Allan Odgaard wrote:

On 23. Mar 2004, at 8:49, Tom Bernard wrote:

What is the status of NSRegion?

Pure speculation, but Panther did introduce the optimized refresh discussed in the posts you linked to, so most likely they have done so by creating the NSRegion class.

They also did add a few methods to work with rectangle lists, although nothing fancy like AND, OR, and XOR of regions. In my experience such stuff is mostly needed by the implementation of the window/view/layer system and not really useful in application code, so the NSRegion class will probably remain private.

From a class-dump of NSRegion it looks like you might be right .. the methods they implemented look to be exactly the sorts of things which you'd expect to see for window management. (try "class-dump -C NSRegion /System/Library/Frameworks/AppKit.framework/AppKit" if you want to take a look)

On the other hand, it appears to be a wrapper around CGRegion (also undocumented) which, based on the symbols defined in CoreGraphics, appears to have a full set of region manipulation functions. Hopefully this will be made public in future releases, along with an enhanced NSRegion.

(If you're curious about CoreGraphics regions, try running "strings /System/Library/Frameworks/ApplicationServices.framework/Frameworks/ CoreGraphics.framework/CoreGraphics|grep -i region")


Interestingly I needed such functions myself not long ago, and did exhaustive searching on the net before writing my own, and did not find any source at all which implemented it -- maybe I was just bad at searching, or my thesis holds that this is really a rare requirement ;)

Regions can be useful when you want to implement pixel-accurate hit testing. (For example, if your application has icons which can be selected like the Finder, or if you have irregularly shaped controls such as the Mac OS 9 tab control.) On the other hand, they are resolution dependent (after all, they're really just a form of compressed bitmap) and are thus not appropriate for high quality drawing. Apple may avoid making them available because people might start using them where they're not really appropriate.

I believe the QuickDraw region patent (US Patent 4,622,545) has recently expired, so if anyone wants to write a Cocoa implementation it would probably be legal.


--
Tim Buchheim System Administrator
Computer Science Department Phone: (909) 607-3485
Harvey Mudd College Fax: (909) 607-8364
1250 N Dartmouth Ave E-mail: email@hidden
Claremont, CA 91711 http://www.cs.hmc.edu/~tcb/
_______________________________________________
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: 
 >NSRegion (From: Tom Bernard <email@hidden>)
 >Re: NSRegion (From: Allan Odgaard <email@hidden>)

  • Prev by Date: Debugger documentation
  • Next by Date: Re: Cocoa Daemon under Jaguar
  • Previous by thread: Re: NSRegion
  • Next by thread: Re: NSRegion
  • Index(es):
    • Date
    • Thread