NSBezierPath (again) and region subtraction.
NSBezierPath (again) and region subtraction.
- Subject: NSBezierPath (again) and region subtraction.
- From: Paul Fox <email@hidden>
- Date: Tue, 2 Jul 2002 17:11:46 +0000
Say I have a window like so:
------------------
| | |
| | |
| | |
| 'X' NSView | <- child subview of X
| | |
------------------
If I want to draw into my view but not my subview I can create a clipping
region using NSBezierPath, e.g.
NSBezierPath *p1 = [NSBezierPath bezierPathWithRect: [v frame]];
NSBezierPath *p2 = [NSBezierPath bezierPathWithRect: ...];
[p1 appendBezierPath: p2];
[p1 setWindingRule: NSEvenOffWindingRule];
[p1 addClip];
This is oh-so good unless the child (p2) touches the sides of the
parent. In which case the clipping doesnt occur. Looking at the NSBezierPath
docs and the docs for the winding rule, I dont see an example of
'how to subtract a rectangle' from a NSBezierPath where one or more
sides overlap. The Even/Odd winding rule is used for donuts (see
the docs to see what I mean).
Am I using the wrong method? Or do I have to get out my regions-exposure
library code to handle this? Seems like a very simple thing to ask.
Just checked the CGRect functions and they seem to be lacking (there
is no subtract or difference function).
Question 2:
Whilst I have the stage, how can you force a NSView to the top
of the stacking order? (Like XRaiseWindow in X11 speak). If I
removeFromSuperview and then addSubview to put it back - it has
the desired effect, except Cocoa decides it wants to redraw everything
in site. (I tried removeFromSuperviewWithoutNeedingDisplay but that doesnt
seem to have the desired effect). It would seem like a nice
idea to alter the Z-level stacking order without having to
remove and put back the view. Any ideas?
thanks
_______________________________________________
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.