• 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: Setting a clip mask on a NSView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting a clip mask on a NSView


  • Subject: Re: Setting a clip mask on a NSView
  • From: Timothy Wall <email@hidden>
  • Date: Sun, 27 Jan 2008 09:06:41 -0500


On Jan 26, 2008, at 8:29 PM, Jonathon Mah wrote:

Hi Tim,

On 2008-01-27, at 07:53, Timothy Wall wrote:

Is it possible to set an arbitrary clip mask on an NSView without rewriting its drawRect? The goal is to be able to clip/obscure parts of a NSView without necessarily putting anything in front of it.


You mention an "arbitrary" mask, but the next paragraph makes me think that a rectangular mask may be enough. If that's the case, you could stick your NSView inside an NSClipView, then set the clipping origin with -scrollToPoint: (it will take the size from the clip view).

Imagine I'm writing my own "mini-desktop" within a window (like windows multi-document interface). Most of the time the clipping would be sets of rectangles, but it'd be possible to have one of the "desktop" elements be non-rectangular.



Cocoa doesn't like the idea of "in front of" (overlapping views aren't supported, except in layer-backed Core Animation); the paradigm is more "inside of".

That doesn't sound promising.


If you do need arbitrary clipping (circles or the like), you could implement your own clipview-like class, but you might not save much as you'd still have to call -drawRect: and pass it a rectangle (you could do some calculations and call it multiple times with multiple rects).

So the "canonical" way to clip a given NSView is to have an ancestor do the clipping? It might be possible to insert a shim parent to the component in question.


Thanks
T.

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


References: 
 >Setting a clip mask on a NSView (From: Timothy Wall <email@hidden>)
 >Re: Setting a clip mask on a NSView (From: Jonathon Mah <email@hidden>)

  • Prev by Date: Locate path to file's directory
  • Next by Date: Re: Locate path to file's directory
  • Previous by thread: Re: Setting a clip mask on a NSView
  • Next by thread: NSViews resizeSubviewsWithOldSize is not called on resize
  • Index(es):
    • Date
    • Thread